From 322ee855c5e2566bcaadb9afa33ee324d78ca4ed Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 10 Aug 2022 08:03:42 +0000 Subject: [PATCH] Fixed regressions caused by SIO changes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15717 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/hal/ports/sandbox/hal_sio_lld.c | 40 ++++++++++++++++++++++++------ os/hal/ports/sandbox/hal_sio_lld.h | 32 ++++++++++++++++++++++-- os/sb/vio/sbvio_uart.c | 35 +++----------------------- 3 files changed, 66 insertions(+), 41 deletions(-) diff --git a/os/hal/ports/sandbox/hal_sio_lld.c b/os/hal/ports/sandbox/hal_sio_lld.c index a46a2f139..52a930cd6 100644 --- a/os/hal/ports/sandbox/hal_sio_lld.c +++ b/os/hal/ports/sandbox/hal_sio_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2021 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -137,7 +137,7 @@ msg_t sio_lld_start(SIODriver *siop) { } #endif else { - osalDbgAssert(false, "invalid USART instance"); + osalDbgAssert(false, "invalid SIO instance"); } /* Driver object low level initializations.*/ @@ -175,7 +175,7 @@ void sio_lld_stop(SIODriver *siop) { } #endif else { - osalDbgAssert(false, "invalid USART instance"); + osalDbgAssert(false, "invalid SIO instance"); } } } @@ -205,19 +205,45 @@ void sio_lld_stop_operation(SIODriver *siop) { } /** - * @brief Return the pending SIO events flags. + * @brief Enable flags change notification. + * + * @param[in] siop pointer to the @p SIODriver object + */ +void sio_lld_update_enable_flags(SIODriver *siop) { + + (void)siop; +} + +/** + * @brief Get and clears SIO error event flags. * * @param[in] siop pointer to the @p SIODriver object * @return The pending event flags. * * @notapi */ -sio_events_mask_t sio_lld_get_and_clear_events(SIODriver *siop) { - sio_events_mask_t evtmask = 0U; +sioevents_t sio_lld_get_and_clear_errors(SIODriver *siop) { + sioevents_t errors = (sioevents_t)0; (void)siop; - return evtmask; + return errors; +} + +/** + * @brief Get and clears SIO event flags. + * + * @param[in] siop pointer to the @p SIODriver object + * @return The pending event flags. + * + * @notapi + */ +sioevents_t sio_lld_get_and_clear_events(SIODriver *siop) { + sioevents_t events = (sioevents_t)0; + + (void)siop; + + return events; } /** diff --git a/os/hal/ports/sandbox/hal_sio_lld.h b/os/hal/ports/sandbox/hal_sio_lld.h index 65f99cca9..bb3d3611b 100644 --- a/os/hal/ports/sandbox/hal_sio_lld.h +++ b/os/hal/ports/sandbox/hal_sio_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2021 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -123,6 +123,32 @@ typedef uint32_t sio_events_mask_t; */ #define sio_lld_is_rx_empty(siop) true +/** + * @brief Determines the activity state of the receiver. + *(bool)(((siop)->uart->UARTFR & UART_UARTFR_RXFE) != 0U) + * @param[in] siop pointer to the @p SIODriver object + * @return The RX activity state. + * @retval false if RX is in active state. + * @retval true if RX is in idle state. + * + * @notapi + */ +#define sio_lld_is_rx_idle(siop) true + +/** + * @brief Determines if RX has pending error events to be read and cleared. + * @note Only error and protocol errors are handled, data events are not + * considered. + * + * @param[in] siop pointer to the @p SIODriver object + * @return The RX error events. + * @retval false if RX has no pending events + * @retval true if RX has pending events + * + * @notapi + */ +#define sio_lld_has_rx_errors(siop) false + /** * @brief Determines the state of the TX FIFO. * @@ -167,7 +193,9 @@ extern "C" { void sio_lld_stop(SIODriver *siop); void sio_lld_start_operation(SIODriver *siop); void sio_lld_stop_operation(SIODriver *siop); - sio_events_mask_t sio_lld_get_and_clear_events(SIODriver *siop); + void sio_lld_update_enable_flags(SIODriver *siop); + sioevents_t sio_lld_get_and_clear_errors(SIODriver *siop); + sioevents_t sio_lld_get_and_clear_events(SIODriver *siop); size_t sio_lld_read(SIODriver *siop, uint8_t *buffer, size_t n); size_t sio_lld_write(SIODriver *siop, const uint8_t *buffer, size_t n); msg_t sio_lld_get(SIODriver *siop); diff --git a/os/sb/vio/sbvio_uart.c b/os/sb/vio/sbvio_uart.c index d0599abc7..c7b166252 100644 --- a/os/sb/vio/sbvio_uart.c +++ b/os/sb/vio/sbvio_uart.c @@ -45,45 +45,16 @@ /* Module local variables. */ /*===========================================================================*/ -static void vuart_rx_cb(SIODriver *siop); -static void vuart_rx_idle_cb(SIODriver *siop); -static void vuart_tx_cb(SIODriver *siop); -static void vuart_tx_end_cb(SIODriver *siop); -static void vuart_rx_evt_cb(SIODriver *siop); - +static void vuart_cb(SIODriver *siop); static const SIOOperation vuart_operation = { - .rx_cb = vuart_rx_cb, - .rx_idle_cb = vuart_rx_idle_cb, - .tx_cb = vuart_tx_cb, - .tx_end_cb = vuart_tx_end_cb, - .rx_evt_cb = vuart_rx_evt_cb + .cb = vuart_cb }; /*===========================================================================*/ /* Module local functions. */ /*===========================================================================*/ -static void vuart_rx_cb(SIODriver *siop) { - - (void)siop; -} - -static void vuart_rx_idle_cb(SIODriver *siop) { - - (void)siop; -} - -static void vuart_tx_cb(SIODriver *siop) { - - (void)siop; -} - -static void vuart_tx_end_cb(SIODriver *siop) { - - (void)siop; -} - -static void vuart_rx_evt_cb(SIODriver *siop) { +static void vuart_cb(SIODriver *siop) { (void)siop; }