28 #if (HAL_USE_CAN == TRUE) || defined(__DOXYGEN__) 41 #define CAN_LIMIT_WARNING 1U 45 #define CAN_LIMIT_ERROR 2U 49 #define CAN_BUS_OFF_ERROR 4U 53 #define CAN_FRAMING_ERROR 8U 57 #define CAN_OVERFLOW_ERROR 16U 63 #define CAN_ANY_MAILBOX 0U 79 #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) 80 #define CAN_USE_SLEEP_MODE TRUE 86 #if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) 87 #define CAN_ENFORCE_USE_CALLBACKS FALSE 123 #define CAN_MAILBOX_TO_MASK(mbx) (1U << ((mbx) - 1U)) 130 #define canTransmit(canp, mailbox, ctfp, timeout) \ 131 canTransmitTimeout(canp, mailbox, ctfp, timeout) 138 #define canReceive(canp, mailbox, crfp, timeout) \ 139 canReceiveTimeout(canp, mailbox, crfp, timeout) 146 #if (CAN_ENFORCE_USE_CALLBACKS == FALSE) || defined(__DOXYGEN__) 150 #define _can_tx_empty_isr(canp, flags) { \ 151 osalSysLockFromISR(); \ 152 osalThreadDequeueAllI(&(canp)->txqueue, MSG_OK); \ 153 osalEventBroadcastFlagsI(&(canp)->txempty_event, flags); \ 154 osalSysUnlockFromISR(); \ 160 #define _can_rx_full_isr(canp, flags) { \ 161 osalSysLockFromISR(); \ 162 osalThreadDequeueAllI(&(canp)->rxqueue, MSG_OK); \ 163 osalEventBroadcastFlagsI(&(canp)->rxfull_event, flags); \ 164 osalSysUnlockFromISR(); \ 170 #define _can_wakeup_isr(canp) { \ 171 osalSysLockFromISR(); \ 172 osalEventBroadcastFlagsI(&(canp)->wakeup_event, 0U); \ 173 osalSysUnlockFromISR(); \ 179 #define _can_error_isr(canp, flags) { \ 180 osalSysLockFromISR(); \ 181 osalEventBroadcastFlagsI(&(canp)->error_event, flags); \ 182 osalSysUnlockFromISR(); \ 185 #define _can_tx_empty_isr(canp, flags) { \ 186 if ((canp)->txempty_cb != NULL) { \ 187 (canp)->txempty_cb(canp, flags); \ 189 osalSysLockFromISR(); \ 190 osalThreadDequeueAllI(&(canp)->txqueue, MSG_OK); \ 191 osalSysUnlockFromISR(); \ 194 #define _can_rx_full_isr(canp, flags) { \ 195 if ((canp)->rxfull_cb != NULL) { \ 196 (canp)->rxfull_cb(canp, flags); \ 198 osalSysLockFromISR(); \ 199 osalThreadDequeueAllI(&(canp)->rxqueue, MSG_OK); \ 200 osalSysUnlockFromISR(); \ 203 #define _can_wakeup_isr(canp) { \ 204 if ((canp)->wakeup_cb != NULL) { \ 205 (canp)->wakeup_cb(canp, 0U); \ 209 #define _can_error_isr(canp, flags) { \ 210 if ((canp)->error_cb != NULL) { \ 211 (canp)->error_cb(canp, flags); \ 242 #if CAN_USE_SLEEP_MODE uint32_t canmbx_t
Type of a transmission mailbox index.
void canStart(CANDriver *canp, const CANConfig *config)
Configures and activates the CAN peripheral.
Structure representing an CAN driver.
msg_t canTransmitTimeout(CANDriver *canp, canmbx_t mailbox, const CANTxFrame *ctfp, sysinterval_t timeout)
Can frame transmission.
int32_t msg_t
Type of a message.
void canObjectInit(CANDriver *canp)
Initializes the standard part of a CANDriver structure.
PLATFORM CAN subsystem low level driver header.
bool canTryReceiveI(CANDriver *canp, canmbx_t mailbox, CANRxFrame *crfp)
Can frame receive attempt.
void canSleep(CANDriver *canp)
Enters the sleep mode.
void canInit(void)
CAN Driver initialization.
void canWakeup(CANDriver *canp)
Enforces leaving the sleep mode.
uint32_t sysinterval_t
Type of system time interval.
void canStop(CANDriver *canp)
Deactivates the CAN peripheral.
Driver configuration structure.
msg_t canReceiveTimeout(CANDriver *canp, canmbx_t mailbox, CANRxFrame *crfp, sysinterval_t timeout)
Can frame receive.
canstate_t
Driver state machine possible states.
bool canTryTransmitI(CANDriver *canp, canmbx_t mailbox, const CANTxFrame *ctfp)
Can frame transmission attempt.