Search by Tags

Register Access

 
Article updated at 27 Feb 2019
Compare with Revision



Toradex provides support to directly access hardware registers from Windows CE.
To simplify this task, we offer freely available libraries as well as a demonstration application. Both can be downloaded from Toradex CE Libraries and Code Samples.

A simple code snippet to read a register looks like this:

// include the required header files
#include <CoProcLib.h>
#include <MapRegLib.h>
 
// variable declarations
volatile DWORD *pRegister;             // a pointer to the register
DWORD Value;                           // variable to store the register's content
 
// code to execute
{
    pRegister = MapRegister(0x40E00000)    // This is required to allow access to a page of 1024 DWORD registers (4096 Bytes)
 
    Value = *pRegister;                    // <= the actual read operation
 
    UnMapRegister((void*)pRegister);       // clean up when the register page is not required anymore
}

A more detailed example can be found through the link listed above.