/*************************************************************************** *Function Name: Cputimer_configure *Description: Cpu timer2 configuration, used to OS count *Parameter: *Return: *Author/Date: ***************************************************************************/ void Cputimer_configure(void) {

 CPUTimer_startTimer(CPUTIMER1_BASE);  //启动定时器1

 // 初始化CPU定时器

 CPUTimer_setPeriod(CPUTIMER1_BASE, DEVICE_SYSCLK_FREQ/1000);  //设置定时器周期为设备系统时钟频率的1/1000(即1毫秒)

 CPUTimer_setPreScaler(CPUTIMER1_BASE, 0);  //设置定时器预分频器为0

 // 确保定时器停止
 CPUTimer_stopTimer(CPUTIMER1_BASE);  //停止定时器

 CPUTimer_setEmulationMode(CPUTIMER1_BASE,CPUTIMER_EMULATIONMODE_STOPATZERO);  //设置定时器为在计数器归零时停止模式

 CPUTimer_reloadTimerCounter(CPUTIMER1_BASE);  //重新加载定时器计数器

 CPUTimer_startTimer(CPUTIMER1_BASE);  //启动定时器1

}

Cpu Timer2 Configuration for OS Counting