Skip to main content

Map Reg Lib API

danger

this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.


Library to support Register Mapping. More...

Data Structures

struct  MEM_T Struct for physical and virtual addresses - useful for DMA operations)
 

Macros

#define MRL_VER_MAJ   1
 
#define MRL_VER_MIN   3
 
#define MRL_VER_BUILD   0
 
#define PAGE_SIZE   4096
 
#define UnMapMemory   UnMapRegister
 

Functions

LPVOID AllocPhysMem (DWORD cbSize, DWORD fdwProtect, DWORD dwAlignmentMask, DWORD dwFlags, PULONG pPhysicalAddress)
 
BOOL FreePhysMem (LPVOID lpvAddress)
 
BOOL VirtualCopy (LPVOID lpvDest, LPVOID lpvSrc, DWORD cbSize, DWORD fdwProtect)
 
BOOL VirtualSetAttributes (LPVOID lpvAddress, DWORD cbSize, DWORD dwNewFlags, DWORD dwMask, LPDWORD lpdwOldFlags)
 
LPVOID CreateStaticMapping (DWORD dwPhysBase, DWORD dwSize)
 
void * MapRegister (DWORD pa)
 
void * MapMemory (DWORD pa, DWORD size)
 
void UnMapRegister (volatile void *pRegs)
 
LPVOID AllocPhysMemCompat (DWORD cbSize, DWORD fdwProtect, DWORD dwAlignmentMask, DWORD dwFlags, PULONG pPhysicalAddress)
 
BOOL FreePhysMemCompat (LPVOID lpvAddress)
 
BOOL VirtualCopyCompat (LPVOID lpvDest, LPVOID lpvSrc, DWORD cbSize, DWORD fdwProtect)
 
BOOL LockPagesCompat (LPVOID lpvAddress, DWORD cbSize, PDWORD pPFNs, int fOptions)
 
BOOL VirtualSetAttributesCompat (LPVOID lpvAddress, DWORD cbSize, DWORD dwNewFlags, DWORD dwMask, LPDWORD lpdwOldFlags)
 
void * OALPAtoVA (UINT32 pa, BOOL cached)
 
void MRLGetLibVersion (DWORD *pVerMaj, DWORD *pVerMin, DWORD *pBuild)
 

Detailed Description

Library to support Register Mapping.
Author:
kia
Rev:
2101
Date:
2014-03-10 14:27:38 +0100 (Mo, 10 Mrz 2014)
Target Platforms:
Colibri PXAxxx, T20 & T30, Apalis T30

Macro Definition Documentation

#define MRL_VER_BUILD   0
#define MRL_VER_MAJ   1
#define MRL_VER_MIN   3
#define PAGE_SIZE   4096
#define UnMapMemory   UnMapRegister

Function Documentation

LPVOID AllocPhysMem(DWORD cbSize,
  DWORD fdwProtect,
  DWORD dwAlignmentMask,
  DWORD dwFlags,
  PULONG pPhysicalAddress 
 )  
LPVOID AllocPhysMemCompat(DWORD cbSize,
  DWORD fdwProtect,
  DWORD dwAlignmentMask,
  DWORD dwFlags,
  PULONG pPhysicalAddress 
 )  
Win CE 6.0 and 5.0 compatible version of AllocPhysMem()
Parameters
[in]cbSizeNumber of bytes to allocate
[in]fdwProtectSpecifies the protection desired
[in]dwAlignmentmaskBit mask describing the byte alignment
[in]dwFlagsReserved, set to 0
[in]pPhysicalAddressPhysical address
Return values
0Error
>0Virtual address
LPVOID CreateStaticMapping(DWORD dwPhysBase,
  DWORD dwSize 
 )  
BOOL FreePhysMem(LPVOID lpvAddress) 
BOOL FreePhysMemCompat(LPVOID lpvAddress) 
Win CE 6.0 and 5.0 compatible version of FreePhysMem()
Parameters
[in]lpvAddressVirtual Address
Return values
FALSE,:Failure, TRUE: Success
BOOL LockPagesCompat(LPVOID lpvAddress,
  DWORD cbSize,
  PDWORD pPFNs,
  int fOptions 
 )  
Win CE 6.0 and 5.0 compatible version of LockPages()
Locks into memory the specified region of the virtual address space
Parameters
[in]lpvAddressVirtual Starting Address
[in]cbSizeNumber of bytes to lock
[in]pPFNsArray of physical frame numbers
[in]fOptionsOption Flags
Return values
FALSE,:Failure, TRUE: Success
void* MapMemory(DWORD pa,
  DWORD size 
 )  
Same as MapRegister() but can also map larger sections
Parameters
[in]paPhysical address.
[in]sizeSize to map in bytes.
Return values
Virtualaddress
void* MapRegister(DWORD pa) 
Map Registers at a physical address (map areas up to the PAGE_SIZE).
Parameters
[in]paPhysical address
Return values
Virtualaddress
void MRLGetLibVersion(DWORD * pVerMaj,
  DWORD * pVerMin,
  DWORD * pBuild 
 )  
Returns the library Version.
Parameters
[out]pVerMajReturns the major version number. Set this parameter to NULL if not required.
[out]pVerMinReturns the minor version number. Set this parameter to NULL if not required.
[out]pBuildReturns the build number. Set this parameter to NULL if not required.
void* OALPAtoVA(UINT32 pa,
  BOOL cached 
 )  
Get Virtual Address from Physical Address
Parameters
[in]paPhysical Address
[in]cachedTRUE: Cached, FALSE: Not cached
Return values
VirtualAddress
void UnMapRegister(volatile void * pRegs) 
Unmap Register
Parameters
[in]pRegs,:Pointer to virual address
BOOL VirtualCopy(LPVOID lpvDest,
  LPVOID lpvSrc,
  DWORD cbSize,
  DWORD fdwProtect 
 )  
BOOL VirtualCopyCompat(LPVOID lpvDest,
  LPVOID lpvSrc,
  DWORD cbSize,
  DWORD fdwProtect 
 )  
Win CE 6.0 and 5.0 compatible version of VirtualCopy()
Parameters
[in]lpvDestDestination Virtual Address
[in]lpvSrcSource Virtual Address
[in]cbSizeNumber of bytes to copy
[in]fdwProtectSpecifies the protection desired
Return values
FALSE,:Failure, TRUE: Success
BOOL VirtualSetAttributes(LPVOID lpvAddress,
  DWORD cbSize,
  DWORD dwNewFlags,
  DWORD dwMask,
  LPDWORD lpdwOldFlags 
 )  
BOOL VirtualSetAttributesCompat(LPVOID lpvAddress,
  DWORD cbSize,
  DWORD dwNewFlags,
  DWORD dwMask,
  LPDWORD lpdwOldFlags 
 )  
Win CE 6.0 and 5.0 compatible version of VirtualSetAttributes()
Change the per-page attributes for a range of virtual memory
Parameters
[in]lpvAddressVirtual Starting Address
[in]cbSizeNumber of bytes
[in]dwNewFlagsThe new flags values
[in]dwMaskMask the bits to be changed
[out]lpdwOldFlagsIf not NULL, returns the original value of the first page entry
Return values
FALSE,:Failure, TRUE: Success


Send Feedback!