aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-02-22 15:10:56 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-02-22 15:10:56 +0000
commitfc7818faf7f47cdbabc9081cd7c795879f97ed7e (patch)
tree05c4026934a778c8bcae756f12fc5a40db390ebf
parent04385d42d46173127ac7c5274cbd15d5d255c460 (diff)
downloadChibiOS-fc7818faf7f47cdbabc9081cd7c795879f97ed7e.tar.gz
ChibiOS-fc7818faf7f47cdbabc9081cd7c795879f97ed7e.tar.bz2
ChibiOS-fc7818faf7f47cdbabc9081cd7c795879f97ed7e.zip
Reworked CAN driver working. TODO: activate 2nd RX queue.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5301 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/include/can.h5
-rw-r--r--os/hal/platforms/STM32/can_lld.c4
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) {