WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hal_uart_v151_regs_op.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
3 * Description: UART HAL Header.
4 *
5 * Create: 2023-02-17
6 */
7
8#ifndef HAL_UART_V151_REGS_OP_H
9#define HAL_UART_V151_REGS_OP_H
10
11#include "platform_core.h"
13#include "hal_uart.h"
14
22#define HAL_UART_ENABLE_FLAG_NONE 0
23#define HAL_UART_ENABLE_FLAG_RX (1U << 0)
24#define HAL_UART_ENABLE_FLAG_TX (1U << 1)
25#define HAL_UART_ENABLE_FLAG_CTS (1U << 2)
26#define HAL_UART_ENABLE_FLAG_RTS (1U << 3)
27
29
35
41
47
53
59
60// uart dma config
61typedef enum {
62 HAL_UART_DMA_DISABLE = 0, // diable tx and rx
63 HAL_UART_DMA_RX_EN = 1, // enable rx
64 HAL_UART_DMA_TX_EN = 2, // enable tx
65 HAL_UART_DMA_RX_DISABLE = 3, // diable rx
66 HAL_UART_DMA_TX_DISABLE = 4, // diable tx
68
69
82
91
92/* Uart stop bits modes available */
93typedef enum {
94 UART_STOP_BITS_1 = 0, /* !< 1 Stop bit */
95 UART_STOP_BITS_2 = 1, /* !< 2 Stop bits */
97
109
110#if defined(CONFIG_UART_SUPPORT_DMA)
111#define UART_INT_RTI HAL_UART_INTERRUPT_RX
112#define UART_INT_RXI HAL_UART_INTERRUPT_CHAR_TIMEOUT
113#define UARTIMSC 0
114void hal_uart_uartifls_set_rxiflsel(uart_bus_t bus, uint32_t val);
115void hal_uart_int_set(uart_bus_t bus, uint32_t reg, uint32_t int_id, uint32_t val);
116#endif
117
125
132
138volatile uint32_t *hal_uart_get_data_register(uart_bus_t uart);
139
145
153void hal_uart_set_baud_rate(uart_bus_t uart, uint32_t baud, uint32_t uart_clk);
154
161uint32_t hal_uart_get_baud_rate(uart_bus_t uart, uint32_t uart_clk);
162
169
176
183
189
196void hal_uart_enable_interrupt(uart_bus_t uart, hal_uart_interrupt_t interrupt_type, bool val);
197
204
211
218
224
230
238bool hal_uart_switch_trx(uart_bus_t uart, bool switch_trx);
239
245
251
257void hal_uart_check_en(uart_bus_t uart, bool val);
258
265
271void hal_uart_sir_mode_en(uart_bus_t uart, bool val);
272
278void hal_uart_tx_pause_en(uart_bus_t uart, bool val);
279
285void hal_uart_set_baud_div(uart_bus_t uart, uint8_t val);
286
292uint32_t hal_uart_get_baud_div(uart_bus_t uart);
293
294#if defined(CONFIG_UART_IP_VERSION_V151_PRO)
300void hal_uart_rx_en(uart_bus_t uart, bool val);
301
307void hal_uart_set_lp_req_en(uart_bus_t uart, bool val);
308#endif
309
316
323
330
337
344
350void hal_uart_set_dmaen(uart_bus_t bus, uint32_t val);
351
352static inline bool hal_uart_get_cpr_shadow(uart_bus_t uart)
353{
354 return ((uart_parameter_t)g_hal_uart_reg[uart]->uart_parameter).uart_parameter.shadow;
355}
356
357static inline uint16_t hal_uart_get_cpr_fifo_mode(uart_bus_t uart)
358{
359 return((uart_parameter_t)g_hal_uart_reg[uart]->uart_parameter).uart_parameter.fifo_depth;
360}
361
362static inline uint16_t hal_uart_get_cpr_afce_mode(uart_bus_t uart)
363{
364 return((uart_parameter_t)g_hal_uart_reg[uart]->uart_parameter).uart_parameter.afce_mode;
365}
366
367static inline uint16_t hal_uart_get_cpr_apb_data_width(uart_bus_t uart)
368{
369 return((uart_parameter_t)g_hal_uart_reg[uart]->uart_parameter).uart_parameter.apb_data_width;
370}
371
372static inline uint16_t hal_uart_get_cpr_dma_extra(uart_bus_t uart)
373{
374 return((uart_parameter_t)g_hal_uart_reg[uart]->uart_parameter).uart_parameter.dma_mode;
375}
376
380#endif
#define reg(base, offset)
Definition chip_io.h:178
uart_bus_t
UART bus.
Definition platform_core.h:198
#define UART_BUS_MAX_NUMBER
Definition platform_core.h:133
enum hal_uart_stop_bit hal_uart_stop_bit_t
UART停止位定义
enum hal_uart_data_bit hal_uart_data_bit_t
UART数据位定义
enum hal_uart_parity hal_uart_parity_t
UART奇偶校验位定义
void hal_uart_set_fifo_en(uart_bus_t uart, hal_uart_fifo_t fifo)
Sets FIFO enabled or not.
Definition hal_uart_v151.c:291
void hal_uart_set_parity(uart_bus_t uart, hal_uart_parity_t parity)
Sets the parity bits to use in the uart.
Definition hal_uart_v151.c:433
uint32_t hal_uart_get_error_status(uart_bus_t uart)
Returns a pointer to the error register to read from.
Definition hal_uart_v151.c:343
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.
Definition hal_uart_v151.c:419
void hal_uart_check_en(uart_bus_t uart, bool val)
Enable/disable uart parity check.
Definition hal_uart_v151.c:577
bool hal_uart_get_error_status_fram(uart_bus_t uart)
Get the frame error status
Definition hal_uart_v151.c:354
uart_err_info_index
Definition hal_uart_v151_regs_op.h:98
void hal_uart_disable_interrupt(uart_bus_t uart, hal_uart_interrupt_t interrupt_type)
Disables the uart interrupt type specified
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...
bool hal_uart_get_error_status_overrun(uart_bus_t uart)
Get the overrun error status
Definition hal_uart_v151.c:366
uart_reg_t * g_hal_uart_reg[UART_BUS_MAX_NUMBER]
Definition hal_uart_v151.c:66
hal_uart_line_error_interrupt_t
Definition hal_uart_v151_regs_op.h:84
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
Definition hal_uart_v151.c:320
void hal_uart_enable_interrupt(uart_bus_t uart, hal_uart_interrupt_t interrupt_type, bool val)
Enables the uart interrupt type specified
Definition hal_uart_v151.c:469
void hal_uart_set_baud_div(uart_bus_t uart, uint8_t val)
Sets the sample baud rate to use in the uart.
Definition hal_uart_v151.c:604
hal_uart_auto_flow_ctl_t
Definition hal_uart_v151_regs_op.h:43
hal_uart_interrupt_t
Definition hal_uart_v151_regs_op.h:71
hal_uart_sample_baud_rate_t
Definition hal_uart_v151_regs_op.h:49
uart_stop_bits_t
Definition hal_uart_v151_regs_op.h:93
uint32_t hal_uart_get_baud_div(uart_bus_t uart)
Returns the sample baud rate of the uart.
Definition hal_uart_v151.c:611
void hal_uart_clear_interrupt(uart_bus_t uart, hal_uart_interrupt_t interrupt_type)
Clears the uart interrupt type specified.
Definition hal_uart_v151.c:501
bool hal_uart_get_error_status_break(uart_bus_t uart)
Get the break error status
Definition hal_uart_v151.c:360
void hal_uart_uartifls_set_rxiflsel(uart_bus_t bus, uint32_t val)
Definition hal_uart_v151.c:752
void hal_uart_force_idle_isr(uart_bus_t uart)
Forces the pending excecution of the idle isr in an interrupt context.
Definition hal_uart_v151.c:571
void hal_uart_force_tx_isr(uart_bus_t uart)
Forces the pending excecution of the tx isr in an interrupt context.
Definition hal_uart_v151.c:565
hal_uart_ptim_mode_t
Definition hal_uart_v151_regs_op.h:37
uint32_t hal_uart_get_baud_rate(uart_bus_t uart, uint32_t uart_clk)
Reads the baud rate back from the registers
Definition hal_uart_v151.c:401
void hal_uart_parity_en(uart_bus_t uart, hal_uart_parity_t val)
Select uart odd/even parity check.
Definition hal_uart_v151.c:584
bool hal_uart_get_error_status_parity(uart_bus_t uart)
Get the parity error status
Definition hal_uart_v151.c:348
void hal_uart_set_dmaen(uart_bus_t bus, uint32_t val)
set uart dma_mode
Definition hal_uart_v151_regs_op.c:54
void hal_uart_int_set(uart_bus_t bus, uint32_t reg, uint32_t int_id, uint32_t val)
Definition hal_uart_v151.c:765
void hal_uart_tx_pause_en(uart_bus_t uart, bool val)
Enable/disable uart tx pause.
Definition hal_uart_v151.c:597
hal_uart_fifo_t
Definition hal_uart_v151_regs_op.h:31
hal_uart_dma_config_t
Definition hal_uart_v151_regs_op.h:61
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.
Definition hal_uart_v151.c:426
void hal_uart_isr(uart_bus_t uart)
Generic ISR for UARTs called from the specific handler.
void hal_uart_sir_mode_en(uart_bus_t uart, bool val)
Enable/disable uart sir mode.
Definition hal_uart_v151.c:591
void hal_uart_disable_uart(uart_bus_t uart)
Disables the uart.
Definition hal_uart_v151.c:509
volatile uint32_t * hal_uart_get_data_register(uart_bus_t uart)
Returns a pointer to the data register to write or read from.
Definition hal_uart_v151.c:338
uint32_t hal_uart_get_fifo_status(uart_bus_t uart)
Returns the raw fifo status of the uart.
Definition hal_uart_v151.c:560
hal_uart_low_power_req_t
Definition hal_uart_v151_regs_op.h:55
void hal_uart_set_baud_rate(uart_bus_t uart, uint32_t baud, uint32_t uart_clk)
Sets the baud rate.
Definition hal_uart_v151.c:379
void hal_uart_clear_pending(uart_bus_t uart)
Clear the pending status of the corresponding uart
@ UART_ERR_INFO_UARTRIS
Definition hal_uart_v151_regs_op.h:105
@ UART_ERR_INFO_UARTRSR
Definition hal_uart_v151_regs_op.h:104
@ UART_ERR_INFO_INT_FLAG
Definition hal_uart_v151_regs_op.h:106
@ UART_ERR_INFO_UARTFBRD
Definition hal_uart_v151_regs_op.h:102
@ UART_ERR_INFO_UARTCR
Definition hal_uart_v151_regs_op.h:100
@ UART_ERR_INFO_UARTIBRD
Definition hal_uart_v151_regs_op.h:101
@ UART_ERROR_MAX_INFO_NUM
Definition hal_uart_v151_regs_op.h:107
@ UART_ERR_INFO_UARTLCR_H
Definition hal_uart_v151_regs_op.h:99
@ UART_ERR_INFO_UARTDMACR
Definition hal_uart_v151_regs_op.h:103
@ HAL_UART_RX_FIFO_ERR
Definition hal_uart_v151_regs_op.h:85
@ HAL_UART_OVERRUN_ERR
Definition hal_uart_v151_regs_op.h:88
@ HAL_UART_BREAK_INTR
Definition hal_uart_v151_regs_op.h:89
@ HAL_UART_PARITY_ERR
Definition hal_uart_v151_regs_op.h:87
@ HAL_UART_FRAME_ERR
Definition hal_uart_v151_regs_op.h:86
@ HAL_UART_AUTO_FLOW_CTL_DISABLED
Definition hal_uart_v151_regs_op.h:44
@ HAL_UART_AUTO_FLOW_CTL_ENABLED
Definition hal_uart_v151_regs_op.h:45
@ HAL_UART_INTERRUPT_IDLE
Definition hal_uart_v151_regs_op.h:80
@ HAL_UART_INTERRUPT_CHAR_TIMEOUT
Definition hal_uart_v151_regs_op.h:78
@ HAL_UART_INTERRUPT_MODEM_STATUS
Definition hal_uart_v151_regs_op.h:72
@ HAL_UART_INTERRUPT_RECEIVER_LINE_STATUS
Definition hal_uart_v151_regs_op.h:76
@ HAL_UART_INTERRUPT_NO_INTERRUPT
Definition hal_uart_v151_regs_op.h:73
@ HAL_UART_INTERRUPT_ERROR
Definition hal_uart_v151_regs_op.h:79
@ HAL_UART_INTERRUPT_BUSY_DETECT
Definition hal_uart_v151_regs_op.h:77
@ HAL_UART_INTERRUPT_TX
Definition hal_uart_v151_regs_op.h:74
@ HAL_UART_INTERRUPT_RX
Definition hal_uart_v151_regs_op.h:75
@ HAL_UART_SAMPLE_BAUD_RATE_EIGHT
Definition hal_uart_v151_regs_op.h:50
@ HAL_UART_SAMPLE_BAUD_RATE_SIXTEEN
Definition hal_uart_v151_regs_op.h:51
@ UART_STOP_BITS_2
Definition hal_uart_v151_regs_op.h:95
@ UART_STOP_BITS_1
Definition hal_uart_v151_regs_op.h:94
@ HAL_UART_PTIM_MODE_DISABLED
Definition hal_uart_v151_regs_op.h:38
@ HAL_UART_PTIM_MODE_ENABLED
Definition hal_uart_v151_regs_op.h:39
@ HAL_UART_FIFO_DISABLED
Definition hal_uart_v151_regs_op.h:32
@ HAL_UART_FIFO_ENABLED
Definition hal_uart_v151_regs_op.h:33
@ HAL_UART_DMA_RX_EN
Definition hal_uart_v151_regs_op.h:63
@ HAL_UART_DMA_RX_DISABLE
Definition hal_uart_v151_regs_op.h:65
@ HAL_UART_DMA_TX_DISABLE
Definition hal_uart_v151_regs_op.h:66
@ HAL_UART_DMA_DISABLE
Definition hal_uart_v151_regs_op.h:62
@ HAL_UART_DMA_TX_EN
Definition hal_uart_v151_regs_op.h:64
@ HAL_UART_LOW_POWER_REQ_ENABLED
Definition hal_uart_v151_regs_op.h:57
@ HAL_UART_LOW_POWER_REQ_DISABLED
Definition hal_uart_v151_regs_op.h:56
Definition hal_uart_v151_regs_def.h:491
Definition hal_uart_v151_regs_def.h:433