]> Pileus Git - ~andy/linux/blob - drivers/staging/rtl8188eu/include/drv_types.h
staging: r8188eu: Cleanup of include/hal_intf.h
[~andy/linux] / 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 <drv_types_linux.h>
35 #include <rtw_ht.h>
36 #include <rtw_cmd.h>
37 #include <rtw_xmit.h>
38 #include <rtw_recv.h>
39 #include <hal_intf.h>
40 #include <hal_com.h>
41 #include <rtw_qos.h>
42 #include <rtw_security.h>
43 #include <rtw_pwrctrl.h>
44 #include <rtw_io.h>
45 #include <rtw_eeprom.h>
46 #include <sta_info.h>
47 #include <rtw_mlme.h>
48 #include <rtw_debug.h>
49 #include <rtw_rf.h>
50 #include <rtw_event.h>
51 #include <rtw_led.h>
52 #include <rtw_mlme_ext.h>
53 #include <rtw_p2p.h>
54 #include <rtw_ap.h>
55 #include <rtw_mp.h>
56 #include <rtw_br_ext.h>
57
58 enum _NIC_VERSION {
59         RTL8711_NIC,
60         RTL8712_NIC,
61         RTL8713_NIC,
62         RTL8716_NIC
63 };
64
65 #define SPEC_DEV_ID_NONE                BIT(0)
66 #define SPEC_DEV_ID_DISABLE_HT          BIT(1)
67 #define SPEC_DEV_ID_ENABLE_PS           BIT(2)
68 #define SPEC_DEV_ID_RF_CONFIG_1T1R      BIT(3)
69 #define SPEC_DEV_ID_RF_CONFIG_2T2R      BIT(4)
70 #define SPEC_DEV_ID_ASSIGN_IFNAME       BIT(5)
71
72 struct specific_device_id {
73         u32             flags;
74         u16             idVendor;
75         u16             idProduct;
76 };
77
78 struct registry_priv {
79         u8      chip_version;
80         u8      rfintfs;
81         u8      lbkmode;
82         u8      hci;
83         struct ndis_802_11_ssid ssid;
84         u8      network_mode;   /* infra, ad-hoc, auto */
85         u8      channel;/* ad-hoc support requirement */
86         u8      wireless_mode;/* A, B, G, auto */
87         u8      scan_mode;/* active, passive */
88         u8      radio_enable;
89         u8      preamble;/* long, short, auto */
90         u8      vrtl_carrier_sense;/* Enable, Disable, Auto */
91         u8      vcs_type;/* RTS/CTS, CTS-to-self */
92         u16     rts_thresh;
93         u16     frag_thresh;
94         u8      adhoc_tx_pwr;
95         u8      soft_ap;
96         u8      power_mgnt;
97         u8      ips_mode;
98         u8      smart_ps;
99         u8      long_retry_lmt;
100         u8      short_retry_lmt;
101         u16     busy_thresh;
102         u8      ack_policy;
103         u8      mp_mode;
104         u8      software_encrypt;
105         u8      software_decrypt;
106         u8      acm_method;
107           /* UAPSD */
108         u8      wmm_enable;
109         u8      uapsd_enable;
110         u8      uapsd_max_sp;
111         u8      uapsd_acbk_en;
112         u8      uapsd_acbe_en;
113         u8      uapsd_acvi_en;
114         u8      uapsd_acvo_en;
115
116         struct wlan_bssid_ex    dev_network;
117
118         u8      ht_enable;
119         u8      cbw40_enable;
120         u8      ampdu_enable;/* for tx */
121         u8      rx_stbc;
122         u8      ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
123         u8      lowrate_two_xmit;
124
125         u8      rf_config;
126         u8      low_power;
127
128         u8      wifi_spec;/*  !turbo_mode */
129
130         u8      channel_plan;
131         bool    bAcceptAddbaReq;
132
133         u8      antdiv_cfg;
134         u8      antdiv_type;
135
136         u8      usbss_enable;/* 0:disable,1:enable */
137         u8      hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
138         u8      hwpwrp_detect;/* 0:disable,1:enable */
139
140         u8      hw_wps_pbc;/* 0:disable,1:enable */
141
142         u8      max_roaming_times; /*  the max number driver will try */
143
144         u8      fw_iol; /* enable iol without other concern */
145
146         u8      enable80211d;
147
148         u8      ifname[16];
149         u8      if2name[16];
150
151         u8      notch_filter;
152 };
153
154 /* For registry parameters */
155 #define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
156 #define RGTRY_SZ(field)   sizeof(((struct registry_priv *)0)->field)
157 #define BSSID_OFT(field) ((u32)FIELD_OFFSET(struct wlan_bssid_ex, field))
158 #define BSSID_SZ(field)   sizeof(((struct wlan_bssid_ex *)0)->field)
159
160 #define MAX_CONTINUAL_URB_ERR           4
161
162 struct dvobj_priv {
163         struct adapter *if1;
164         struct adapter *if2;
165
166         /* For 92D, DMDP have 2 interface. */
167         u8      InterfaceNumber;
168         u8      NumInterfaces;
169
170         /* In /Out Pipe information */
171         int     RtInPipe[2];
172         int     RtOutPipe[3];
173         u8      Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
174
175         u8      irq_alloc;
176
177 /*-------- below is for USB INTERFACE --------*/
178
179         u8      nr_endpoint;
180         u8      ishighspeed;
181         u8      RtNumInPipes;
182         u8      RtNumOutPipes;
183         int     ep_num[5]; /* endpoint number */
184         int     RegUsbSS;
185         struct semaphore usb_suspend_sema;
186         struct mutex  usb_vendor_req_mutex;
187
188         u8 *usb_alloc_vendor_req_buf;
189         u8 *usb_vendor_req_buf;
190
191         struct usb_interface *pusbintf;
192         struct usb_device *pusbdev;
193
194         atomic_t continual_urb_error;
195 };
196
197 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
198 {
199         /* todo: get interface type from dvobj and the return
200          * the dev accordingly */
201         return &dvobj->pusbintf->dev;
202 };
203
204 enum _IFACE_TYPE {
205         IFACE_PORT0, /* mapping to port0 for C/D series chips */
206         IFACE_PORT1, /* mapping to port1 for C/D series chip */
207         MAX_IFACE_PORT,
208 };
209
210 enum _ADAPTER_TYPE {
211         PRIMARY_ADAPTER,
212         SECONDARY_ADAPTER,
213         MAX_ADAPTER,
214 };
215
216 enum driver_state {
217         DRIVER_NORMAL = 0,
218         DRIVER_DISAPPEAR = 1,
219         DRIVER_REPLACE_DONGLE = 2,
220 };
221
222 struct adapter {
223         int     DriverState;/* for disable driver using module, use dongle toi
224                              * replace module. */
225         int     pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
226         int     bDongle;/* build-in module or external dongle */
227         u16     chip_type;
228
229         struct dvobj_priv *dvobj;
230         struct  mlme_priv mlmepriv;
231         struct  mlme_ext_priv mlmeextpriv;
232         struct  cmd_priv        cmdpriv;
233         struct  evt_priv        evtpriv;
234         struct  io_priv iopriv;
235         struct  xmit_priv       xmitpriv;
236         struct  recv_priv       recvpriv;
237         struct  sta_priv        stapriv;
238         struct  security_priv   securitypriv;
239         struct  registry_priv   registrypriv;
240         struct  pwrctrl_priv    pwrctrlpriv;
241         struct  eeprom_priv eeprompriv;
242         struct  led_priv        ledpriv;
243         struct  mp_priv mppriv;
244
245 #ifdef CONFIG_88EU_AP_MODE
246         struct  hostapd_priv    *phostapdpriv;
247 #endif
248
249         struct wifidirect_info  wdinfo;
250
251         void *HalData;
252         u32 hal_data_sz;
253         struct hal_ops  HalFunc;
254
255         s32     bDriverStopped;
256         s32     bSurpriseRemoved;
257         s32     bCardDisableWOHSM;
258
259         u32     IsrContent;
260         u32     ImrContent;
261
262         u8      EepromAddressSize;
263         u8      hw_init_completed;
264         u8      bDriverIsGoingToUnload;
265         u8      init_adpt_in_progress;
266         u8      bHaltInProgress;
267
268         void *cmdThread;
269         void *evtThread;
270         void *xmitThread;
271         void *recvThread;
272         void (*intf_start)(struct adapter *adapter);
273         void (*intf_stop)(struct adapter *adapter);
274         struct  net_device *pnetdev;
275
276         /*  used by rtw_rereg_nd_name related function */
277         struct rereg_nd_name_data {
278                 struct  net_device *old_pnetdev;
279                 char old_ifname[IFNAMSIZ];
280                 u8 old_ips_mode;
281                 u8 old_bRegUseLed;
282         } rereg_nd_name_priv;
283
284         int bup;
285         struct net_device_stats stats;
286         struct iw_statistics iwstats;
287         struct proc_dir_entry *dir_dev;/*  for proc directory */
288
289         int net_closed;
290         u8 bFWReady;
291         u8 bBTFWReady;
292         u8 bReadPortCancel;
293         u8 bWritePortCancel;
294         u8 bRxRSSIDisplay;
295         /* The driver will show up the desired channel number
296          * when this flag is 1. */
297         u8 bNotifyChannelChange;
298 #ifdef CONFIG_88EU_P2P
299         /* The driver will show the current P2P status when the
300          * upper application reads it. */
301         u8 bShowGetP2PState;
302 #endif
303         struct adapter *pbuddy_adapter;
304
305         struct mutex *hw_init_mutex;
306
307         spinlock_t br_ext_lock;
308         struct nat25_network_db_entry   *nethash[NAT25_HASH_SIZE];
309         int                             pppoe_connection_in_progress;
310         unsigned char                   pppoe_addr[MACADDRLEN];
311         unsigned char                   scdb_mac[MACADDRLEN];
312         unsigned char                   scdb_ip[4];
313         struct nat25_network_db_entry   *scdb_entry;
314         unsigned char                   br_mac[MACADDRLEN];
315         unsigned char                   br_ip[4];
316         struct br_ext_info              ethBrExtInfo;
317
318         u8      fix_rate;
319
320         unsigned char     in_cta_test;
321 };
322
323 #define adapter_to_dvobj(adapter) (adapter->dvobj)
324
325 int rtw_handle_dualmac(struct adapter *adapter, bool init);
326
327 static inline u8 *myid(struct eeprom_priv *peepriv)
328 {
329         return peepriv->mac_addr;
330 }
331
332 #endif /* __DRV_TYPES_H__ */