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 HDF_WIFI_CONFIG_HEADER_H 10 #define HDF_WIFI_CONFIG_HEADER_H 11 12 #include "hdf_base.h" 13 #include "device_resource_if.h" 14 15 #define WIFI_CONFIG_NAME_MAX 20 16 #define WIFI_CHIP_MAX 3 17 #define GPIO_PRAM_COUNT 2 18 #define BUS_REG_COUNT 2 19 #define BUS_FUNC_MAX 1 20 #define GPIO_ARGS_COUNT 3 21 22 struct HdfConfigWifiStation { 23 const char *name; 24 uint8_t mode; 25 }; 26 27 struct HdfConfigWifiHostAp { 28 const char *name; 29 uint8_t mode; 30 uint8_t vapResNum; 31 uint8_t userResNum; 32 }; 33 34 struct HdfConfigWifiP2P { 35 const char *name; 36 uint8_t mode; 37 }; 38 39 struct HdfConfigWifiMac80211 { 40 uint8_t mode; 41 }; 42 43 struct HdfConfigWifiPhy { 44 uint8_t mode; 45 }; 46 47 struct HdfConfigWifiModuleConfig { 48 uint32_t featureMap; 49 const char *msgName; 50 struct HdfConfigWifiStation station; 51 struct HdfConfigWifiHostAp hostAp; 52 struct HdfConfigWifiP2P p2p; 53 struct HdfConfigWifiMac80211 mac80211; 54 struct HdfConfigWifiPhy Phy; 55 }; 56 57 struct HdfConfigWifiBus { 58 uint8_t busType; 59 uint8_t funcNum[BUS_FUNC_MAX]; 60 uint32_t funcNumSize; 61 uint16_t vendorId; 62 uint16_t deviceId; 63 uint16_t timeout; 64 uint16_t blockSize; 65 }; 66 67 struct HdfConfigWifiChip { 68 const char *chipName; 69 uint8_t chipId; 70 uint32_t featureMap; 71 uint8_t powerType; 72 uint8_t irqNo; 73 struct HdfConfigWifiBus bus; 74 }; 75 76 struct HdfConfigWifiDeviceList { 77 struct HdfConfigWifiChip chip[WIFI_CHIP_MAX]; 78 uint16_t chipSize; 79 }; 80 81 struct HdfConfigWifiBusRegs { 82 uint32_t cclkOut[BUS_REG_COUNT]; 83 uint32_t ccmd[BUS_REG_COUNT]; 84 uint32_t cdata0[BUS_REG_COUNT]; 85 uint32_t cdata1[BUS_REG_COUNT]; 86 uint32_t cdata2[BUS_REG_COUNT]; 87 uint32_t cdata3[BUS_REG_COUNT]; 88 }; 89 90 struct HdfConfigWifiBoard { 91 const char *boardName; 92 uint8_t busType; 93 uint8_t busIdx; 94 uint8_t reset[GPIO_PRAM_COUNT]; 95 uint8_t gpioArgs[GPIO_ARGS_COUNT]; 96 struct HdfConfigWifiBusRegs busRegs; 97 }; 98 99 struct HdfConfigWifiWifiConfig { 100 struct HdfConfigWifiModuleConfig moduleConfig; 101 struct HdfConfigWifiDeviceList deviceList; 102 struct HdfConfigWifiBoard board; 103 }; 104 105 struct HdfConfigWifiRoot { 106 struct HdfConfigWifiWifiConfig wifiConfig; 107 }; 108 109 struct HdfConfigWifiRoot* HdfWifiGetModuleConfigRoot(void); 110 int32_t HdfParseWifiConfig(const struct DeviceResourceNode *node); 111 112 #endif // HDF_WIFI_CONFIG_HEADER_H