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