Search by Tags

Map Reg Lib API

 

Compare with Revision



Subscribe for this article updates

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] cbSize Number of bytes to allocate
[in] fdwProtect Specifies the protection desired
[in] dwAlignmentmask Bit mask describing the byte alignment
[in] dwFlags Reserved, set to 0
[in] pPhysicalAddress Physical address
Return values
0 Error
>0 Virtual 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] lpvAddress Virtual 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] lpvAddress Virtual Starting Address
[in] cbSize Number of bytes to lock
[in] pPFNs Array of physical frame numbers
[in] fOptions Option Flags
Return values
FALSE,: Failure, TRUE: Success
void* MapMemory ( DWORD  pa,
DWORD  size
)

Same as MapRegister() but can also map larger sections

Parameters
[in] pa Physical address.
[in] size Size to map in bytes.
Return values
Virtual address
void* MapRegister ( DWORD  pa )

Map Registers at a physical address (map areas up to the PAGE_SIZE).

Parameters
[in] pa Physical address
Return values
Virtual address
void MRLGetLibVersion ( DWORD *  pVerMaj,
DWORD *  pVerMin,
DWORD *  pBuild
)

Returns the library Version.

Parameters
[out] pVerMaj Returns the major version number. Set this parameter to NULL if not required.
[out] pVerMin Returns the minor version number. Set this parameter to NULL if not required.
[out] pBuild Returns 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] pa Physical Address
[in] cached TRUE: Cached, FALSE: Not cached
Return values
Virtual Address
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] lpvDest Destination Virtual Address
[in] lpvSrc Source Virtual Address
[in] cbSize Number of bytes to copy
[in] fdwProtect Specifies 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] lpvAddress Virtual Starting Address
[in] cbSize Number of bytes
[in] dwNewFlags The new flags values
[in] dwMask Mask the bits to be changed
[out] lpdwOldFlags If not NULL, returns the original value of the first page entry
Return values
FALSE,: Failure, TRUE: Success