diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-01-27 21:58:04 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-02-02 15:17:14 -0500 |
commit | 95adff74311f501ee2f78b382120ce248109ed04 (patch) | |
tree | e9c6dcf1bc19571d52af11e66397350a96a642a1 /src/stm32/can.c | |
parent | 95eb00740b9582772d6e5584d2cee2085c49016f (diff) | |
download | kutter-95adff74311f501ee2f78b382120ce248109ed04.tar.gz kutter-95adff74311f501ee2f78b382120ce248109ed04.tar.xz kutter-95adff74311f501ee2f78b382120ce248109ed04.zip |
stm32: Use CAN_TSR_CODE to select next tx fifo in can.c
The spec states that the TX fifo is transmitted in chronological order
if the TXFP bit is set, but it's unclear if the software needs to fill
the tx fifo in a particular order to obtain that result. Use the TSR
CODE bit field to fill the TX fifo in the order that the hardware
reports as next.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/can.c')
-rw-r--r-- | src/stm32/can.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/stm32/can.c b/src/stm32/can.c index d2e5f45b..ef9b58eb 100644 --- a/src/stm32/can.c +++ b/src/stm32/can.c @@ -91,12 +91,8 @@ static int can_find_empty_tx_mbox(void) { uint32_t tsr = SOC_CAN->TSR; - if (tsr & CAN_TSR_TME0) - return 0; - if (tsr & CAN_TSR_TME1) - return 1; - if (tsr & CAN_TSR_TME2) - return 2; + if (tsr & (CAN_TSR_TME0|CAN_TSR_TME1|CAN_TSR_TME2)) + return (tsr & CAN_TSR_CODE) >> CAN_TSR_CODE_Pos; return -1; } |