Common process - adapter the uart api provide by OS
更多...
#include "tuya_cloud_types.h"
浏览源代码.
|
|
#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 更多...
|
| |
Common process - adapter the uart api provide by OS
- 版本
- 0.1
- 日期
- 2021-08-24
- 版权所有
- Copyright 2021-2025 Tuya Inc. All Rights Reserved.
◆ 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_id | uart 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] | buff | data receive buff |
| [in] | len | receive length |
- 返回
- none
◆ tal_uart_deinit()
| OPERATE_RET tal_uart_deinit |
( |
TUYA_UART_NUM_E |
port_id | ) |
|
deinit uart
- 参数
-
| [in] | port_id | uart 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_id | uart 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] | cfg | uart 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_id | uart 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] | data | read data buffer |
| [in] | len | the 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_id | uart 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_cb | receive 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_id | uart 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] | data | send data buffer |
| [in] | len | the send size |
- 注解
- This API is used to send data by uart.
- 返回
- >=0, the write size; < 0, write error