1 Star 0 Fork 5.1K

xulinlin / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
uart_if-h.md 24.59 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

uart_if.h

Overview

Related Modules:

UART

Description:

Declares standard UART APIs.

Since:

1.0

Summary

Data Structures

Data Structure Name

Description

UartAttribute

Defines basic attributes of the UART port.

Macros

Macro Name and Value

Description

UART_ATTR_DATABIT_8   0

Indicates the UART word length, which is 8 data bits per frame.

UART_ATTR_DATABIT_7   1

Indicates the UART word length, which is 7 data bits per frame.

UART_ATTR_DATABIT_6   2

Indicates the UART word length, which is 6 data bits per frame.

UART_ATTR_DATABIT_5   3

Indicates the UART word length, which is 5 data bits per frame.

UART_ATTR_PARITY_NONE   0

Indicates that the UART device has no parity bit.

UART_ATTR_PARITY_ODD   1

Indicates that the UART device has an odd parity bit.

UART_ATTR_PARITY_EVEN   2

Indicates that the UART device has an even parity bit.

UART_ATTR_PARITY_MARK   3

Indicates that the parity bit is 1.

UART_ATTR_PARITY_SPACE   4

Indicates that the parity bit is 0.

UART_ATTR_STOPBIT_1   0

Indicates that the UART device has 1 stop bit.

UART_ATTR_STOPBIT_1P5   1

Indicates that the UART device has 1.5 stop bits.

UART_ATTR_STOPBIT_2   2

Indicates that the UART device has 2 stop bits.

UART_ATTR_RTS_DIS   0

Indicates that Request To Send (RTS) is disabled for the UART device.

UART_ATTR_RTS_EN   1

Indicates that RTS is enabled for the UART device.

UART_ATTR_CTS_DIS   0

Indicates that Clear To Send (CTS) is disabled for the UART device.

UART_ATTR_CTS_EN   1

Indicates that CTS is enabled for the UART device.

UART_ATTR_RX_FIFO_DIS   0

Indicates that First In First Out (FIFO) is disabled for the receiving UART.

UART_ATTR_RX_FIFO_EN   1

Indicates that FIFO is enabled for the receiving UART.

UART_ATTR_TX_FIFO_DIS   0

Indicates that FIFO is disabled for the transmitting UART.

UART_ATTR_TX_FIFO_EN   1

Indicates that FIFO is enabled for the transmitting UART.

Enumerations

Enumeration Name

Description

UartTransMode {   UART_MODE_RD_BLOCK = 0, UART_MODE_RD_NONBLOCK, UART_MODE_DMA_RX_EN, UART_MODE_DMA_RX_DIS,   UART_MODE_DMA_TX_EN, UART_MODE_DMA_TX_DIS }

Enumerates UART transmission modes.

Functions

Function Name

Description

UartOpen (uint32_t port)

struct DevHandle

Obtains the UART device handle.

UartClose (struct DevHandle *handle)

void 

Releases the UART device handle.

UartRead (struct DevHandle *handle, uint8_t *data, uint32_t size)

int32_t 

Reads data of a specified size from a UART device.

UartWrite (struct DevHandle *handle, uint8_t *data, uint32_t size)

int32_t 

Writes data of a specified size into a UART device.

UartGetBaud (struct DevHandle *handle, uint32_t *baudRate)

int32_t 

Obtains the baud rate of the UART device.

UartSetBaud (struct DevHandle *handle, uint32_t baudRate)

int32_t 

Sets the baud rate for the UART device.

UartGetAttribute (struct DevHandle *handle, struct UartAttribute *attribute)

int32_t 

Obtains the UART attribute.

UartSetAttribute (struct DevHandle *handle, struct UartAttribute *attribute)

int32_t 

Sets the UART attribute.

UartSetTransMode (struct DevHandle *handle, enum UartTransMode mode)

int32_t 

Sets the UART transmission mode.

Details

Macro Definition Documentation

UART_ATTR_CTS_DIS

#define UART_ATTR_CTS_DIS   0

Description:

Indicates that Clear To Send (CTS) is disabled for the UART device.

UART_ATTR_CTS_EN

#define UART_ATTR_CTS_EN   1

Description:

Indicates that CTS is enabled for the UART device.

UART_ATTR_DATABIT_5

#define UART_ATTR_DATABIT_5   3

Description:

Indicates the UART word length, which is 5 data bits per frame.

UART_ATTR_DATABIT_6

#define UART_ATTR_DATABIT_6   2

Description:

Indicates the UART word length, which is 6 data bits per frame.

UART_ATTR_DATABIT_7

#define UART_ATTR_DATABIT_7   1

Description:

Indicates the UART word length, which is 7 data bits per frame.

UART_ATTR_DATABIT_8

#define UART_ATTR_DATABIT_8   0

Description:

Indicates the UART word length, which is 8 data bits per frame.

UART_ATTR_PARITY_EVEN

#define UART_ATTR_PARITY_EVEN   2

Description:

Indicates that the UART device has an even parity bit.

UART_ATTR_PARITY_MARK

#define UART_ATTR_PARITY_MARK   3

Description:

Indicates that the parity bit is 1.

UART_ATTR_PARITY_NONE

#define UART_ATTR_PARITY_NONE   0

Description:

Indicates that the UART device has no parity bit.

UART_ATTR_PARITY_ODD

#define UART_ATTR_PARITY_ODD   1

Description:

Indicates that the UART device has an odd parity bit.

UART_ATTR_PARITY_SPACE

#define UART_ATTR_PARITY_SPACE   4

Description:

Indicates that the parity bit is 0.

UART_ATTR_RTS_DIS

#define UART_ATTR_RTS_DIS   0

Description:

Indicates that Request To Send (RTS) is disabled for the UART device.

UART_ATTR_RTS_EN

#define UART_ATTR_RTS_EN   1

Description:

Indicates that RTS is enabled for the UART device.

UART_ATTR_RX_FIFO_DIS

#define UART_ATTR_RX_FIFO_DIS   0

Description:

Indicates that First In First Out (FIFO) is disabled for the receiving UART.

UART_ATTR_RX_FIFO_EN

#define UART_ATTR_RX_FIFO_EN   1

Description:

Indicates that FIFO is enabled for the receiving UART.

UART_ATTR_STOPBIT_1

#define UART_ATTR_STOPBIT_1   0

Description:

Indicates that the UART device has 1 stop bit.

UART_ATTR_STOPBIT_1P5

#define UART_ATTR_STOPBIT_1P5   1

Description:

Indicates that the UART device has 1.5 stop bits.

UART_ATTR_STOPBIT_2

#define UART_ATTR_STOPBIT_2   2

Description:

Indicates that the UART device has 2 stop bits.

UART_ATTR_TX_FIFO_DIS

#define UART_ATTR_TX_FIFO_DIS   0

Description:

Indicates that FIFO is disabled for the transmitting UART.

UART_ATTR_TX_FIFO_EN

#define UART_ATTR_TX_FIFO_EN   1

Description:

Indicates that FIFO is enabled for the transmitting UART.

1
https://gitee.com/xulinl/docs.git
git@gitee.com:xulinl/docs.git
xulinl
docs
docs
master

搜索帮助