libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Enabling and controlling UART FIFO More...
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... | |
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_disable_fifo | ( | uint32_t | uart | ) |
Disable FIFO for the UART.
[in] | uart | UART block register address base UART register base addresses |
Definition at line 604 of file uart.c.
References UART_LCRH.
void uart_enable_fifo | ( | uint32_t | uart | ) |
Enable FIFO for the UART.
[in] | uart | UART block register address base UART register base addresses |
Definition at line 594 of file uart.c.
References UART_LCRH, and UART_LCRH_FEN.
|
inlinestatic |
Determine if the RX fifo is empty.
[in] | uart | UART block register address base UART register base addresses |
Definition at line 517 of file uart.h.
References UART_FR, and UART_FR_RXFE.
|
inlinestatic |
Determine if the RX fifo is full.
[in] | uart | UART block register address base UART register base addresses |
Definition at line 506 of file uart.h.
References UART_FR, and UART_FR_RXFF.
|
inlinestatic |
Determine if the TX fifo is empty.
[in] | uart | UART block register address base UART register base addresses |
Definition at line 495 of file uart.h.
References UART_FR, and UART_FR_TXFE.
|
inlinestatic |
Determine if the TX fifo is full.
[in] | uart | UART block register address base UART register base addresses |
Definition at line 483 of file uart.h.
References UART_FR, and UART_FR_TXFF.
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.
[in] | uart | UART block register address base UART register base addresses |
[in] | rx_level | Trigger level for RX FIFO |
[in] | tx_level | Trigger level for TX FIFO |
Definition at line 616 of file uart.c.
References UART_IFLS.