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 #include "i2c_test.h" 10 #include "device_resource_if.h" 11 #include "hdf_base.h" 12 #include "hdf_device_desc.h" 13 #include "platform_device_test.h" 14 #include "platform_event_test.h" 15 #include "platform_log.h" 16 #include "platform_manager_test.h" 17 #include "platform_queue_test.h" 18 DoAllPlatformTest(void)19static void DoAllPlatformTest(void) 20 { 21 #ifdef PLATFORM_TEST_ON_INIT 22 PlatformEventTestExecuteAll(); 23 PlatformQueueTestExecuteAll(); 24 PlatformManagerTestExecuteAll(); 25 PlatformDeviceTestExecuteAll(); 26 #ifdef LOSCFG_DRIVERS_HDF_PLATFORM_I2C 27 PLAT_LOGE("DoAllPlatformTest: do i2c test ..."); 28 I2cTestExecuteAll(); 29 #endif 30 #endif 31 } 32 PlatformTestBind(struct HdfDeviceObject * device)33static int32_t PlatformTestBind(struct HdfDeviceObject *device) 34 { 35 static struct IDeviceIoService service; 36 37 if (device == NULL) { 38 PLAT_LOGE("PlatformTestBind: device is null!"); 39 return HDF_ERR_IO; 40 } 41 42 DoAllPlatformTest(); 43 device->service = &service; 44 PLAT_LOGE("PlatformTestBind: done!"); 45 return HDF_SUCCESS; 46 } 47 PlatformTestInit(struct HdfDeviceObject * device)48static int32_t PlatformTestInit(struct HdfDeviceObject *device) 49 { 50 (void)device; 51 return HDF_SUCCESS; 52 } 53 PlatformTestRelease(struct HdfDeviceObject * device)54static void PlatformTestRelease(struct HdfDeviceObject *device) 55 { 56 if (device != NULL) { 57 device->service = NULL; 58 } 59 return; 60 } 61 62 struct HdfDriverEntry g_platformTestEntry = { 63 .moduleVersion = 1, 64 .Bind = PlatformTestBind, 65 .Init = PlatformTestInit, 66 .Release = PlatformTestRelease, 67 .moduleName = "PLATFORM_TEST_DRIVER", 68 }; 69 HDF_INIT(g_platformTestEntry); 70