28 #if (HAL_USE_UART == TRUE) || defined(__DOXYGEN__) 38 #define UART_NO_ERROR 0 39 #define UART_PARITY_ERROR 4 40 #define UART_FRAMING_ERROR 8 41 #define UART_OVERRUN_ERROR 16 42 #define UART_NOISE_ERROR 32 43 #define UART_BREAK_DETECTED 64 50 #define UART_ERR_NOT_ACTIVE (size_t)-1 65 #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) 66 #define UART_USE_WAIT FALSE 73 #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) 74 #define UART_USE_MUTUAL_EXCLUSION FALSE 123 #if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__) 131 #define _uart_wakeup_tx1_isr(uartp) { \ 132 if ((uartp)->early == true) { \ 133 osalSysLockFromISR(); \ 134 osalThreadResumeI(&(uartp)->threadtx, MSG_OK); \ 135 osalSysUnlockFromISR(); \ 139 #define _uart_wakeup_tx1_isr(uartp) 142 #if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__) 150 #define _uart_wakeup_tx2_isr(uartp) { \ 151 if ((uartp)->early == false) { \ 152 osalSysLockFromISR(); \ 153 osalThreadResumeI(&(uartp)->threadtx, MSG_OK); \ 154 osalSysUnlockFromISR(); \ 158 #define _uart_wakeup_tx2_isr(uartp) 161 #if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__) 169 #define _uart_wakeup_rx_complete_isr(uartp) { \ 170 osalSysLockFromISR(); \ 171 osalThreadResumeI(&(uartp)->threadrx, MSG_OK); \ 172 osalSysUnlockFromISR(); \ 175 #define _uart_wakeup_rx_complete_isr(uartp) 178 #if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__) 186 #define _uart_wakeup_rx_error_isr(uartp) { \ 187 osalSysLockFromISR(); \ 188 osalThreadResumeI(&(uartp)->threadrx, MSG_RESET); \ 189 osalSysUnlockFromISR(); \ 192 #define _uart_wakeup_rx_error_isr(uartp) 195 #if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__) 203 #define _uart_wakeup_rx_cm_isr(uartp) { \ 204 osalSysLockFromISR(); \ 205 osalThreadResumeI(&(uartp)->threadrx, MSG_TIMEOUT); \ 206 osalSysUnlockFromISR(); \ 209 #define _uart_wakeup_rx_cm_isr(uartp) 212 #if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__) 220 #define _uart_wakeup_rx_timeout_isr(uartp) { \ 221 osalSysLockFromISR(); \ 222 osalThreadResumeI(&(uartp)->threadrx, MSG_TIMEOUT); \ 223 osalSysUnlockFromISR(); \ 226 #define _uart_wakeup_rx_timeout_isr(uartp) 243 #define _uart_tx1_isr_code(uartp) { \ 244 (uartp)->txstate = UART_TX_COMPLETE; \ 245 if ((uartp)->config->txend1_cb != NULL) { \ 246 (uartp)->config->txend1_cb(uartp); \ 248 if ((uartp)->txstate == UART_TX_COMPLETE) { \ 249 (uartp)->txstate = UART_TX_IDLE; \ 251 _uart_wakeup_tx1_isr(uartp); \ 268 #define _uart_tx2_isr_code(uartp) { \ 269 if ((uartp)->config->txend2_cb != NULL) { \ 270 (uartp)->config->txend2_cb(uartp); \ 272 _uart_wakeup_tx2_isr(uartp); \ 289 #define _uart_rx_complete_isr_code(uartp) { \ 290 (uartp)->rxstate = UART_RX_COMPLETE; \ 291 if ((uartp)->config->rxend_cb != NULL) { \ 292 (uartp)->config->rxend_cb(uartp); \ 294 if ((uartp)->rxstate == UART_RX_COMPLETE) { \ 295 (uartp)->rxstate = UART_RX_IDLE; \ 296 uart_enter_rx_idle_loop(uartp); \ 298 _uart_wakeup_rx_complete_isr(uartp); \ 316 #define _uart_rx_error_isr_code(uartp, errors) { \ 317 if ((uartp)->config->rxerr_cb != NULL) { \ 318 (uartp)->config->rxerr_cb(uartp, errors); \ 320 _uart_wakeup_rx_error_isr(uartp); \ 337 #define _uart_rx_idle_code(uartp) { \ 338 if ((uartp)->config->rxchar_cb != NULL) \ 339 (uartp)->config->rxchar_cb(uartp, (uartp)->rxbuf); \ 356 #define _uart_timeout_isr_code(uartp) { \ 357 if ((uartp)->config->timeout_cb != NULL) { \ 358 (uartp)->config->timeout_cb(uartp); \ 360 _uart_wakeup_rx_timeout_isr(uartp); \ 377 #define _uart_rx_char_match_isr_code(uartp) { \ 378 if ((uartp)->config->rx_cm_cb != NULL) { \ 379 (uartp)->config->rx_cm_cb(uartp); \ 381 _uart_wakeup_rx_cm_isr(uartp); \ 405 #if UART_USE_WAIT == TRUE 413 #if UART_USE_MUTUAL_EXCLUSION == TRUE PLATFORM UART subsystem low level driver header.
void uartStartSend(UARTDriver *uartp, size_t n, const void *txbuf)
Starts a transmission on the UART peripheral.
size_t uartStopReceive(UARTDriver *uartp)
Stops any ongoing receive operation.
void uartInit(void)
UART Driver initialization.
size_t uartStopSendI(UARTDriver *uartp)
Stops any ongoing transmission.
void uartStop(UARTDriver *uartp)
Deactivates the UART peripheral.
msg_t uartSendTimeout(UARTDriver *uartp, size_t *np, const void *txbuf, sysinterval_t timeout)
Performs a transmission on the UART peripheral.
size_t uartStopReceiveI(UARTDriver *uartp)
Stops any ongoing receive operation.
uartstate_t
Driver state machine possible states.
size_t uartStopSend(UARTDriver *uartp)
Stops any ongoing transmission.
msg_t uartReceiveTimeout(UARTDriver *uartp, size_t *np, void *rxbuf, sysinterval_t timeout)
Performs a receive operation on the UART peripheral.
int32_t msg_t
Type of a message.
uarttxstate_t
Transmitter state machine states.
void uartStartSendI(UARTDriver *uartp, size_t n, const void *txbuf)
Starts a transmission on the UART peripheral.
void uartStartReceiveI(UARTDriver *uartp, size_t n, void *rxbuf)
Starts a receive operation on the UART peripheral.
void uartReleaseBus(UARTDriver *uartp)
Releases exclusive access to the UART bus.
void uartAcquireBus(UARTDriver *uartp)
Gains exclusive access to the UART bus.
void uartStartReceive(UARTDriver *uartp, size_t n, void *rxbuf)
Starts a receive operation on the UART peripheral.
uartrxstate_t
Receiver state machine states.
uint32_t sysinterval_t
Type of system time interval.
void uartStart(UARTDriver *uartp, const UARTConfig *config)
Configures and activates the UART peripheral.
Driver configuration structure.
void uartObjectInit(UARTDriver *uartp)
Initializes the standard part of a UARTDriver structure.
Structure representing an UART driver.
msg_t uartSendFullTimeout(UARTDriver *uartp, size_t *np, const void *txbuf, sysinterval_t timeout)
Performs a transmission on the UART peripheral.