Home    Prev Next    
Contents
Programming For PCI Device
Overview
Programmers Guide
Scenario
Access to PCI devices information
How to work with PCI header
Accessing PCI registers
Accessing BAR0-BAR5 areas
I/O Ports control
Single read/write operations
Data array read/write operations
Accessing Physical Memory Addresses
Memory Mapping
Additional Functions
Hardware interrupts handling at user level
Common Issues
Extended options of hardware interrupt handling
PCI Support Routines And Structures
Common Procedures
OpenRapidPci
IsRapidPciOpened
CloseRapidPci
GetHardwareConfiguration
GetPciLocation
PCI specific functions
PCI Header
GetPciHeader
SetPciHeader
ReadFromPci
WriteToPci
PCI BAR Areas
GetNumOfPciBars
GetPciBarLength
GetPciBarPhysicalAddress
GetPciBarLinearAddress
ReadPciBarByte
ReadPciBarWord
ReadPciBarLong
WritePciBarByte
WritePciBarWord
WritePciBarLong
PCI Registers
ReadPciCommandReg
WritePciCommandReg
ControlPciCommandRegBits
ReadPciStatusReg
Memory Access
MapPhysToLinear
UnmapMemory
GetMem
GetMemW
GetMemL
SetMem
SetMemW
SetMemL
Direct Port I/O
GetPortByte
GetPortWord
GetPortLong
SetPortByte
SetPortWord
SetPortLong
ReadPortBuffer
WritePortBuffer
Hardware Interrupts
UnmaskPciIrq
MaskPciIrq
GetInterruptCounter
MapPhysToLinear
Go to RapidDriver Main Page

Maps a specific physical address to a pointer in linear memory for the current process' address space. This function is intended to be used to access
device-specific physical memory (for the memory-mapped devices).

Language

Description

C/C++
void * MapPhysToLinear ( HANDLE hPci, ULONG PhysAddr, ULONG MappedSize );
Delphi
function MapPhysToLinear ( hPci: THandle; PhysAddr:Longword; MappedSize: Longword ): Pointer; stdcall;
VB
Function MapPhysToLinear ( ByVal hPci As Long, ByVal PhysAddr As Long, ByVal MappedSize As Long) As Long



Parameters:
hPci - the handle returned by a successful call to OpenRapidPci
PhysAddr - 32-bit physical address of the start of the region to examine
MappedSize - length in bytes of the physical region. The function uses this parameter to verify that the entire range is addressable.

Return Value :
The linear address of the first byte in the specified range of physical addresses.

Comments:
1. Do not forget to unmap this physical memory area by UnmapMemory when your application not need it anymore.
2. No information can be concluded about the linear addresses for physical addresses if they lie outside the range requested.

See also : UnmapMemory