//------------------------------------------------------------------------------ /// Interrupt service routine for the PIT. Debounces the wake-up pin input. //------------------------------------------------------------------------------ static void ISR_Pit(void) { static unsigned long debounceCounter = DEBOUNCE_TIME; unsigned long pisr = 0; // Read the PISR pisr = PIT_GetStatus() & AT91C_PITC_PITS; if (pisr != 0) { // Read the PIVR. It acknowledges the IT PIT_GetPIVR(); } // Button released if (PIO_Get(&pinWakeUp)) { debounceCounter = DEBOUNCE_TIME; } // Button still pressed else { debounceCounter--; } // End of debounce time if (debounceCounter == 0) { debounceCounter = DEBOUNCE_TIME; PIT_DisableIT(); AT91C_BASE_PITC->PITC_PIMR &= ~AT91C_PITC_PITEN; COMPOSITEDDriver_RemoteWakeUp(); } }
//------------------------------------------------------------------------------ /// Handler for PIT interrupt. Increments the timestamp counter. //------------------------------------------------------------------------------ void ISR_Pit(void) { unsigned int status; // Read the PIT status register status = PIT_GetStatus() & AT91C_PITC_PITS; if (status != 0) { // Read the PIVR to acknowledge interrupt and get number of ticks timestamp += (PIT_GetPIVR() >> 20); #ifdef QF_TICK #ifdef QK __disable_irq(); ++QK_intNest_; #endif QF_INT_UNLOCK(); QF_tick(); QF_INT_LOCK(); #ifdef QK --QK_intNest_; if ( QK_intNest_ ==0) QK_schedule_(); #endif #endif }
//------------------------------------------------------------------------------ /// Handler for PIT interrupt. Increments the timestamp counter. //------------------------------------------------------------------------------ void ISR_Pit(void) { unsigned int status; // Read the PIT status register status = PIT_GetStatus() & AT91C_PITC_PITS; if (status != 0) { // Read the PIVR to acknowledge interrupt and get number of ticks timestamp += (PIT_GetPIVR() >> 20); }
/* _____LOCAL FUNCTIONS______________________________________________________ */ static void pit_interrupt(void) { u32_t u32Pivr = 0; u32_t u32Pisr = 0; // Read the PISR u32Pisr = PIT_GetStatus() & AT91C_PITC_PITS; if (u32Pisr != 0) { // Read the PIVR. It acknowledges the interrupt u32Pivr = PIT_GetPIVR(); // Add to counter the number of occurrences of periodic intervals // since the last read of PITD_PIVR pit_tick_counter += (u32Pivr >> 20); }