#define LPC2368_VPBBASE 0xE0000000
#define LPC2368_TMR0BASE (LPC2368_VPBBASE + 0x00004000)
#define LPC2368_TMR1BASE (LPC2368_VPBBASE + 0x00008000)
#define LPC2368_TMR2BASE (LPC2368_VPBBASE + 0x00070000)
#define LPC2368_TMR3BASE (LPC2368_VPBBASE + 0x00074000)
typedef struct {
u32_t IR ;
u32_t TCR ;
u32_t TC ;
u32_t PR ;
u32_t PC ;
u32_t MCR ;
u32_t MR0 ;
u32_t MR1 ;
u32_t MR2 ;
u32_t MR3 ;
u32_t CCR ;
u32_t CR0 ;
u32_t CR1 ;
u32_t pad0[2] ;
u32_t EMR ; // 3C
u32_t pad1[12];
u32_t CTCR ; // 70
} TMR2368Set;
#define TMR02368 ((volatile TMR2368Set *) LPC2368_TMR0BASE )
#define TMR12368 ((volatile TMR2368Set *) LPC2368_TMR1BASE )
#define TMR22368 ((volatile TMR2368Set *) LPC2368_TMR2BASE )
#define TMR32368 ((volatile TMR2368Set *) LPC2368_TMR3BASE )
void OSTickTmr_Init(void) {
TMR12368->CTCR = 0; // Timer mode
// Interrupt on MR0
// Reset on MR0
TMR12368->MCR = BIN8(00000011);
TMR12368->PR = 0; // no prescaler
TMR12368->MR0 = (5ul * GCCLK) / 1000ul;// 5 ms
TMR12368->TCR = 1; // go!
}