aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-12-06 15:13:33 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-12-06 15:13:33 +0000
commitb33d1f0a4ecbd799fed97c2f27f7a5fe5b19f818 (patch)
tree690e139269750518b7e40e295afeaaae5637a0a4 /os/hal/platforms
parentaa9f517f87125bbe7e9520c838627cde509ffa8c (diff)
downloadChibiOS-b33d1f0a4ecbd799fed97c2f27f7a5fe5b19f818.tar.gz
ChibiOS-b33d1f0a4ecbd799fed97c2f27f7a5fe5b19f818.tar.bz2
ChibiOS-b33d1f0a4ecbd799fed97c2f27f7a5fe5b19f818.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1379 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms')
-rw-r--r--os/hal/platforms/STM32/can_lld.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/os/hal/platforms/STM32/can_lld.c b/os/hal/platforms/STM32/can_lld.c
index 3c8a17b84..b9b088515 100644
--- a/os/hal/platforms/STM32/can_lld.c
+++ b/os/hal/platforms/STM32/can_lld.c
@@ -292,13 +292,10 @@ void can_lld_transmit(CANDriver *canp, const CANTxFrame *ctfp) {
/* Preparing the message.*/
if (ctfp->cf_IDE)
- tir = ((uint32_t)ctfp->cf_EID << 3) |
- ((uint32_t)ctfp->cf_IDE << 2) |
- ((uint32_t)ctfp->cf_RTR << 1);
+ tir = ((uint32_t)ctfp->cf_EID << 3) | ((uint32_t)ctfp->cf_RTR << 1) |
+ CAN_TI0R_IDE;
else
- tir = ((uint32_t)ctfp->cf_SID << 24) |
- ((uint32_t)ctfp->cf_IDE << 2) |
- ((uint32_t)ctfp->cf_RTR << 1);
+ tir = ((uint32_t)ctfp->cf_SID << 21) | ((uint32_t)ctfp->cf_RTR << 1);
tmbp->TDTR = ctfp->cf_DLC;
tmbp->TDLR = ctfp->cf_data32[0];
tmbp->TDHR = ctfp->cf_data32[1];
@@ -329,22 +326,22 @@ void can_lld_receive(CANDriver *canp, CANRxFrame *crfp) {
uint32_t r;
/* Fetches the message.*/
- r = canp->cd_can->sFIFOMailBox[0].RDTR;
- crfp->cf_DLC = r & CAN_RDT0R_DLC;
- crfp->cf_FMI = (uint8_t)(r >> 8);
- crfp->cf_TIME = (uint16_t)(r >> 16);
r = canp->cd_can->sFIFOMailBox[0].RIR;
- crfp->cf_RTR = r & CAN_RI0R_RTR;
- crfp->cf_IDE = r & CAN_RI0R_IDE;
+ crfp->cf_RTR = (r & CAN_RI0R_RTR) >> 1;
+ crfp->cf_IDE = (r & CAN_RI0R_IDE) >> 2;
if (crfp->cf_IDE)
crfp->cf_EID = r >> 3;
else
- crfp->cf_SID = r >> 24;
+ crfp->cf_SID = r >> 21;
+ r = canp->cd_can->sFIFOMailBox[0].RDTR;
+ crfp->cf_DLC = r & CAN_RDT0R_DLC;
+ crfp->cf_FMI = (uint8_t)(r >> 8);
+ crfp->cf_TIME = (uint16_t)(r >> 16);
crfp->cf_data32[0] = canp->cd_can->sFIFOMailBox[0].RDLR;
crfp->cf_data32[1] = canp->cd_can->sFIFOMailBox[0].RDHR;
/* Releases the mailbox.*/
- canp->cd_can->RF0R |= CAN_RF0R_RFOM0;
+ canp->cd_can->RF0R = CAN_RF0R_RFOM0;
/* If the queue is empty re-enables the interrupt in order to generate
events again.*/