File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -375,12 +375,13 @@ static constexpr Register CRORC_CSR(0x00000000);
375375// CHANNEL Control & Status Register
376376// [1] -> CRORC
377377// [2] -> CHANNEL (can be used together - e.g. 0x3)
378- // [9] -> data receive ON / OFF
378+ // [9] -> data receive ON / OFF toggle
379379// [12] -> LOOPBACK ON OFF
380380// [23] -> FIFO NOT EMPTY
381381static constexpr Register CHANNEL_CSR (0x00000010 );
382382static constexpr uint32_t CRORC_RESET (0x00000003 );
383383static constexpr uint32_t DATA_RX_ON_OFF (0x00000200 );
384+ static constexpr uint32_t DATA_RX_ON_OFF_BIT (0x9 );
384385static constexpr uint32_t RXSTAT_NOT_EMPTY (0x00800000 );
385386static constexpr uint32_t LOOPBACK_ON_OFF (0x00001000 );
386387
Original file line number Diff line number Diff line change @@ -349,15 +349,20 @@ void CrorcBar::startDataReceiver(uintptr_t readyFifoBusAddress)
349349 writeRegister (Crorc::Registers::CHANNEL_RRBARX.index , 0x0 );
350350 }
351351
352- if (!(readRegister (Crorc::Registers::CHANNEL_CSR.index ) & Crorc::Registers::DATA_RX_ON_OFF)) {
353- writeRegister (Crorc::Registers::CHANNEL_CSR.index , Crorc::Registers::DATA_RX_ON_OFF);
352+ uint32_t CSRRegister = readRegister (Crorc::Registers::CHANNEL_CSR.index );
353+ if (!Utilities::getBit (CSRRegister, Crorc::Registers::DATA_RX_ON_OFF_BIT)) {
354+ Utilities::setBit (CSRRegister, Crorc::Registers::DATA_RX_ON_OFF_BIT, true );
355+ writeRegister (Crorc::Registers::CHANNEL_CSR.index , CSRRegister);
354356 }
355357}
356358
357359void CrorcBar::stopDataReceiver ()
358360{
359- if (readRegister (Crorc::Registers::CHANNEL_CSR.index ) & Crorc::Registers::DATA_RX_ON_OFF) {
360- writeRegister (Crorc::Registers::CHANNEL_CSR.index , Crorc::Registers::DATA_RX_ON_OFF);
361+ uint32_t CSRRegister = readRegister (Crorc::Registers::CHANNEL_CSR.index );
362+ if (Utilities::getBit (CSRRegister, Crorc::Registers::DATA_RX_ON_OFF_BIT)) {
363+ // Implemented as a toggle, so we write the same value we did for starting
364+ Utilities::setBit (CSRRegister, Crorc::Registers::DATA_RX_ON_OFF_BIT, true );
365+ writeRegister (Crorc::Registers::CHANNEL_CSR.index , CSRRegister);
361366 }
362367}
363368
You can’t perform that action at this time.
0 commit comments