/** * @brief Wake up ISR handler. * * @param[in] canp pointer to the @p CANDriver object * * @notapi */ static void can_lld_wakeup_handler(CANDriver *canp) { /* Wakeup event.*/ canp->state = CAN_READY; can_lld_wakeup(canp); chSysLockFromIsr(); chEvtBroadcastI(&canp->wakeup_event); chSysUnlockFromIsr(); }
/** * @brief Enforces leaving the sleep mode. * @note The sleep mode is supposed to be usually exited automatically by * an hardware event. * * @param[in] canp pointer to the @p CANDriver object */ void canWakeup(CANDriver *canp) { osalDbgCheck(canp != NULL); osalSysLock(); osalDbgAssert((canp->state == CAN_READY) || (canp->state == CAN_SLEEP), "invalid state"); if (canp->state == CAN_SLEEP) { can_lld_wakeup(canp); canp->state = CAN_READY; osalEventBroadcastFlagsI(&canp->wakeup_event, (eventflags_t)0); osalOsRescheduleS(); } osalSysUnlock(); }
/** * @brief Enforces leaving the sleep mode. * @note The sleep mode is supposed to be usually exited automatically by * an hardware event. * * @param[in] canp pointer to the @p CANDriver object */ void canWakeup(CANDriver *canp) { chDbgCheck(canp != NULL, "canWakeup"); chSysLock(); chDbgAssert((canp->state == CAN_READY) || (canp->state == CAN_SLEEP), "canWakeup(), #1", "invalid state"); if (canp->state == CAN_SLEEP) { can_lld_wakeup(canp); canp->state = CAN_READY; chEvtBroadcastI(&canp->wakeup_event); chSchRescheduleS(); } chSysUnlock(); }