diff --git a/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c b/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c index 68a404b8cd3..61b0c723aab 100644 --- a/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c +++ b/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c @@ -84,13 +84,12 @@ static struct { /*************************************************************************************************/ void UART_CommonHandler(mxc_uart_regs_t *uart) { - int32_t err = MXC_UART_AsyncHandler(uart); + const int32_t err = MXC_UART_AsyncHandler(uart); if(err == E_INVALID) { // If the uart is the console, we can try to recover since it is not critical - uint8_t uartIdx = MXC_UART_GET_IDX(uart); - if(uartIdx == CONSOLE_UART) + if(MXC_UART_GET_IDX(uart) == CONSOLE_UART) { MXC_UART_ClearRXFIFO(uart); } @@ -99,11 +98,14 @@ void UART_CommonHandler(mxc_uart_regs_t *uart) PAL_SYS_ASSERT(err == E_NO_ERROR); } } + } void UART0_IRQHandler(void) { + PalLedOn(PAL_LED_ID_CPU_ACTIVE); UART_CommonHandler(MXC_UART0); + } void UART1_IRQHandler(void) { @@ -113,7 +115,7 @@ void UART1_IRQHandler(void) } void UART2_IRQHandler(void) -{ +{ PalLedOn(PAL_LED_ID_CPU_ACTIVE); UART_CommonHandler(MXC_UART2); @@ -121,7 +123,7 @@ void UART2_IRQHandler(void) } void UART3_IRQHandler(void) { - + PalLedOn(PAL_LED_ID_CPU_ACTIVE); UART_CommonHandler(MXC_UART3); diff --git a/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c b/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c index 1335481b843..139a4262fb3 100644 --- a/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c +++ b/Libraries/Cordio/platform/targets/maxim/max32690/sources/pal_uart.c @@ -82,37 +82,51 @@ static struct { * \return None. */ /*************************************************************************************************/ +void UART_CommonHandler(mxc_uart_regs_t *uart) +{ + const int32_t err = MXC_UART_AsyncHandler(uart); + + if(err == E_INVALID) + { + // If the uart is the console, we can try to recover since it is not critical + if(MXC_UART_GET_IDX(uart) == CONSOLE_UART) + { + MXC_UART_ClearRXFIFO(uart); + } + else + { + PAL_SYS_ASSERT(err == E_NO_ERROR); + } + } + +} void UART0_IRQHandler(void) { - int result0; + PalLedOn(PAL_LED_ID_CPU_ACTIVE); - result0 = MXC_UART_AsyncHandler(MXC_UART0); - (void)result0; - PAL_SYS_ASSERT(result0 == 0); + UART_CommonHandler(MXC_UART0); + } void UART1_IRQHandler(void) { - int result1; + PalLedOn(PAL_LED_ID_CPU_ACTIVE); - result1 = MXC_UART_AsyncHandler(MXC_UART1); - (void)result1; - PAL_SYS_ASSERT(result1 == 0); + UART_CommonHandler(MXC_UART1); + } void UART2_IRQHandler(void) { - int result2; + PalLedOn(PAL_LED_ID_CPU_ACTIVE); - result2 = MXC_UART_AsyncHandler(MXC_UART2); - (void)result2; - PAL_SYS_ASSERT(result2 == 0); + UART_CommonHandler(MXC_UART2); + } void UART3_IRQHandler(void) { - int result3; + PalLedOn(PAL_LED_ID_CPU_ACTIVE); - result3 = MXC_UART_AsyncHandler(MXC_UART3); - (void)result3; - PAL_SYS_ASSERT(result3 == 0); + UART_CommonHandler(MXC_UART3); + } /*************************************************************************************************/