gr55xx_ll_uart.h File Reference

Header file containing functions prototypes of UART LL library. More...

#include "gr55xx.h"
+ Include dependency graph for gr55xx_ll_uart.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ll_uart_init_t
 LL UART init Structure definition. More...
 

Macros

#define LL_UART_LSR_OE   UART_LSR_OE
 Overrun error flag. More...
 
#define LL_UART_LSR_PE   UART_LSR_PE
 Parity error flag. More...
 
#define LL_UART_LSR_FE   UART_LSR_FE
 Framing error flag. More...
 
#define LL_UART_LSR_BI   UART_LSR_BI
 Break detection flag. More...
 
#define LL_UART_LSR_THRE   UART_LSR_THRE
 Transmit holding register empty flag. More...
 
#define LL_UART_LSR_TEMT   UART_LSR_TEMT
 Transmitter empty flag. More...
 
#define LL_UART_LSR_RFE   UART_LSR_RFE
 Rx FIFO error flag. More...
 
#define LL_UART_IIR_MS   UART_IIR_IID_MS
 Modem Status flag. More...
 
#define LL_UART_IIR_NIP   UART_IIR_IID_NIP
 No Interrupt Pending flag. More...
 
#define LL_UART_IIR_THRE   UART_IIR_IID_THRE
 THR Empty flag. More...
 
#define LL_UART_IIR_RDA   UART_IIR_IID_RDA
 Received Data Available flag. More...
 
#define LL_UART_IIR_RLS   UART_IIR_IID_RLS
 Receiver Line Status flag. More...
 
#define LL_UART_IIR_CTO   UART_IIR_IID_CTO
 Character Timeout flag. More...
 
#define LL_UART_USR_RFF   UART_USR_RFF
 Rx FIFO Full flag. More...
 
#define LL_UART_USR_RFNE   UART_USR_RFNE
 Rx FIFO Not Empty flag. More...
 
#define LL_UART_USR_TFE   UART_USR_TFE
 Tx FIFO Empty flag. More...
 
#define LL_UART_USR_TFNF   UART_USR_TFNF
 Tx FIFO Not Full flag. More...
 
#define LL_UART_IER_MS   UART_IER_EDSSI
 Enable Modem Status Interrupt. More...
 
#define LL_UART_IER_RLS   UART_IER_ERLS
 Enable Receiver Line Status Interrupt. More...
 
#define LL_UART_IER_THRE   (UART_IER_ETBEI | UART_IER_PTIME)
 Enable Transmit Holding Register Empty Interrupt. More...
 
#define LL_UART_IER_RDA   UART_IER_ERBFI
 Enable Received Data Available Interrupt and Character Timeout Interrupt. More...
 
#define LL_UART_PARITY_NONE   UART_LCR_PARITY_NONE
 Parity control disabled. More...
 
#define LL_UART_PARITY_ODD   UART_LCR_PARITY_ODD
 Parity control enabled and Odd Parity is selected. More...
 
#define LL_UART_PARITY_EVEN   UART_LCR_PARITY_EVEN
 Parity control enabled and Even Parity is selected. More...
 
#define LL_UART_PARITY_SP0   UART_LCR_PARITY_SP0
 Parity control enabled and Stick Parity 0 is selected. More...
 
#define LL_UART_PARITY_SP1   UART_LCR_PARITY_SP1
 Parity control enabled and Stick Parity 1 is selected. More...
 
#define LL_UART_DATABITS_5B   UART_LCR_DLS_5
 5 bits word length : Start bit, 5 data bits, n stop bits More...
 
#define LL_UART_DATABITS_6B   UART_LCR_DLS_6
 6 bits word length : Start bit, 6 data bits, n stop bits More...
 
#define LL_UART_DATABITS_7B   UART_LCR_DLS_7
 7 bits word length : Start bit, 7 data bits, n stop bits More...
 
#define LL_UART_DATABITS_8B   UART_LCR_DLS_8
 8 bits word length : Start bit, 8 data bits, n stop bits More...
 
#define LL_UART_STOPBITS_1   UART_LCR_STOP_1
 1 stop bit More...
 
#define LL_UART_STOPBITS_1_5   UART_LCR_STOP_1_5
 1.5 stop bits More...
 
#define LL_UART_STOPBITS_2   UART_LCR_STOP_2
 2 stop bits More...
 
#define LL_UART_HWCONTROL_NONE   0x00000000U
 CTS and RTS hardware flow control disabled. More...
 
#define LL_UART_HWCONTROL_RTS_CTS   (UART_MCR_AFCE | UART_MCR_RTS)
 CTS and RTS hardware flow control enabled. More...
 
#define LL_UART_TX_FIFO_TH_EMPTY   0x00000000U
 TX FIFO empty. More...
 
#define LL_UART_TX_FIFO_TH_CHAR_2   0x00000001U
 2 characters in TX FIFO More...
 
#define LL_UART_TX_FIFO_TH_QUARTER_FULL   0x00000002U
 TX FIFO 1/4 full. More...
 
#define LL_UART_TX_FIFO_TH_HALF_FULL   0x00000003U
 TX FIFO 1/2 full. More...
 
#define LL_UART_RX_FIFO_TH_CHAR_1   0x00000000U
 1 character in RX FIFO More...
 
#define LL_UART_RX_FIFO_TH_QUARTER_FULL   0x00000001U
 RX FIFO 1/4 full. More...
 
#define LL_UART_RX_FIFO_TH_HALF_FULL   0x00000002U
 RX FIFO 1/2 full. More...
 
#define LL_UART_RX_FIFO_TH_FULL_2   0x00000003U
 RX FIFO 2 less than full. More...
 
#define LL_UART_RTSPIN_STATE_ACTIVE   0x00000001U
 RTS pin active(Logic 1) More...
 
#define LL_UART_RTSPIN_STATE_INACTIVE   0x00000000U
 RTS pin inactive(Logic 0) More...
 
#define LL_UART_CTSPIN_STATE_ACTIVE   0x00000001U
 CTS pin active(Logic 1) More...
 
#define LL_UART_CTSPIN_STATE_INACTIVE   0x00000000U
 CTS pin pin inactive(Logic 0) More...
 
#define LL_UART_DEFAULT_CONFIG
 LL UART InitStrcut default configuartion. More...
 
#define LL_UART_WriteReg(__instance__, __REG__, __VALUE__)   WRITE_REG(__instance__->__REG__, (__VALUE__))
 Write a value in UART register. More...
 
#define LL_UART_ReadReg(__instance__, __REG__)   READ_REG(__instance__->__REG__)
 Read a value in UART register. More...
 
#define __LL_UART_DIV(__PERIPHCLK__, __BAUDRATE__)   ((__PERIPHCLK__) / (__BAUDRATE__) / 16)
 Compute UARTDIV value according to Peripheral Clock and expected Baud Rate (32 bits value of UARTDIV is returned) More...
 
#define __LL_UART_DLF(__PERIPHCLK__, __BAUDRATE__)   ((__PERIPHCLK__) / (__BAUDRATE__) % 16)
 Compute UARTDLF value according to Peripheral Clock and expected Baud Rate (32 bits value of UARTDLF is returned) More...
 

Typedefs

typedef struct _ll_uart_init_t ll_uart_init_t
 LL UART init Structure definition. More...
 

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_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_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...
 
__STATIC_INLINE void ll_uart_enabled_it_ms (uart_regs_t *UARTx)
 Enable Modem Status Interrupt. More...
 
__STATIC_INLINE void ll_uart_enable_it_rls (uart_regs_t *UARTx)
 Enable Receiver Line Status Interrupt. More...
 
__STATIC_INLINE void ll_uart_enable_it_thre (uart_regs_t *UARTx)
 Enable Transmit Holding Register Empty Interrupt. More...
 
__STATIC_INLINE void ll_uart_enable_it_rda (uart_regs_t *UARTx)
 Enable Received Data Available Interrupt and Character Timeout Interrupt. More...
 
__STATIC_INLINE void ll_uart_disable_it_ms (uart_regs_t *UARTx)
 Disable Modem Status Interrupt. More...
 
__STATIC_INLINE void ll_uart_disable_it_rls (uart_regs_t *UARTx)
 Disable Receiver Line Status Interrupt. More...
 
__STATIC_INLINE void ll_uart_disable_it_thre (uart_regs_t *UARTx)
 Disable Transmit Holding Register Empty Interrupt. More...
 
__STATIC_INLINE void ll_uart_disable_it_rda (uart_regs_t *UARTx)
 Disable Received Data Available Interrupt and Character Timeout Interrupt. More...
 
__STATIC_INLINE uint32_t ll_uart_is_enabled_it_ms (uart_regs_t *UARTx)
 Check if the UART Modem Status Interrupt is enabled or disabled. More...
 
__STATIC_INLINE uint32_t ll_uart_is_enabled_it_rls (uart_regs_t *UARTx)
 Check if the UART Receiver Line Status Interrupt is enabled or disabled. More...
 
__STATIC_INLINE uint32_t ll_uart_is_enabled_it_thre (uart_regs_t *UARTx)
 Check if the UART Transmit Holding Register Empty Interrupt is enabled or disabled. More...
 
__STATIC_INLINE uint32_t ll_uart_is_enabled_it_rda (uart_regs_t *UARTx)
 Check if the UART Received Data Available Interrupt and Character Timeout Interrupt is enabled or disabled. More...
 
__STATIC_INLINE void ll_uart_enable_it (uart_regs_t *UARTx, uint32_t mask)
 Enable the specified UART Interrupt. More...
 
__STATIC_INLINE void ll_uart_disable_it (uart_regs_t *UARTx, uint32_t mask)
 Disable the specified UART Interrupt. More...
 
__STATIC_INLINE uint32_t ll_uart_is_enabled_it (uart_regs_t *UARTx, uint32_t mask)
 Check if the specified UART Interrupt is enabled or disabled. More...
 
__STATIC_INLINE uint32_t ll_uart_get_line_status_flag (uart_regs_t *UARTx)
 Get UART Receive Line Status Flag. More...
 
__STATIC_INLINE void ll_uart_clear_line_status_flag (uart_regs_t *UARTx)
 Clear UART Receive Line Status Flag. More...
 
__STATIC_INLINE uint32_t ll_uart_is_active_flag_rff (uart_regs_t *UARTx)
 Check if the UART Receive FIFO Full Flag is set or not. More...
 
__STATIC_INLINE uint32_t ll_uart_is_active_flag_rfne (uart_regs_t *UARTx)
 Check if the UART Receive FIFO Not Empty Flag is set or not. More...
 
__STATIC_INLINE uint32_t ll_uart_is_active_flag_tfe (uart_regs_t *UARTx)
 Check if the UART Transmit FIFO Empty Flag is set or not. More...
 
__STATIC_INLINE uint32_t ll_uart_is_active_flag_tfnf (uart_regs_t *UARTx)
 Check if the UART Transmit FIFO Not Full Flag is set or not. More...
 
__STATIC_INLINE uint32_t ll_uart_get_it_flag (uart_regs_t *UARTx)
 Get UART interrupt flags. More...
 
__STATIC_INLINE uint32_t ll_uart_dma_get_register_address (uart_regs_t *UARTx)
 Get the data register address used for DMA transfer. More...
 
__STATIC_INLINE uint8_t ll_uart_receive_data8 (uart_regs_t *UARTx)
 Read Receiver Data register (Receive Data value, 8 bits) More...
 
__STATIC_INLINE void ll_uart_transmit_data8 (uart_regs_t *UARTx, uint8_t value)
 Write in Transmitter Data Register (Transmit Data value, 8 bits) More...
 
error_status_t ll_uart_deinit (uart_regs_t *UARTx)
 De-initialize UART registers (Registers restored to their default values). More...
 
error_status_t ll_uart_init (uart_regs_t *UARTx, ll_uart_init_t *p_uart_init)
 Initialize UART registers according to the specified parameters in p_uart_init. More...
 
void ll_uart_struct_init (ll_uart_init_t *p_uart_init)
 Set each field of a ll_uart_init_t type structure to default value. More...
 

Detailed Description

Header file containing functions prototypes of UART LL library.

Author
BLE Driver Team
Attention
Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr55xx_ll_uart.h.