1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_WIFI_HAL_CHIP_INTERFACE_H 17 #define OHOS_WIFI_HAL_CHIP_INTERFACE_H 18 19 #include "wifi_hal_define.h" 20 #include "wifi_hal_struct.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #define ERROR_CODE_POS_OVERFLOW (-2) 27 28 /** 29 * @Description Obtains the chip object by ID. 30 * 31 * @param id 32 * @param chip 33 * @return WifiErrorNo 34 */ 35 WifiErrorNo GetWifiChip(uint8_t id, WifiChip *chip); 36 37 /** 38 * @Description Obtains the ID of a Wi-Fi chip. 39 * 40 * @param ids - Chip ID array. 41 * @param size - Size of the input chip ID array. 42 * @return WifiErrorNo 43 */ 44 WifiErrorNo GetWifiChipIds(uint8_t *ids, int32_t *size); 45 46 /** 47 * @Description Obtains the chip ID. 48 * 49 * @param id - Indicates the chip ID. 50 * @return WifiErrorNo 51 */ 52 WifiErrorNo GetChipId(int32_t *id); 53 54 /** 55 * @Description Creating a Device Interface in STA/AP/P2P/NAN Mode. 56 * 57 * @param type 58 * @param iface - Device interface object. 59 * @return WifiErrorNo 60 */ 61 WifiErrorNo CreateIface(int32_t type, WifiIface *iface); 62 63 /** 64 * @Description Obtains the network device interface object based. 65 * 66 * @param ifname - Device Name. 67 * @param iface - Device interface object. 68 * @return WifiErrorNo 69 */ 70 WifiErrorNo GetIface(const char *ifname, WifiIface *iface); 71 72 /** 73 * @Description Obtains the interface type. Obtains the device. 74 * 75 * @param type - Device type. 76 * @param ifaces - Device Interface Name. 77 * @param size - ifaces size. 78 * @return WifiErrorNo 79 */ 80 WifiErrorNo GetIfaceNames(int32_t type, char *ifaces, int32_t size); 81 82 /** 83 * @Description Delete a network device interface object by device interface name. 84 * 85 * @param ifname - Device Name. 86 * @return WifiErrorNo 87 */ 88 WifiErrorNo RemoveIface(const char *ifname); 89 90 /** 91 * @Description Obtains chip capabilities. 92 * 93 * @param capabilities 94 * @return WifiErrorNo 95 */ 96 WifiErrorNo GetCapabilities(uint32_t *capabilities); 97 98 /** 99 * @Description Obtains the joint mode supported by the chip, as shown 100 * in (sta+sta/sta+p2p/sta+ap/sta+nan/ap+nan and so on). 101 * 102 * @param modes - Pattern array. 103 * @param size - Incoming Pattern Array Size and Returns the actual size of the 104 * obtained pattern array. 105 * @return WifiErrorNo 106 */ 107 WifiErrorNo GetSupportedComboModes(int32_t *modes, int32_t *size); 108 109 /** 110 * @Description Configure the current joint mode of the chip. 111 * 112 * @param mode - Mode id. 113 * @return WifiErrorNo 114 */ 115 WifiErrorNo ConfigComboModes(int32_t mode); 116 117 /** 118 * @Description Gets the current federation mode. 119 * 120 * @param id - Current Mode. 121 * @return WifiErrorNo 122 */ 123 WifiErrorNo GetComboModes(int32_t *id); 124 125 /** 126 * @Description Requesting the debugging information of the firmware chip. 127 * 128 * @param bytes - Debug info. 129 * @param size - Size of the input debug information array and Returns the actual 130 * size of debug information. 131 * @return WifiErrorNo 132 */ 133 WifiErrorNo RequestFirmwareDebugDump(unsigned char *bytes, int32_t *size); 134 135 /** 136 * @Description Setting the Low Latency Mode. 137 * 138 * @param mode - Low-latency mode. 139 * @return WifiErrorNo 140 */ 141 WifiErrorNo SetPowerMode(uint8_t mode); 142 143 #ifdef __cplusplus 144 } 145 #endif 146 #endif