Fixed some redundant code.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15735 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
69e0b44070
commit
fe01e7759f
|
@ -197,13 +197,6 @@ msg_t sio_lld_start(SIODriver *siop) {
|
||||||
else {
|
else {
|
||||||
osalDbgAssert(false, "invalid SIO instance");
|
osalDbgAssert(false, "invalid SIO instance");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Driver object low level initializations.*/
|
|
||||||
#if SIO_USE_SYNCHRONIZATION
|
|
||||||
siop->sync_rx = NULL;
|
|
||||||
siop->sync_tx = NULL;
|
|
||||||
siop->sync_txend = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configures the peripheral.*/
|
/* Configures the peripheral.*/
|
||||||
|
|
|
@ -361,13 +361,6 @@ msg_t sio_lld_start(SIODriver *siop) {
|
||||||
else {
|
else {
|
||||||
osalDbgAssert(false, "invalid SIO instance");
|
osalDbgAssert(false, "invalid SIO instance");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Driver object low level initializations.*/
|
|
||||||
#if SIO_USE_SYNCHRONIZATION
|
|
||||||
siop->sync_rx = NULL;
|
|
||||||
siop->sync_tx = NULL;
|
|
||||||
siop->sync_txend = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configures the peripheral.*/
|
/* Configures the peripheral.*/
|
||||||
|
|
|
@ -403,13 +403,6 @@ msg_t sio_lld_start(SIODriver *siop) {
|
||||||
else {
|
else {
|
||||||
osalDbgAssert(false, "invalid SIO instance");
|
osalDbgAssert(false, "invalid SIO instance");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Driver object low level initializations.*/
|
|
||||||
#if SIO_USE_SYNCHRONIZATION
|
|
||||||
siop->sync_rx = NULL;
|
|
||||||
siop->sync_tx = NULL;
|
|
||||||
siop->sync_txend = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configures the peripheral.*/
|
/* Configures the peripheral.*/
|
||||||
|
|
|
@ -63,6 +63,20 @@ static const SIOConfig default_config = {
|
||||||
/* Driver local functions. */
|
/* Driver local functions. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
__attribute__((always_inline))
|
||||||
|
static inline uint32_t __sio_vuart_init(uint32_t nvuart, uint32_t ncfg) {
|
||||||
|
|
||||||
|
__syscall3r(201, SB_VUART_INIT, nvuart, ncfg);
|
||||||
|
return (uint32_t)r0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((always_inline))
|
||||||
|
static inline uint32_t __sio_vuart_deinit(uint32_t nvuart) {
|
||||||
|
|
||||||
|
__syscall2r(201, SB_VUART_INIT, nvuart);
|
||||||
|
return (uint32_t)r0;
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver interrupt handlers. */
|
/* Driver interrupt handlers. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -116,6 +130,7 @@ void sio_lld_init(void) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
msg_t sio_lld_start(SIODriver *siop) {
|
msg_t sio_lld_start(SIODriver *siop) {
|
||||||
|
msg_t msg = HAL_RET_SUCCESS;
|
||||||
|
|
||||||
/* Using the default configuration if the application passed a
|
/* Using the default configuration if the application passed a
|
||||||
NULL pointer.*/
|
NULL pointer.*/
|
||||||
|
@ -130,25 +145,22 @@ msg_t sio_lld_start(SIODriver *siop) {
|
||||||
}
|
}
|
||||||
#if SB_SIO_USE_VUART1 == TRUE
|
#if SB_SIO_USE_VUART1 == TRUE
|
||||||
else if (&SIOD1 == siop) {
|
else if (&SIOD1 == siop) {
|
||||||
|
msg = (msg_t)__sio_vuart_init(siop->nvuart, siop->config->ncfg);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if SB_SIO_USE_VUART2 == TRUE
|
#if SB_SIO_USE_VUART2 == TRUE
|
||||||
else if (&SIOD2 == siop) {
|
else if (&SIOD2 == siop) {
|
||||||
|
msg = (msg_t)__sio_vuart_init(siop->nvuart, siop->config->ncfg);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
osalDbgAssert(false, "invalid SIO instance");
|
osalDbgAssert(false, "invalid SIO instance");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Driver object low level initializations.*/
|
|
||||||
#if SIO_USE_SYNCHRONIZATION
|
|
||||||
siop->sync_rx = NULL;
|
|
||||||
siop->sync_tx = NULL;
|
|
||||||
siop->sync_txend = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return HAL_RET_SUCCESS;
|
/* Configures the peripheral.*/
|
||||||
|
|
||||||
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,17 +173,17 @@ msg_t sio_lld_start(SIODriver *siop) {
|
||||||
void sio_lld_stop(SIODriver *siop) {
|
void sio_lld_stop(SIODriver *siop) {
|
||||||
|
|
||||||
if (siop->state == SIO_READY) {
|
if (siop->state == SIO_READY) {
|
||||||
/* Resets the peripheral.*/
|
|
||||||
|
|
||||||
/* Disables the peripheral.*/
|
/* Disables the peripheral.*/
|
||||||
if (false) {
|
if (false) {
|
||||||
}
|
}
|
||||||
#if SB_SIO_USE_VUART1 == TRUE
|
#if SB_SIO_USE_VUART1 == TRUE
|
||||||
else if (&SIOD1 == siop) {
|
else if (&SIOD1 == siop) {
|
||||||
|
(void) __sio_vuart_deinit(siop->nvuart);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if SB_SIO_USE_VUART2 == TRUE
|
#if SB_SIO_USE_VUART2 == TRUE
|
||||||
else if (&SIOD2 == siop) {
|
else if (&SIOD2 == siop) {
|
||||||
|
(void) __sio_vuart_deinit(siop->nvuart);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
|
@ -180,30 +192,6 @@ void sio_lld_stop(SIODriver *siop) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Starts a SIO operation.
|
|
||||||
*
|
|
||||||
* @param[in] siop pointer to an @p SIODriver structure
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
void sio_lld_start_operation(SIODriver *siop) {
|
|
||||||
|
|
||||||
(void)siop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stops an ongoing SIO operation, if any.
|
|
||||||
*
|
|
||||||
* @param[in] siop pointer to an @p SIODriver structure
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
void sio_lld_stop_operation(SIODriver *siop) {
|
|
||||||
|
|
||||||
(void)siop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable flags change notification.
|
* @brief Enable flags change notification.
|
||||||
*
|
*
|
||||||
|
@ -344,7 +332,7 @@ msg_t sio_lld_control(SIODriver *siop, unsigned int operation, void *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Serves an USART interrupt.
|
* @brief Serves an VUART interrupt.
|
||||||
*
|
*
|
||||||
* @param[in] siop pointer to the @p SIODriver object
|
* @param[in] siop pointer to the @p SIODriver object
|
||||||
*
|
*
|
||||||
|
|
|
@ -92,11 +92,6 @@
|
||||||
/* Driver macros. */
|
/* Driver macros. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Type of a SIO events mask.
|
|
||||||
*/
|
|
||||||
typedef uint32_t sio_events_mask_t;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Low level fields of the SIO driver structure.
|
* @brief Low level fields of the SIO driver structure.
|
||||||
*/
|
*/
|
||||||
|
@ -121,11 +116,11 @@ typedef uint32_t sio_events_mask_t;
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
#define sio_lld_is_rx_empty(siop) true
|
#define sio_lld_is_rx_empty(siop) false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Determines the activity state of the receiver.
|
* @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
|
* @param[in] siop pointer to the @p SIODriver object
|
||||||
* @return The RX activity state.
|
* @return The RX activity state.
|
||||||
* @retval false if RX is in active state.
|
* @retval false if RX is in active state.
|
||||||
|
@ -133,7 +128,7 @@ typedef uint32_t sio_events_mask_t;
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
#define sio_lld_is_rx_idle(siop) true
|
#define sio_lld_is_rx_idle(siop) false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Determines if RX has pending error events to be read and cleared.
|
* @brief Determines if RX has pending error events to be read and cleared.
|
||||||
|
@ -159,7 +154,7 @@ typedef uint32_t sio_events_mask_t;
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
#define sio_lld_is_tx_full(siop) true
|
#define sio_lld_is_tx_full(siop) false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Determines the transmission state.
|
* @brief Determines the transmission state.
|
||||||
|
@ -171,7 +166,7 @@ typedef uint32_t sio_events_mask_t;
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
#define sio_lld_is_tx_ongoing(siop) true
|
#define sio_lld_is_tx_ongoing(siop) false
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* External declarations. */
|
/* External declarations. */
|
||||||
|
@ -191,8 +186,6 @@ extern "C" {
|
||||||
void sio_lld_init(void);
|
void sio_lld_init(void);
|
||||||
msg_t sio_lld_start(SIODriver *siop);
|
msg_t sio_lld_start(SIODriver *siop);
|
||||||
void sio_lld_stop(SIODriver *siop);
|
void sio_lld_stop(SIODriver *siop);
|
||||||
void sio_lld_start_operation(SIODriver *siop);
|
|
||||||
void sio_lld_stop_operation(SIODriver *siop);
|
|
||||||
void sio_lld_update_enable_flags(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_errors(SIODriver *siop);
|
||||||
sioevents_t sio_lld_get_and_clear_events(SIODriver *siop);
|
sioevents_t sio_lld_get_and_clear_events(SIODriver *siop);
|
||||||
|
|
Loading…
Reference in New Issue