Ejemplo n.º 1
0
/**
 * \brief Interrupt handler for the RTC.
 */
void RTC_Handler (void)
{
  uint32_t status = RTC->RTC_SR;
  
  /* Second increment interrupt */
  if ((status & RTC_SR_SEC) == RTC_SR_SEC) {
    /* Disable RTC interrupt */
    RTC_DisableIt(RTC, RTC_IDR_SECDIS);
    
    RTC_ClearSCCR(RTC, RTC_SCCR_SECCLR);
    
    RTC_EnableIt(RTC, RTC_IER_SECEN);
  } else {
    /* Time or date alarm */
    if ((status & RTC_SR_ALARM) == RTC_SR_ALARM) {
      /* Disable RTC interrupt */
      RTC_DisableIt(RTC, RTC_IDR_ALRDIS);
      
      if (RTC_callBack != NULL) {
        RTC_callBack();
      }
      
      RTC_ClearSCCR(RTC, RTC_SCCR_ALRCLR);
      RTC_EnableIt(RTC, RTC_IER_ALREN);
    }
  }
}
Ejemplo n.º 2
0
//------------------------------------------------------------------------------
// REAL TIME CLOCK
//------------------------------------------------------------------------------
void RTC_IrqHandler(void)
{
  volatile TDFM_ItServList *pTmpItServ;
  unsigned int status;
  
  status = AT91C_BASE_RTC->RTC_SR;
  if ((status & AT91C_RTC_SECEV) == AT91C_RTC_SECEV) {
    // Disable RTC interrupt
    RTC_DisableIt(AT91C_RTC_SECEV);
  }
  
  pTmpItServ = gpItHandlerFirst;
  while(pTmpItServ != NULL) {
    if(pTmpItServ->itID == AT91C_ID_RTC)
      pTmpItServ->ItHandler();
    
    pTmpItServ = pTmpItServ->next;
  }
  
  AT91C_BASE_RTC->RTC_SCCR = AT91C_RTC_SECEV;
  
  RTC_EnableIt(AT91C_RTC_SECEV);
}