GNU Linux-libre 4.14.259-gnu1
[releases.git] / 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  ******************************************************************************/
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>
29 #include <rtw_ht.h>
30 #include <rtw_cmd.h>
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>
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>
46 #include <rtw_ap.h>
47
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
55 struct registry_priv {
56         struct ndis_802_11_ssid ssid;
57         u8      channel;/* ad-hoc support requirement */
58         u8      wireless_mode;/* A, B, G, auto */
59         u8      preamble;/* long, short, auto */
60         u8      vrtl_carrier_sense;/* Enable, Disable, Auto */
61         u8      vcs_type;/* RTS/CTS, CTS-to-self */
62         u16     rts_thresh;
63         u16     frag_thresh;
64         u8      power_mgnt;
65         u8      ips_mode;
66         u8      smart_ps;
67         u8      mp_mode;
68         u8      acm_method;
69           /* UAPSD */
70         u8      wmm_enable;
71         u8      uapsd_enable;
72
73         struct wlan_bssid_ex    dev_network;
74
75         u8      ht_enable;
76         u8      cbw40_enable;
77         u8      ampdu_enable;/* for tx */
78         u8      rx_stbc;
79         u8      ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
80
81         u8      wifi_spec;/*  !turbo_mode */
82
83         u8      channel_plan;
84         bool    accept_addba_req; /* true = accept AP's Add BA req */
85
86         u8      antdiv_cfg;
87         u8      antdiv_type;
88
89         u8      usbss_enable;/* 0:disable,1:enable */
90         u8      hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
91
92         u8      max_roaming_times; /*  the max number driver will try */
93
94         u8      fw_iol; /* enable iol without other concern */
95
96         u8      enable80211d;
97
98         u8      ifname[16];
99         u8      if2name[16];
100
101         u8      notch_filter;
102         bool    monitor_enable;
103 };
104
105 #define MAX_CONTINUAL_URB_ERR           4
106
107 struct dvobj_priv {
108         struct adapter *if1;
109         /* For 92D, DMDP have 2 interface. */
110         u8      InterfaceNumber;
111         u8      NumInterfaces;
112
113         /* In /Out Pipe information */
114         int     RtInPipe[2];
115         int     RtOutPipe[3];
116         u8      Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
117
118 /*-------- below is for USB INTERFACE --------*/
119         u8      ishighspeed;
120         u8      RtNumInPipes;
121         u8      RtNumOutPipes;
122         struct mutex  usb_vendor_req_mutex;
123
124         struct usb_interface *pusbintf;
125         struct usb_device *pusbdev;
126 };
127
128 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
129 {
130         /* todo: get interface type from dvobj and the return
131          * the dev accordingly */
132         return &dvobj->pusbintf->dev;
133 };
134
135 struct adapter {
136         struct dvobj_priv *dvobj;
137         struct  mlme_priv mlmepriv;
138         struct  mlme_ext_priv mlmeextpriv;
139         struct  cmd_priv        cmdpriv;
140         struct  xmit_priv       xmitpriv;
141         struct  recv_priv       recvpriv;
142         struct  sta_priv        stapriv;
143         struct  security_priv   securitypriv;
144         struct  registry_priv   registrypriv;
145         struct  pwrctrl_priv    pwrctrlpriv;
146         struct  eeprom_priv eeprompriv;
147         struct  led_priv        ledpriv;
148
149         struct hal_data_8188e *HalData;
150
151         s32     bDriverStopped;
152         s32     bSurpriseRemoved;
153
154         u8      hw_init_completed;
155
156         void *cmdThread;
157         struct  net_device *pnetdev;
158         struct  net_device *pmondev;
159
160         int bup;
161         struct net_device_stats stats;
162         struct iw_statistics iwstats;
163         struct proc_dir_entry *dir_dev;/*  for proc directory */
164
165         int net_closed;
166         u8 bFWReady;
167         u8 bReadPortCancel;
168         u8 bWritePortCancel;
169
170         struct mutex hw_init_mutex;
171 };
172
173 #define adapter_to_dvobj(adapter) (adapter->dvobj)
174
175 static inline u8 *myid(struct eeprom_priv *peepriv)
176 {
177         return peepriv->mac_addr;
178 }
179
180 #endif /* __DRV_TYPES_H__ */