diff options
-rw-r--r-- | os/hal/include/can.h | 5 | ||||
-rw-r--r-- | os/hal/platforms/STM32/can_lld.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/os/hal/include/can.h b/os/hal/include/can.h index 234981448..1d8492d28 100644 --- a/os/hal/include/can.h +++ b/os/hal/include/can.h @@ -119,6 +119,11 @@ typedef enum { * @{
*/
/**
+ * @bried Converts a mailbox index to a bit mask.
+ */
+#define CAN_MAILBOX_TO_MASK(mbx) (1 << ((mbx) - 1))
+
+/**
* @brief Adds some flags to the CAN status mask.
*
* @param[in] canp pointer to the @p CANDriver object
diff --git a/os/hal/platforms/STM32/can_lld.c b/os/hal/platforms/STM32/can_lld.c index 7a6185c1f..89d1b25ac 100644 --- a/os/hal/platforms/STM32/can_lld.c +++ b/os/hal/platforms/STM32/can_lld.c @@ -137,7 +137,7 @@ static void can_lld_tx_handler(CANDriver *canp) { chSysLockFromIsr();
while (chSemGetCounterI(&canp->txsem) < 0)
chSemSignalI(&canp->txsem);
- chEvtBroadcastI(&canp->txempty_event);
+ chEvtBroadcastFlagsI(&canp->txempty_event, CAN_MAILBOX_TO_MASK(1));
chSysUnlockFromIsr();
}
@@ -158,7 +158,7 @@ static void can_lld_rx0_handler(CANDriver *canp) { chSysLockFromIsr();
while (chSemGetCounterI(&canp->rxsem) < 0)
chSemSignalI(&canp->rxsem);
- chEvtBroadcastI(&canp->rxfull_event);
+ chEvtBroadcastFlagsI(&canp->rxfull_event, CAN_MAILBOX_TO_MASK(1));
chSysUnlockFromIsr();
}
if ((rf0r & CAN_RF0R_FOVR0) > 0) {
|