In CH7, I will examine the timer hadware and the interrupt related to this.
RealviewPB uses SP804 Timer and my goal is to implement "delay()" using it.
To use a new hardware, fisrt to do is making a register struct.
ypedef union TimerXControl_t
{
uint32_t all;
struct {
uint32_t OneShot:1; //0
uint32_t TimerSize:1; //1
uint32_t TimerPre:2; //3:2
uint32_t Reserved0:1; //4
uint32_t IntEnable:1; //5
uint32_t TimerMode:1; //6
uint32_t TimerEn:1; //7
uint32_t Reserved1:24; //31:8
} bits;
} TimerXControl_t;
- b0 : default(wrapping mode)