diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-09-16 09:26:46 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-09-16 09:26:46 +0000 |
commit | c145c837da830279f68f6ba0431d856cc6bf67f2 (patch) | |
tree | c0696ba90e6ca8c19c2969d4463b3fabfccb4be2 /os/hal/platforms/STM32 | |
parent | f90a0f37906a9363a6e702d8ac1c4c8257370efa (diff) | |
download | ChibiOS-c145c837da830279f68f6ba0431d856cc6bf67f2.tar.gz ChibiOS-c145c837da830279f68f6ba0431d856cc6bf67f2.tar.bz2 ChibiOS-c145c837da830279f68f6ba0431d856cc6bf67f2.zip |
Removed flags handling in CAN driver, now it is done using the new event flags.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4672 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32')
-rw-r--r-- | os/hal/platforms/STM32/can_lld.c | 13 | ||||
-rw-r--r-- | os/hal/platforms/STM32/can_lld.h | 9 |
2 files changed, 7 insertions, 15 deletions
diff --git a/os/hal/platforms/STM32/can_lld.c b/os/hal/platforms/STM32/can_lld.c index dd0cacd11..32d273c6f 100644 --- a/os/hal/platforms/STM32/can_lld.c +++ b/os/hal/platforms/STM32/can_lld.c @@ -95,9 +95,8 @@ CH_IRQ_HANDLER(STM32_CAN1_RX0_HANDLER) { if ((rf0r & CAN_RF0R_FOVR0) > 0) {
/* Overflow events handling.*/
CAN1->RF0R = CAN_RF0R_FOVR0;
- canAddFlagsI(&CAND1, CAN_OVERFLOW_ERROR);
chSysLockFromIsr();
- chEvtBroadcastI(&CAND1.error_event);
+ chEvtBroadcastFlagsI(&CAND1.error_event, CAN_OVERFLOW_ERROR);
chSysUnlockFromIsr();
}
@@ -138,16 +137,18 @@ CH_IRQ_HANDLER(STM32_CAN1_SCE_HANDLER) { }
/* Error event.*/
if (msr & CAN_MSR_ERRI) {
- canstatus_t flags;
+ flagsmask_t flags;
uint32_t esr = CAN1->ESR;
CAN1->ESR &= ~CAN_ESR_LEC;
- flags = (canstatus_t)(esr & 7);
+ flags = (flagsmask_t)(esr & 7);
if ((esr & CAN_ESR_LEC) > 0)
flags |= CAN_FRAMING_ERROR;
+
chSysLockFromIsr();
- canAddFlagsI(&CAND1, flags | (canstatus_t)(flags < 16));
- chEvtBroadcastI(&CAND1.error_event);
+ /* The content of the ESR register is copied unchanged in the upper
+ half word of the listener flags mask.*/
+ chEvtBroadcastFlagsI(&CAND1.error_event, flags | (flagsmask_t)(esr < 16));
chSysUnlockFromIsr();
}
diff --git a/os/hal/platforms/STM32/can_lld.h b/os/hal/platforms/STM32/can_lld.h index 6cb882df2..003a6743f 100644 --- a/os/hal/platforms/STM32/can_lld.h +++ b/os/hal/platforms/STM32/can_lld.h @@ -112,11 +112,6 @@ /*===========================================================================*/
/**
- * @brief CAN status flags.
- */
-typedef uint32_t canstatus_t;
-
-/**
* @brief CAN transmission frame.
* @note Accessing the frame data as word16 or word32 is not portable because
* machine data endianness, it can be still useful for a quick filling.
@@ -273,10 +268,6 @@ typedef struct { * @brief A CAN bus error happened.
*/
EventSource error_event;
- /**
- * @brief Error flags set when an error event is broadcasted.
- */
- canstatus_t status;
#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__)
/**
* @brief Entering sleep state event.
|