libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
UART

VF6xx Universal Asynchronous Receiver/Transmitter (UART) More...

Collaboration diagram for UART:

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...
 

Detailed Description

VF6xx Universal Asynchronous Receiver/Transmitter (UART)

UART API.

Author
© 2014 Stefan Agner stefa.nosp@m.n@ag.nosp@m.ner.c.nosp@m.h
Date
03 July 2014

This library supports the UART in the VF6xx SoC of Freescale. Devices can have up to 6 UARTs.

LGPL License Terms libopencm3 License

Function Documentation

◆ uart_disable()

void uart_disable ( uint32_t  uart)

UART Disable.

At the end of the current frame, the UART is disabled to reduce power.

Parameters
[in]uartunsigned 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.

◆ uart_enable()

void uart_enable ( uint32_t  uart)

UART Enable.

Enable Tramitter and Receiver

Parameters
[in]uartunsigned 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.

◆ uart_recv()

uint8_t uart_recv ( uint32_t  uart)

UART Read a Received Data Word.

Parameters
[in]uartunsigned 32 bit. UART block register address base UART register base addresses
Returns
unsigned 8 bit data word.

Definition at line 185 of file uart.c.

References UART_D.

Referenced by uart_recv_blocking().

Here is the caller graph for this function:

◆ 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.

Parameters
[in]uartunsigned 32 bit. UART block register address base UART register base addresses
Returns
unsigned 16 bit data word.

Definition at line 217 of file uart.c.

References uart_recv(), and uart_wait_recv_ready().

Here is the call graph for this function:

◆ uart_send()

void uart_send ( uint32_t  uart,
uint8_t  data 
)

UART Send a Data Word.

Parameters
[in]uartunsigned 32 bit. UART block register address base UART register base addresses
[in]dataunsigned 8 bit.

Definition at line 140 of file uart.c.

References UART_D.

Referenced by uart_send_blocking().

Here is the caller graph for this function:

◆ 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.

Parameters
[in]uartunsigned 32 bit. UART block register address base UART register base addresses
[in]dataunsigned 8 bit.

Definition at line 171 of file uart.c.

References uart_send(), and uart_wait_send_ready().

Here is the call graph for this function:

◆ uart_set_baudrate()

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.

Parameters
[in]uartunsigned 32 bit. UART block register address base UART register base addresses
[in]baudunsigned 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.

◆ uart_set_flow_control()

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.

Parameters
[in]uartunsigned 32 bit. UART block register address base UART register base addresses
[in]flowcontrolunsigned 8 bit. Flowcontrol uart_cr3_flowcontrol.

Definition at line 95 of file uart.c.

References UART_MODEM.

◆ uart_set_parity()

void uart_set_parity ( uint32_t  uart,
uint8_t  parity 
)

UART Set Parity.

The parity bit can be selected as none, even or odd.

Parameters
[in]uartunsigned 32 bit. UART block register address base UART register base addresses
[in]parityunsigned 8 bit. Parity UART Parity Selection.

Definition at line 76 of file uart.c.

References UART_C1.

◆ uart_wait_recv_ready()

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.

Parameters
[in]uartunsigned 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().

Here is the caller graph for this function:

◆ uart_wait_send_ready()

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.

Parameters
[in]uartunsigned 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().

Here is the caller graph for this function: