@@ -196,7 +196,7 @@ static dmx::DmxTransmit s_dmx_transmit;
196196// RDM TX
197197static dmx::RdmTxData s_RdmTxBuffer[dmx::config::max::kPorts ] ALIGNED SECTION_DMA_BUFFER ;
198198
199- template <uint32_t uart, uint32_t port_index>
199+ template <uint32_t uart, uint32_t port_index>
200200void IrqHandlerDmxRdmInput () {
201201 auto & rx_buffer = sv_rx_buffer[port_index];
202202 const auto kIsFlagIdleFrame = (USART_REG_VAL (uart, USART_FLAG_IDLE ) & BIT (USART_BIT_POS (USART_FLAG_IDLE ))) == BIT (USART_BIT_POS (USART_FLAG_IDLE ));
@@ -334,7 +334,7 @@ void IrqHandlerDmxRdmInput() {
334334 }
335335}
336336
337- template <uint32_t UsartPeripheral, uint32_t DmaController, dma_channel_enum DmaChannel>
337+ template <uint32_t UsartPeripheral, uint32_t DmaController, dma_channel_enum DmaChannel>
338338void DmaStartTx (const uint8_t * data, uint32_t length) {
339339 auto dma_chctl = DMA_CHCTL (DmaController, DmaChannel);
340340 // Disable channel
@@ -352,7 +352,7 @@ void DmaStartTx(const uint8_t* data, uint32_t length) {
352352 USART_CTL2 (UsartPeripheral) |= USART_TRANSMIT_DMA_ENABLE ;
353353}
354354
355- template <uint32_t UsartPeripheral, uint32_t DmaController, dma_channel_enum DmaChannel, typename TxBufferType>
355+ template <uint32_t UsartPeripheral, uint32_t DmaController, dma_channel_enum DmaChannel, typename TxBufferType>
356356void DmaRestartDmxTx (TxBufferType& tx_buffer) {
357357 auto & dmx = tx_buffer.dmx ;
358358
@@ -368,7 +368,7 @@ void DmaRestartDmxTx(TxBufferType& tx_buffer) {
368368#define DMA_RESTART_DMX_TX (PORT_INDEX, USARTx, DMAx, CHx ) \
369369 DmaRestartDmxTx<USARTx, DMAx, CHx>(s_DmxTxBuffer[PORT_INDEX ])
370370
371- template <uint32_t UsartPeripheral, uint32_t DmaController, dma_channel_enum DmaChannel, typename TxBufferType>
371+ template <uint32_t UsartPeripheral, uint32_t DmaController, dma_channel_enum DmaChannel, typename TxBufferType>
372372void DmaStartRdmTx (TxBufferType& tx_buffer) {
373373 const auto & packet = tx_buffer.rdm .data ;
374374
@@ -489,7 +489,7 @@ void TIMER1_IRQHandler() {
489489 } break ;
490490
491491 default :
492- [[unlikely]] assert (false );
492+ [[unlikely]] assert (false && " switch " );
493493 break ;
494494 }
495495 }
@@ -556,7 +556,7 @@ void TIMER1_IRQHandler() {
556556 } break ;
557557
558558 default :
559- [[unlikely]] assert (false );
559+ [[unlikely]] assert (false && " switch " );
560560 break ;
561561 }
562562 }
@@ -593,7 +593,7 @@ void TIMER1_IRQHandler() {
593593 break ;
594594
595595 default :
596- [[unlikely]] assert (false );
596+ [[unlikely]] assert (false && " switch " );
597597 break ;
598598 }
599599 } else if (s_RdmTxBuffer[dmx::config::kUsart2Port ].state != dmx::RdmTxState::kIdle ) {
@@ -624,7 +624,7 @@ void TIMER1_IRQHandler() {
624624 } break ;
625625
626626 default :
627- [[unlikely]] assert (false );
627+ [[unlikely]] assert (false && " switch " );
628628 break ;
629629 }
630630 }
@@ -690,7 +690,7 @@ void TIMER1_IRQHandler() {
690690 break ;
691691
692692 default :
693- [[unlikely]] assert (false );
693+ [[unlikely]] assert (false && " switch " );
694694 break ;
695695 }
696696 }
@@ -732,7 +732,7 @@ void TIMER4_IRQHandler() {
732732 break ;
733733
734734 default :
735- [[unlikely]] assert (false );
735+ [[unlikely]] assert (false && " switch " );
736736 break ;
737737 }
738738 } else if (s_RdmTxBuffer[dmx::config::kUart4Port ].state != dmx::RdmTxState::kIdle ) {
@@ -765,7 +765,7 @@ void TIMER4_IRQHandler() {
765765 break ;
766766
767767 default :
768- [[unlikely]] assert (false );
768+ [[unlikely]] assert (false && " switch " );
769769 break ;
770770 }
771771 }
@@ -802,7 +802,7 @@ void TIMER4_IRQHandler() {
802802 break ;
803803
804804 default :
805- [[unlikely]] assert (false );
805+ [[unlikely]] assert (false && " switch " );
806806 break ;
807807 }
808808 } else if (s_RdmTxBuffer[dmx::config::kUsart5Port ].state != dmx::RdmTxState::kIdle ) {
@@ -834,7 +834,7 @@ void TIMER4_IRQHandler() {
834834 break ;
835835
836836 default :
837- [[unlikely]] assert (false );
837+ [[unlikely]] assert (false && " switch " );
838838 break ;
839839 }
840840 }
@@ -893,7 +893,7 @@ void TIMER4_IRQHandler() {
893893 break ;
894894
895895 default :
896- [[unlikely]] assert (false );
896+ [[unlikely]] assert (false && " switch " );
897897 break ;
898898 }
899899 }
@@ -952,7 +952,7 @@ void TIMER4_IRQHandler() {
952952 break ;
953953
954954 default :
955- [[unlikely]] assert (false );
955+ [[unlikely]] assert (false && " switch " );
956956 break ;
957957 }
958958 }
@@ -1048,8 +1048,8 @@ void DMA0_Channel6_IRQHandler() {
10481048 s_DmxTxBuffer[dmx::config::kUsart1Port ].state = dmx::TxRxState::kDmxInter ;
10491049 }
10501050#if !defined(CONFIG_DMX_DISABLE_STATISTICS)
1051- const auto kSent = sv_total_statistics[dmx::config::kUsart1Port ].dmx .sent + 1 ;
1052- sv_total_statistics[dmx::config::kUsart1Port ].dmx .sent = kSent ;
1051+ const auto kSent = sv_total_statistics[dmx::config::kUsart1Port ].dmx .sent + 1 ;
1052+ sv_total_statistics[dmx::config::kUsart1Port ].dmx .sent = kSent ;
10531053#endif // !defined(CONFIG_DMX_DISABLE_STATISTICS)
10541054 } else if (s_RdmTxBuffer[dmx::config::kUsart1Port ].state != dmx::RdmTxState::kIdle ) {
10551055 TIMER_CH1CV (TIMER1 ) = TIMER_CNT (TIMER1 ) + rdm::transmit::kDirectionTime ;
@@ -1370,8 +1370,8 @@ void Dmx::SetPortDirection(uint32_t port_index, dmx::Direction port_direction, b
13701370 GPIO_BOP (kDirGpio [port_index].port ) = kDirGpio [port_index].pin ;
13711371 } else if (port_direction == dmx::Direction::kInput ) {
13721372 GPIO_BC (kDirGpio [port_index].port ) = kDirGpio [port_index].pin ;
1373- } else [[unlikely]] {
1374- assert (false );
1373+ } else [[unlikely]] {
1374+ assert (false && " Invalid direction " );
13751375 }
13761376 } else if (!enable_data) {
13771377 DataDisable (port_index);
@@ -1382,7 +1382,7 @@ void Dmx::SetPortDirection(uint32_t port_index, dmx::Direction port_direction, b
13821382 }
13831383}
13841384
1385- template <uint32_t port_index, dmx::Direction port_direction, bool enable_data>
1385+ template <uint32_t port_index, dmx::Direction port_direction, bool enable_data>
13861386void Dmx::SetPortDirection () {
13871387 DMX_CHECK_PORT_INDEX_VOID (port_index);
13881388
@@ -1396,7 +1396,7 @@ void Dmx::SetPortDirection() {
13961396 } else if constexpr (port_direction == dmx::Direction::kInput ) {
13971397 GPIO_BC (kDirGpio [port_index].port ) = kDirGpio [port_index].pin ;
13981398 } else {
1399- static_assert (false );
1399+ static_assert (false , " Invalid direction " );
14001400 }
14011401 } else if constexpr (!enable_data) {
14021402 DataDisable (port_index);
@@ -1437,7 +1437,7 @@ void Dmx::DataEnable(uint32_t port_index) {
14371437 return ;
14381438 }
14391439
1440- assert (false );
1440+ assert (false && " Not reachable " );
14411441}
14421442
14431443void Dmx::DataDisable (uint32_t port_index) {
@@ -1473,7 +1473,7 @@ void Dmx::DataDisable(uint32_t port_index) {
14731473 return ;
14741474 }
14751475
1476- assert (false );
1476+ assert (false && " Not reachable " );
14771477}
14781478
14791479void Dmx::ClearData (uint32_t port_index) {
@@ -1530,7 +1530,7 @@ void Dmx::FullOn() {
15301530}
15311531
15321532// DMX Send
1533- template <uint32_t portIndex, bool hasStartCode, dmx::SendStyle dmxSendStyle>
1533+ template <uint32_t portIndex, bool hasStartCode, dmx::SendStyle dmxSendStyle>
15341534void Dmx::SetSendDataInternal (const uint8_t * data, uint32_t length) {
15351535 DMX_CHECK_PORT_INDEX_VOID (portIndex);
15361536
@@ -1570,14 +1570,14 @@ void Dmx::SetSendDataInternal(const uint8_t* data, uint32_t length) {
15701570
15711571void Dmx::StartSendStyleDirect (uint32_t port_index) {
15721572 DMX_CHECK_PORT_INDEX_VOID (port_index);
1573-
1573+
15741574 if ((sv_port_state[port_index] == dmx::PortState::kTx ) && (s_DmxTxBuffer[port_index].output_style == dmx::OutputStyle::kDelta ) && (s_DmxTxBuffer[port_index].state == dmx::TxRxState::kIdle )) {
15751575 StartDmxOutput (port_index);
15761576 }
15771577}
15781578
15791579template <uint32_t port_index, uint32_t nUart>
1580- static void StartDmxOutputBreak () {
1580+ void StartDmxOutputBreak () {
15811581 // USART_FLAG_TC is set after power on.
15821582 // The flag is cleared by DMA interrupt when maximum slots - 1 are transmitted.
15831583 // TODO(a): Do we need a timeout just to be safe?
@@ -1659,16 +1659,16 @@ static void StartDmxOutputBreak() {
16591659 break ;
16601660#endif // defined(DMX_USE_UART7)
16611661 default :
1662- [[unlikely]] assert (false );
1662+ [[unlikely]] assert (false && " switch " );
16631663
16641664 break ;
16651665 }
16661666
1667- assert (false );
1667+ assert (false && " Not reachable " );
16681668}
16691669
1670- template <uint32_t portIndex>
1671- static void StartDmxOutputPort () {
1670+ template <uint32_t portIndex>
1671+ void StartDmxOutputPort () {
16721672 if constexpr (portIndex < dmx::config::max::kPorts ) {
16731673 StartDmxOutputBreak<portIndex, DmxPortToUart (portIndex)>();
16741674 }
@@ -1751,17 +1751,17 @@ void Dmx::RdmTransmit(uint32_t port_index, const uint8_t* data, uint32_t length)
17511751 RDM_HANDLE_SEND_CASE (7 );
17521752#endif
17531753 default :
1754- [[unlikely]] assert (false );
1754+ [[unlikely]] assert (false && " switch " );
17551755 return ;
17561756 }
17571757}
17581758
1759- template <uint32_t portIndex>
1759+ template <uint32_t portIndex>
17601760void Dmx::RdmSendDataInternal (const uint8_t * data, uint32_t length) {
17611761 DMX_CHECK_PORT_INDEX_VOID (portIndex);
17621762 assert (data != nullptr );
17631763 assert (length <= sizeof (TRdmMessage));
1764-
1764+
17651765 SetPortDirection<portIndex, dmx::Direction::kOutput , false >();
17661766
17671767 auto & tx_buffer = s_RdmTxBuffer[portIndex];
@@ -1775,8 +1775,8 @@ void Dmx::RdmSendDataInternal(const uint8_t* data, uint32_t length) {
17751775 StartRdmOutput (portIndex);
17761776}
17771777
1778- template <uint32_t port_index, uint32_t uart>
1779- static void StartRdmOutput () {
1778+ template <uint32_t port_index, uint32_t uart>
1779+ void StartRdmOutput () {
17801780 DEBUG_PRINTF (" port_index=%u, uart=%p" , port_index, reinterpret_cast <void *>(uart));
17811781 // USART_FLAG_TC is set after power on.
17821782 // The flag is cleared by DMA interrupt when maximum slots - 1 are transmitted.
@@ -1866,15 +1866,15 @@ static void StartRdmOutput() {
18661866#endif // defined(DMX_USE_UART7)
18671867
18681868 default :
1869- [[unlikely]] assert (false );
1869+ [[unlikely]] assert (false && " switch " );
18701870 break ;
18711871 }
18721872
1873- assert (false );
1873+ assert (false && " Not reachable " );
18741874}
18751875
1876- template <uint32_t portIndex>
1877- static void StartRdmOutputPort () {
1876+ template <uint32_t portIndex>
1877+ void StartRdmOutputPort () {
18781878 if constexpr (portIndex < dmx::config::max::kPorts ) {
18791879 StartRdmOutput<portIndex, DmxPortToUart (portIndex)>();
18801880 }
0 commit comments