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 I2C_TEST_H 10 #define I2C_TEST_H 11 12 #include "i2c_if.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 int32_t I2cTestExecute(int cmd); 19 void I2cTestExecuteAll(void); 20 21 enum I2cTestCmd { 22 I2C_TEST_CMD_TRANSFER = 0, 23 I2C_TEST_CMD_MULTI_THREAD = 1, 24 I2C_TEST_CMD_RELIABILITY = 2, 25 I2C_TEST_CMD_PERFORMANCE = 3, 26 I2C_TEST_CMD_SETUP_ALL = 4, 27 I2C_TEST_CMD_TEARDOWN_ALL = 5, 28 I2C_TEST_CMD_SETUP_SINGLE = 6, 29 I2C_TEST_CMD_TEARDOWN_SINGLE = 7, 30 I2C_MINI_WRITE_READ_TEST = 8, 31 I2C_TEST_CMD_MAX = 9, 32 }; 33 34 struct I2cTestConfig { 35 uint16_t busNum; 36 uint16_t devAddr; 37 uint16_t regAddr; 38 uint16_t regLen; 39 uint16_t bufSize; 40 }; 41 42 struct I2cTester { 43 struct I2cTestConfig config; 44 DevHandle handle; 45 uint16_t total; 46 uint16_t fails; 47 }; 48 #ifdef __cplusplus 49 } 50 #endif 51 #endif /* I2C_TEST_H */ 52