Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / staging / rtl8188eu / include / drv_types.h
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  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 /*-----------------------------------------------------------------------------
21
22         For type defines and data structure defines
23
24 ------------------------------------------------------------------------------*/
25
26
27 #ifndef __DRV_TYPES_H__
28 #define __DRV_TYPES_H__
29
30 #define DRV_NAME "r8188eu"
31
32 #include <osdep_service.h>
33 #include <wlan_bssdef.h>
34 #include <rtw_ht.h>
35 #include <rtw_cmd.h>
36 #include <rtw_xmit.h>
37 #include <rtw_recv.h>
38 #include <hal_intf.h>
39 #include <hal_com.h>
40 #include <rtw_qos.h>
41 #include <rtw_security.h>
42 #include <rtw_pwrctrl.h>
43 #include <rtw_eeprom.h>
44 #include <sta_info.h>
45 #include <rtw_mlme.h>
46 #include <rtw_debug.h>
47 #include <rtw_rf.h>
48 #include <rtw_event.h>
49 #include <rtw_led.h>
50 #include <rtw_mlme_ext.h>
51 #include <rtw_ap.h>
52
53 #define SPEC_DEV_ID_NONE                BIT(0)
54 #define SPEC_DEV_ID_DISABLE_HT          BIT(1)
55 #define SPEC_DEV_ID_ENABLE_PS           BIT(2)
56 #define SPEC_DEV_ID_RF_CONFIG_1T1R      BIT(3)
57 #define SPEC_DEV_ID_RF_CONFIG_2T2R      BIT(4)
58 #define SPEC_DEV_ID_ASSIGN_IFNAME       BIT(5)
59
60 struct registry_priv {
61         u8      chip_version;
62         u8      rfintfs;
63         u8      lbkmode;
64         u8      hci;
65         struct ndis_802_11_ssid ssid;
66         u8      network_mode;   /* infra, ad-hoc, auto */
67         u8      channel;/* ad-hoc support requirement */
68         u8      wireless_mode;/* A, B, G, auto */
69         u8      scan_mode;/* active, passive */
70         u8      radio_enable;
71         u8      preamble;/* long, short, auto */
72         u8      vrtl_carrier_sense;/* Enable, Disable, Auto */
73         u8      vcs_type;/* RTS/CTS, CTS-to-self */
74         u16     rts_thresh;
75         u16     frag_thresh;
76         u8      adhoc_tx_pwr;
77         u8      soft_ap;
78         u8      power_mgnt;
79         u8      ips_mode;
80         u8      smart_ps;
81         u8      long_retry_lmt;
82         u8      short_retry_lmt;
83         u16     busy_thresh;
84         u8      ack_policy;
85         u8      mp_mode;
86         u8      software_encrypt;
87         u8      software_decrypt;
88         u8      acm_method;
89           /* UAPSD */
90         u8      wmm_enable;
91         u8      uapsd_enable;
92         u8      uapsd_max_sp;
93         u8      uapsd_acbk_en;
94         u8      uapsd_acbe_en;
95         u8      uapsd_acvi_en;
96         u8      uapsd_acvo_en;
97
98         struct wlan_bssid_ex    dev_network;
99
100         u8      ht_enable;
101         u8      cbw40_enable;
102         u8      ampdu_enable;/* for tx */
103         u8      rx_stbc;
104         u8      ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
105         u8      lowrate_two_xmit;
106
107         u8      rf_config;
108         u8      low_power;
109
110         u8      wifi_spec;/*  !turbo_mode */
111
112         u8      channel_plan;
113         bool    bAcceptAddbaReq;
114
115         u8      antdiv_cfg;
116         u8      antdiv_type;
117
118         u8      usbss_enable;/* 0:disable,1:enable */
119         u8      hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
120         u8      hwpwrp_detect;/* 0:disable,1:enable */
121
122         u8      hw_wps_pbc;/* 0:disable,1:enable */
123
124         u8      max_roaming_times; /*  the max number driver will try */
125
126         u8      fw_iol; /* enable iol without other concern */
127
128         u8      enable80211d;
129
130         u8      ifname[16];
131         u8      if2name[16];
132
133         u8      notch_filter;
134 };
135
136 /* For registry parameters */
137 #define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
138 #define RGTRY_SZ(field)   sizeof(((struct registry_priv *)0)->field)
139 #define BSSID_OFT(field) ((u32)FIELD_OFFSET(struct wlan_bssid_ex, field))
140 #define BSSID_SZ(field)   sizeof(((struct wlan_bssid_ex *)0)->field)
141
142 #define MAX_CONTINUAL_URB_ERR           4
143
144 struct dvobj_priv {
145         struct adapter *if1;
146         /* For 92D, DMDP have 2 interface. */
147         u8      InterfaceNumber;
148         u8      NumInterfaces;
149
150         /* In /Out Pipe information */
151         int     RtInPipe[2];
152         int     RtOutPipe[3];
153         u8      Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
154
155 /*-------- below is for USB INTERFACE --------*/
156
157         u8      nr_endpoint;
158         u8      ishighspeed;
159         u8      RtNumInPipes;
160         u8      RtNumOutPipes;
161         int     ep_num[5]; /* endpoint number */
162         struct mutex  usb_vendor_req_mutex;
163
164         u8 *usb_vendor_req_buf;
165
166         struct usb_interface *pusbintf;
167         struct usb_device *pusbdev;
168 };
169
170 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
171 {
172         /* todo: get interface type from dvobj and the return
173          * the dev accordingly */
174         return &dvobj->pusbintf->dev;
175 };
176
177 struct adapter {
178         int     pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
179         u16     chip_type;
180
181         struct dvobj_priv *dvobj;
182         struct  mlme_priv mlmepriv;
183         struct  mlme_ext_priv mlmeextpriv;
184         struct  cmd_priv        cmdpriv;
185         struct  xmit_priv       xmitpriv;
186         struct  recv_priv       recvpriv;
187         struct  sta_priv        stapriv;
188         struct  security_priv   securitypriv;
189         struct  registry_priv   registrypriv;
190         struct  pwrctrl_priv    pwrctrlpriv;
191         struct  eeprom_priv eeprompriv;
192         struct  led_priv        ledpriv;
193
194 #ifdef CONFIG_88EU_AP_MODE
195         struct  hostapd_priv    *phostapdpriv;
196 #endif
197
198         struct wifidirect_info  wdinfo;
199
200         void *HalData;
201         struct hal_ops  HalFunc;
202
203         s32     bDriverStopped;
204         s32     bSurpriseRemoved;
205
206         u8      hw_init_completed;
207
208         void *cmdThread;
209         void *evtThread;
210         void (*intf_start)(struct adapter *adapter);
211         void (*intf_stop)(struct adapter *adapter);
212         struct  net_device *pnetdev;
213
214         /*  used by rtw_rereg_nd_name related function */
215         struct rereg_nd_name_data {
216                 struct  net_device *old_pnetdev;
217                 char old_ifname[IFNAMSIZ];
218                 u8 old_ips_mode;
219                 u8 old_bRegUseLed;
220         } rereg_nd_name_priv;
221
222         int bup;
223         struct net_device_stats stats;
224         struct iw_statistics iwstats;
225         struct proc_dir_entry *dir_dev;/*  for proc directory */
226
227         int net_closed;
228         u8 bFWReady;
229         u8 bReadPortCancel;
230         u8 bWritePortCancel;
231         u8 bRxRSSIDisplay;
232         /* The driver will show up the desired channel number
233          * when this flag is 1. */
234         u8 bNotifyChannelChange;
235
236         struct mutex hw_init_mutex;
237
238         spinlock_t br_ext_lock;
239
240         u8      fix_rate;
241
242         unsigned char     in_cta_test;
243 };
244
245 #define adapter_to_dvobj(adapter) (adapter->dvobj)
246
247 int rtw_handle_dualmac(struct adapter *adapter, bool init);
248
249 static inline u8 *myid(struct eeprom_priv *peepriv)
250 {
251         return peepriv->mac_addr;
252 }
253
254 #endif /* __DRV_TYPES_H__ */