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 PLATFORM_CORE_H 10 #define PLATFORM_CORE_H 11 12 #include "hdf_base.h" 13 14 #include "platform_log.h" 15 #include "platform_errno.h" 16 #include "platform_event.h" 17 #include "platform_queue.h" 18 #ifndef __USER__ 19 #include "platform_device.h" 20 #include "platform_manager.h" 21 #endif 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif /* __cplusplus */ 28 29 enum PlatformModuleType { 30 PLATFORM_MODULE_GPIO, 31 PLATFORM_MODULE_I2C, 32 PLATFORM_MODULE_SPI, 33 PLATFORM_MODULE_PIN, 34 PLATFORM_MODULE_CLOCK, 35 PLATFORM_MODULE_REGULATOR, 36 PLATFORM_MODULE_MIPI_DSI, 37 PLATFORM_MODULE_MIPI_CSI, 38 PLATFORM_MODULE_UART, 39 PLATFORM_MODULE_SDIO, 40 PLATFORM_MODULE_MDIO, 41 PLATFORM_MODULE_APB, 42 PLATFORM_MODULE_PCIE, 43 PLATFORM_MODULE_PCM, 44 PLATFORM_MODULE_I2S, 45 PLATFORM_MODULE_PWM, 46 PLATFORM_MODULE_DMA, 47 PLATFORM_MODULE_ADC, 48 PLATFORM_MODULE_RTC, 49 PLATFORM_MODULE_WDT, 50 PLATFORM_MODULE_I3C, 51 PLATFORM_MODULE_CAN, 52 PLATFORM_MODULE_HDMI, 53 PLATFORM_MODULE_MMC, 54 PLATFORM_MODULE_MTD, 55 PLATFORM_MODULE_TIMER, 56 PLATFORM_MODULE_DEFAULT, 57 PLATFORM_MODULE_MAX, 58 }; 59 60 struct PlatformModuleInfo { 61 enum PlatformModuleType moduleType; 62 const char *moduleName; 63 void *priv; 64 }; 65 66 struct PlatformModuleInfo *PlatformModuleInfoGet(enum PlatformModuleType moduleType); 67 int32_t PlatformModuleInfoCount(void); 68 69 void PlatformGlobalLock(void); 70 void PlatformGlobalUnlock(void); 71 72 /* Os adapt */ 73 bool PlatInIrqContext(void); 74 75 #ifdef __cplusplus 76 #if __cplusplus 77 } 78 #endif 79 #endif /* __cplusplus */ 80 81 #endif /* PLATFORM_CORE_H */ 82