定时器结构比较简单,只需要初始化3个寄存器即可,但是需要使用AIC中断控制器
//定时器基址
//TIM========================================================================================================
#define TIMER0_BASE (0xB8001000) //寄存器基址
#define TIMER1_BASE (0xB8001010) //寄存器基址
#define TIMER2_BASE (0xB8001020) //寄存器基址
#define TIMER3_BASE (0xB8001030) //寄存器基址
#define TIMER4_BASE (0xB8001040) //寄存器基址
#define TIMER_ISR_ADDR (0xB8001060)
typedef struct
{
vu32 CSP;
vu32 CMPR;
vu32 DR;
}TIM_TypeDef;
#define TIM0 ((TIM_TypeDef *) TIMER0_BASE)
#define TIM1 ((TIM_TypeDef *) TIMER1_BASE)
#define TIM2 ((TIM_TypeDef *) TIMER2_BASE)
#define TIM3 ((TIM_TypeDef *) TIMER3_BASE)
#define TIM4 ((TIM_TypeDef *) TIMER4_BASE)
|