ChibiOS/HAL 9.0.0
hal_uart.h File Reference

UART Driver macros and structures. More...

#include "hal_uart_lld.h"

Go to the source code of this file.

Macros

UART status flags
#define UART_NO_ERROR   0
 No pending conditions.
#define UART_PARITY_ERROR   4
 Parity error happened.
#define UART_FRAMING_ERROR   8
 Framing error happened.
#define UART_OVERRUN_ERROR   16
 Overflow happened.
#define UART_NOISE_ERROR   32
 Noise on the line.
#define UART_BREAK_DETECTED   64
 Break detected.
UART error conditions
#define UART_ERR_NOT_ACTIVE   (size_t)-1
UART configuration options
#define UART_USE_WAIT   FALSE
 Enables synchronous APIs.
#define UART_USE_MUTUAL_EXCLUSION   FALSE
 Enables the uartAcquireBus() and uartReleaseBus() APIs.
Low level driver helper macros
#define _uart_wakeup_tx1_isr(uartp)
 Wakes up the waiting thread in case of early TX complete.
#define _uart_wakeup_tx2_isr(uartp)
 Wakes up the waiting thread in case of late TX complete.
#define _uart_wakeup_rx_complete_isr(uartp)
 Wakes up the waiting thread in case of RX complete.
#define _uart_wakeup_rx_error_isr(uartp)
 Wakes up the waiting thread in case of RX error.
#define _uart_wakeup_rx_cm_isr(uartp)
 Wakes up the waiting thread in case of RX character match.
#define _uart_wakeup_rx_timeout_isr(uartp)
 Wakes up the waiting thread in case of RX timeout.
#define _uart_tx1_isr_code(uartp)
 Common ISR code for early TX.
#define _uart_tx2_isr_code(uartp)
 Common ISR code for late TX.
#define _uart_rx_complete_isr_code(uartp)
 Common ISR code for RX complete.
#define _uart_rx_error_isr_code(uartp, errors)
 Common ISR code for RX error.
#define _uart_rx_idle_code(uartp)
 Common ISR code for RX on idle.
#define _uart_timeout_isr_code(uartp)
 Timeout ISR code for receiver.
#define _uart_rx_char_match_isr_code(uartp)
 Character match ISR code for receiver.

Enumerations

enum  uartstate_t { UART_UNINIT = 0 , UART_STOP = 1 , UART_READY = 2 }
 Driver state machine possible states. More...
enum  uarttxstate_t { UART_TX_IDLE = 0 , UART_TX_ACTIVE = 1 , UART_TX_COMPLETE = 2 }
 Transmitter state machine states. More...
enum  uartrxstate_t { UART_RX_IDLE = 0 , UART_RX_ACTIVE = 1 , UART_RX_COMPLETE = 2 }
 Receiver state machine states. More...

Functions

void uartInit (void)
 UART Driver initialization.
void uartObjectInit (UARTDriver *uartp)
 Initializes the standard part of a UARTDriver structure.
msg_t uartStart (UARTDriver *uartp, const UARTConfig *config)
 Configures and activates the UART peripheral.
void uartStop (UARTDriver *uartp)
 Deactivates the UART peripheral.
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.
size_t uartStopSend (UARTDriver *uartp)
 Stops any ongoing transmission.
size_t uartStopSendI (UARTDriver *uartp)
 Stops any ongoing transmission.
void uartStartReceive (UARTDriver *uartp, size_t n, void *rxbuf)
 Starts a receive operation on the UART peripheral.
void uartStartReceiveI (UARTDriver *uartp, size_t n, void *rxbuf)
 Starts a receive operation on the UART peripheral.
size_t uartStopReceive (UARTDriver *uartp)
 Stops any ongoing receive operation.
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.
msg_t uartSendFullTimeout (UARTDriver *uartp, size_t *np, const void *txbuf, sysinterval_t timeout)
 Performs a transmission 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 uartAcquireBus (UARTDriver *uartp)
 Gains exclusive access to the UART bus.
void uartReleaseBus (UARTDriver *uartp)
 Releases exclusive access to the UART bus.

Detailed Description

UART Driver macros and structures.

Definition in file hal_uart.h.