diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-12-06 10:25:53 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-12-06 10:25:53 +0000 |
commit | aac691f35fc7090baa51e31d80aab4f495ddcaa3 (patch) | |
tree | f2ec7f27635c03f3200c55d9e688cfb56c36ec15 /os/hal/platforms | |
parent | 646d8a2376e3d476a3d00edb665770596fb252f6 (diff) | |
download | ChibiOS-aac691f35fc7090baa51e31d80aab4f495ddcaa3.tar.gz ChibiOS-aac691f35fc7090baa51e31d80aab4f495ddcaa3.tar.bz2 ChibiOS-aac691f35fc7090baa51e31d80aab4f495ddcaa3.zip |
STM32 CAN driver completed, HAL stress test demo added.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1377 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms')
-rw-r--r-- | os/hal/platforms/STM32/can_lld.c | 5 | ||||
-rw-r--r-- | os/hal/platforms/STM32/can_lld.h | 20 |
2 files changed, 21 insertions, 4 deletions
diff --git a/os/hal/platforms/STM32/can_lld.c b/os/hal/platforms/STM32/can_lld.c index 26cbadc43..7a9970c30 100644 --- a/os/hal/platforms/STM32/can_lld.c +++ b/os/hal/platforms/STM32/can_lld.c @@ -58,7 +58,7 @@ CH_IRQ_HANDLER(Vector8C) { CH_IRQ_PROLOGUE();
/* No more events until a message is transmitted.*/
- CAN1->IER &= ~CAN_IER_TMEIE;
+ CAN1->TSR = CAN_TSR_RQCP0 | CAN_TSR_RQCP1 | CAN_TSR_RQCP2;
chEvtBroadcastI(&CAND1.cd_txempty_event);
CH_IRQ_EPILOGUE();
@@ -299,9 +299,6 @@ void can_lld_transmit(CANDriver *canp, const CANTxFrame *ctfp) { tmbp->TDLR = ctfp->cf_data32[0];
tmbp->TDHR = ctfp->cf_data32[1];
tmbp->TIR = tir | CAN_TI0R_TXRQ;
-
- /* Re-enables the interrupt in order to generate events again.*/
- canp->cd_can->IER |= CAN_IER_TMEIE;
}
/**
diff --git a/os/hal/platforms/STM32/can_lld.h b/os/hal/platforms/STM32/can_lld.h index b7dff8ced..49498ef7b 100644 --- a/os/hal/platforms/STM32/can_lld.h +++ b/os/hal/platforms/STM32/can_lld.h @@ -29,6 +29,15 @@ #if CH_HAL_USE_CAN || defined(__DOXYGEN__)
+/*
+ * The following macros from the ST header file are replaced with better
+ * equivalents. + */
+#undef CAN_BTR_BRP
+#undef CAN_BTR_TS1
+#undef CAN_BTR_TS2
+#undef CAN_BTR_SJW
+
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
@@ -48,6 +57,17 @@ #define CAN_MAX_FILTERS 14
#endif
+#define CAN_BTR_BRP(n) (n) /**< @brief BRP field macro.*/
+#define CAN_BTR_TS1(n) ((n) << 16) /**< @brief TS1 field macro.*/
+#define CAN_BTR_TS2(n) ((n) << 20) /**< @brief TS2 field macro.*/
+#define CAN_BTR_SJW(n) ((n) << 24) /**< @brief SJW field macro.*/
+
+#define CAN_IDE_STD 0 /**< @brief Standard id. */
+#define CAN_IDE_EXT 1 /**< @brief Extended id. */
+
+#define CAN_RTR_DATA 0 /**< @brief Data frame. */
+#define CAN_RTR_REMOTE 1 /**< @brief Remote frame. */
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
|