#include <windows.h>
#include <stdio.h>
#include <rtapi.h>
void main(void) {
BOOL success=0;
static PVOID vAddress;// virtual memory address returned
LARGE_INTEGER physAddr; // base physical address
ULONG length; // length to map in
BOOLEAN cacheEnable; // cache accesses to memory ?
physAddr.QuadPart = 0x0000FFFFF;
length = 1024;
cacheEnable = 0;
vAddress=RtMapMemory( physAddr, length, cacheEnable);
if (vAddress==NULL) {
printf("Failure on RtMapMemory( 0x%08X, %d, %d ).\n",
physAddr.LowPart, length, cacheEnable );
}
else {
printf("Success on RtMapMemory( 0x%08X, %d, %d ).\n", physAddr.LowPart,
length, cacheEnable );
printf("Virtual memory address = 0x%08X \n", vAddress);
success = RtUnmapMemory( vAddress);
if (!success) {
printf("Failure on RtUnmapMemory( 0x%08X)\t", vAddress);
}
else {
printf("Success on RtUnmapMemory( 0x%08X)\n\n", vAddress);
}
}
ExitProcess(0);
}