1 /* 2 * hdf_public_ap6275s.h 3 * 4 * ap6275s driver header 5 * 6 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 */ 22 23 #ifndef _HDF_PUBLIC_AP6275S_H_ 24 #define _HDF_PUBLIC_AP6275S_H_ 25 #include <net/cfg80211.h> 26 #include "net_device.h" 27 #include "hdf_wl_interface.h" 28 29 #include "wifi_module.h" 30 #include "wifi_mac80211_ops.h" 31 #include "hdf_wlan_utils.h" 32 #include "net_bdh_adpater.h" 33 34 int get_scan_ifidx(const char *ifname); 35 extern struct cfg80211_ops wl_cfg80211_ops; 36 extern struct net_device_ops dhd_ops_pri; 37 extern struct hdf_inf_map g_hdf_infmap[HDF_INF_MAX]; 38 extern struct net_device *GetLinuxInfByNetDevice(const struct NetDevice *netDevice); 39 extern struct wireless_dev *wrap_get_widev(void); 40 extern struct ieee80211_regdomain *wrp_get_regdomain(void); 41 extern int32_t wl_get_all_sta(struct net_device *ndev, uint32_t *num); 42 extern s32 wl_get_all_sta_info(struct net_device *ndev, char* mac, uint32_t num); 43 extern int g_hdf_ifidx; 44 extern int g_mgmt_tx_event_ifidx; 45 extern u32 p2p_remain_freq; 46 extern struct NetDevice* GetHdfNetDeviceByLinuxInf(struct net_device *dev); 47 extern int g_scan_event_ifidx; 48 extern int g_conn_event_ifidx; 49 extern int bdh6_reset_driver_flag; 50 extern int start_p2p_completed; 51 extern struct mutex bdh6_reset_driver_lock; 52 void dhd_get_mac_address(struct net_device *dev, unsigned char **addr); 53 54 int32_t wal_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, struct net_device *netDev); 55 int32_t wal_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *netDev, int32_t freq, 56 unsigned int duration); 57 void wl_cfg80211_add_virtual_iface_wrap(struct wiphy *wiphy, char *name, enum nl80211_iftype type, 58 struct vif_params *params); 59 extern int memcpy_s(void *dest, size_t dest_max, const void *src, size_t count); 60 extern int32_t HdfWifiEventDelSta(struct NetDevice *netDev, const uint8_t *macAddr, uint8_t addrLen); 61 int hdf_cfgp2p_register_ndev(struct net_device *p2p_netdev, struct net_device *primary_netdev, struct wiphy *wiphy); 62 struct NetDeviceInterFace *wal_get_net_p2p_ops(void); 63 int hdf_start_p2p_device(void); 64 s32 wldev_ioctl_get(struct net_device *dev, u32 cmd, unsigned char *arg, u32 len); 65 struct wiphy *get_linux_wiphy_hdfdev(NetDevice *netDev); 66 extern int dhd_netdev_changemtu_wrapper(struct net_device *netdev, int mtu); 67 extern struct NetDeviceInterFace *wal_get_net_dev_ops(void); 68 69 int BDH6InitNetdev(struct NetDevice *netDevice, int private_data_size, int type, int ifidx); 70 struct NetDevice *get_hdf_netdev(int ifidx); 71 struct net_device *get_krn_netdev(int ifidx); 72 extern void rtnl_lock(void); 73 extern void rtnl_unlock(void); 74 75 struct NetDevice *get_real_netdev(NetDevice *netDev); 76 extern struct wiphy *get_linux_wiphy_ndev(struct net_device *ndev); 77 int get_dhd_priv_data_size(void); 78 extern int32_t wl_cfg80211_set_country_code(struct net_device *net, char *country_code, 79 bool notify, bool user_enforced, int revinfo); 80 extern int snprintf_s(char *dest, size_t dest_max, size_t count, const char *format, ...); 81 82 extern int32_t WalChangeBeacon(NetDevice *hnetDev, struct WlanBeaconConf *param); 83 extern int32_t Bdh6Ghcap(struct NetDevice *hnetDev, struct WlanHwCapability **capability); 84 extern int32_t HdfStartScan(NetDevice *hhnetDev, struct WlanScanRequest *scanParam); 85 extern int32_t WifiScanSetUserIe(const struct WlanScanRequest *params, struct cfg80211_scan_request *request); 86 extern int32_t WifiScanSetChannel(const struct wiphy *wiphy, const struct WlanScanRequest *params, 87 struct cfg80211_scan_request *request); 88 extern int32_t BDH6Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice); 89 90 /********************************* hdf_bdh_mac80211 ***********************************************/ 91 typedef enum { 92 WLAN_BAND_2G, 93 WLAN_BAND_5G, 94 WLAN_BAND_BUTT 95 } wlan_channel_band_enum; 96 #define WIFI_24G_CHANNEL_NUMS (14) 97 #define WAL_MIN_CHANNEL_2G (1) 98 #define WAL_MAX_CHANNEL_2G (14) 99 #define WAL_MIN_FREQ_2G (2412 + 5*(WAL_MIN_CHANNEL_2G - 1)) 100 #define WAL_MAX_FREQ_2G (2484) 101 #define WAL_FREQ_2G_INTERVAL (5) 102 103 #define WLAN_WPS_IE_MAX_SIZE (352) // (WLAN_MEM_EVENT_SIZE2 - 32) /* 32表示事件自身占用的空间 */ 104 #define MAC_80211_FRAME_LEN 24 /* 非四地址情况下,MAC帧头的长度 */ 105 extern struct ieee80211_regdomain *bdh6_get_regdomain(void); 106 extern void BDH6WalReleaseHwCapability(struct WlanHwCapability *self); 107 108 /************************************* ap.c *************************************************/ 109 extern void bdh6_nl80211_calculate_ap_params(struct cfg80211_ap_settings *params); 110 extern int32_t WalStartAp(NetDevice *hnetDev); 111 112 113 /************************************ sta.c ***************************************/ 114 extern int32_t WifiScanSetRequest(struct NetDevice *netdev, const struct WlanScanRequest *params, 115 struct cfg80211_scan_request *request); 116 extern struct ieee80211_channel *WalGetChannel(struct wiphy *wiphy, int32_t freq); 117 extern struct ieee80211_channel *GetChannelByFreq(const struct wiphy *wiphy, uint16_t center_freq); 118 119 /************************************* hdf_wl_interface.h **************************************/ 120 extern int g_event_ifidx; 121 122 extern int32_t Bdh6SAction(struct NetDevice *hhnetDev, WifiActionData *actionData); 123 extern int32_t Bdh6Fband(NetDevice *hnetDev, int32_t band, int32_t *freqs, uint32_t *num); 124 extern int32_t HdfConnect(NetDevice *hnetDev, WlanConnectParams *param); 125 #endif 126