1 /* 2 * Copyright (c) 2020-2022 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 #ifndef HDF_WLAN_CONFIG_H 9 #define HDF_WLAN_CONFIG_H 10 11 #include "device_resource_if.h" 12 #define WLAN_DEVICE_MAX 3 13 #define WLAN_MAX_CHIP_NUM 3 14 #define BUS_FUNC_MAX 1 15 #define CHIP_BUS_DEVICE_ID_COUNT 1 16 17 struct HdfConfigWlanStation { 18 const char *name; 19 uint8_t mode; 20 }; 21 22 struct HdfConfigWlanHostAp { 23 const char *name; 24 uint8_t mode; 25 uint8_t vapResNum; 26 uint8_t userResNum; 27 }; 28 29 struct HdfConfigWlanP2P { 30 const char *name; 31 uint8_t mode; 32 }; 33 34 struct HdfConfigWlanMac80211 { 35 uint8_t mode; 36 }; 37 38 struct HdfConfigWlanPhy { 39 uint8_t mode; 40 }; 41 42 struct HdfConfigWlanModuleConfig { 43 uint32_t featureMap; 44 const char *msgName; 45 struct HdfConfigWlanStation station; 46 struct HdfConfigWlanHostAp hostAp; 47 struct HdfConfigWlanP2P p2p; 48 struct HdfConfigWlanMac80211 mac80211; 49 struct HdfConfigWlanPhy Phy; 50 }; 51 52 /* ----------------------------------------------* 53 * deviceList architecture * 54 * ---------------------------------------------- */ 55 struct HdfConfigWlanPower { 56 uint8_t powerSeqDelay; 57 uint8_t powerType; 58 uint16_t gpioId; 59 uint8_t activeLevel; 60 }; 61 62 63 struct HdfConfWlanPowers { 64 uint8_t powerCount; 65 struct HdfConfigWlanPower power0; 66 struct HdfConfigWlanPower power1; 67 }; 68 69 struct HdfConfWlanRest { 70 uint8_t resetType; 71 uint16_t gpioId; 72 uint8_t activeLevel; 73 uint8_t resetHoldTime; 74 }; 75 76 struct HdfConfigWlanBus { 77 uint8_t busEnable; 78 uint8_t busType; 79 uint8_t busIdx; 80 uint8_t funcNum[BUS_FUNC_MAX]; 81 uint32_t funcNumSize; 82 uint16_t timeout; 83 uint16_t blockSize; 84 }; 85 86 struct HdfConfigWlanDevInst { 87 uint8_t deviceInstId; 88 struct HdfConfWlanPowers powers; 89 struct HdfConfWlanRest reset; 90 struct HdfConfigWlanBus bus; 91 uint8_t bootUpTimeOut; 92 }; 93 94 struct HdfConfigWlanDeviceList { 95 struct HdfConfigWlanDevInst deviceInst[WLAN_DEVICE_MAX]; 96 uint16_t deviceListSize; 97 }; 98 /* ----------------------------------------------* 99 * chip config * 100 * ---------------------------------------------- */ 101 struct HdfConfWlanBusArgs { 102 uint16_t vendorId; 103 uint16_t deviceId[1]; 104 }; 105 struct HdfConfigWlanChipInst { 106 const char *driverName; 107 struct HdfConfWlanBusArgs chipBus; 108 }; 109 struct HdfConfigWlanChipList { 110 struct HdfConfigWlanChipInst chipInst[WLAN_MAX_CHIP_NUM]; 111 uint16_t chipInstSize; 112 }; 113 114 struct HdfConfigWlanConfig { 115 const char* hostChipName; 116 struct HdfConfigWlanModuleConfig moduleConfig; 117 struct HdfConfigWlanDeviceList deviceList; 118 struct HdfConfigWlanChipList chipList; 119 }; 120 struct HdfConfigWlanRoot { 121 struct HdfConfigWlanConfig wlanConfig; 122 }; 123 124 struct HdfConfigWlanRoot *HdfWlanGetModuleConfigRoot(void); 125 int32_t HdfParseWlanConfig(const struct DeviceResourceNode *node); 126 127 #endif