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