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