diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-11-29 08:40:11 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-11-29 08:40:11 +0000 |
commit | 544117e9eb5a5ca827f1fbf62814459503b36e9e (patch) | |
tree | 0fa5bc94f3f8939eb1a5f7986136e7048d9d881e /os/io/src/can.c | |
parent | 3dc0fb372d94f4dc35150be02cc02ce582d55f41 (diff) | |
download | ChibiOS-544117e9eb5a5ca827f1fbf62814459503b36e9e.tar.gz ChibiOS-544117e9eb5a5ca827f1fbf62814459503b36e9e.tar.bz2 ChibiOS-544117e9eb5a5ca827f1fbf62814459503b36e9e.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1347 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/src/can.c')
-rw-r--r-- | os/io/src/can.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/os/io/src/can.c b/os/io/src/can.c index 4c88f9c71..bb3e0d1a5 100644 --- a/os/io/src/can.c +++ b/os/io/src/can.c @@ -24,8 +24,10 @@ * @{
*/
-#include <ch.h>
-#include <can.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_CAN
/**
* @brief CAN Driver initialization.
@@ -44,8 +46,8 @@ void canObjectInit(CANDriver *canp) { canp->can_state = CAN_STOP;
canp->can_config = NULL;
- chSemInit(&canp->can_txsem);
- chSemInit(&canp->can_rxsem);
+ chSemInit(&canp->can_txsem, 0);
+ chSemInit(&canp->can_rxsem, 0);
chEvtInit(&canp->can_rxfull_event);
chEvtInit(&canp->can_txempty_event);
#if CAN_USE_SLEEP_MODE
@@ -183,7 +185,7 @@ void canSleep(CANDriver *canp) { chDbgAssert((canp->can_state == CAN_READY) || (canp->can_state == CAN_SLEEP),
"canSleep(), #1",
"invalid state");
- if (canp->can_state = CAN_READY) {
+ if (canp->can_state == CAN_READY) {
can_lld_sleep(canp);
canp->can_state = CAN_SLEEP;
chEvtBroadcastI(&canp->can_sleep_event);
@@ -207,7 +209,7 @@ void canWakeup(CANDriver *canp) { chDbgAssert((canp->can_state == CAN_READY) || (canp->can_state == CAN_SLEEP),
"canWakeup(), #1",
"invalid state");
- if (canp->can_state = CAN_SLEEP) {
+ if (canp->can_state == CAN_SLEEP) {
can_lld_wakeup(canp);
canp->can_state = CAN_READY;
chEvtBroadcastI(&canp->can_wakeup_event);
@@ -217,4 +219,6 @@ void canWakeup(CANDriver *canp) { }
#endif /* CAN_USE_SLEEP_MODE */
+#endif /* CH_HAL_USE_CAN */
+
/** @} */
|