|
RtMapMemory maps a range of physical memory addresses into the user's virtual address space.
Syntax
PVOID RtMapMemory( LARGE_INTEGER physAddr, ULONG Length, MEMORY_CACHING_TYPE CacheType );
Parameters
physAddr
A LARGE_INTEGER specifying the base of the physical address range to map.
Length
An unsigned 32-bit value representing the length, in bytes, of the address range to map.
CacheType
Specifies a MEMORY_CACHING_TYPE value, which indicates the cache attribute to use to map the physical address range.
Return Values
NOTE: No access checks are performed on these addresses or the ranges requested. Use this function with care to avoid memory corruption.
Remarks
RtMapMemory creates a map between a range of user virtual addresses and a range of physical memory addresses, giving the user direct access to physical memory locations on the system. Typically, this is used to access peripheral registers or buffers mapped into the physical address space of the machine. The largest address must be a legal value on the machine. For 32-bit machines, the largest address that can be represented is 0XFFFFFFFF.
The length of the physical address range to map has a limit of 64 MB (in bytes) in RtMapMemory for both Win32 and RTSS applications. If you want to modify this limit, do the following:
The Upper Bounds setting is an RtMapMemory API call parameter limit that does not allow any allocations greater then the provided value, even if the system is able to map the memory. This upper bound value does not guarantee allocation up to the upper boundary value. RtMapMemory can still fail for values smaller than the upper bound limit if there is not enough memory available.
RtMapMemory uses ZwMapViewOfSection on the Windows side and MMMapIOSpace on the RTX side to allow for mappings larger than 64 MB. This can sometimes cause Windows to fail when trying to map an address that RTX had previously mapped.
Requirements
Header | Rtapi.h |
Library | rtapi_w32.lib (Windows), Rtx_Rtss.lib (RTSS) |
See Also: