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 SPI_TEST_H
10 #define SPI_TEST_H
11 
12 #include "platform_if.h"
13 
14 #ifdef __cplusplus
15 #if __cplusplus
16 extern "C" {
17 #endif
18 #endif /* __cplusplus */
19 
20 enum SpiTestCmd {
21     SPI_TRANSFER_TEST = 0,
22     SPI_MULTI_TRANSFER_TEST,
23     SPI_DMA_TRANSFER_TEST,
24     SPI_INT_TRANSFER_TEST,
25     SPI_RELIABILITY_TEST,
26     SPI_PERFORMANCE_TEST,
27     SPI_TEST_ALL,
28     SPI_TEST_CMD_MAX,
29 };
30 
31 struct SpiTestConfig {
32     uint32_t bus;
33     uint32_t cs;
34     uint32_t len;
35     uint8_t *wbuf;
36     uint8_t *rbuf;
37     uint32_t testDma;
38 };
39 
40 struct SpiTester {
41     struct SpiTestConfig config;
42     DevHandle handle;
43     uint16_t total;
44     uint16_t fails;
45 };
46 
47 int32_t SpiTestExecute(int cmd);
48 
49 #ifdef __cplusplus
50 #if __cplusplus
51 }
52 #endif
53 #endif /* __cplusplus */
54 
55 #endif /* SPI_TEST_H */
56