libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
VF6xx Universal Asynchronous Receiver/Transmitter (UART) More...
Functions | |
void | uart_set_baudrate (uint32_t uart, uint32_t baud) |
UART Set Baudrate. More... | |
void | uart_set_parity (uint32_t uart, uint8_t parity) |
UART Set Parity. More... | |
void | uart_set_flow_control (uint32_t uart, uint8_t flowcontrol) |
UART Set Hardware Flow Control. More... | |
void | uart_enable (uint32_t uart) |
UART Enable. More... | |
void | uart_disable (uint32_t uart) |
UART Disable. More... | |
void | uart_send (uint32_t uart, uint8_t data) |
UART Send a Data Word. More... | |
void | uart_wait_send_ready (uint32_t uart) |
UART Wait for Transmit Data Buffer Empty. More... | |
void | uart_send_blocking (uint32_t uart, uint8_t data) |
UART Send Data byte blocking. More... | |
uint8_t | uart_recv (uint32_t uart) |
UART Read a Received Data Word. More... | |
void | uart_wait_recv_ready (uint32_t uart) |
UART Wait for Received Data Available. More... | |
uint8_t | uart_recv_blocking (uint32_t uart) |
UART Read a Received Data Word with Blocking. More... | |
VF6xx Universal Asynchronous Receiver/Transmitter (UART)
This library supports the UART in the VF6xx SoC of Freescale. Devices can have up to 6 UARTs.
LGPL License Terms libopencm3 License
void uart_disable | ( | uint32_t | uart | ) |
UART Disable.
At the end of the current frame, the UART is disabled to reduce power.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
Definition at line 127 of file uart.c.
References UART_C2, UART_C2_RE, and UART_C2_TE.
void uart_enable | ( | uint32_t | uart | ) |
UART Enable.
Enable Tramitter and Receiver
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
Definition at line 113 of file uart.c.
References UART_C2, UART_C2_RE, and UART_C2_TE.
uint8_t uart_recv | ( | uint32_t | uart | ) |
UART Read a Received Data Word.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
Definition at line 185 of file uart.c.
References UART_D.
Referenced by uart_recv_blocking().
uint8_t uart_recv_blocking | ( | uint32_t | uart | ) |
UART Read a Received Data Word with Blocking.
Wait until a data word has been received then return the word.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
Definition at line 217 of file uart.c.
References uart_recv(), and uart_wait_recv_ready().
void uart_send | ( | uint32_t | uart, |
uint8_t | data | ||
) |
UART Send a Data Word.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
[in] | data | unsigned 8 bit. |
Definition at line 140 of file uart.c.
References UART_D.
Referenced by uart_send_blocking().
void uart_send_blocking | ( | uint32_t | uart, |
uint8_t | data | ||
) |
UART Send Data byte blocking.
Blocks until the transmit data buffer becomes empty before sending the next (given) byte.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
[in] | data | unsigned 8 bit. |
Definition at line 171 of file uart.c.
References uart_send(), and uart_wait_send_ready().
void uart_set_baudrate | ( | uint32_t | uart, |
uint32_t | baud | ||
) |
UART Set Baudrate.
The baud rate is computed from the IPG bus clock. The bus clock must be calculated by using ccm_calculate_clocks before calling this function.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
[in] | baud | unsigned 32 bit. Baud rate specified in Hz. |
Definition at line 53 of file uart.c.
References ccm_ipg_bus_clk, UART_BDH, UART_BDH_SBR_MASK, UART_BDL, and UART_BDL_SBR_MASK.
void uart_set_flow_control | ( | uint32_t | uart, |
uint8_t | flowcontrol | ||
) |
UART Set Hardware Flow Control.
The flow control bit can be selected as none, RTS, CTS or RTS+CTS.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
[in] | flowcontrol | unsigned 8 bit. Flowcontrol uart_cr3_flowcontrol. |
Definition at line 95 of file uart.c.
References UART_MODEM.
void uart_set_parity | ( | uint32_t | uart, |
uint8_t | parity | ||
) |
UART Set Parity.
The parity bit can be selected as none, even or odd.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
[in] | parity | unsigned 8 bit. Parity UART Parity Selection. |
Definition at line 76 of file uart.c.
References UART_C1.
void uart_wait_recv_ready | ( | uint32_t | uart | ) |
UART Wait for Received Data Available.
Blocks until the receive data buffer holds a valid received data word.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
Definition at line 200 of file uart.c.
References UART_S1, and UART_S1_RDRF.
Referenced by uart_recv_blocking().
void uart_wait_send_ready | ( | uint32_t | uart | ) |
UART Wait for Transmit Data Buffer Empty.
Blocks until the transmit data buffer becomes empty and is ready to accept the next data word.
[in] | uart | unsigned 32 bit. UART block register address base UART register base addresses |
Definition at line 155 of file uart.c.
References UART_S1, and UART_S1_TC.
Referenced by uart_send_blocking().