Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of version 2 of the GNU General Public License as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 14 | ******************************************************************************/ |
| 15 | /*----------------------------------------------------------------------------- |
| 16 | |
| 17 | For type defines and data structure defines |
| 18 | |
| 19 | ------------------------------------------------------------------------------*/ |
| 20 | |
| 21 | |
| 22 | #ifndef __DRV_TYPES_H__ |
| 23 | #define __DRV_TYPES_H__ |
| 24 | |
| 25 | #define DRV_NAME "r8188eu" |
| 26 | |
| 27 | #include <osdep_service.h> |
| 28 | #include <wlan_bssdef.h> |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 29 | #include <rtw_ht.h> |
| 30 | #include <rtw_cmd.h> |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 31 | #include <rtw_xmit.h> |
| 32 | #include <rtw_recv.h> |
| 33 | #include <hal_intf.h> |
| 34 | #include <hal_com.h> |
| 35 | #include <rtw_qos.h> |
| 36 | #include <rtw_security.h> |
| 37 | #include <rtw_pwrctrl.h> |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 38 | #include <rtw_eeprom.h> |
| 39 | #include <sta_info.h> |
| 40 | #include <rtw_mlme.h> |
| 41 | #include <rtw_debug.h> |
| 42 | #include <rtw_rf.h> |
| 43 | #include <rtw_event.h> |
| 44 | #include <rtw_led.h> |
| 45 | #include <rtw_mlme_ext.h> |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 46 | #include <rtw_ap.h> |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 47 | |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 48 | #define SPEC_DEV_ID_NONE BIT(0) |
| 49 | #define SPEC_DEV_ID_DISABLE_HT BIT(1) |
| 50 | #define SPEC_DEV_ID_ENABLE_PS BIT(2) |
| 51 | #define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3) |
| 52 | #define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4) |
| 53 | #define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5) |
| 54 | |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 55 | struct registry_priv { |
| 56 | u8 chip_version; |
| 57 | u8 rfintfs; |
| 58 | u8 lbkmode; |
| 59 | u8 hci; |
| 60 | struct ndis_802_11_ssid ssid; |
| 61 | u8 network_mode; /* infra, ad-hoc, auto */ |
| 62 | u8 channel;/* ad-hoc support requirement */ |
| 63 | u8 wireless_mode;/* A, B, G, auto */ |
| 64 | u8 scan_mode;/* active, passive */ |
| 65 | u8 radio_enable; |
| 66 | u8 preamble;/* long, short, auto */ |
| 67 | u8 vrtl_carrier_sense;/* Enable, Disable, Auto */ |
| 68 | u8 vcs_type;/* RTS/CTS, CTS-to-self */ |
| 69 | u16 rts_thresh; |
| 70 | u16 frag_thresh; |
| 71 | u8 adhoc_tx_pwr; |
| 72 | u8 soft_ap; |
| 73 | u8 power_mgnt; |
| 74 | u8 ips_mode; |
| 75 | u8 smart_ps; |
| 76 | u8 long_retry_lmt; |
| 77 | u8 short_retry_lmt; |
| 78 | u16 busy_thresh; |
| 79 | u8 ack_policy; |
| 80 | u8 mp_mode; |
| 81 | u8 software_encrypt; |
| 82 | u8 software_decrypt; |
| 83 | u8 acm_method; |
| 84 | /* UAPSD */ |
| 85 | u8 wmm_enable; |
| 86 | u8 uapsd_enable; |
| 87 | u8 uapsd_max_sp; |
| 88 | u8 uapsd_acbk_en; |
| 89 | u8 uapsd_acbe_en; |
| 90 | u8 uapsd_acvi_en; |
| 91 | u8 uapsd_acvo_en; |
| 92 | |
| 93 | struct wlan_bssid_ex dev_network; |
| 94 | |
| 95 | u8 ht_enable; |
| 96 | u8 cbw40_enable; |
| 97 | u8 ampdu_enable;/* for tx */ |
| 98 | u8 rx_stbc; |
| 99 | u8 ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */ |
| 100 | u8 lowrate_two_xmit; |
| 101 | |
| 102 | u8 rf_config; |
| 103 | u8 low_power; |
| 104 | |
| 105 | u8 wifi_spec;/* !turbo_mode */ |
| 106 | |
| 107 | u8 channel_plan; |
Luca Ceresoli | d6c6ad9 | 2015-12-02 22:54:04 +0100 | [diff] [blame] | 108 | bool accept_addba_req; /* true = accept AP's Add BA req */ |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 109 | |
| 110 | u8 antdiv_cfg; |
| 111 | u8 antdiv_type; |
| 112 | |
| 113 | u8 usbss_enable;/* 0:disable,1:enable */ |
| 114 | u8 hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */ |
| 115 | u8 hwpwrp_detect;/* 0:disable,1:enable */ |
| 116 | |
| 117 | u8 hw_wps_pbc;/* 0:disable,1:enable */ |
| 118 | |
| 119 | u8 max_roaming_times; /* the max number driver will try */ |
| 120 | |
| 121 | u8 fw_iol; /* enable iol without other concern */ |
| 122 | |
| 123 | u8 enable80211d; |
| 124 | |
| 125 | u8 ifname[16]; |
| 126 | u8 if2name[16]; |
| 127 | |
| 128 | u8 notch_filter; |
Jakub Sitnicki | 0a0796e | 2015-09-18 08:13:00 +0200 | [diff] [blame] | 129 | bool monitor_enable; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | /* For registry parameters */ |
Ivan Safonov | 5e3027b | 2016-03-02 14:59:01 +0700 | [diff] [blame] | 133 | #define RGTRY_OFT(field) ((u32)offsetof(struct registry_priv, field)) |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 134 | #define RGTRY_SZ(field) sizeof(((struct registry_priv *)0)->field) |
Ivan Safonov | 5e3027b | 2016-03-02 14:59:01 +0700 | [diff] [blame] | 135 | #define BSSID_OFT(field) ((u32)offsetofT(struct wlan_bssid_ex, field)) |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 136 | #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *)0)->field) |
| 137 | |
| 138 | #define MAX_CONTINUAL_URB_ERR 4 |
| 139 | |
| 140 | struct dvobj_priv { |
| 141 | struct adapter *if1; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 142 | /* For 92D, DMDP have 2 interface. */ |
| 143 | u8 InterfaceNumber; |
| 144 | u8 NumInterfaces; |
| 145 | |
| 146 | /* In /Out Pipe information */ |
| 147 | int RtInPipe[2]; |
| 148 | int RtOutPipe[3]; |
| 149 | u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */ |
| 150 | |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 151 | /*-------- below is for USB INTERFACE --------*/ |
| 152 | |
| 153 | u8 nr_endpoint; |
| 154 | u8 ishighspeed; |
| 155 | u8 RtNumInPipes; |
| 156 | u8 RtNumOutPipes; |
| 157 | int ep_num[5]; /* endpoint number */ |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 158 | struct mutex usb_vendor_req_mutex; |
| 159 | |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 160 | u8 *usb_vendor_req_buf; |
| 161 | |
| 162 | struct usb_interface *pusbintf; |
| 163 | struct usb_device *pusbdev; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) |
| 167 | { |
| 168 | /* todo: get interface type from dvobj and the return |
| 169 | * the dev accordingly */ |
| 170 | return &dvobj->pusbintf->dev; |
| 171 | }; |
| 172 | |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 173 | struct adapter { |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 174 | struct dvobj_priv *dvobj; |
| 175 | struct mlme_priv mlmepriv; |
| 176 | struct mlme_ext_priv mlmeextpriv; |
| 177 | struct cmd_priv cmdpriv; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 178 | struct xmit_priv xmitpriv; |
| 179 | struct recv_priv recvpriv; |
| 180 | struct sta_priv stapriv; |
| 181 | struct security_priv securitypriv; |
| 182 | struct registry_priv registrypriv; |
| 183 | struct pwrctrl_priv pwrctrlpriv; |
| 184 | struct eeprom_priv eeprompriv; |
| 185 | struct led_priv ledpriv; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 186 | |
| 187 | #ifdef CONFIG_88EU_AP_MODE |
| 188 | struct hostapd_priv *phostapdpriv; |
| 189 | #endif |
| 190 | |
| 191 | struct wifidirect_info wdinfo; |
| 192 | |
| 193 | void *HalData; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 194 | struct hal_ops HalFunc; |
| 195 | |
| 196 | s32 bDriverStopped; |
| 197 | s32 bSurpriseRemoved; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 198 | |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 199 | u8 hw_init_completed; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 200 | |
| 201 | void *cmdThread; |
| 202 | void *evtThread; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 203 | void (*intf_start)(struct adapter *adapter); |
| 204 | void (*intf_stop)(struct adapter *adapter); |
| 205 | struct net_device *pnetdev; |
Jakub Sitnicki | 0a0796e | 2015-09-18 08:13:00 +0200 | [diff] [blame] | 206 | struct net_device *pmondev; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 207 | |
| 208 | /* used by rtw_rereg_nd_name related function */ |
| 209 | struct rereg_nd_name_data { |
| 210 | struct net_device *old_pnetdev; |
| 211 | char old_ifname[IFNAMSIZ]; |
| 212 | u8 old_ips_mode; |
| 213 | u8 old_bRegUseLed; |
| 214 | } rereg_nd_name_priv; |
| 215 | |
| 216 | int bup; |
| 217 | struct net_device_stats stats; |
| 218 | struct iw_statistics iwstats; |
| 219 | struct proc_dir_entry *dir_dev;/* for proc directory */ |
| 220 | |
| 221 | int net_closed; |
| 222 | u8 bFWReady; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 223 | u8 bReadPortCancel; |
| 224 | u8 bWritePortCancel; |
| 225 | u8 bRxRSSIDisplay; |
| 226 | /* The driver will show up the desired channel number |
| 227 | * when this flag is 1. */ |
| 228 | u8 bNotifyChannelChange; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 229 | |
navin patidar | fc8b5ae | 2014-06-01 17:46:30 +0530 | [diff] [blame] | 230 | struct mutex hw_init_mutex; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 231 | |
| 232 | spinlock_t br_ext_lock; |
Larry Finger | a7c947b | 2013-08-21 22:34:03 -0500 | [diff] [blame] | 233 | |
| 234 | u8 fix_rate; |
| 235 | |
| 236 | unsigned char in_cta_test; |
| 237 | }; |
| 238 | |
| 239 | #define adapter_to_dvobj(adapter) (adapter->dvobj) |
| 240 | |
| 241 | int rtw_handle_dualmac(struct adapter *adapter, bool init); |
| 242 | |
| 243 | static inline u8 *myid(struct eeprom_priv *peepriv) |
| 244 | { |
| 245 | return peepriv->mac_addr; |
| 246 | } |
| 247 | |
| 248 | #endif /* __DRV_TYPES_H__ */ |