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
121#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
129#define _uart_wakeup_tx1_isr(uartp) { \
130 if ((uartp)->early == true) { \
131 osalSysLockFromISR(); \
132 osalThreadResumeI(&(uartp)->threadtx, MSG_OK); \
133 osalSysUnlockFromISR(); \
137#define _uart_wakeup_tx1_isr(uartp)
140#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
148#define _uart_wakeup_tx2_isr(uartp) { \
149 if ((uartp)->early == false) { \
150 osalSysLockFromISR(); \
151 osalThreadResumeI(&(uartp)->threadtx, MSG_OK); \
152 osalSysUnlockFromISR(); \
156#define _uart_wakeup_tx2_isr(uartp)
159#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
167#define _uart_wakeup_rx_complete_isr(uartp) { \
168 osalSysLockFromISR(); \
169 osalThreadResumeI(&(uartp)->threadrx, MSG_OK); \
170 osalSysUnlockFromISR(); \
173#define _uart_wakeup_rx_complete_isr(uartp)
176#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
184#define _uart_wakeup_rx_error_isr(uartp) { \
185 osalSysLockFromISR(); \
186 osalThreadResumeI(&(uartp)->threadrx, MSG_RESET); \
187 osalSysUnlockFromISR(); \
190#define _uart_wakeup_rx_error_isr(uartp)
193#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
201#define _uart_wakeup_rx_cm_isr(uartp) { \
202 osalSysLockFromISR(); \
203 osalThreadResumeI(&(uartp)->threadrx, MSG_TIMEOUT); \
204 osalSysUnlockFromISR(); \
207#define _uart_wakeup_rx_cm_isr(uartp)
210#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
218#define _uart_wakeup_rx_timeout_isr(uartp) { \
219 osalSysLockFromISR(); \
220 osalThreadResumeI(&(uartp)->threadrx, MSG_TIMEOUT); \
221 osalSysUnlockFromISR(); \
224#define _uart_wakeup_rx_timeout_isr(uartp)
241#define _uart_tx1_isr_code(uartp) { \
242 (uartp)->txstate = UART_TX_IDLE; \
243 if ((uartp)->config->txend1_cb != NULL) { \
244 (uartp)->config->txend1_cb(uartp); \
246 _uart_wakeup_tx1_isr(uartp); \
263#define _uart_tx2_isr_code(uartp) { \
264 if ((uartp)->config->txend2_cb != NULL) { \
265 (uartp)->config->txend2_cb(uartp); \
267 _uart_wakeup_tx2_isr(uartp); \
284#define _uart_rx_complete_isr_code(uartp) { \
285 (uartp)->rxstate = UART_RX_IDLE; \
286 uart_enter_rx_idle_loop(uartp); \
287 if ((uartp)->config->rxend_cb != NULL) { \
288 (uartp)->config->rxend_cb(uartp); \
290 _uart_wakeup_rx_complete_isr(uartp); \
308#define _uart_rx_error_isr_code(uartp, errors) { \
309 if ((uartp)->config->rxerr_cb != NULL) { \
310 (uartp)->config->rxerr_cb(uartp, errors); \
312 _uart_wakeup_rx_error_isr(uartp); \
329#define _uart_rx_idle_code(uartp) { \
330 if ((uartp)->config->rxchar_cb != NULL) \
331 (uartp)->config->rxchar_cb(uartp, (uartp)->rxbuf); \
348#define _uart_timeout_isr_code(uartp) { \
349 if ((uartp)->config->timeout_cb != NULL) { \
350 (uartp)->config->timeout_cb(uartp); \
352 _uart_wakeup_rx_timeout_isr(uartp); \
369#define _uart_rx_char_match_isr_code(uartp) { \
370 if ((uartp)->config->rx_cm_cb != NULL) { \
371 (uartp)->config->rx_cm_cb(uartp); \
373 _uart_wakeup_rx_cm_isr(uartp); \
397#if UART_USE_WAIT == TRUE
405#if UART_USE_MUTUAL_EXCLUSION == TRUE
struct hal_uart_config UARTConfig
Driver configuration structure.
void uartInit(void)
UART Driver initialization.
void uartStartSend(UARTDriver *uartp, size_t n, const void *txbuf)
Starts a transmission on the UART peripheral.
void uartStartSendI(UARTDriver *uartp, size_t n, const void *txbuf)
Starts a transmission on the UART peripheral.
void uartObjectInit(UARTDriver *uartp)
Initializes the standard part of a UARTDriver structure.
uartstate_t
Driver state machine possible states.
uartrxstate_t
Receiver state machine states.
uarttxstate_t
Transmitter state machine states.
void uartAcquireBus(UARTDriver *uartp)
Gains exclusive access to the UART bus.
msg_t uartStart(UARTDriver *uartp, const UARTConfig *config)
Configures and activates the UART peripheral.
void uartStartReceiveI(UARTDriver *uartp, size_t n, void *rxbuf)
Starts a receive operation on the UART peripheral.
msg_t uartReceiveTimeout(UARTDriver *uartp, size_t *np, void *rxbuf, sysinterval_t timeout)
Performs a receive operation on the UART peripheral.
void uartReleaseBus(UARTDriver *uartp)
Releases exclusive access to the UART bus.
msg_t uartSendFullTimeout(UARTDriver *uartp, size_t *np, const void *txbuf, sysinterval_t timeout)
Performs a transmission on the UART peripheral.
void uartStop(UARTDriver *uartp)
Deactivates the UART peripheral.
void uartStartReceive(UARTDriver *uartp, size_t n, void *rxbuf)
Starts a receive operation on the UART peripheral.
size_t uartStopSend(UARTDriver *uartp)
Stops any ongoing transmission.
size_t uartStopReceive(UARTDriver *uartp)
Stops any ongoing receive operation.
size_t uartStopSendI(UARTDriver *uartp)
Stops any ongoing transmission.
size_t uartStopReceiveI(UARTDriver *uartp)
Stops any ongoing receive operation.
msg_t uartSendTimeout(UARTDriver *uartp, size_t *np, const void *txbuf, sysinterval_t timeout)
Performs a transmission on the UART peripheral.
struct hal_uart_driver UARTDriver
Type of structure representing an UART driver.
uint64_t sysinterval_t
Type of time interval.
PLATFORM UART subsystem low level driver header.