1 /* 2 * Copyright (c) 2020-2023 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 HDF_UHDF_TEST_H 10 #define HDF_UHDF_TEST_H 11 12 #include "hdf_base.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif /* __cplusplus */ 17 18 #define HDF_TEST_SERVICE_NAME "khdf_ut" 19 #define CHECK_TEST_NULL_PTR_RETURN(ptr) \ 20 do { \ 21 if ((ptr) == NULL) { \ 22 printf("pointer is null and return\n\r"); \ 23 return HDF_FAILURE; \ 24 } \ 25 } while (0) 26 27 struct HdfTestMsg { 28 uint16_t cmd; // submodule command 29 uint8_t subCmd; // test case command 30 int8_t result; 31 }; 32 33 // two hundred values allocated per submodule 34 enum HdfTestSubModuleCmd { 35 TEST_PAL_I2C_TYPE = 0, 36 TEST_PAL_SPI_TYPE = 1, 37 TEST_PAL_GPIO_TYPE = 2, 38 TEST_PAL_PIN_TYPE = 3, 39 TEST_PAL_CLOCK_TYPE = 4, 40 TEST_PAL_REGULATOR_TYPE = 5, 41 TEST_PAL_MIPI_DSI_TYPE = 6, 42 TEST_PAL_UART_TYPE = 7, 43 TEST_PAL_SDIO_TYPE = 8, 44 TEST_PAL_MDIO_TYPE = 9, 45 TEST_PAL_APB_TYPE = 10, 46 TEST_PAL_PCIE_TYPE = 11, 47 TEST_PAL_PCM_TYPE = 12, 48 TEST_PAL_I2S_TYPE = 13, 49 TEST_PAL_PWM_TYPE = 14, 50 TEST_PAL_DMA_TYPE = 15, 51 TEST_PAL_EFUSE_TYPE = 16, 52 TEST_PAL_FLASH_TYPE = 17, 53 TEST_PAL_EMMC_TYPE = 18, 54 TEST_PAL_RTC_TYPE = 19, 55 TEST_PAL_ADC_TYPE = 20, 56 TEST_PAL_WDT_TYPE = 21, 57 TEST_PAL_I3C_TYPE = 22, 58 TEST_PAL_MIPI_CSI_TYPE = 23, 59 TEST_PAL_DAC_TYPE = 24, 60 TEST_PAL_TIMER_TYPE = 25, 61 TEST_PAL_CAN_TYPE = 26, 62 TEST_PAL_MANAGER_TYPE = 194, 63 TEST_PAL_DEVICE_TYPE = 195, 64 TEST_PAL_QUEUE_TYPE = 196, 65 TEST_PAL_EVENT_TYPE = 197, 66 TEST_PAL_DUMPER_TYPE = 198, 67 TEST_PAL_TRACE_TYPE = 199, 68 TEST_PAL_END = 200, 69 TEST_OSAL_BEGIN = TEST_PAL_END, 70 #define HDF_OSAL_TEST_ITEM(v) (TEST_OSAL_BEGIN + (v)) 71 TEST_OSAL_ITEM = HDF_OSAL_TEST_ITEM(1), 72 TEST_OSAL_END = 400, 73 TEST_WIFI_BEGIN = TEST_OSAL_END, 74 TEST_WIFI_TYPE = TEST_WIFI_BEGIN + 1, 75 TEST_WIFI_PCIE_BUS_TYPE, 76 TEST_WIFI_END = 600, 77 TEST_CONFIG_TYPE = 601, 78 TEST_HDF_FRAME_END = 800, 79 TEST_USB_DEVICE_TYPE = 900, 80 TEST_USB_HOST_TYPE = 1000, 81 TEST_USB_HOST_RAW_TYPE = 1100, 82 }; 83 84 void HdfTestOpenService(void); 85 void HdfTestCloseService(void); 86 int HdfTestSendMsgToService(struct HdfTestMsg *msg); 87 88 #ifdef __cplusplus 89 } 90 #endif /* __cplusplus */ 91 92 #endif // HDF_UHDF_TEST_H 93