//************************************************************************ void __ISR(_CORE_TIMER_VECTOR, ipl2) CoreTimerHandler(void) { unsigned int cur_timer_val; cur_timer_val = ReadCoreTimer(); // clear the interrupt flag mCTClearIntFlag(); // update the period UpdateCoreTimer(CORE_TICK_RATE); // .. things to do // Check for CoreTimer overflows, record for micros() function // If micros() is not called more often than every 107 seconds (the // period of overflow for CoreTimer) then overflows to CoreTimer // will be lost. So we put code here to check for this condition // and record it so that the next call to micros() will be accurate. if (!gMicros_calculating) { if (cur_timer_val < gCore_timer_last_val) { // We have an overflow gCore_timer_micros += ((0xFFFFFFFF - gCore_timer_last_val) + cur_timer_val) / CORETIMER_TICKS_PER_MICROSECOND; gCore_timer_first_val = cur_timer_val; gMicros_overflows = gCore_timer_micros; } gCore_timer_last_val = cur_timer_val; } // Count this millisecond gTimer0_millis++; }
//! Keep 1ms resolution system time void __ISR(_CORE_TIMER_VECTOR, ipl2) CoreTimerHandler(void) { // clear the interrupt flag mCTClearIntFlag(); // update the period UpdateCoreTimer(CORE_TICK_RATE); ++_sys_time; }
void __ISR(_CORE_TIMER_VECTOR, ipl6) CoreTimerHandler(void) { /* update the period */ UpdateCoreTimer(CORE_TICK_RATE); /* do repetitive tasks here */ stepgen(); /* clear the interrupt flag */ mCTClearIntFlag(); }
void BSP_TickISR_Handler (void) { mCTClearIntFlag(); // Clear the core timer interrupt UpdateCoreTimer(BSP_TMR_RELOAD); // Prepare for the next core timer interrupt }