1 /******************************************************************************
2 *
3 * Copyright(c) 2007 - 2010 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 * Modifications for inclusion into the Linux staging tree are
19 * Copyright(c) 2010 Larry Finger. All rights reserved.
20 *
21 * Contact information:
22 * WLAN FAE <wlanfae@realtek.com>
23 * Larry Finger <Larry.Finger@lwfinger.net>
24 *
25 ******************************************************************************/
26 /* ---------------------------------------------------------------------
27 *
28 * For type defines and data structure defines
29 *
30 * ---------------------------------------------------------------------
31 */
32 #ifndef __DRV_TYPES_H__
33 #define __DRV_TYPES_H__
34
35 struct _adapter;
36
37 #include "osdep_service.h"
38 #include "wlan_bssdef.h"
39 #include "rtl8712_spec.h"
40 #include "rtl8712_hal.h"
41 #include <linux/mutex.h>
42 #include <linux/completion.h>
43
44 enum _NIC_VERSION {
45 RTL8711_NIC,
46 RTL8712_NIC,
47 RTL8713_NIC,
48 RTL8716_NIC
49 };
50
51 struct _adapter;
52
53 struct qos_priv {
54 /* bit mask option: u-apsd, s-apsd, ts, block ack... */
55 unsigned int qos_option;
56 };
57
58 #include "rtl871x_ht.h"
59 #include "rtl871x_cmd.h"
60 #include "rtl871x_xmit.h"
61 #include "rtl871x_recv.h"
62 #include "rtl871x_security.h"
63 #include "rtl871x_pwrctrl.h"
64 #include "rtl871x_io.h"
65 #include "rtl871x_eeprom.h"
66 #include "sta_info.h"
67 #include "rtl871x_mlme.h"
68 #include "rtl871x_mp.h"
69 #include "rtl871x_debug.h"
70 #include "rtl871x_rf.h"
71 #include "rtl871x_event.h"
72 #include "rtl871x_led.h"
73
74 #define SPEC_DEV_ID_DISABLE_HT BIT(1)
75
76 struct specific_device_id {
77 u32 flags;
78 u16 idVendor;
79 u16 idProduct;
80
81 };
82
83 struct registry_priv {
84 u8 chip_version;
85 u8 rfintfs;
86 u8 lbkmode;
87 u8 hci;
88 u8 network_mode; /*infra, ad-hoc, auto*/
89 struct ndis_802_11_ssid ssid;
90 u8 channel;/* ad-hoc support requirement */
91 u8 wireless_mode;/* A, B, G, auto */
92 u8 vrtl_carrier_sense; /*Enable, Disable, Auto*/
93 u8 vcs_type;/*RTS/CTS, CTS-to-self*/
94 u16 rts_thresh;
95 u16 frag_thresh;
96 u8 preamble;/*long, short, auto*/
97 u8 scan_mode;/*active, passive*/
98 u8 adhoc_tx_pwr;
99 u8 soft_ap;
100 u8 smart_ps;
101 u8 power_mgnt;
102 u8 radio_enable;
103 u8 long_retry_lmt;
104 u8 short_retry_lmt;
105 u16 busy_thresh;
106 u8 ack_policy;
107 u8 mp_mode;
108 u8 software_encrypt;
109 u8 software_decrypt;
110 /* UAPSD */
111 u8 wmm_enable;
112 u8 uapsd_enable;
113 u8 uapsd_max_sp;
114 u8 uapsd_acbk_en;
115 u8 uapsd_acbe_en;
116 u8 uapsd_acvi_en;
117 u8 uapsd_acvo_en;
118
119 struct wlan_bssid_ex dev_network;
120
121 u8 ht_enable;
122 u8 cbw40_enable;
123 u8 ampdu_enable;/*for tx*/
124 u8 rf_config;
125 u8 low_power;
126 u8 wifi_test;
127 };
128
129 struct dvobj_priv {
130 struct _adapter *padapter;
131 u32 nr_endpoint;
132 u8 ishighspeed;
133 uint (*inirp_init)(struct _adapter *adapter);
134 uint (*inirp_deinit)(struct _adapter *adapter);
135 struct usb_device *pusbdev;
136 };
137
138 /**
139 * struct _adapter - the main adapter structure for this device.
140 *
141 * bup: True indicates that the interface is up.
142 */
143 struct _adapter {
144 struct dvobj_priv dvobjpriv;
145 struct mlme_priv mlmepriv;
146 struct cmd_priv cmdpriv;
147 struct evt_priv evtpriv;
148 struct io_queue *pio_queue;
149 struct xmit_priv xmitpriv;
150 struct recv_priv recvpriv;
151 struct sta_priv stapriv;
152 struct security_priv securitypriv;
153 struct registry_priv registrypriv;
154 struct wlan_acl_pool acl_list;
155 struct pwrctrl_priv pwrctrlpriv;
156 struct eeprom_priv eeprompriv;
157 struct hal_priv halpriv;
158 struct led_priv ledpriv;
159 struct mp_priv mppriv;
160 s32 bDriverStopped;
161 s32 bSurpriseRemoved;
162 u32 IsrContent;
163 u32 ImrContent;
164 u8 EepromAddressSize;
165 u8 hw_init_completed;
166 struct task_struct *cmdThread;
167 pid_t evtThread;
168 struct task_struct *xmitThread;
169 pid_t recvThread;
170 uint (*dvobj_init)(struct _adapter *adapter);
171 void (*dvobj_deinit)(struct _adapter *adapter);
172 struct net_device *pnetdev;
173 int bup;
174 struct net_device_stats stats;
175 struct iw_statistics iwstats;
176 int pid; /*process id from UI*/
177 struct work_struct wkFilterRxFF0;
178 u8 blnEnableRxFF0Filter;
179 spinlock_t lockRxFF0Filter;
180 const struct firmware *fw;
181 struct usb_interface *pusb_intf;
182 struct mutex mutex_start;
183 struct completion rtl8712_fw_ready;
184 };
185
myid(struct eeprom_priv * peepriv)186 static inline u8 *myid(struct eeprom_priv *peepriv)
187 {
188 return peepriv->mac_addr;
189 }
190
191 u8 r8712_usb_hal_bus_init(struct _adapter *adapter);
192
193 #endif /*__DRV_TYPES_H__*/
194
195