1 /* 2 * Copyright (c) 2020-2022 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 GPIO_TEST_H 10 #define GPIO_TEST_H 11 12 #include "hdf_base.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 #define NAME_SIZE_MAX 100 19 20 int32_t GpioTestExecute(int cmd); 21 void GpioTestExecuteAll(void); 22 23 enum GpioTestCmd { 24 GPIO_TEST_SET_GET_DIR = 0, 25 GPIO_TEST_WRITE_READ = 1, 26 GPIO_TEST_IRQ_LEVEL = 2, 27 GPIO_TEST_IRQ_EDGE = 3, 28 GPIO_TEST_IRQ_THREAD = 4, 29 GPIO_TEST_GET_NUM_BY_NAME = 5, 30 GPIO_TEST_RELIABILITY = 6, 31 GPIO_TEST_PERFORMANCE = 7, 32 GPIO_TEST_MAX = 8, 33 }; 34 35 struct GpioTestConfig { 36 char testNameOne[NAME_SIZE_MAX]; 37 char testNameTwo[NAME_SIZE_MAX]; 38 uint16_t gpio; 39 uint16_t gpioTestTwo; 40 uint16_t gpioIrq; 41 uint16_t testUserApi; 42 }; 43 44 struct GpioTester { 45 struct GpioTestConfig cfg; 46 uint16_t oldDir; 47 uint16_t oldVal; 48 uint16_t irqCnt; 49 uint16_t total; 50 uint16_t fails; 51 uint32_t irqTimeout; 52 }; 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58 #endif /* GPIO_TEST_H */ 59