WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
UART V151 Regs Operation

宏定义

#define HAL_UART_ENABLE_FLAG_NONE   0
 Bitmasks used to configure which UART features to enable in
 
#define HAL_UART_ENABLE_FLAG_RX   (1U << 0)
 
#define HAL_UART_ENABLE_FLAG_TX   (1U << 1)
 
#define HAL_UART_ENABLE_FLAG_CTS   (1U << 2)
 
#define HAL_UART_ENABLE_FLAG_RTS   (1U << 3)
 
#define UART_INT_RTI   HAL_UART_INTERRUPT_RX
 
#define UART_INT_RXI   HAL_UART_INTERRUPT_CHAR_TIMEOUT
 
#define UARTIMSC   0
 

枚举

enum  hal_uart_fifo_t { HAL_UART_FIFO_DISABLED , HAL_UART_FIFO_ENABLED }
 
enum  hal_uart_ptim_mode_t { HAL_UART_PTIM_MODE_DISABLED , HAL_UART_PTIM_MODE_ENABLED }
 
enum  hal_uart_auto_flow_ctl_t { HAL_UART_AUTO_FLOW_CTL_DISABLED , HAL_UART_AUTO_FLOW_CTL_ENABLED }
 
enum  hal_uart_sample_baud_rate_t { HAL_UART_SAMPLE_BAUD_RATE_EIGHT = 0x7 , HAL_UART_SAMPLE_BAUD_RATE_SIXTEEN = 0xf }
 
enum  hal_uart_low_power_req_t { HAL_UART_LOW_POWER_REQ_DISABLED , HAL_UART_LOW_POWER_REQ_ENABLED }
 
enum  hal_uart_dma_config_t {
  HAL_UART_DMA_DISABLE = 0 , HAL_UART_DMA_RX_EN = 1 , HAL_UART_DMA_TX_EN = 2 , HAL_UART_DMA_RX_DISABLE = 3 ,
  HAL_UART_DMA_TX_DISABLE = 4
}
 
enum  hal_uart_interrupt_t {
  HAL_UART_INTERRUPT_MODEM_STATUS = 0x0 , HAL_UART_INTERRUPT_NO_INTERRUPT = 0x1 , HAL_UART_INTERRUPT_TX = 0x2 , HAL_UART_INTERRUPT_RX = 0x4 ,
  HAL_UART_INTERRUPT_RECEIVER_LINE_STATUS = 0x6 , HAL_UART_INTERRUPT_BUSY_DETECT = 0x7 , HAL_UART_INTERRUPT_CHAR_TIMEOUT = 0xC , HAL_UART_INTERRUPT_ERROR ,
  HAL_UART_INTERRUPT_IDLE
}
 
enum  hal_uart_line_error_interrupt_t {
  HAL_UART_RX_FIFO_ERR = 0x1 , HAL_UART_FRAME_ERR = 0x2 , HAL_UART_PARITY_ERR = 0x4 , HAL_UART_OVERRUN_ERR = 0x8 ,
  HAL_UART_BREAK_INTR = 0x10
}
 
enum  uart_stop_bits_t { UART_STOP_BITS_1 = 0 , UART_STOP_BITS_2 = 1 }
 
enum  uart_err_info_index {
  UART_ERR_INFO_UARTLCR_H = 0 , UART_ERR_INFO_UARTCR = 1 , UART_ERR_INFO_UARTIBRD = 2 , UART_ERR_INFO_UARTFBRD = 3 ,
  UART_ERR_INFO_UARTDMACR = 4 , UART_ERR_INFO_UARTRSR = 5 , UART_ERR_INFO_UARTRIS = 6 , UART_ERR_INFO_INT_FLAG = 7 ,
  UART_ERROR_MAX_INFO_NUM
}
 

函数

void hal_uart_uartifls_set_rxiflsel (uart_bus_t bus, uint32_t val)
 
void hal_uart_int_set (uart_bus_t bus, uint32_t reg, uint32_t int_id, uint32_t val)
 
void hal_uart_set_fifo_en (uart_bus_t uart, hal_uart_fifo_t fifo)
 Sets FIFO enabled or not.
 
uint16_t hal_uart_get_rx_fifo_level (uart_bus_t uart)
 Obtains the RX FIFO trigger level in bytes, as configured by hal_uart_init_fifo
 
volatile uint32_t * hal_uart_get_data_register (uart_bus_t uart)
 Returns a pointer to the data register to write or read from.
 
uint32_t hal_uart_get_error_status (uart_bus_t uart)
 Returns a pointer to the error register to read from.
 
void hal_uart_set_baud_rate (uart_bus_t uart, uint32_t baud, uint32_t uart_clk)
 Sets the baud rate.
 
uint32_t hal_uart_get_baud_rate (uart_bus_t uart, uint32_t uart_clk)
 Reads the baud rate back from the registers
 
void hal_uart_set_data_bits (uart_bus_t uart, hal_uart_data_bit_t bits)
 Sets the data bits to use in the uart.
 
void hal_uart_set_stop_bits (uart_bus_t uart, hal_uart_stop_bit_t bits)
 Sets the data bits to use in the uart.
 
void hal_uart_set_parity (uart_bus_t uart, hal_uart_parity_t parity)
 Sets the parity bits to use in the uart.
 
void hal_uart_disable_uart (uart_bus_t uart)
 Disables the uart.
 
void hal_uart_enable_interrupt (uart_bus_t uart, hal_uart_interrupt_t interrupt_type, bool val)
 Enables the uart interrupt type specified
 
void hal_uart_disable_interrupt (uart_bus_t uart, hal_uart_interrupt_t interrupt_type)
 Disables the uart interrupt type specified
 
void hal_uart_clear_interrupt (uart_bus_t uart, hal_uart_interrupt_t interrupt_type)
 Clears the uart interrupt type specified.
 
uint32_t hal_uart_get_fifo_status (uart_bus_t uart)
 Returns the raw fifo status of the uart.
 
void hal_uart_force_tx_isr (uart_bus_t uart)
 Forces the pending excecution of the tx isr in an interrupt context.
 
void hal_uart_force_idle_isr (uart_bus_t uart)
 Forces the pending excecution of the idle isr in an interrupt context.
 
bool hal_uart_switch_trx (uart_bus_t uart, bool switch_trx)
 Switch the TRX of the specified UART, uart_l default value PIN50: rx; PIN51: tx. uart_h default value PIN36: tx; PIN37: rx. uart_m default value PIN30: tx; PIN31: rx.
 
void hal_uart_isr (uart_bus_t uart)
 Generic ISR for UARTs called from the specific handler.
 
void hal_uart_clear_pending (uart_bus_t uart)
 Clear the pending status of the corresponding uart
 
void hal_uart_check_en (uart_bus_t uart, bool val)
 Enable/disable uart parity check.
 
void hal_uart_parity_en (uart_bus_t uart, hal_uart_parity_t val)
 Select uart odd/even parity check.
 
void hal_uart_sir_mode_en (uart_bus_t uart, bool val)
 Enable/disable uart sir mode.
 
void hal_uart_tx_pause_en (uart_bus_t uart, bool val)
 Enable/disable uart tx pause.
 
void hal_uart_set_baud_div (uart_bus_t uart, uint8_t val)
 Sets the sample baud rate to use in the uart.
 
uint32_t hal_uart_get_baud_div (uart_bus_t uart)
 Returns the sample baud rate of the uart.
 
bool hal_uart_get_error_status_parity (uart_bus_t uart)
 Get the parity error status
 
bool hal_uart_get_error_status_fram (uart_bus_t uart)
 Get the frame error status
 
bool hal_uart_get_error_status_break (uart_bus_t uart)
 Get the break error status
 
bool hal_uart_get_error_status_overrun (uart_bus_t uart)
 Get the overrun error status
 
void hal_uart_set_dmaen (uart_bus_t bus, uint32_t val)
 set uart dma_mode
 

变量

uart_reg_tg_hal_uart_reg [UART_BUS_MAX_NUMBER]
 

详细描述

宏定义说明

◆ HAL_UART_ENABLE_FLAG_CTS

#define HAL_UART_ENABLE_FLAG_CTS   (1U << 2)

◆ HAL_UART_ENABLE_FLAG_NONE

#define HAL_UART_ENABLE_FLAG_NONE   0

Bitmasks used to configure which UART features to enable in

◆ HAL_UART_ENABLE_FLAG_RTS

#define HAL_UART_ENABLE_FLAG_RTS   (1U << 3)

◆ HAL_UART_ENABLE_FLAG_RX

#define HAL_UART_ENABLE_FLAG_RX   (1U << 0)

◆ HAL_UART_ENABLE_FLAG_TX

#define HAL_UART_ENABLE_FLAG_TX   (1U << 1)

◆ UART_INT_RTI

#define UART_INT_RTI   HAL_UART_INTERRUPT_RX

◆ UART_INT_RXI

#define UART_INT_RXI   HAL_UART_INTERRUPT_CHAR_TIMEOUT

◆ UARTIMSC

#define UARTIMSC   0

枚举类型说明

◆ hal_uart_auto_flow_ctl_t

Auto Flow Control Status

枚举值
HAL_UART_AUTO_FLOW_CTL_DISABLED 
HAL_UART_AUTO_FLOW_CTL_ENABLED 

◆ hal_uart_dma_config_t

枚举值
HAL_UART_DMA_DISABLE 
HAL_UART_DMA_RX_EN 
HAL_UART_DMA_TX_EN 
HAL_UART_DMA_RX_DISABLE 
HAL_UART_DMA_TX_DISABLE 

◆ hal_uart_fifo_t

FIFO Status

枚举值
HAL_UART_FIFO_DISABLED 
HAL_UART_FIFO_ENABLED 

◆ hal_uart_interrupt_t

Uart interrupt types

枚举值
HAL_UART_INTERRUPT_MODEM_STATUS 
HAL_UART_INTERRUPT_NO_INTERRUPT 
HAL_UART_INTERRUPT_TX 
HAL_UART_INTERRUPT_RX 
HAL_UART_INTERRUPT_RECEIVER_LINE_STATUS 
HAL_UART_INTERRUPT_BUSY_DETECT 
HAL_UART_INTERRUPT_CHAR_TIMEOUT 
HAL_UART_INTERRUPT_ERROR 
HAL_UART_INTERRUPT_IDLE 

◆ hal_uart_line_error_interrupt_t

Uart receiver line error interrupt types

枚举值
HAL_UART_RX_FIFO_ERR 
HAL_UART_FRAME_ERR 
HAL_UART_PARITY_ERR 
HAL_UART_OVERRUN_ERR 
HAL_UART_BREAK_INTR 

◆ hal_uart_low_power_req_t

Low power request enable

枚举值
HAL_UART_LOW_POWER_REQ_DISABLED 
HAL_UART_LOW_POWER_REQ_ENABLED 

◆ hal_uart_ptim_mode_t

Programmable THRE Interrupt Mode

枚举值
HAL_UART_PTIM_MODE_DISABLED 
HAL_UART_PTIM_MODE_ENABLED 

◆ hal_uart_sample_baud_rate_t

Sample baud rate

枚举值
HAL_UART_SAMPLE_BAUD_RATE_EIGHT 
HAL_UART_SAMPLE_BAUD_RATE_SIXTEEN 

◆ uart_err_info_index

枚举值
UART_ERR_INFO_UARTLCR_H 
UART_ERR_INFO_UARTCR 
UART_ERR_INFO_UARTIBRD 
UART_ERR_INFO_UARTFBRD 
UART_ERR_INFO_UARTDMACR 
UART_ERR_INFO_UARTRSR 
UART_ERR_INFO_UARTRIS 
UART_ERR_INFO_INT_FLAG 
UART_ERROR_MAX_INFO_NUM 

◆ uart_stop_bits_t

枚举值
UART_STOP_BITS_1 
UART_STOP_BITS_2 

函数说明

◆ hal_uart_check_en()

void hal_uart_check_en ( uart_bus_t  uart,
bool  val 
)

Enable/disable uart parity check.

参数
uartThe uart needs to be enable/disable uart parity check.
valTrue means enable uart parity check, false means disable.

◆ hal_uart_clear_interrupt()

void hal_uart_clear_interrupt ( uart_bus_t  uart,
hal_uart_interrupt_t  interrupt_type 
)

Clears the uart interrupt type specified.

参数
uartUart bus.
interrupt_typeUart interrupt type.

◆ hal_uart_clear_pending()

void hal_uart_clear_pending ( uart_bus_t  uart)

Clear the pending status of the corresponding uart

参数
uartThe uart needs to be clear pending.

◆ hal_uart_disable_interrupt()

void hal_uart_disable_interrupt ( uart_bus_t  uart,
hal_uart_interrupt_t  interrupt_type 
)

Disables the uart interrupt type specified

参数
uart
interrupt_type

◆ hal_uart_disable_uart()

void hal_uart_disable_uart ( uart_bus_t  uart)

Disables the uart.

参数
uartUart bus.

◆ hal_uart_enable_interrupt()

void hal_uart_enable_interrupt ( uart_bus_t  uart,
hal_uart_interrupt_t  interrupt_type,
bool  val 
)

Enables the uart interrupt type specified

参数
uartUart bus.
interrupt_typeUart interrupt type
valEnable or disable

◆ hal_uart_force_idle_isr()

void hal_uart_force_idle_isr ( uart_bus_t  uart)

Forces the pending excecution of the idle isr in an interrupt context.

参数
uartUart bus

◆ hal_uart_force_tx_isr()

void hal_uart_force_tx_isr ( uart_bus_t  uart)

Forces the pending excecution of the tx isr in an interrupt context.

参数
uartUart bus

◆ hal_uart_get_baud_div()

uint32_t hal_uart_get_baud_div ( uart_bus_t  uart)

Returns the sample baud rate of the uart.

参数
uart
返回
the sample baud rate of the uart.

◆ hal_uart_get_baud_rate()

uint32_t hal_uart_get_baud_rate ( uart_bus_t  uart,
uint32_t  uart_clk 
)

Reads the baud rate back from the registers

参数
uartThe Uart bus to read from
uart_clkUart clock.
返回
The current baud rate

◆ hal_uart_get_data_register()

volatile uint32_t * hal_uart_get_data_register ( uart_bus_t  uart)

Returns a pointer to the data register to write or read from.

参数
uartUart bus.
返回
data pointer.

◆ hal_uart_get_error_status()

uint32_t hal_uart_get_error_status ( uart_bus_t  uart)

Returns a pointer to the error register to read from.

Get the error status

返回
error register value.
参数
uartThe uart needs to get err status.
返回
Error status

◆ hal_uart_get_error_status_break()

bool hal_uart_get_error_status_break ( uart_bus_t  uart)

Get the break error status

参数
uartThe uart needs to get err status.
返回
True if there are break error, otherwise false

◆ hal_uart_get_error_status_fram()

bool hal_uart_get_error_status_fram ( uart_bus_t  uart)

Get the frame error status

参数
uartThe uart needs to get err status.
返回
True if there are frame error, otherwise false

◆ hal_uart_get_error_status_overrun()

bool hal_uart_get_error_status_overrun ( uart_bus_t  uart)

Get the overrun error status

参数
uartThe uart needs to get err status.
返回
True if there are overrun error, otherwise false

◆ hal_uart_get_error_status_parity()

bool hal_uart_get_error_status_parity ( uart_bus_t  uart)

Get the parity error status

参数
uartThe uart needs to get err status.
返回
True if there are parity error, otherwise false

◆ hal_uart_get_fifo_status()

uint32_t hal_uart_get_fifo_status ( uart_bus_t  uart)

Returns the raw fifo status of the uart.

参数
uart
返回
the raw fifo status of the uart.

◆ hal_uart_get_rx_fifo_level()

uint16_t hal_uart_get_rx_fifo_level ( uart_bus_t  uart)

Obtains the RX FIFO trigger level in bytes, as configured by hal_uart_init_fifo

参数
uartUart bus.
返回
The currently configured FIFO trigger level

◆ hal_uart_int_set()

void hal_uart_int_set ( uart_bus_t  bus,
uint32_t  reg,
uint32_t  int_id,
uint32_t  val 
)

◆ hal_uart_isr()

void hal_uart_isr ( uart_bus_t  uart)

Generic ISR for UARTs called from the specific handler.

参数
uartUart that triggered the interrupt

◆ hal_uart_parity_en()

void hal_uart_parity_en ( uart_bus_t  uart,
hal_uart_parity_t  val 
)

Select uart odd/even parity check.

参数
uartThe uart needs to be enable/disable uart parity check.
valSelected parity check mods.

◆ hal_uart_set_baud_div()

void hal_uart_set_baud_div ( uart_bus_t  uart,
uint8_t  val 
)

Sets the sample baud rate to use in the uart.

参数
uartUart bus.
valSample baud rate.

◆ hal_uart_set_baud_rate()

void hal_uart_set_baud_rate ( uart_bus_t  uart,
uint32_t  baud,
uint32_t  uart_clk 
)

Sets the baud rate.

参数
uartUart bus.
baudBaud rate.
uart_clkUart clock.
返回
error code

◆ hal_uart_set_data_bits()

void hal_uart_set_data_bits ( uart_bus_t  uart,
hal_uart_data_bit_t  bits 
)

Sets the data bits to use in the uart.

参数
uartUart bus.
bitsData bits.

◆ hal_uart_set_dmaen()

void hal_uart_set_dmaen ( uart_bus_t  bus,
uint32_t  val 
)

set uart dma_mode

参数
busThe uart needs to set dma
val0x0 dma extra diabled, 0x1 dma extra enbale

◆ hal_uart_set_fifo_en()

void hal_uart_set_fifo_en ( uart_bus_t  uart,
hal_uart_fifo_t  fifo 
)

Sets FIFO enabled or not.

参数
uartUart bus.
fifoFIFO state.
返回
None.

◆ hal_uart_set_parity()

void hal_uart_set_parity ( uart_bus_t  uart,
hal_uart_parity_t  parity 
)

Sets the parity bits to use in the uart.

参数
uartUart bus.
parityParity bits.

◆ hal_uart_set_stop_bits()

void hal_uart_set_stop_bits ( uart_bus_t  uart,
hal_uart_stop_bit_t  bits 
)

Sets the data bits to use in the uart.

参数
uartUart bus.
bitsData bits.

◆ hal_uart_sir_mode_en()

void hal_uart_sir_mode_en ( uart_bus_t  uart,
bool  val 
)

Enable/disable uart sir mode.

参数
uartThe uart needs to be enable/disable uart sir mode.
valTrue means enable uart sir mode, false means disable.

◆ hal_uart_switch_trx()

bool hal_uart_switch_trx ( uart_bus_t  uart,
bool  switch_trx 
)

Switch the TRX of the specified UART, uart_l default value PIN50: rx; PIN51: tx. uart_h default value PIN36: tx; PIN37: rx. uart_m default value PIN30: tx; PIN31: rx.

参数
uartThe uart to switch.
switch_trxfalse: the default uart trx status; true: reverse the uart trx status.
返回
The result of switched. true: switch the trx; false: switch to default value.

◆ hal_uart_tx_pause_en()

void hal_uart_tx_pause_en ( uart_bus_t  uart,
bool  val 
)

Enable/disable uart tx pause.

参数
uartThe uart needs to be enable/disable uart tx pause.
valTrue means enable uart tx pause, false means disable.

◆ hal_uart_uartifls_set_rxiflsel()

void hal_uart_uartifls_set_rxiflsel ( uart_bus_t  bus,
uint32_t  val 
)

变量说明

◆ g_hal_uart_reg

uart_reg_t* g_hal_uart_reg[UART_BUS_MAX_NUMBER]
extern

Base addresses of all UARTS supported by the core