diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-03-09 19:10:30 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-03-09 19:10:30 +0300 |
commit | 8c8b48d30f37d92351d03ab3787dd4dbd1506415 (patch) | |
tree | 860b2fb4b03289d7c04330c75996d98528cdad26 | |
parent | 4481135c99124a38eee3fcbb6955e6846df6bd42 (diff) |
Tided up CAN Tx buffer allocation
-rw-r--r-- | src/CAN/CanInterface.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp index 3182e457..15df4626 100644 --- a/src/CAN/CanInterface.cpp +++ b/src/CAN/CanInterface.cpp @@ -92,7 +92,7 @@ static bool inExpansionMode = false; constexpr CanDevice::Config Can0Config = { .dataSize = 64, - .numTxBuffers = 6, + .numTxBuffers = 5, .txFifoSize = 16, .numRxBuffers = 0, .rxFifo0Size = 16, @@ -137,16 +137,15 @@ static CanDevice *can1dev = nullptr; #endif -// Transmit buffer usage +// Transmit buffer usage. All dedicated buffer numbers must be < Can0Config.numTxBuffers. constexpr auto TxBufferIndexUrgent = CanDevice::TxBufferNumber::buffer0; constexpr auto TxBufferIndexTimeSync = CanDevice::TxBufferNumber::buffer1; -constexpr auto TxBufferIndexMotion = CanDevice::TxBufferNumber::fifo; -// We should probably use a FIFO or a queue for the remainder, but for now each has its own message buffer -constexpr auto TxBufferIndexRequest = CanDevice::TxBufferNumber::buffer3; -constexpr auto TxBufferIndexResponse = CanDevice::TxBufferNumber::buffer4; -constexpr auto TxBufferIndexBroadcast = CanDevice::TxBufferNumber::buffer5; +constexpr auto TxBufferIndexRequest = CanDevice::TxBufferNumber::buffer2; +constexpr auto TxBufferIndexResponse = CanDevice::TxBufferNumber::buffer3; +constexpr auto TxBufferIndexBroadcast = CanDevice::TxBufferNumber::buffer4; +constexpr auto TxBufferIndexMotion = CanDevice::TxBufferNumber::fifo; // we send lots of movement messages so use the FIFO for them -// Receive buffer/FIFO usage +// Receive buffer/FIFO usage. All dedicated buffer numbers must be < Can0Config.numRxBuffers. constexpr auto RxBufferIndexBroadcast = CanDevice::RxBufferNumber::fifo0; constexpr auto RxBufferIndexRequest = CanDevice::RxBufferNumber::fifo0; constexpr auto RxBufferIndexResponse = CanDevice::RxBufferNumber::fifo1; |