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 {
|
||||
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.*/
|
||||
|
|
|
@ -361,13 +361,6 @@ msg_t sio_lld_start(SIODriver *siop) {
|
|||
else {
|
||||
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.*/
|
||||
|
|
|
@ -403,13 +403,6 @@ msg_t sio_lld_start(SIODriver *siop) {
|
|||
else {
|
||||
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.*/
|
||||
|
|
|
@ -63,6 +63,20 @@ static const SIOConfig default_config = {
|
|||
/* 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. */
|
||||
/*===========================================================================*/
|
||||
|
@ -116,6 +130,7 @@ void sio_lld_init(void) {
|
|||
* @notapi
|
||||
*/
|
||||
msg_t sio_lld_start(SIODriver *siop) {
|
||||
msg_t msg = HAL_RET_SUCCESS;
|
||||
|
||||
/* Using the default configuration if the application passed a
|
||||
NULL pointer.*/
|
||||
|
@ -130,25 +145,22 @@ msg_t sio_lld_start(SIODriver *siop) {
|
|||
}
|
||||
#if SB_SIO_USE_VUART1 == TRUE
|
||||
else if (&SIOD1 == siop) {
|
||||
msg = (msg_t)__sio_vuart_init(siop->nvuart, siop->config->ncfg);
|
||||
}
|
||||
#endif
|
||||
#if SB_SIO_USE_VUART2 == TRUE
|
||||
else if (&SIOD2 == siop) {
|
||||
msg = (msg_t)__sio_vuart_init(siop->nvuart, siop->config->ncfg);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
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) {
|
||||
|
||||
if (siop->state == SIO_READY) {
|
||||
/* Resets the peripheral.*/
|
||||
|
||||
/* Disables the peripheral.*/
|
||||
if (false) {
|
||||
}
|
||||
#if SB_SIO_USE_VUART1 == TRUE
|
||||
else if (&SIOD1 == siop) {
|
||||
(void) __sio_vuart_deinit(siop->nvuart);
|
||||
}
|
||||
#endif
|
||||
#if SB_SIO_USE_VUART2 == TRUE
|
||||
else if (&SIOD2 == siop) {
|
||||
(void) __sio_vuart_deinit(siop->nvuart);
|
||||
}
|
||||
#endif
|
||||
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.
|
||||
*
|
||||
|
@ -212,7 +200,7 @@ void sio_lld_stop_operation(SIODriver *siop) {
|
|||
void sio_lld_update_enable_flags(SIODriver *siop) {
|
||||
|
||||
(void)siop;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get and clears SIO error event flags.
|
||||
|
@ -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
|
||||
*
|
||||
|
|
|
@ -92,11 +92,6 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
@ -121,11 +116,11 @@ typedef uint32_t sio_events_mask_t;
|
|||
*
|
||||
* @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.
|
||||
*(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.
|
||||
|
@ -133,7 +128,7 @@ typedef uint32_t sio_events_mask_t;
|
|||
*
|
||||
* @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.
|
||||
|
@ -159,7 +154,7 @@ typedef uint32_t sio_events_mask_t;
|
|||
*
|
||||
* @notapi
|
||||
*/
|
||||
#define sio_lld_is_tx_full(siop) true
|
||||
#define sio_lld_is_tx_full(siop) false
|
||||
|
||||
/**
|
||||
* @brief Determines the transmission state.
|
||||
|
@ -171,7 +166,7 @@ typedef uint32_t sio_events_mask_t;
|
|||
*
|
||||
* @notapi
|
||||
*/
|
||||
#define sio_lld_is_tx_ongoing(siop) true
|
||||
#define sio_lld_is_tx_ongoing(siop) false
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
|
@ -191,8 +186,6 @@ extern "C" {
|
|||
void sio_lld_init(void);
|
||||
msg_t sio_lld_start(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);
|
||||
sioevents_t sio_lld_get_and_clear_errors(SIODriver *siop);
|
||||
sioevents_t sio_lld_get_and_clear_events(SIODriver *siop);
|
||||
|
|
Loading…
Reference in New Issue