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
Additional Functions
Go to RapidDriver Main Page

As it was mentioned, the MapPhysToLinear function returns the pointer to the linear memory defined by it's physical address and size. You can work with a returned pointer directly or by means of additional functions set which provides physical memory access by bytes, by words or by double words. It's especially useful for Visual Basic programmers as Visual basic has some limitations on working with a pointers directly.

Below is the list of the above mentioned functions:

UCHAR  GetMem  (HANDLE hPci, ULONG LinAddr, ULONG Offset);
USHORT 
GetMemW (HANDLE hPci, ULONG LinAddr, ULONG Offset); 
ULONG  
GetMemL (HANDLE hPci, ULONG LinAddr, ULONG Offset); 
void   
SetMem  (HANDLE hPci, ULONG LinAddr, ULONG Offset, UCHAR bValue);
void   
SetMemW (HANDLE hPci, ULONG LinAddr, ULONG Offset, USHORT wValue); 
void   
SetMemL (HANDLE hPci, ULONG LinAddr, ULONG Offset, ULONG dValue);