aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/can_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-30 21:34:05 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-30 21:34:05 +0000
commit8a433087afe80e92aea1c558965994b53bfcfb48 (patch)
tree6d57405dddc07daa8ef7995d8898dbd7256a5258 /os/hal/platforms/STM32/can_lld.c
parent770c4873d20623f6d4f678d62b67eb6218e259bf (diff)
downloadChibiOS-8a433087afe80e92aea1c558965994b53bfcfb48.tar.gz
ChibiOS-8a433087afe80e92aea1c558965994b53bfcfb48.tar.bz2
ChibiOS-8a433087afe80e92aea1c558965994b53bfcfb48.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1368 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/can_lld.c')
-rw-r--r--os/hal/platforms/STM32/can_lld.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/os/hal/platforms/STM32/can_lld.c b/os/hal/platforms/STM32/can_lld.c
index 91831cff1..30d270a37 100644
--- a/os/hal/platforms/STM32/can_lld.c
+++ b/os/hal/platforms/STM32/can_lld.c
@@ -33,6 +33,11 @@
/* Low Level Driver exported variables. */
/*===========================================================================*/
+/** @brief ADC1 driver identifier.*/
+#if USE_STM32_CAN1 || defined(__DOXYGEN__)
+CANDriver CAND1;
+#endif
+
/*===========================================================================*/
/* Low Level Driver local variables. */
/*===========================================================================*/
@@ -45,6 +50,62 @@
/* Low Level Driver interrupt handlers. */
/*===========================================================================*/
+/*
+ * CAN1 TX interrupt handler.
+ */
+CH_IRQ_HANDLER(Vector8C) {
+
+ CH_IRQ_PROLOGUE();
+
+ /* No more events until a message is transmitted.*/
+ CAN1->IER &= ~CAN_IER_TMEIE;
+ chEvtBroadcastI(&CAND1.cd_txempty_event);
+
+ CH_IRQ_EPILOGUE();
+}
+
+/*
+ * CAN1 RX0 interrupt handler.
+ */
+CH_IRQ_HANDLER(Vector90) {
+
+ CH_IRQ_PROLOGUE();
+
+ /* No more events until the incoming messages queues are emptied.*/
+ CAN1->IER &= ~(CAN_IER_FMPIE0 | CAN_IER_FMPIE1);
+ chEvtBroadcastI(&CAND1.cd_rxfull_event);
+
+ CH_IRQ_EPILOGUE();
+}
+
+/*
+ * CAN1 RX1 interrupt handler.
+ */
+CH_IRQ_HANDLER(Vector94) {
+
+ CH_IRQ_PROLOGUE();
+
+ /* No more events until the incoming messages queues are emptied.*/
+ CAN1->IER &= ~(CAN_IER_FMPIE0 | CAN_IER_FMPIE1);
+ chEvtBroadcastI(&CAND1.cd_rxfull_event);
+
+ CH_IRQ_EPILOGUE();
+}
+
+/*
+ * CAN1 SCE interrupt handler.
+ */
+CH_IRQ_HANDLER(Vector98) {
+
+ CH_IRQ_PROLOGUE();
+
+ canAddFlagsI(&CAND1, 1);
+ chEvtBroadcastI(&CAND1.cd_error_event);
+ CAN1->MSR = CAN_MSR_ERRI;
+
+ CH_IRQ_EPILOGUE();
+}
+
/*===========================================================================*/
/* Low Level Driver exported functions. */
/*===========================================================================*/
@@ -63,7 +124,7 @@ void can_lld_init(void) {
*/
void can_lld_start(CANDriver *canp) {
- if (canp->can_state == CAN_STOP) {
+ if (canp->cd_state == CAN_STOP) {
/* Clock activation.*/
}
/* Configuration.*/