|
| errcode_t | uapi_uart_init (uart_bus_t bus, const uart_pin_config_t *pins, const uart_attr_t *attr, const uart_extra_attr_t *extra_attr, uart_buffer_config_t *uart_buffer_config) |
| | 初始化指定的串口。
|
| |
| errcode_t | uapi_uart_deinit (uart_bus_t bus) |
| | 去初始化指定的串口。
|
| |
| errcode_t | uapi_uart_set_attr (uart_bus_t bus, const uart_attr_t *attr) |
| | 设置串口的基础配置参数。
|
| |
| errcode_t | uapi_uart_get_attr (uart_bus_t bus, const uart_attr_t *attr) |
| | 获取串口的基础配置参数。
|
| |
| bool | uapi_uart_has_pending_transmissions (uart_bus_t bus) |
| | 判断是否存在正在等待的传输。
|
| |
| bool | uapi_uart_rx_fifo_is_empty (uart_bus_t bus) |
| | 判断RX FIFO是否为空。
|
| |
| bool | uapi_uart_tx_fifo_is_empty (uart_bus_t bus) |
| | 判断TX FIFO是否为空。
|
| |
| errcode_t | uapi_uart_register_rx_callback (uart_bus_t bus, uart_rx_condition_t condition, uint32_t size, uart_rx_callback_t callback) |
| | 注册接收回调函数,这个回调函数会根据触发条件和Size触发。
|
| |
| void | uapi_uart_unregister_rx_callback (uart_bus_t bus) |
| | 去注册接收回调函数。
|
| |
| errcode_t | uapi_uart_register_parity_error_callback (uart_bus_t bus, uart_error_callback_t callback) |
| | 注册奇偶校验错误处理的回调函数。
|
| |
| errcode_t | uapi_uart_register_frame_error_callback (uart_bus_t bus, uart_error_callback_t callback) |
| | 注册帧错误处理回调函数。
|
| |
| errcode_t | uapi_uart_register_overrun_error_callback (uart_bus_t bus, uart_error_callback_t callback) |
| | 注册溢出错误处理回调函数。
|
| |
| int32_t | uapi_uart_write (uart_bus_t bus, const uint8_t *buffer, uint32_t length, uint32_t timeout) |
| | 将数据发送到已经打开的UART上,使用直接发送的方式。
|
| |
| errcode_t | uapi_uart_write_int (uart_bus_t bus, const uint8_t *buffer, uint32_t length, void *params, uart_tx_callback_t finished_with_buffer_func) |
| | 使用中断模式将数据发送到已经打开的UART上,当数据发送完成,会调用回调函数。
|
| |
| int32_t | uapi_uart_write_by_dma (uart_bus_t bus, const void *buffer, uint32_t length, uart_write_dma_config_t *dma_cfg) |
| | 通过DMA发送数据。
|
| |
| int32_t | uapi_uart_read_by_dma (uart_bus_t bus, const void *buffer, uint32_t length, uart_write_dma_config_t *dma_cfg) |
| | 通过DMA读取数据。
|
| |
| int32_t | uapi_uart_read (uart_bus_t bus, const uint8_t *buffer, uint32_t length, uint32_t timeout) |
| | 从UART读取数据。
|
| |
| errcode_t | uapi_uart_flush_rx_data (uart_bus_t bus) |
| | 刷新UART接收Buffer中的数据。
|
| |
| errcode_t | uapi_uart_update_rx_buff (uart_bus_t bus, uint8_t *rx_buffer, uint16_t rx_buffer_size) |
| | 更新UART接收Buffer的地址和长度。
|
| |
| errcode_t | uapi_uart_suspend (uintptr_t arg) |
| | 挂起所有的UART通道。
|
| |
| errcode_t | uapi_uart_resume (uintptr_t arg) |
| | 恢复所有的UART通道。
|
| |
Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved.
Description: Provides UART driver api
History:
2022-06-01, Create file.
◆ UART_RX_CONDITION_MASK_FULL
| #define UART_RX_CONDITION_MASK_FULL 4 |
◆ UART_RX_CONDITION_MASK_IDLE
| #define UART_RX_CONDITION_MASK_IDLE 1 |
◆ UART_RX_CONDITION_MASK_SUFFICIENT_DATA
| #define UART_RX_CONDITION_MASK_SUFFICIENT_DATA 2 |
◆ uart_attr_t
◆ uart_buffer_config_t
◆ uart_data_bit_t
◆ uart_error_callback_t
| typedef void(* uart_error_callback_t) (uint32_t *err_info, uint32_t len) |
UART错误处理回调函数,通过uapi_uart_register_frame_error_callback注册到驱动中。
◆ uart_extra_attr_t
◆ uart_flow_ctrl_t
◆ uart_parity_t
◆ uart_pin_config_t
◆ uart_rx_callback_t
| typedef void(* uart_rx_callback_t) (const void *buffer, uint16_t length, bool error) |
◆ uart_rx_condition_t
◆ uart_stop_bit_t
◆ uart_tx_callback_t
| typedef void(* uart_tx_callback_t) (const void *buffer, uint32_t length, const void *params) |
◆ uart_write_dma_config_t
◆ uart_rx_condition
UART在数据接收的时候触发回调的条件定义。
| 枚举值 |
|---|
| UART_RX_CONDITION_FULL_OR_IDLE | 如果数据接收暂停,或者接收缓存已经满了,就触发数据接收回调,
在接收回调处理过程中接收到的UART数据,会直接丢弃。
|
| UART_RX_CONDITION_FULL_OR_SUFFICIENT_DATA | 如果接收缓存已满,或者接收的数据量到达指定的数据长度,就触发数据接收回调,
在接收回调处理过程中接收到的UART数据,会直接丢弃。 如果存在接收数据的积压数据,则可以向回调提供超过请求的数据。
|
| UART_RX_CONDITION_FULL_OR_SUFFICIENT_DATA_OR_IDLE | 如果接收缓存已满,或者接收的数据量到达指定的数据长度,或者接收数据暂停,就触发数据接收回调,
在接收回调处理过程中接收到的UART数据,会直接丢弃。
|
◆ uapi_uart_deinit()
◆ uapi_uart_flush_rx_data()
◆ uapi_uart_get_attr()
◆ uapi_uart_has_pending_transmissions()
| bool uapi_uart_has_pending_transmissions |
( |
uart_bus_t |
bus | ) |
|
◆ uapi_uart_init()
◆ uapi_uart_read()
| int32_t uapi_uart_read |
( |
uart_bus_t |
bus, |
|
|
const uint8_t * |
buffer, |
|
|
uint32_t |
length, |
|
|
uint32_t |
timeout |
|
) |
| |
◆ uapi_uart_read_by_dma()
◆ uapi_uart_register_frame_error_callback()
◆ uapi_uart_register_overrun_error_callback()
◆ uapi_uart_register_parity_error_callback()
◆ uapi_uart_register_rx_callback()
注册接收回调函数,这个回调函数会根据触发条件和Size触发。
◆ uapi_uart_resume()
◆ uapi_uart_rx_fifo_is_empty()
◆ uapi_uart_set_attr()
◆ uapi_uart_suspend()
◆ uapi_uart_tx_fifo_is_empty()
◆ uapi_uart_unregister_rx_callback()
| void uapi_uart_unregister_rx_callback |
( |
uart_bus_t |
bus | ) |
|
◆ uapi_uart_update_rx_buff()
| errcode_t uapi_uart_update_rx_buff |
( |
uart_bus_t |
bus, |
|
|
uint8_t * |
rx_buffer, |
|
|
uint16_t |
rx_buffer_size |
|
) |
| |
◆ uapi_uart_write()
| int32_t uapi_uart_write |
( |
uart_bus_t |
bus, |
|
|
const uint8_t * |
buffer, |
|
|
uint32_t |
length, |
|
|
uint32_t |
timeout |
|
) |
| |
将数据发送到已经打开的UART上,使用直接发送的方式。
◆ uapi_uart_write_by_dma()
◆ uapi_uart_write_int()
使用中断模式将数据发送到已经打开的UART上,当数据发送完成,会调用回调函数。