XWOS API
4.0
XWOS C/C++ API参考手册
|
玄武设备栈:UART控制器 更多...
#include <xwcd/ds/standard.h>
#include <xwos/lib/xwbop.h>
#include <xwos/osal/lock/spinlock.h>
#include <xwos/osal/sync/sem.h>
#include <xwos/osal/lock/mtx.h>
#include <xwcd/ds/device.h>
#include <xwcd/ds/soc/dma.h>
结构体 | |
struct | xwds_uart_cfg |
UART配置 更多... | |
struct | xwds_uartc_driver |
BSP中需要提供的UART控制器驱动函数表 更多... | |
struct | xwds_uartc |
UART控制器 更多... | |
宏定义 | |
#define | XWDS_UART_RXQ_SIZE XWCDCFG_ds_UART_RXQ_SIZE |
类型定义 | |
typedef void(* | xwds_uartc_eqcb_f) (struct xwds_uartc *, xwer_t) |
异步发送的回调函数类型 | |
枚举 | |
enum | xwds_uart_bits_em { XWDS_UART_BITS_5 = 0U , XWDS_UART_BITS_6 , XWDS_UART_BITS_7 , XWDS_UART_BITS_8 , XWDS_UART_BITS_9 } |
UART字长枚举 更多... | |
enum | xwds_uart_stopbits_em { XWDS_UART_STOPBITS_0_5 = 0U , XWDS_UART_STOPBITS_1_0 , XWDS_UART_STOPBITS_1_5 , XWDS_UART_STOPBITS_2_0 } |
UART停止位枚举 更多... | |
enum | xwds_uart_parity_em { XWDS_UART_PARITY_NONE = 0U , XWDS_UART_PARITY_EVEN , XWDS_UART_PARITY_ODD } |
UART奇偶校验枚举 更多... | |
enum | xwds_uart_hardwareflowcontrol_em { XWDS_UART_HFC_NONE = 0U , XWDS_UART_HFC_RTS = ((xwbmp_t)1 << ( 0 )) , XWDS_UART_HFC_CTS = ((xwbmp_t)1 << ( 1 )) } |
UART硬件流控枚举 更多... | |
enum | xwds_uart_mode_em { XWDS_UART_MODE_CLOSE = 0U , XWDS_UART_MODE_TX = ((xwbmp_t)1 << ( 0 )) , XWDS_UART_MODE_RX = ((xwbmp_t)1 << ( 1 )) } |
UART模式枚举 更多... | |
函数 | |
void | xwds_uartc_construct (struct xwds_uartc *uartc) |
XWDS API:UART控制器的构造函数 | |
void | xwds_uartc_destruct (struct xwds_uartc *uartc) |
XWDS API:UART控制器对象的析构函数 | |
xwer_t | xwds_uartc_grab (struct xwds_uartc *uartc) |
增加对象的引用计数 | |
xwer_t | xwds_uartc_put (struct xwds_uartc *uartc) |
减少对象的引用计数 | |
xwer_t | xwds_uartc_rx (struct xwds_uartc *uartc, xwu8_t *buf, xwsz_t *size, xwtm_t to) |
XWDS API:从接收队列中获取数据 | |
xwer_t | xwds_uartc_try_rx (struct xwds_uartc *uartc, xwu8_t *buf, xwsz_t *size) |
XWDS API:尝试从接收队列中获取数据 | |
xwer_t | xwds_uartc_tx (struct xwds_uartc *uartc, const xwu8_t *data, xwsz_t *size, xwtm_t to) |
XWDS API:同步发送 | |
xwer_t | xwds_uartc_eq (struct xwds_uartc *uartc, const xwu8_t *data, xwsz_t *size, xwds_uartc_eqcb_f cb) |
XWDS API:异步发送 | |
xwer_t | xwds_uartc_putc (struct xwds_uartc *uartc, const xwu8_t byte, xwtm_t to) |
XWDS API:直接发送一个字节(非DMA模式) | |
xwer_t | xwds_uartc_cfg (struct xwds_uartc *uartc, const struct xwds_uart_cfg *cfg) |
XWDS API:配置UART | |
static bool | xwds_uart_tst_baudrate (xwu32_t baudrate) |
测试UART波特率是否合法 | |
void | xwds_uartc_drvcb_rxq_flush (struct xwds_uartc *uartc) |
XWDS Driver Callback:清空接收队列 | |
xwsq_t | xwds_uartc_drvcb_rxq_fill (struct xwds_uartc *uartc, xwu8_t bytes[], xwsz_t size) |
XWDS Driver Callback:从UART硬件接收数据到缓冲区 | |
void | xwds_uartc_drvcb_rxq_pub (struct xwds_uartc *uartc, xwsq_t tail) |
XWDS Driver Callback:发布数据到接收队列 | |
玄武设备栈:UART控制器
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
在文件 controller.h 中定义.