HPM SDK
HPMicro Software Development Kit
UART driver APIs

UART driver APIs. More...

Data Structures

struct  uart_modem_config
 UART modem config. More...
 
struct  hpm_uart_rxline_idle_detect_config
 UART Idle config, suitable for RX and TX. More...
 
struct  hpm_uart_config
 UART config. More...
 
struct  uart_trig_config_t
 
struct  uart_fifo_ctrl_t
 

Typedefs

typedef enum parity parity_setting_t
 
typedef enum num_of_stop_bits num_of_stop_bits_t
 
typedef enum word_length word_length_t
 
typedef enum uart_fifo_trg_lvl uart_fifo_trg_lvl_t
 
typedef enum uart_signal uart_signal_t
 
typedef enum uart_signal_level uart_signal_level_t
 
typedef enum uart_modem_stat uart_modem_stat_t
 
typedef enum uart_intr_enable uart_intr_enable_t
 
typedef enum uart_intr_id uart_intr_id_t
 
typedef enum uart_stat uart_stat_t
 
typedef struct uart_modem_config uart_modem_config_t
 UART modem config. More...
 
typedef enum hpm_uart_rxline_idle_cond uart_rxline_idle_cond_t
 UART Idle detection conditions, suitable for RX and TX. More...
 
typedef struct hpm_uart_rxline_idle_detect_config uart_rxline_idle_config_t
 UART Idle config, suitable for RX and TX. More...
 
typedef struct hpm_uart_config uart_config_t
 UART config. More...
 

Enumerations

enum  { status_uart_no_suitable_baudrate_parameter_found = ((uint32_t)( status_group_uart )*1000U + (uint32_t)( 1 )) }
 UART status. More...
 
enum  parity {
  parity_none = 0 , parity_odd , parity_even , parity_always_1 ,
  parity_always_0
}
 
enum  num_of_stop_bits { stop_bits_1 = 0 , stop_bits_1_5 , stop_bits_2 }
 
enum  word_length { word_length_5_bits = 0 , word_length_6_bits , word_length_7_bits , word_length_8_bits }
 
enum  uart_fifo_trg_lvl {
  uart_fifo_1_byte = 0 , uart_fifo_2_bytes = 1 , uart_fifo_3_bytes = 2 , uart_fifo_4_bytes = 3 ,
  uart_fifo_5_bytes = 4 , uart_fifo_6_bytes = 5 , uart_fifo_7_bytes = 6 , uart_fifo_8_bytes = 7 ,
  uart_fifo_9_bytes = 8 , uart_fifo_10_bytes = 9 , uart_fifo_11_bytes = 10 , uart_fifo_12_bytes = 11 ,
  uart_fifo_13_bytes = 12 , uart_fifo_14_bytes = 13 , uart_fifo_15_bytes = 14 , uart_fifo_16_bytes = 15 ,
  uart_rx_fifo_trg_not_empty = uart_fifo_1_byte , uart_rx_fifo_trg_gt_one_quarter = uart_fifo_4_bytes , uart_rx_fifo_trg_gt_half = uart_fifo_8_bytes , uart_rx_fifo_trg_gt_three_quarters = uart_fifo_12_bytes ,
  uart_tx_fifo_trg_not_full = uart_fifo_16_bytes , uart_tx_fifo_trg_lt_three_quarters = uart_fifo_12_bytes , uart_tx_fifo_trg_lt_half = uart_fifo_8_bytes , uart_tx_fifo_trg_lt_one_quarter = uart_fifo_4_bytes
}
 
enum  uart_signal { uart_signal_rts = UART_MCR_RTS_MASK }
 
enum  uart_signal_level { uart_signal_level_high , uart_signal_level_low }
 
enum  uart_modem_stat { uart_modem_stat_cts = UART_MSR_CTS_MASK , uart_modem_stat_dcts_changed = UART_MSR_DCTS_MASK }
 
enum  uart_intr_enable {
  uart_intr_rx_data_avail_or_timeout = UART_IER_ERBI_MASK , uart_intr_tx_slot_avail = UART_IER_ETHEI_MASK , uart_intr_rx_line_stat = UART_IER_ELSI_MASK , uart_intr_modem_stat = UART_IER_EMSI_MASK ,
  uart_intr_rx_line_idle = UART_IER_ERXIDLE_MASK , uart_intr_tx_line_idle = UART_IER_ETXIDLE_MASK , uart_intr_addr_match = UART_IER_EADDRM_MASK , uart_intr_addr_match_and_rxidle = UART_IER_EADDRM_IDLE_MASK ,
  uart_intr_addr_datalost = UART_IER_EDATLOST_MASK
}
 
enum  uart_intr_id {
  uart_intr_id_modem_stat = 0x0 , uart_intr_id_tx_slot_avail = 0x2 , uart_intr_id_rx_data_avail = 0x4 , uart_intr_id_rx_line_stat = 0x6 ,
  uart_intr_id_rx_timeout = 0xc
}
 
enum  uart_stat {
  uart_stat_data_ready = UART_LSR_DR_MASK , uart_stat_overrun_error = UART_LSR_OE_MASK , uart_stat_parity_error = UART_LSR_PE_MASK , uart_stat_framing_error = UART_LSR_FE_MASK ,
  uart_stat_line_break = UART_LSR_LBREAK_MASK , uart_stat_tx_slot_avail = UART_LSR_THRE_MASK , uart_stat_transmitter_empty = UART_LSR_TEMT_MASK , uart_stat_rx_fifo_error = UART_LSR_ERRF_MASK
}
 
enum  hpm_uart_rxline_idle_cond { uart_rxline_idle_cond_rxline_logic_one = 0 , uart_rxline_idle_cond_state_machine_idle = 1 }
 UART Idle detection conditions, suitable for RX and TX. More...
 

Functions

static uint8_t uart_get_fifo_size (UART_Type *ptr)
 Get fifo size. More...
 
void uart_config_fifo_ctrl (UART_Type *ptr, uart_fifo_ctrl_t *ctrl)
 uart config fifo control More...
 
static void uart_clear_rx_fifo (UART_Type *ptr)
 uart clear rx fifo by reading data More...
 
static void uart_enable_rx_function (UART_Type *ptr, bool enable)
 
static void uart_reset_tx_fifo (UART_Type *ptr)
 Reset TX Fifo. More...
 
static void uart_reset_rx_fifo (UART_Type *ptr)
 Reset RX Fifo. More...
 
static void uart_reset_all_fifo (UART_Type *ptr)
 [in] Reset both TX and RX Fifo More...
 
static void uart_modem_enable_loopback (UART_Type *ptr)
 Enable modem loopback. More...
 
static void uart_modem_disable_loopback (UART_Type *ptr)
 Disable modem loopback. More...
 
static void uart_modem_disable_auto_flow_control (UART_Type *ptr)
 Disable modem auto flow control. More...
 
static void uart_modem_enable_auto_flow_control (UART_Type *ptr)
 Enable modem auto flow control. More...
 
static void uart_modem_config (UART_Type *ptr, uart_modem_config_t *config)
 Configure modem. More...
 
static uint8_t uart_get_modem_status (UART_Type *ptr)
 Get modem status. More...
 
static void uart_write_byte (UART_Type *ptr, uint8_t c)
 Write byte to TX. More...
 
static uint8_t uart_read_byte (UART_Type *ptr)
 Read byte from RX. More...
 
static bool uart_check_modem_status (UART_Type *ptr, uart_modem_stat_t mask)
 Check modem status with given mask. More...
 
static void uart_disable_irq (UART_Type *ptr, uart_intr_enable_t irq_mask)
 Disable IRQ with mask. More...
 
static void uart_enable_irq (UART_Type *ptr, uart_intr_enable_t irq_mask)
 Enable IRQ with mask. More...
 
static uint32_t uart_get_enabled_irq (UART_Type *ptr)
 Get Enabled IRQ. More...
 
static uint8_t uart_get_irq_id (UART_Type *ptr)
 Get interrupt identification. More...
 
static void uart_enable_rxline_idle_detection (UART_Type *ptr)
 Enable UART RX Idle Line detection logic. More...
 
static void uart_disable_rxline_idle_detection (UART_Type *ptr)
 Disable UART RX Idle Line detection logic. More...
 
hpm_stat_t uart_init_rxline_idle_detection (UART_Type *ptr, uart_rxline_idle_config_t rxidle_config)
 Configure UART RX Line detection. More...
 
static bool uart_is_txline_idle (UART_Type *ptr)
 Determine whether UART TX Line is idle. More...
 
static void uart_clear_txline_idle_flag (UART_Type *ptr)
 Clear UART TX Line Idle Flag. More...
 
static bool uart_is_rxline_idle (UART_Type *ptr)
 Determine whether UART RX Line is idle. More...
 
static void uart_clear_rxline_idle_flag (UART_Type *ptr)
 Clear UART RX Line Idle Flag. More...
 
static void uart_enable_txline_idle_detection (UART_Type *ptr)
 Enable UART TX Idle Line detection logic. More...
 
static void uart_disable_txline_idle_detection (UART_Type *ptr)
 Disable UART TX Idle Line detection logic. More...
 
hpm_stat_t uart_init_txline_idle_detection (UART_Type *ptr, uart_rxline_idle_config_t txidle_config)
 Configure UART TX Line detection. More...
 
static uint32_t uart_get_status (UART_Type *ptr)
 Get status. More...
 
static bool uart_check_status (UART_Type *ptr, uart_stat_t mask)
 Check uart status according to the given status mask. More...
 
void uart_default_config (UART_Type *ptr, uart_config_t *config)
 Get default config. More...
 
hpm_stat_t uart_init (UART_Type *ptr, uart_config_t *config)
 Initialization. More...
 
hpm_stat_t uart_send_byte (UART_Type *ptr, uint8_t c)
 Send one byte after checking thresh hold status. More...
 
hpm_stat_t uart_receive_byte (UART_Type *ptr, uint8_t *c)
 Receive one byte after checking data ready status. More...
 
hpm_stat_t uart_try_receive_byte (UART_Type *ptr, uint8_t *c)
 Try to receive one byte without checking data ready status. More...
 
void uart_set_signal_level (UART_Type *ptr, uart_signal_t signal, uart_signal_level_t level)
 Set uart signal output level. More...
 
hpm_stat_t uart_flush (UART_Type *ptr)
 Flush sending buffer/fifo. More...
 
hpm_stat_t uart_receive_data (UART_Type *ptr, uint8_t *buf, uint32_t size_in_byte)
 Receive bytes blocking. More...
 
hpm_stat_t uart_send_data (UART_Type *ptr, uint8_t *buf, uint32_t size_in_byte)
 Send bytes blocking. More...
 
hpm_stat_t uart_set_baudrate (UART_Type *ptr, uint32_t baudrate, uint32_t src_clock_hz)
 Sets UART baudrate. More...
 
void uart_config_transfer_trig_mode (UART_Type *ptr, uart_trig_config_t *config)
 uart configure transfer trigger mode More...
 
static void uart_software_trig_transfer (UART_Type *ptr)
 uart software trigger transmit More...
 
static void uart_enable_hardware_trig_transfer (UART_Type *ptr, bool enable)
 uart enable hardware trigger mode More...
 
static uint8_t uart_get_data_count_in_rx_fifo (UART_Type *ptr)
 UART get data count in rx fifo. More...
 
static uint8_t uart_get_data_count_in_tx_fifo (UART_Type *ptr)
 UART get data count in tx fifo. More...
 
static void uart_enable_9bit_transmit_mode (UART_Type *ptr, bool enable)
 uart enable 9bit transmit mode More...
 
static void uart_enable_address0_match (UART_Type *ptr, uint8_t addr)
 uart enable address0 match More...
 
static void uart_enable_address1_match (UART_Type *ptr, uint8_t addr)
 uart enable address1 match More...
 
static void uart_disable_address0_match (UART_Type *ptr)
 uart disable address0 match More...
 
static void uart_disable_address1_match (UART_Type *ptr)
 uart disable address1 match More...
 
static void uart_disable_address_match (UART_Type *ptr)
 uart disable address match(address0 and address1) More...
 
static bool uart_is_addr_match (UART_Type *ptr)
 Determine whether address match for 9bit mode. More...
 
static void uart_clear_addr_match_flag (UART_Type *ptr)
 Clear UART address match Flag. More...
 
static bool uart_is_addr_match_and_rxidle (UART_Type *ptr)
 Determine whether address match and rx idle for 9bit mode. More...
 
static void uart_clear_addr_match_and_rxidle_flag (UART_Type *ptr)
 Clear UART address match and rxidle Flag. More...
 
static bool uart_is_data_lost (UART_Type *ptr)
 Determine whether data lost for 9bit mode. More...
 
static void uart_clear_data_lost_flag (UART_Type *ptr)
 Clear UART data lost Flag. More...
 
static void uart_modem_write_rts_pin (UART_Type *ptr, uint8_t high)
 Write RTS level for uart modem mode. More...
 

Detailed Description

UART driver APIs.

Typedef Documentation

◆ num_of_stop_bits_t

◆ parity_setting_t

◆ uart_config_t

#include <drivers/inc/hpm_uart_drv.h>

UART config.

◆ uart_fifo_trg_lvl_t

◆ uart_intr_enable_t

◆ uart_intr_id_t

◆ uart_modem_config_t

#include <drivers/inc/hpm_uart_drv.h>

UART modem config.

◆ uart_modem_stat_t

◆ uart_rxline_idle_cond_t

#include <drivers/inc/hpm_uart_drv.h>

UART Idle detection conditions, suitable for RX and TX.

◆ uart_rxline_idle_config_t

#include <drivers/inc/hpm_uart_drv.h>

UART Idle config, suitable for RX and TX.

◆ uart_signal_level_t

◆ uart_signal_t

◆ uart_stat_t

◆ word_length_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <drivers/inc/hpm_uart_drv.h>

UART status.

Enumerator
status_uart_no_suitable_baudrate_parameter_found 

◆ hpm_uart_rxline_idle_cond

#include <drivers/inc/hpm_uart_drv.h>

UART Idle detection conditions, suitable for RX and TX.

Enumerator
uart_rxline_idle_cond_rxline_logic_one 

Treat as idle if the RX Line high duration exceeds threshold

uart_rxline_idle_cond_state_machine_idle 

Treat as idle if the RX state machine idle state duration exceeds threshold

◆ num_of_stop_bits

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
stop_bits_1 
stop_bits_1_5 
stop_bits_2 

◆ parity

enum parity

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
parity_none 
parity_odd 
parity_even 
parity_always_1 
parity_always_0 

◆ uart_fifo_trg_lvl

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
uart_fifo_1_byte 
uart_fifo_2_bytes 
uart_fifo_3_bytes 
uart_fifo_4_bytes 
uart_fifo_5_bytes 
uart_fifo_6_bytes 
uart_fifo_7_bytes 
uart_fifo_8_bytes 
uart_fifo_9_bytes 
uart_fifo_10_bytes 
uart_fifo_11_bytes 
uart_fifo_12_bytes 
uart_fifo_13_bytes 
uart_fifo_14_bytes 
uart_fifo_15_bytes 
uart_fifo_16_bytes 
uart_rx_fifo_trg_not_empty 
uart_rx_fifo_trg_gt_one_quarter 
uart_rx_fifo_trg_gt_half 
uart_rx_fifo_trg_gt_three_quarters 
uart_tx_fifo_trg_not_full 
uart_tx_fifo_trg_lt_three_quarters 
uart_tx_fifo_trg_lt_half 
uart_tx_fifo_trg_lt_one_quarter 

◆ uart_intr_enable

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
uart_intr_rx_data_avail_or_timeout 
uart_intr_tx_slot_avail 
uart_intr_rx_line_stat 
uart_intr_modem_stat 
uart_intr_rx_line_idle 
uart_intr_tx_line_idle 
uart_intr_addr_match 
uart_intr_addr_match_and_rxidle 
uart_intr_addr_datalost 

◆ uart_intr_id

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
uart_intr_id_modem_stat 
uart_intr_id_tx_slot_avail 
uart_intr_id_rx_data_avail 
uart_intr_id_rx_line_stat 
uart_intr_id_rx_timeout 

◆ uart_modem_stat

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
uart_modem_stat_cts 
uart_modem_stat_dcts_changed 

◆ uart_signal

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
uart_signal_rts 

◆ uart_signal_level

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
uart_signal_level_high 
uart_signal_level_low 

◆ uart_stat

enum uart_stat

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
uart_stat_data_ready 
uart_stat_overrun_error 
uart_stat_parity_error 
uart_stat_framing_error 
uart_stat_line_break 
uart_stat_tx_slot_avail 
uart_stat_transmitter_empty 
uart_stat_rx_fifo_error 

◆ word_length

#include <drivers/inc/hpm_uart_drv.h>

Enumerator
word_length_5_bits 
word_length_6_bits 
word_length_7_bits 
word_length_8_bits 

Function Documentation

◆ uart_check_modem_status()

static bool uart_check_modem_status ( UART_Type ptr,
uart_modem_stat_t  mask 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Check modem status with given mask.

Parameters
[in]ptrUART base address
maskStatus mask value to be checked against
Return values
trueif any bit in given mask is set
falseif none of any bit in given mask is set

◆ uart_check_status()

static bool uart_check_status ( UART_Type ptr,
uart_stat_t  mask 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Check uart status according to the given status mask.

Note
maybe clear other bits, such as PE/OE/LBREAK/ERRF bit. use uart_get_status API if you need to get these bits
Parameters
[in]ptrUART base address
maskStatus mask value to be checked against
Return values
trueif any bit in given mask is set
falseif none of any bit in given mask is set

◆ uart_clear_addr_match_and_rxidle_flag()

static void uart_clear_addr_match_and_rxidle_flag ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Clear UART address match and rxidle Flag.

Parameters
[in]ptrUART base address

◆ uart_clear_addr_match_flag()

static void uart_clear_addr_match_flag ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Clear UART address match Flag.

Parameters
[in]ptrUART base address

◆ uart_clear_data_lost_flag()

static void uart_clear_data_lost_flag ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Clear UART data lost Flag.

Parameters
[in]ptrUART base address

◆ uart_clear_rx_fifo()

static void uart_clear_rx_fifo ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart clear rx fifo by reading data

Note
read out all data in rx fifo, the uart_intr_rx_data_avail_or_timeout is cleared when RBR register is read
Parameters
[in]ptrUART base address

◆ uart_clear_rxline_idle_flag()

static void uart_clear_rxline_idle_flag ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Clear UART RX Line Idle Flag.

Parameters
[in]ptrUART base address

◆ uart_clear_txline_idle_flag()

static void uart_clear_txline_idle_flag ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Clear UART TX Line Idle Flag.

Parameters
[in]ptrUART base address

◆ uart_config_fifo_ctrl()

void uart_config_fifo_ctrl ( UART_Type ptr,
uart_fifo_ctrl_t ctrl 
)

#include <drivers/inc/hpm_uart_drv.h>

uart config fifo control

Note
fifo control register(FCR) is WO access, if support FCCR register, it is RW access.
Parameters
[in]ptrUART base address
[in]ctrluart_fifo_ctrl_t

◆ uart_config_transfer_trig_mode()

void uart_config_transfer_trig_mode ( UART_Type ptr,
uart_trig_config_t config 
)

#include <drivers/inc/hpm_uart_drv.h>

uart configure transfer trigger mode

This function can configure uart to send data in fifo after being triggered

Parameters
ptrUART base address
configuart_trig_config_t config

◆ uart_default_config()

void uart_default_config ( UART_Type ptr,
uart_config_t config 
)

#include <drivers/inc/hpm_uart_drv.h>

Get default config.

Parameters
[in]ptrUART base address
configPointer to the buffer to save default values

◆ uart_disable_address0_match()

static void uart_disable_address0_match ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart disable address0 match

Parameters
ptrUART base address

◆ uart_disable_address1_match()

static void uart_disable_address1_match ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart disable address1 match

Parameters
ptrUART base address

◆ uart_disable_address_match()

static void uart_disable_address_match ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart disable address match(address0 and address1)

Parameters
ptrUART base address

◆ uart_disable_irq()

static void uart_disable_irq ( UART_Type ptr,
uart_intr_enable_t  irq_mask 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Disable IRQ with mask.

Parameters
[in]ptrUART base address
irq_maskIRQ mask value to be disabled

◆ uart_disable_rxline_idle_detection()

static void uart_disable_rxline_idle_detection ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Disable UART RX Idle Line detection logic.

Parameters
[in]ptrUART base address

◆ uart_disable_txline_idle_detection()

static void uart_disable_txline_idle_detection ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Disable UART TX Idle Line detection logic.

Parameters
[in]ptrUART base address

◆ uart_enable_9bit_transmit_mode()

static void uart_enable_9bit_transmit_mode ( UART_Type ptr,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart enable 9bit transmit mode

Parameters
ptrUART base address
enabletrue for enable, false for disable

◆ uart_enable_address0_match()

static void uart_enable_address0_match ( UART_Type ptr,
uint8_t  addr 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart enable address0 match

Parameters
ptrUART base address
addraddress value

◆ uart_enable_address1_match()

static void uart_enable_address1_match ( UART_Type ptr,
uint8_t  addr 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart enable address1 match

Parameters
ptrUART base address
addraddress value

◆ uart_enable_hardware_trig_transfer()

static void uart_enable_hardware_trig_transfer ( UART_Type ptr,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart enable hardware trigger mode

This function enable hardware trigger the transfer, the transfer start when hardware event occured

Parameters
ptrUART base address
enabletrue for enable, false for disable

◆ uart_enable_irq()

static void uart_enable_irq ( UART_Type ptr,
uart_intr_enable_t  irq_mask 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Enable IRQ with mask.

Parameters
[in]ptrUART base address
irq_maskIRQ mask value to be enabled

◆ uart_enable_rx_function()

static void uart_enable_rx_function ( UART_Type ptr,
bool  enable 
)
inlinestatic

◆ uart_enable_rxline_idle_detection()

static void uart_enable_rxline_idle_detection ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Enable UART RX Idle Line detection logic.

Parameters
[in]ptrUART base address

◆ uart_enable_txline_idle_detection()

static void uart_enable_txline_idle_detection ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Enable UART TX Idle Line detection logic.

Parameters
[in]ptrUART base address

◆ uart_flush()

hpm_stat_t uart_flush ( UART_Type ptr)

#include <drivers/inc/hpm_uart_drv.h>

Flush sending buffer/fifo.

Parameters
[in]ptrUART base address
Return values
status_successonly if it succeeds

◆ uart_get_data_count_in_rx_fifo()

static uint8_t uart_get_data_count_in_rx_fifo ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

UART get data count in rx fifo.

Parameters
ptrUART base address
Return values
datacount

◆ uart_get_data_count_in_tx_fifo()

static uint8_t uart_get_data_count_in_tx_fifo ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

UART get data count in tx fifo.

Parameters
ptrUART base address
Return values
datacount

◆ uart_get_enabled_irq()

static uint32_t uart_get_enabled_irq ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Get Enabled IRQ.

Parameters
[in]ptrUART base address
Returns
enabled irq

◆ uart_get_fifo_size()

static uint8_t uart_get_fifo_size ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Get fifo size.

Parameters
[in]ptrUART base address
Return values
sizeof Fifo

◆ uart_get_irq_id()

static uint8_t uart_get_irq_id ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Get interrupt identification.

Parameters
[in]ptrUART base address
Return values
interruptid

◆ uart_get_modem_status()

static uint8_t uart_get_modem_status ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Get modem status.

Parameters
[in]ptrUART base address
Return values
Currentmodem status

◆ uart_get_status()

static uint32_t uart_get_status ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Get status.

Parameters
[in]ptrUART base address
Return values
currentstatus

◆ uart_init()

hpm_stat_t uart_init ( UART_Type ptr,
uart_config_t config 
)

#include <drivers/inc/hpm_uart_drv.h>

Initialization.

Parameters
[in]ptrUART base address
configPointer to config struct
Return values
status_successonly if it succeeds

◆ uart_init_rxline_idle_detection()

hpm_stat_t uart_init_rxline_idle_detection ( UART_Type ptr,
uart_rxline_idle_config_t  rxidle_config 
)

#include <drivers/inc/hpm_uart_drv.h>

Configure UART RX Line detection.

Parameters
[in]ptrUART base address
[in]rxidle_configRXLine IDLE detection configuration
Return values
status_successif no error occurs

◆ uart_init_txline_idle_detection()

hpm_stat_t uart_init_txline_idle_detection ( UART_Type ptr,
uart_rxline_idle_config_t  txidle_config 
)

#include <drivers/inc/hpm_uart_drv.h>

Configure UART TX Line detection.

Parameters
[in]ptrUART base address
[in]txidle_configTXLine IDLE detection configuration
Return values
status_successif no error occurs

◆ uart_is_addr_match()

static bool uart_is_addr_match ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Determine whether address match for 9bit mode.

Parameters
[in]ptrUART base address
Return values
falseif uart address is not match

◆ uart_is_addr_match_and_rxidle()

static bool uart_is_addr_match_and_rxidle ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Determine whether address match and rx idle for 9bit mode.

Parameters
[in]ptrUART base address
Return values
falseif uart address is not match and not rx idle

◆ uart_is_data_lost()

static bool uart_is_data_lost ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Determine whether data lost for 9bit mode.

Parameters
[in]ptrUART base address
Return values
falseif uart data is not lost

◆ uart_is_rxline_idle()

static bool uart_is_rxline_idle ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Determine whether UART RX Line is idle.

Parameters
[in]ptrUART base address
Return values
falseif uart RX line is not idle

◆ uart_is_txline_idle()

static bool uart_is_txline_idle ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Determine whether UART TX Line is idle.

Parameters
[in]ptrUART base address
Return values
falseif uart TX line is not idle

◆ uart_modem_config()

static void uart_modem_config ( UART_Type ptr,
uart_modem_config_t config 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Configure modem.

Parameters
[in]ptrUART base address
configPointer to modem config struct

◆ uart_modem_disable_auto_flow_control()

static void uart_modem_disable_auto_flow_control ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Disable modem auto flow control.

Parameters
[in]ptrUART base address

◆ uart_modem_disable_loopback()

static void uart_modem_disable_loopback ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Disable modem loopback.

Parameters
[in]ptrUART base address

◆ uart_modem_enable_auto_flow_control()

static void uart_modem_enable_auto_flow_control ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Enable modem auto flow control.

Parameters
[in]ptrUART base address

◆ uart_modem_enable_loopback()

static void uart_modem_enable_loopback ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Enable modem loopback.

Parameters
[in]ptrUART base address

◆ uart_modem_write_rts_pin()

static void uart_modem_write_rts_pin ( UART_Type ptr,
uint8_t  high 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Write RTS level for uart modem mode.

Parameters
[in]ptrUART base address
highRTS set to high when it is set to true

◆ uart_read_byte()

static uint8_t uart_read_byte ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Read byte from RX.

Parameters
ptrUART base address
Return values
RXbyte

◆ uart_receive_byte()

hpm_stat_t uart_receive_byte ( UART_Type ptr,
uint8_t *  c 
)

#include <drivers/inc/hpm_uart_drv.h>

Receive one byte after checking data ready status.

Parameters
[in]ptrUART base address
cPointer to buffer to save the byte received on UART
Return values
status_successonly if it succeeds

◆ uart_receive_data()

hpm_stat_t uart_receive_data ( UART_Type ptr,
uint8_t *  buf,
uint32_t  size_in_byte 
)

#include <drivers/inc/hpm_uart_drv.h>

Receive bytes blocking.

Parameters
[in]ptrUART base address
bufPointer to the buffer to save received data
size_in_byteSize in byte to be sent
Return values
status_successonly if it succeeds

◆ uart_reset_all_fifo()

static void uart_reset_all_fifo ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

[in] Reset both TX and RX Fifo

Parameters
[in]ptrUART base address

◆ uart_reset_rx_fifo()

static void uart_reset_rx_fifo ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Reset RX Fifo.

Parameters
[in]ptrUART base address

◆ uart_reset_tx_fifo()

static void uart_reset_tx_fifo ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Reset TX Fifo.

Parameters
[in]ptrUART base address

◆ uart_send_byte()

hpm_stat_t uart_send_byte ( UART_Type ptr,
uint8_t  c 
)

#include <drivers/inc/hpm_uart_drv.h>

Send one byte after checking thresh hold status.

Parameters
[in]ptrUART base address
cByte to be sent
Return values
status_successonly if it succeeds

◆ uart_send_data()

hpm_stat_t uart_send_data ( UART_Type ptr,
uint8_t *  buf,
uint32_t  size_in_byte 
)

#include <drivers/inc/hpm_uart_drv.h>

Send bytes blocking.

Parameters
[in]ptrUART base address
bufPointer to the buffer to be sent
size_in_byteSize in byte to be sent
Return values
status_successonly if it succeeds

◆ uart_set_baudrate()

hpm_stat_t uart_set_baudrate ( UART_Type ptr,
uint32_t  baudrate,
uint32_t  src_clock_hz 
)

#include <drivers/inc/hpm_uart_drv.h>

Sets UART baudrate.

This function configures the UART module baud rate. This function is used to update the UART module baud rate after the UART module is initialized by the uart_init.

Parameters
ptrUART base address
baudrateUART baudrate to be set
src_clock_hzUART clock source frequency in Hz.
Return values
status_uart_no_suitable_baudrate_parameter_foundBaudrate is not supported in the current clock source
status_successSet baudrate succeeded.

◆ uart_set_signal_level()

void uart_set_signal_level ( UART_Type ptr,
uart_signal_t  signal,
uart_signal_level_t  level 
)

#include <drivers/inc/hpm_uart_drv.h>

Set uart signal output level.

Parameters
[in]ptrUART base address
signalTarget signal
levelTarget signal level

◆ uart_software_trig_transfer()

static void uart_software_trig_transfer ( UART_Type ptr)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

uart software trigger transmit

This function immediately triggers the transfer, the transfer configed by uart_config_transfer_trig_mode()

Parameters
ptrUART base address

◆ uart_try_receive_byte()

hpm_stat_t uart_try_receive_byte ( UART_Type ptr,
uint8_t *  c 
)

#include <drivers/inc/hpm_uart_drv.h>

Try to receive one byte without checking data ready status.

Parameters
[in]ptrUART base address
cPointer to buffer to save the byte received on UART
Return values
status_successonly if it succeeds

◆ uart_write_byte()

static void uart_write_byte ( UART_Type ptr,
uint8_t  c 
)
inlinestatic

#include <drivers/inc/hpm_uart_drv.h>

Write byte to TX.

Parameters
ptrUART base address
cdata to be sent