static void Tmr_TickInit (void)
{
CPU_INT32U pclk_freq;
CPU_INT32U tmr_reload;
/* VIC TIMER #0 Initialization */
VICIntSelect &= ~(1 << VIC_TIMER0); /* Enable interrupts */
VICVectAddr2 = (CPU_INT32U)Tmr_TickISR_Handler; /* Set the vector address */
VICVectCntl2 = 0x20 | VIC_TIMER0; /* Enable vectored interrupts */
VICIntEnable = (1 << VIC_TIMER0); /* Enable Interrupts */
pclk_freq = BSP_CPU_PclkFreq();
tmr_reload = pclk_freq / OS_TICKS_PER_SEC;
T0TCR = 0; /* Disable timer 0. */
T0PC = 0; /* Prescaler is set to no division. */
T0MR0 = tmr_reload;
T0MCR = 3; /* Interrupt on MR0 (reset TC) */
T0CCR = 0; /* Capture is disabled. */
T0EMR = 0; /* No external match output. */
T0TCR = 0x01; /* Enable timer 0 */
}
void Tmr_TickISR_Handler (void)
{
T0IR = 0xFF; /* Clear timer #0 interrupt */
//LED_ON();
OSTimeTick(); /* Call uC/OS-II's OSTimeTick() */
}
前一个函数式设置定时器0,后一个是服务子程序,uc编译和运行已经没问题了,但是tick总是为零,没有调度其他任务,iar观测第一次运行任务切换次数3次,清零后任务切换次数为0,我怀疑是 定时器0没有进中断,没有系统时钟的原因,但是看上边的设置没有看出问题,请高手赐教 |