1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef UART_TEST_H
10 #define UART_TEST_H
11 
12 #include "uart_if.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17 
18 int32_t UartTestExecute(int cmd);
19 
20 enum UartTestCmd {
21     UART_TEST_CMD_WRITE = 0,
22     UART_TEST_CMD_READ = 1,
23     UART_TEST_CMD_SET_BAUD = 2,
24     UART_TEST_CMD_GET_BAUD = 3,
25     UART_TEST_CMD_SET_ATTRIBUTE = 4,
26     UART_TEST_CMD_GET_ATTRIBUTE = 5,
27     UART_TEST_CMD_SET_TRANSMODE = 6,
28     UART_TEST_CMD_RELIABILITY = 7,
29     UART_TEST_CMD_PERFORMANCE = 8,
30     UART_MINI_BLOCK_WRITE_TEST = 9,
31     UART_TEST_CMD_MAX = 10,
32 };
33 
34 struct UartTestConfig {
35     uint32_t port;
36     uint32_t len;
37     uint8_t *wbuf;
38     uint8_t *rbuf;
39 };
40 
41 struct UartTester {
42     struct UartTestConfig config;
43     DevHandle handle;
44     uint16_t total;
45     uint16_t fails;
46 };
47 
48 #ifdef __cplusplus
49 }
50 #endif /* __cplusplus */
51 
52 #endif /* UART_TEST_H */
53