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

Enabling and controlling UART FIFO More...

Collaboration diagram for UART FIFO control:

Functions

void uart_enable_fifo (uint32_t uart)
 Enable FIFO for the UART. More...
 
void uart_disable_fifo (uint32_t uart)
 Disable FIFO for the UART. More...
 
void uart_set_fifo_trigger_levels (uint32_t uart, enum uart_fifo_rx_trigger_level rx_level, enum uart_fifo_tx_trigger_level tx_level)
 Set the FIFO trigger levels. More...
 
static bool uart_is_tx_fifo_full (uint32_t uart)
 Determine if the TX fifo is full. More...
 
static bool uart_is_tx_fifo_empty (uint32_t uart)
 Determine if the TX fifo is empty. More...
 
static bool uart_is_rx_fifo_full (uint32_t uart)
 Determine if the RX fifo is full. More...
 
static bool uart_is_rx_fifo_empty (uint32_t uart)
 Determine if the RX fifo is empty. More...
 

Detailed Description

Enabling and controlling UART FIFO

The UART on the LM4F can either be used with a single character TX and RX buffer, or with a 8 character TX and RX FIFO. In order to use the FIFO it must be enabled, this is done with uart_enable_fifo() and can be disabled again with uart_disable_fifo(). On reset the FIFO is disabled, and it must be explicitly be enabled.

When enabling the UART FIFOs, RX and TX interrupts are triggered according to the amount of data in the FIFOs. For the RX FIFO the trigger level is defined by how full the FIFO is. The TX FIFO trigger level is defined by how empty the FIFO is instead.

For example, to enable the FIFOs and trigger interrupts for a single received and single transmitted character:

void uart_enable_fifo(uint32_t uart)
Enable FIFO for the UART.
Definition: uart.c:594
void uart_set_fifo_trigger_levels(uint32_t uart, enum uart_fifo_rx_trigger_level rx_level, enum uart_fifo_tx_trigger_level tx_level)
Set the FIFO trigger levels.
Definition: uart.c:616
@ UART_FIFO_RX_TRIG_1_8
Definition: uart.h:413
@ UART_FIFO_TX_TRIG_7_8
Definition: uart.h:433
#define UART0
Definition: uart.h:49

Function Documentation

◆ uart_disable_fifo()

void uart_disable_fifo ( uint32_t  uart)

Disable FIFO for the UART.

Parameters
[in]uartUART block register address base UART register base addresses

Definition at line 604 of file uart.c.

References UART_LCRH.

◆ uart_enable_fifo()

void uart_enable_fifo ( uint32_t  uart)

Enable FIFO for the UART.

Parameters
[in]uartUART block register address base UART register base addresses

Definition at line 594 of file uart.c.

References UART_LCRH, and UART_LCRH_FEN.

◆ uart_is_rx_fifo_empty()

static bool uart_is_rx_fifo_empty ( uint32_t  uart)
inlinestatic

Determine if the RX fifo is empty.

Parameters
[in]uartUART block register address base UART register base addresses

Definition at line 517 of file uart.h.

References UART_FR, and UART_FR_RXFE.

◆ uart_is_rx_fifo_full()

static bool uart_is_rx_fifo_full ( uint32_t  uart)
inlinestatic

Determine if the RX fifo is full.

Parameters
[in]uartUART block register address base UART register base addresses

Definition at line 506 of file uart.h.

References UART_FR, and UART_FR_RXFF.

◆ uart_is_tx_fifo_empty()

static bool uart_is_tx_fifo_empty ( uint32_t  uart)
inlinestatic

Determine if the TX fifo is empty.

Parameters
[in]uartUART block register address base UART register base addresses

Definition at line 495 of file uart.h.

References UART_FR, and UART_FR_TXFE.

◆ uart_is_tx_fifo_full()

static bool uart_is_tx_fifo_full ( uint32_t  uart)
inlinestatic

Determine if the TX fifo is full.

Parameters
[in]uartUART block register address base UART register base addresses

Definition at line 483 of file uart.h.

References UART_FR, and UART_FR_TXFF.

◆ uart_set_fifo_trigger_levels()

void uart_set_fifo_trigger_levels ( uint32_t  uart,
enum uart_fifo_rx_trigger_level  rx_level,
enum uart_fifo_tx_trigger_level  tx_level 
)

Set the FIFO trigger levels.

Parameters
[in]uartUART block register address base UART register base addresses
[in]rx_levelTrigger level for RX FIFO
[in]tx_levelTrigger level for TX FIFO

Definition at line 616 of file uart.c.

References UART_IFLS.