Example #1
0
/* Invoked in interrupt context */
void cc_rtc_isr(void)
{
    struct u64_time alarm, value;
    u32 status;

    /* Read the interrupt status, also clears the status */
    status = MAP_PRCMIntStatus();
    UNUSED(status);
    if(rtc == NULL) {
        return;
    }
    /*
       Need to ascertain ISR has not been invoked for older or stale alarm.
       This can happen if alarm was either updated or cancelled by the user
       while holding up ISR through disable system interrupt
    */
    if(false == rtc->has_alarm)
        return; /* Race condition: alarm was cleared interim, ignore */

    rtc_alarm_rd(&alarm);
    rtc_value_rd(&value);

    if(true == is_valid_alarm(&alarm, &value, NULL))
        return; /* Race condition: ISR for old / stale alarm, ignore */

    rtc->has_alarm = false; /* Valid ISR: alarm is about to be processed */

    /* This ISR is for the active alarm, therefore, handle it */
    rtc->timeout_cb(rtc->cb_param);

    return;
}
Example #2
0
//****************************************************************************
//
//! \brief  This function handles the PRCM interrupt
//!
//! \param  intr_param is a void pointer (not used)
//!
//! \return none
//
//****************************************************************************
void prcm_interrupt_handler(void *intr_param)
{
        int status;

        /* Read the interrupt status, also clears the status */
        status = MAP_PRCMIntStatus();

        if((PRCM_INT_SLOW_CLK_CTR == status) || (sw_simulate_rtc)) {
                sw_simulate_rtc = 0;
                /* Invoke the RTC interrupt handler */
                cc_rtc_isr();
        } else if(0 == status) {
                /* Invoke the wake from LPDS interrupt handler */
                wake_interrupt_handler();
        } else {
        }
}
Example #3
0
STATIC void PRCMInterruptHandler (void) {
    // reading the interrupt status automatically clears the interrupt
    if (PRCM_INT_SLOW_CLK_CTR == MAP_PRCMIntStatus()) {
        // reconfigure it again (if repeat is true)
        pyb_rtc_repeat_alarm (pybsleep_data.rtc_obj);
        pybsleep_data.rtc_obj->irq_flags = PYB_RTC_ALARM0;
        // need to check if irq's are enabled from the user point of view
        if (pybsleep_data.rtc_obj->irq_enabled && (pybsleep_data.rtc_obj->pwrmode & PYB_PWR_MODE_ACTIVE)) {
            mp_irq_handler(pybsleep_data.rtc_obj->irq_obj);
        }
        pybsleep_data.rtc_obj->irq_flags = 0;
    } else {
        // interrupt has been triggered while waking up from LPDS
        switch (MAP_PRCMLPDSWakeupCauseGet()) {
        case PRCM_LPDS_HOST_IRQ:
            pybsleep_data.wlan_obj->irq_flags = MODWLAN_WIFI_EVENT_ANY;
            mp_irq_handler(pybsleep_data.wlan_obj->irq_obj);
            pybsleep_wake_reason = PYB_SLP_WAKED_BY_WLAN;
            pybsleep_data.wlan_obj->irq_flags = 0;
            break;
        case PRCM_LPDS_GPIO:
            mp_irq_handler(pybsleep_data.gpio_lpds_wake_cb);
            pybsleep_wake_reason = PYB_SLP_WAKED_BY_GPIO;
            break;
        case PRCM_LPDS_TIMER:
            // reconfigure it again if repeat is true
            pyb_rtc_repeat_alarm (pybsleep_data.rtc_obj);
            pybsleep_data.rtc_obj->irq_flags = PYB_RTC_ALARM0;
            // next one clears the wake cause flag
            MAP_PRCMLPDSWakeupSourceDisable(PRCM_LPDS_TIMER);
            mp_irq_handler(pybsleep_data.rtc_obj->irq_obj);
            pybsleep_data.rtc_obj->irq_flags = 0;
            pybsleep_wake_reason = PYB_SLP_WAKED_BY_RTC;
            break;
        default:
            break;
        }
    }
}