未验证 提交 3191bf2d 编写于 作者: O openharmony_ci 提交者: Gitee

!4009 【OpenHarmony开源贡献者计划2022】watchdog及UART英文相关格式及表达问题

Merge pull request !4009 from king_he/driver-1a
......@@ -2,13 +2,13 @@
## Overview<a name="section833012453535"></a>
- The Universal Asynchronous Receiver/Transmitter \(UART\) is a universal serial data bus used for asynchronous communication. It enables bi-directional communication between devices in full-duplex mode.
- UART is widely used to print information for debugging or to connect to various external modules such as GPS and Bluetooth.
- A UART is connected to other modules through two wires \(as shown in [Figure 1](#fig68294715408)\) or four wires \(as shown in [Figure 2](#fig179241542163112)\).
- TX: TX pin of the transmitting UART. It is connected to the RX pin of the peer UART.
- RX: RX pin of the receiving UART. It is connected to the TX pin of the peer UART.
- RTS: Request to Send signal pin. It is connected to the CTS pin of the peer UART and is used to indicate whether the local UART is ready to receive data.
- CTS: Clear to Send signal pin. It is connected to the RTS pin of the peer UART and is used to indicate whether the local UART is allowed to send data to the peer end.
The Universal Asynchronous Receiver/Transmitter \(UART\) is a universal serial data bus used for asynchronous communication. It enables bi-directional communication between devices in full-duplex mode.
UART is widely used to print information for debugging or to connect to various external modules such as GPS and Bluetooth.
A UART is connected to other modules through two wires \(as shown in [Figure 1](#fig68294715408)\) or four wires \(as shown in [Figure 2](#fig179241542163112)\).
- TX: TX pin of the transmitting UART. It is connected to the RX pin of the peer UART.
- RX: RX pin of the receiving UART. It is connected to the TX pin of the peer UART.
- RTS: Request to Send signal pin. It is connected to the CTS pin of the peer UART and is used to indicate whether the local UART is ready to receive data.
- CTS: Clear to Send signal pin. It is connected to the RTS pin of the peer UART and is used to indicate whether the local UART is allowed to send data to the peer end.
**Figure 1** 2-wire UART communication<a name="fig68294715408"></a>
![](figures/2-wire-uart-communication.png "2-wire-uart-communication")
......@@ -17,11 +17,13 @@
![](figures/4-wire-uart-communication.png "4-wire-uart-communication")
- The transmitting and receiving UARTs must ensure that they have the same settings on particular attributes such as the baud rate and data format \(start bit, data bit, parity bit, and stop bit\) before they start to communicate. During data transmission, a UART sends data to the peer end over the TX pin and receives data from the peer end over the RX pin. When the size of the buffer used by a UART for storing received data reaches the preset threshold, the RTS signal of the UART changes to **1** \(data cannot be received\), and the peer UART stops sending data to it because its CTS signal does not allow it to send data.
- The UART interface defines a set of common functions for operating a UART port, including obtaining and releasing device handles, reading and writing data of a specified length, and obtaining and setting the baud rate, as well as the device attributes.
The transmitting and receiving UARTs must ensure that they have the same settings on particular attributes such as the baud rate and data format \(start bit, data bit, parity bit, and stop bit\) before they start to communicate. During data transmission, a UART sends data to the peer end over the TX pin and receives data from the peer end over the RX pin. When the size of the buffer used by a UART for storing received data reaches the preset threshold, the RTS signal of the UART changes to **1** \(data cannot be received\), and the peer UART stops sending data to it because its CTS signal does not allow it to send data.
## Available APIs<a name="section1928742202715"></a>
The UART interface defines a set of common functions for operating a UART port, including obtaining and releasing device handles, reading and writing data of a specified length, and obtaining and setting the baud rate, as well as the device attributes.
**Table 1** APIs for the UART driver
<a name="table1731550155318"></a>
......@@ -94,7 +96,7 @@
</tbody>
</table>
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>![](../public_sys-resources/icon-note.gif) **NOTE**<br>
>All functions provided in this document can be called only in kernel space.
## Usage Guidelines<a name="section12779050105412"></a>
......@@ -656,4 +658,3 @@ _ERR:
UartClose(handle);
}
```
\ No newline at end of file
......@@ -178,13 +178,11 @@ The UART module adaptation involves the following steps:
- Initialize **UartHost**.
- Instantiate **UartHostMethod** in the **UartHost** object.
>![](../public_sys-resources/icon-note.gif) **NOTE**
For details, see [Available APIs](#available-apis).
>For details, see [Available APIs](#available-apis).
4. \(Optional\) Debug the driver.
4. Debug the driver.
- \(Optional\) For new drivers, verify the basic functions, such as the UART control status and response to interrupts.
For new drivers, verify the basic functions, such as the UART control status and response to interrupts.
## Development Example<a name="section774610224154520"></a>
......@@ -314,7 +312,7 @@ The following uses **uart\_hi35xx.c** as an example to present the contents th
#define UART_FLG_RD_BLOCK (1 << 2)
RecvNotify recv; // Pointer to the function that receives serial port data
struct UartOps *ops; // Custom function pointer structure. For details, see device/hisilicon/drivers/uart/uart_pl011.c.
void *private; // It stores the pointer to the start address of UartPl011Port for easy invocation.
void *private; // Pointer to the start address of UartPl011Port for easy invocation
};
// UartHost is the controller structure at the core layer. Its members are assigned with values by using the Init function.
......@@ -545,6 +543,3 @@ The following uses **uart\_hi35xx.c** as an example to present the contents th
host->priv = NULL;
}
```
\ No newline at end of file
......@@ -70,7 +70,7 @@ A watchdog, also called a watchdog timer, is a hardware timing device. If an err
</tbody>
</table>
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>![](../public_sys-resources/icon-note.gif) **NOTE**<br>
>All watchdog functions provided in this document can be called only in kernel mode.
## Usage Guidelines<a name="section10103184312813"></a>
......@@ -536,4 +536,3 @@ static int32_t TestCaseWatchdog(void)
return -1;
}
```
\ No newline at end of file
......@@ -127,13 +127,11 @@ The Watchdog module adaptation involves the following steps:
- Initialize **WatchdogCntlr**.
- Instantiate **WatchdogMethod** in the **WatchdogCntlr** object.
>![](../public_sys-resources/icon-note.gif) **NOTE**
For details, see [Available APIs](#available-apis).
>For details, see [Available APIs](#available-apis).
4. \(Optional\) Debug the driver.
4. Debug the driver.
- \(Optional\) For new drivers, verify basic functions, for example, verify the information returned after the connect operation and whether the watchdog timer is successfully set.
For new drivers, verify basic functions, for example, verify the information returned after the connect operation and whether the watchdog timer is successfully set.
## Development Example<a name="section1832270347160117"></a>
......@@ -358,6 +356,3 @@ The following uses **watchdog\_hi35xx.c** as an example to present the content
OsalMemFree(hwdt); // Release the memory occupied by the vendor-defined objects.
}
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册