I want to address the iMX7 EIM registers. For this I use this structure and map it to the address 0x30BC0000.
/* WEIM registers */
typedef struct {
UINT32 CS0GCR1;
UINT32 CS0GCR2;
UINT32 CS0RD1;
UINT32 CS0RD2;
UINT32 CS0WR1;
UINT32 CS0WR2;
UINT32 CS1GCR1;
UINT32 CS1GCR2;
UINT32 CS1RD1;
UINT32 CS1RD2;
UINT32 CS1WR1;
UINT32 CS1WR2;
UINT32 CS2GCR1;
UINT32 CS2GCR2;
UINT32 CS2RD1;
UINT32 CS2RD2;
UINT32 CS2WR1;
UINT32 CS2WR2;
UINT32 CS3GCR1;
UINT32 CS3GCR2;
UINT32 CS3RD1;
UINT32 CS3RD2;
UINT32 CS3WR1;
UINT32 CS3WR2;
UINT32 CS4GCR1;
UINT32 CS4GCR2;
UINT32 CS4RD1;
UINT32 CS4RD2;
UINT32 CS4WR1;
UINT32 CS4WR2;
UINT32 CS5GCR1;
UINT32 CS5GCR2;
UINT32 CS5RD1;
UINT32 CS5RD2;
UINT32 CS5WR1;
UINT32 CS5WR2;
UINT32 WCR;
UINT32 WIAR;
UINT32 EAR;
}CSP_WEIM_REGS, *PCSP_WEIM_REGS;
If I want to read the register, the program crashes. What do I have to do differently?
int wmain(int argc, wchar_t *argv[])
{
printf("Welcome to Windows Embedded Project System \n");
// Init MapMemLib
HANDLE maphandle = Map_Init();
tVersion libver;
// Get Libversion
Map_GetVersion(&libver);
//read register
volatile PCSP_WEIM_REGS g_pWEIM = (PCSP_WEIM_REGS)Map_OALPAtoVA(0x30bc0000, 0);
_tprintf(TEXT("read: %08x\r\n"), g_pWEIM->CS0GCR2);
return 0;
}