diff --git a/os/hal/include/hal_uart.h b/os/hal/include/hal_uart.h index a07464993..ec5fc0908 100644 --- a/os/hal/include/hal_uart.h +++ b/os/hal/include/hal_uart.h @@ -392,7 +392,7 @@ extern "C" { #endif void uartInit(void); void uartObjectInit(UARTDriver *uartp); - void uartStart(UARTDriver *uartp, const UARTConfig *config); + msg_t uartStart(UARTDriver *uartp, const UARTConfig *config); void uartStop(UARTDriver *uartp); void uartStartSend(UARTDriver *uartp, size_t n, const void *txbuf); void uartStartSendI(UARTDriver *uartp, size_t n, const void *txbuf); diff --git a/os/hal/src/hal_uart.c b/os/hal/src/hal_uart.c index 42455bd67..09d572722 100644 --- a/os/hal/src/hal_uart.c +++ b/os/hal/src/hal_uart.c @@ -94,7 +94,8 @@ void uartObjectInit(UARTDriver *uartp) { * * @api */ -void uartStart(UARTDriver *uartp, const UARTConfig *config) { +msg_t uartStart(UARTDriver *uartp, const UARTConfig *config) { + msg_t msg; osalDbgCheck((uartp != NULL) && (config != NULL)); @@ -103,9 +104,18 @@ void uartStart(UARTDriver *uartp, const UARTConfig *config) { "invalid state"); uartp->config = config; + +#if defined(UART_LLD_ENHANCED_API) + msg = uart_lld_start(uartp); +#else uart_lld_start(uartp); + msg = HAL_START_SUCCESS; +#endif + uartp->state = UART_READY; osalSysUnlock(); + + return msg; } /**