TuyaOS
结构体 | 宏定义 | 类型定义 | 函数
tal_uart.h 文件参考

Common process - adapter the uart api provide by OS 更多...

#include "tuya_cloud_types.h"
tal_uart.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  TAL_UART_CFG_T
 

宏定义

#define O_ASYNC_WRITE   (1 << 1) /* 异步写 */
 
#define O_BLOCK   1 /* 阻塞读写 */
 
#define O_FLOW_CTRL   (1 << 2) /* 流控使能 */
 
#define O_RX_DMA   (1 << 4) /* 用DMA接收 */
 
#define O_TX_DMA   (1 << 3) /* 用DMA发送 */
 

类型定义

typedef VOID_T(* TAL_UART_IRQ_CB) (TUYA_UART_NUM_E port_id, VOID_T *buff, UINT16_T len)
 uart irq callback 更多...
 

函数

OPERATE_RET tal_uart_deinit (TUYA_UART_NUM_E port_id)
 deinit uart 更多...
 
OPERATE_RET tal_uart_init (TUYA_UART_NUM_E port_id, TAL_UART_CFG_T *cfg)
 init uart 更多...
 
INT_T tal_uart_read (TUYA_UART_NUM_E port_id, UINT8_T *data, UINT32_T len)
 read data from uart 更多...
 
VOID_T tal_uart_rx_reg_irq_cb (TUYA_UART_NUM_E port_id, TAL_UART_IRQ_CB rx_cb)
 enable uart rx interrupt and register interrupt callback func 更多...
 
INT_T tal_uart_write (TUYA_UART_NUM_E port_id, CONST UINT8_T *data, UINT32_T len)
 send data by uart 更多...
 

详细描述

Common process - adapter the uart api provide by OS

版本
0.1
日期
2021-08-24

类型定义说明

◆ TAL_UART_IRQ_CB

typedef VOID_T(* TAL_UART_IRQ_CB) (TUYA_UART_NUM_E port_id, VOID_T *buff, UINT16_T len)

uart irq callback

参数
[in]port_iduart port id, id index starts from 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[out]buffdata receive buff
[in]lenreceive length
返回
none

函数说明

◆ tal_uart_deinit()

OPERATE_RET tal_uart_deinit ( TUYA_UART_NUM_E  port_id)

deinit uart

参数
[in]port_iduart port id, id index starts from 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
注解
This API is used to deinit uart.
返回
the uart deinit result, 0, deinit success, other deinit error

◆ tal_uart_init()

OPERATE_RET tal_uart_init ( TUYA_UART_NUM_E  port_id,
TAL_UART_CFG_T cfg 
)

init uart

参数
[in]port_iduart port id, id index starts from 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]cfguart configure
注解
This API is used to init uart.
返回
the uart init result, 0, init success, other init error

◆ tal_uart_read()

INT_T tal_uart_read ( TUYA_UART_NUM_E  port_id,
UINT8_T *  data,
UINT32_T  len 
)

read data from uart

参数
[in]port_iduart port id, id index starts from 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]dataread data buffer
[in]lenthe read size
注解
This API is used to read data from uart.
返回
>=0, the read size; < 0, read error

◆ tal_uart_rx_reg_irq_cb()

VOID_T tal_uart_rx_reg_irq_cb ( TUYA_UART_NUM_E  port_id,
TAL_UART_IRQ_CB  rx_cb 
)

enable uart rx interrupt and register interrupt callback func

参数
[in]port_iduart port id, id index starts from 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]rx_cbreceive interrupt callback
返回
none

◆ tal_uart_write()

INT_T tal_uart_write ( TUYA_UART_NUM_E  port_id,
CONST UINT8_T *  data,
UINT32_T  len 
)

send data by uart

参数
[in]port_iduart port id, id index starts from 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]datasend data buffer
[in]lenthe send size
注解
This API is used to send data by uart.
返回
>=0, the write size; < 0, write error