Configuration functions

Functions

__STATIC_INLINE void ll_uart_set_baud_rate (uart_regs_t *UARTx, uint32_t peripheral_clock, uint32_t baud_rate)
 Configure UART DLF and DLH register for achieving expected Baud Rate value. More...
 
__STATIC_INLINE uint32_t ll_uart_get_baud_rate (uart_regs_t *UARTx, uint32_t peripheral_clock)
 Return current Baud Rate value. More...
 
__STATIC_INLINE void ll_uart_set_data_bits_length (uart_regs_t *UARTx, uint32_t data_bits)
 Set the length of the data bits. More...
 
__STATIC_INLINE uint32_t ll_uart_get_data_bits_length (uart_regs_t *UARTx)
 Return the length of the data bits. More...
 
__STATIC_INLINE void ll_uart_set_stop_bits_length (uart_regs_t *UARTx, uint32_t stop_bits)
 Set the length of the stop bits. More...
 
__STATIC_INLINE uint32_t ll_uart_get_stop_bits_length (uart_regs_t *UARTx)
 Retrieve the length of the stop bits. More...
 
__STATIC_INLINE void ll_uart_set_parity (uart_regs_t *UARTx, uint32_t parity)
 Configure Parity. More...
 
__STATIC_INLINE uint32_t ll_uart_get_parity (uart_regs_t *UARTx)
 Return Parity configuration. More...
 
__STATIC_INLINE void ll_uart_config_character (uart_regs_t *UARTx, uint32_t data_bits, uint32_t parity, uint32_t stop_bits)
 Configure Character frame format (Datawidth, Parity control, Stop Bits) More...
 
__STATIC_INLINE void ll_uart_set_bc (uart_regs_t *UARTx)
 Set the break control. More...
 
__STATIC_INLINE void ll_uart_reset_bc (uart_regs_t *UARTx)
 Reset the break control. More...
 
__STATIC_INLINE void ll_uart_set_rts_pin_state (uart_regs_t *UARTx, uint32_t pin_state)
 Set UART RTS pin state to Active/Inactive. More...
 
__STATIC_INLINE uint32_t ll_uart_get_rts_pin_state (uart_regs_t *UARTx)
 Get UART RTS pin state. More...
 
__STATIC_INLINE uint32_t ll_uart_get_cts_pin_state (uart_regs_t *UARTx)
 Get UART CTS pin state. More...
 
__STATIC_INLINE uint32_t ll_uart_is_changed_cts (uart_regs_t *UARTx)
 Indicate if CTS is changed since the last time the MSR was read. More...
 
__STATIC_INLINE void ll_uart_enable_sir (uart_regs_t *UARTx)
 Configure SIR mode enable. More...
 
__STATIC_INLINE void ll_uart_disable_sir (uart_regs_t *UARTx)
 Configure SIR mode disable. More...
 
__STATIC_INLINE uint32_t ll_uart_is_enabled_sir (uart_regs_t *UARTx)
 Return SIR mode state. More...
 
__STATIC_INLINE void ll_uart_set_hw_flow_ctrl (uart_regs_t *UARTx, uint32_t hw_flow_ctrl)
 Configure HW Flow Control mode (None or Both CTS and RTS) More...
 
__STATIC_INLINE uint32_t ll_uart_get_hw_flow_ctrl (uart_regs_t *UARTx)
 Return HW Flow Control configuration (None or Both CTS and RTS) More...
 
__STATIC_INLINE void ll_uart_enable_break_sending (uart_regs_t *UARTx)
 Enable Break sending. More...
 
__STATIC_INLINE void ll_uart_disable_break_sending (uart_regs_t *UARTx)
 Disable Break sending. More...
 
__STATIC_INLINE uint32_t ll_uart_is_enabled_break_sending (uart_regs_t *UARTx)
 Indicate if Break sending is enabled. More...
 
__STATIC_INLINE void ll_uart_enable_fifo (uart_regs_t *UARTx)
 Enable TX FIFO and RX FIFO. More...
 
__STATIC_INLINE void ll_uart_disable_fifo (uart_regs_t *UARTx)
 Disable TX FIFO and RX FIFO. More...
 
__STATIC_INLINE uint32_t ll_uart_is_enabled_fifo (uart_regs_t *UARTx)
 Indicate if TX FIFO and RX FIFO is enabled. More...
 
__STATIC_INLINE void ll_uart_set_tx_fifo_threshold (uart_regs_t *UARTx, uint32_t threshold)
 Set threshold of TX FIFO that triggers an THRE interrupt. More...
 
__STATIC_INLINE uint32_t ll_uart_get_tx_fifo_threshold (uart_regs_t *UARTx)
 Get threshold of TX FIFO that triggers an THRE interrupt. More...
 
__STATIC_INLINE void ll_uart_set_rx_fifo_threshold (uart_regs_t *UARTx, uint32_t threshold)
 Set threshold of RX FIFO that triggers an RDA interrupt. More...
 
__STATIC_INLINE uint32_t ll_uart_get_rx_fifo_threshold (uart_regs_t *UARTx)
 Get threshold of RX FIFO that triggers an RDA interrupt. More...
 
__STATIC_INLINE uint32_t ll_uart_get_tx_fifo_level (uart_regs_t *UARTx)
 Get FIFO Transmission Level. More...
 
__STATIC_INLINE uint32_t ll_uart_get_rx_fifo_level (uart_regs_t *UARTx)
 Get FIFO reception Level. More...
 
__STATIC_INLINE void ll_uart_flush_rx_fifo (uart_regs_t *UARTx)
 Flush Receive FIFO. More...
 
__STATIC_INLINE void ll_uart_flush_tx_fifo (uart_regs_t *UARTx)
 Flush Transmit FIFO. More...
 
__STATIC_INLINE void ll_uart_reset (uart_regs_t *UARTx)
 Reset UART. More...
 

Detailed Description

Function Documentation

◆ ll_uart_config_character()

__STATIC_INLINE void ll_uart_config_character ( uart_regs_t *  UARTx,
uint32_t  data_bits,
uint32_t  parity,
uint32_t  stop_bits 
)

Configure Character frame format (Datawidth, Parity control, Stop Bits)

Note
This function call is equivalent to the following function call sequence :

Register|BitsName --------|-------- LCR | PS LCR | EPS LCR | PEN LCR | STOP LCR | DLS

Parameters
UARTxUART instance
data_bitsThis parameter can be one of the following values:
parityThis parameter can be one of the following values:
stop_bitsThis parameter can be one of the following values: (*) STOPBITS_1_5 only valid when DataBits = 5 (*) STOPBITS_2 is invalid when DataBits = 5
Return values
None

Definition at line 522 of file ll_uart.h.

◆ ll_uart_disable_break_sending()

__STATIC_INLINE void ll_uart_disable_break_sending ( uart_regs_t *  UARTx)

Disable Break sending.

Register|BitsName --------|-------- LCR | BC

Parameters
UARTxUART instance
Return values
None

Definition at line 746 of file ll_uart.h.

◆ ll_uart_disable_fifo()

__STATIC_INLINE void ll_uart_disable_fifo ( uart_regs_t *  UARTx)

Disable TX FIFO and RX FIFO.

Register|BitsName --------|-------- SFE | SFE

Parameters
UARTxUART instance
Return values
None

Definition at line 791 of file ll_uart.h.

◆ ll_uart_disable_sir()

__STATIC_INLINE void ll_uart_disable_sir ( uart_regs_t *  UARTx)

Configure SIR mode disable.

Note
This function is used to Disable UART SIR mode.

Register|BitsName --------|-------- MCR | SIRE

Parameters
UARTxUART instance
Return values
None

Definition at line 662 of file ll_uart.h.

◆ ll_uart_enable_break_sending()

__STATIC_INLINE void ll_uart_enable_break_sending ( uart_regs_t *  UARTx)

Enable Break sending.

Register|BitsName --------|-------- LCR | BC

Parameters
UARTxUART instance
Return values
None

Definition at line 731 of file ll_uart.h.

◆ ll_uart_enable_fifo()

__STATIC_INLINE void ll_uart_enable_fifo ( uart_regs_t *  UARTx)

Enable TX FIFO and RX FIFO.

Register|BitsName --------|-------- SFE | SFE

Parameters
UARTxUART instance
Return values
None

Definition at line 776 of file ll_uart.h.

◆ ll_uart_enable_sir()

__STATIC_INLINE void ll_uart_enable_sir ( uart_regs_t *  UARTx)

Configure SIR mode enable.

Note
This function is used to Enable UART SIR mode.

Register|BitsName --------|-------- MCR | SIRE

Parameters
UARTxUART instance
Return values
None

Definition at line 646 of file ll_uart.h.

◆ ll_uart_flush_rx_fifo()

__STATIC_INLINE void ll_uart_flush_rx_fifo ( uart_regs_t *  UARTx)

Flush Receive FIFO.

Register|BitsName --------|-------- SRR | RFR

Parameters
UARTxUART instance
Return values
None

Definition at line 929 of file ll_uart.h.

◆ ll_uart_flush_tx_fifo()

__STATIC_INLINE void ll_uart_flush_tx_fifo ( uart_regs_t *  UARTx)

Flush Transmit FIFO.

Register|BitsName --------|-------- SRR | XFR

Parameters
UARTxUART instance
Return values
None

Definition at line 944 of file ll_uart.h.

◆ ll_uart_get_baud_rate()

__STATIC_INLINE uint32_t ll_uart_get_baud_rate ( uart_regs_t *  UARTx,
uint32_t  peripheral_clock 
)

Return current Baud Rate value.

Note
In case of non-initialized or invalid value stored in DLL,DLH and DLF register, the value 0 will be returned..

Register|BitsName --------|-------- DLL | DLL DLH | DLH

Parameters
UARTxUART instance
peripheral_clockPeripheral Clock
Return values
BaudRate

Definition at line 341 of file ll_uart.h.

◆ ll_uart_get_cts_pin_state()

__STATIC_INLINE uint32_t ll_uart_get_cts_pin_state ( uart_regs_t *  UARTx)

Get UART CTS pin state.

Note
The CTS pin is ACTIVE when logic level is low, and INACTIVE when logic level is high.

Register|BitsName --------|-------- MSR | CTS

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 615 of file ll_uart.h.

◆ ll_uart_get_data_bits_length()

__STATIC_INLINE uint32_t ll_uart_get_data_bits_length ( uart_regs_t *  UARTx)

Return the length of the data bits.

Register|BitsName --------|-------- LCR | DLS

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 393 of file ll_uart.h.

◆ ll_uart_get_hw_flow_ctrl()

__STATIC_INLINE uint32_t ll_uart_get_hw_flow_ctrl ( uart_regs_t *  UARTx)

Return HW Flow Control configuration (None or Both CTS and RTS)

Register|BitsName --------|-------- MCR | AFCE MCR | RTS

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 716 of file ll_uart.h.

◆ ll_uart_get_parity()

__STATIC_INLINE uint32_t ll_uart_get_parity ( uart_regs_t *  UARTx)

Return Parity configuration.

Register|BitsName --------|-------- LCR | SP LCR | EPS LCR | PEN

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 481 of file ll_uart.h.

◆ ll_uart_get_rts_pin_state()

__STATIC_INLINE uint32_t ll_uart_get_rts_pin_state ( uart_regs_t *  UARTx)

Get UART RTS pin state.

Note
The RTS pin is ACTIVE when logic level is low, and INACTIVE when logic level is high.

Register|BitsName --------|-------- SRTS | SRTS MCR | RTS

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 597 of file ll_uart.h.

◆ ll_uart_get_rx_fifo_level()

__STATIC_INLINE uint32_t ll_uart_get_rx_fifo_level ( uart_regs_t *  UARTx)

Get FIFO reception Level.

Register|BitsName --------|-------- RFL | RFL

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 914 of file ll_uart.h.

◆ ll_uart_get_rx_fifo_threshold()

__STATIC_INLINE uint32_t ll_uart_get_rx_fifo_threshold ( uart_regs_t *  UARTx)

Get threshold of RX FIFO that triggers an RDA interrupt.

Register|BitsName --------|-------- SRT | SRT

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 884 of file ll_uart.h.

◆ ll_uart_get_stop_bits_length()

__STATIC_INLINE uint32_t ll_uart_get_stop_bits_length ( uart_regs_t *  UARTx)

Retrieve the length of the stop bits.

Register|BitsName --------|-------- LCR | STOP

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 433 of file ll_uart.h.

◆ ll_uart_get_tx_fifo_level()

__STATIC_INLINE uint32_t ll_uart_get_tx_fifo_level ( uart_regs_t *  UARTx)

Get FIFO Transmission Level.

Register|BitsName --------|-------- TFL | TFL

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 899 of file ll_uart.h.

◆ ll_uart_get_tx_fifo_threshold()

__STATIC_INLINE uint32_t ll_uart_get_tx_fifo_threshold ( uart_regs_t *  UARTx)

Get threshold of TX FIFO that triggers an THRE interrupt.

Register|BitsName --------|-------- STET | STET

Parameters
UARTxUART instance
Return values
Returnedvalue can be one of the following values:

Definition at line 845 of file ll_uart.h.

◆ ll_uart_is_changed_cts()

__STATIC_INLINE uint32_t ll_uart_is_changed_cts ( uart_regs_t *  UARTx)

Indicate if CTS is changed since the last time the MSR was read.

Register|BitsName --------|-------- MSR | DCTS

Parameters
UARTxUART instance
Return values
Stateof bit (1 or 0).

Definition at line 630 of file ll_uart.h.

◆ ll_uart_is_enabled_break_sending()

__STATIC_INLINE uint32_t ll_uart_is_enabled_break_sending ( uart_regs_t *  UARTx)

Indicate if Break sending is enabled.

Register|BitsName --------|-------- LCR | BC

Parameters
UARTxUART instance
Return values
Stateof bit (1 or 0).

Definition at line 761 of file ll_uart.h.

◆ ll_uart_is_enabled_fifo()

__STATIC_INLINE uint32_t ll_uart_is_enabled_fifo ( uart_regs_t *  UARTx)

Indicate if TX FIFO and RX FIFO is enabled.

Register|BitsName --------|-------- SFE | SFE

Parameters
UARTxUART instance
Return values
Stateof bit (1 or 0).

Definition at line 806 of file ll_uart.h.

◆ ll_uart_is_enabled_sir()

__STATIC_INLINE uint32_t ll_uart_is_enabled_sir ( uart_regs_t *  UARTx)

Return SIR mode state.

Note
This function is used to return UART SIR mode state.

Register|BitsName --------|-------- MCR | SIRE

Parameters
UARTxUART instance
Return values
Stateof bit (1 or 0).

Definition at line 678 of file ll_uart.h.

◆ ll_uart_reset()

__STATIC_INLINE void ll_uart_reset ( uart_regs_t *  UARTx)

Reset UART.

Note
This function asynchronously resets the DW_apb_uart and synchronously removes the reset assertion. For a two clock implementation, both pclk and sclk domains will be reset.

Register|BitsName --------|-------- SRR | UR

Parameters
UARTxUART instance
Return values
None

Definition at line 962 of file ll_uart.h.

◆ ll_uart_reset_bc()

__STATIC_INLINE void ll_uart_reset_bc ( uart_regs_t *  UARTx)

Reset the break control.

Register|BitsName --------|-------- LCR | BC

Parameters
UARTxUART instance
Return values
None

Definition at line 558 of file ll_uart.h.

◆ ll_uart_set_baud_rate()

__STATIC_INLINE void ll_uart_set_baud_rate ( uart_regs_t *  UARTx,
uint32_t  peripheral_clock,
uint32_t  baud_rate 
)

Configure UART DLF and DLH register for achieving expected Baud Rate value.

Note
Peripheral clock and Baud rate values provided as function parameters should be valid (Baud rate value != 0)

Register|BitsName --------|-------- DLL | DLL DLH | DLH

Parameters
UARTxUART instance
peripheral_clockPeripheral Clock
baud_rateBaud Rate
Return values
None

Definition at line 317 of file ll_uart.h.

References __LL_UART_DIV, and __LL_UART_DLF.

◆ ll_uart_set_bc()

__STATIC_INLINE void ll_uart_set_bc ( uart_regs_t *  UARTx)

Set the break control.

Note
If set to one, the serial output is forced to the spacing (logic 0) state.

Register|BitsName --------|-------- LCR | BC

Parameters
UARTxUART instance
Return values
None

Definition at line 542 of file ll_uart.h.

◆ ll_uart_set_data_bits_length()

__STATIC_INLINE void ll_uart_set_data_bits_length ( uart_regs_t *  UARTx,
uint32_t  data_bits 
)

Set the length of the data bits.

Register|BitsName --------|-------- LCR | DLS

Parameters
UARTxUART instance
data_bitsThis parameter can be one of the following values:
Return values
None

Definition at line 374 of file ll_uart.h.

◆ ll_uart_set_hw_flow_ctrl()

__STATIC_INLINE void ll_uart_set_hw_flow_ctrl ( uart_regs_t *  UARTx,
uint32_t  hw_flow_ctrl 
)

Configure HW Flow Control mode (None or Both CTS and RTS)

Note
This function is used to Enable/Disable UART Auto Flow Control.

Register|BitsName --------|-------- MCR | AFCE MCR | RTS

Parameters
UARTxUART instance
hw_flow_ctrlThis parameter can be one of the following values:
Return values
None

Definition at line 698 of file ll_uart.h.

◆ ll_uart_set_parity()

__STATIC_INLINE void ll_uart_set_parity ( uart_regs_t *  UARTx,
uint32_t  parity 
)

Configure Parity.

Note
This function selects if hardware parity control (generation and detection) is enabled or disabled. When the parity control is enabled (Odd,Even,0,1), computed parity bit is inserted at the MSB position and parity is checked on the received data.

Register|BitsName --------|-------- LCR | SP LCR | EPS LCR | PEN

Parameters
UARTxUART instance
parityThis parameter can be one of the following values:
Return values
None

Definition at line 459 of file ll_uart.h.

◆ ll_uart_set_rts_pin_state()

__STATIC_INLINE void ll_uart_set_rts_pin_state ( uart_regs_t *  UARTx,
uint32_t  pin_state 
)

Set UART RTS pin state to Active/Inactive.

Note
The RTS pin is ACTIVE when logic level is low, and INACTIVE when logic level is high.

Register|BitsName --------|-------- SRTS | SRTS MCR | RTS

Parameters
UARTxUART instance
pin_stateThis parameter can be one of the following values:
Return values
None

Definition at line 578 of file ll_uart.h.

◆ ll_uart_set_rx_fifo_threshold()

__STATIC_INLINE void ll_uart_set_rx_fifo_threshold ( uart_regs_t *  UARTx,
uint32_t  threshold 
)

Set threshold of RX FIFO that triggers an RDA interrupt.

Register|BitsName --------|-------- SRT | SRT

Parameters
UARTxUART instance
thresholdThis parameter can be one of the following values:
Return values
None

Definition at line 865 of file ll_uart.h.

◆ ll_uart_set_stop_bits_length()

__STATIC_INLINE void ll_uart_set_stop_bits_length ( uart_regs_t *  UARTx,
uint32_t  stop_bits 
)

Set the length of the stop bits.

Register|BitsName --------|-------- LCR | STOP

Parameters
UARTxUART instance
stop_bitsThis parameter can be one of the following values: (*) STOPBITS_1_5 only valid when DataBits = 5 (*) STOPBITS_2 is invalid when DataBits = 5
Return values
None

Definition at line 415 of file ll_uart.h.

◆ ll_uart_set_tx_fifo_threshold()

__STATIC_INLINE void ll_uart_set_tx_fifo_threshold ( uart_regs_t *  UARTx,
uint32_t  threshold 
)

Set threshold of TX FIFO that triggers an THRE interrupt.

Register|BitsName --------|-------- STET | STET

Parameters
UARTxUART instance
thresholdThis parameter can be one of the following values:
Return values
None

Definition at line 826 of file ll_uart.h.