]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/rtl8723au/include/drv_types.h
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[karo-tx-linux.git] / drivers / staging / rtl8723au / 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 #include <osdep_service.h>
26 #include <wlan_bssdef.h>
27
28
29 enum _NIC_VERSION {
30         RTL8711_NIC,
31         RTL8712_NIC,
32         RTL8713_NIC,
33         RTL8716_NIC
34
35 };
36
37
38 #include <rtw_ht.h>
39
40 #include <rtw_cmd.h>
41 #include <rtw_xmit.h>
42 #include <rtw_recv.h>
43 #include <hal_intf.h>
44 #include <hal_com.h>
45 #include <rtw_security.h>
46 #include <rtw_pwrctrl.h>
47 #include <rtw_io.h>
48 #include <rtw_eeprom.h>
49 #include <sta_info.h>
50 #include <rtw_mlme.h>
51 #include <rtw_debug.h>
52 #include <rtw_rf.h>
53 #include <rtw_event.h>
54 #include <rtw_led.h>
55 #include <rtw_mlme_ext.h>
56 #include <rtw_ap.h>
57
58 #include "ioctl_cfg80211.h"
59
60 struct registry_priv {
61         u8      chip_version;
62         u8      rfintfs;
63         struct  cfg80211_ssid ssid;
64         u8      channel;/* ad-hoc support requirement */
65         u8      wireless_mode;/* A, B, G, auto */
66         u8      scan_mode;/* active, passive */
67         u8      preamble;/* long, short, auto */
68         u8      vrtl_carrier_sense;/* Enable, Disable, Auto */
69         u8      vcs_type;/* RTS/CTS, CTS-to-self */
70         u16     rts_thresh;
71         u16  frag_thresh;
72         u8      adhoc_tx_pwr;
73         u8      soft_ap;
74         u8      power_mgnt;
75         u8      ips_mode;
76         u8      smart_ps;
77         u8      long_retry_lmt;
78         u8      short_retry_lmt;
79         u16     busy_thresh;
80         u8      ack_policy;
81         u8      software_encrypt;
82         u8      software_decrypt;
83         u8      acm_method;
84           /* UAPSD */
85         u8      wmm_enable;
86         u8      uapsd_enable;
87
88         struct wlan_bssid_ex    dev_network;
89
90         u8      ht_enable;
91         u8      cbw40_enable;
92         u8      ampdu_enable;/* for tx */
93         u8      rx_stbc;
94         u8      ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
95         u8      lowrate_two_xmit;
96
97         u8      rf_config;
98         u8      low_power;
99
100         u8      wifi_spec;/*  !turbo_mode */
101
102         u8      channel_plan;
103 #ifdef CONFIG_8723AU_BT_COEXIST
104         u8      btcoex;
105         u8      bt_iso;
106         u8      bt_sco;
107         u8      bt_ampdu;
108 #endif
109         bool    bAcceptAddbaReq;
110
111         u8      antdiv_cfg;
112         u8      antdiv_type;
113
114         u8      usbss_enable;/* 0:disable,1:enable */
115         u8      hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
116         u8      hwpwrp_detect;/* 0:disable,1:enable */
117
118         u8      hw_wps_pbc;/* 0:disable,1:enable */
119
120         u8      max_roaming_times; /* max number driver will try to roaming */
121
122         u8 enable80211d;
123
124         u8 ifname[16];
125         u8 if2name[16];
126
127         u8 notch_filter;
128
129         u8 regulatory_tid;
130 };
131
132
133 #define MAX_CONTINUAL_URB_ERR 4
134
135 #define GET_PRIMARY_ADAPTER(padapter)                                   \
136         (((struct rtw_adapter *)padapter)->dvobj->if1)
137
138 enum _IFACE_ID {
139         IFACE_ID0, /* maping to PRIMARY_ADAPTER */
140         IFACE_ID1, /* maping to SECONDARY_ADAPTER */
141         IFACE_ID2,
142         IFACE_ID3,
143         IFACE_ID_MAX,
144 };
145
146 struct dvobj_priv {
147         struct rtw_adapter *if1; /* PRIMARY_ADAPTER */
148         struct rtw_adapter *if2; /* SECONDARY_ADAPTER */
149
150         /* for local/global synchronization */
151         struct mutex hw_init_mutex;
152         struct mutex h2c_fwcmd_mutex;
153         struct mutex setch_mutex;
154         struct mutex setbw_mutex;
155
156         unsigned char   oper_channel; /* saved chan info when set chan bw */
157         unsigned char   oper_bwmode;
158         unsigned char   oper_ch_offset;/* PRIME_CHNL_OFFSET */
159
160         struct rtw_adapter *padapters[IFACE_ID_MAX];
161         u8 iface_nums; /*  total number of ifaces used runtime */
162
163         /* For 92D, DMDP have 2 interface. */
164         u8      InterfaceNumber;
165         u8      NumInterfaces;
166
167         /* In /Out Pipe information */
168         int     RtInPipe[2];
169         int     RtOutPipe[3];
170         u8      Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
171
172 /*-------- below is for USB INTERFACE --------*/
173
174         u8      nr_endpoint;
175         u8      ishighspeed;
176         u8      RtNumInPipes;
177         u8      RtNumOutPipes;
178         int     ep_num[5]; /* endpoint number */
179
180         struct mutex  usb_vendor_req_mutex;
181
182         u8 *usb_alloc_vendor_req_buf;
183         u8 *usb_vendor_req_buf;
184
185         struct usb_interface *pusbintf;
186         struct usb_device *pusbdev;
187         atomic_t continual_urb_error;
188
189 /*-------- below is for PCIE INTERFACE --------*/
190
191 };
192
193 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
194 {
195         /* todo: get interface type from dvobj and the return the dev accordingly */
196         return &dvobj->pusbintf->dev;
197 }
198
199 enum _IFACE_TYPE {
200         IFACE_PORT0, /* mapping to port0 for C/D series chips */
201         IFACE_PORT1, /* mapping to port1 for C/D series chip */
202         MAX_IFACE_PORT,
203 };
204
205 enum _ADAPTER_TYPE {
206         PRIMARY_ADAPTER,
207         SECONDARY_ADAPTER,
208         MAX_ADAPTER,
209 };
210
211 struct rtw_adapter {
212         int     pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
213         int     bDongle;/* build-in module or external dongle */
214         u16     chip_type;
215         u16     HardwareType;
216
217         struct dvobj_priv *dvobj;
218         struct  mlme_priv mlmepriv;
219         struct  mlme_ext_priv mlmeextpriv;
220         struct  cmd_priv        cmdpriv;
221         struct  evt_priv        evtpriv;
222         struct  xmit_priv       xmitpriv;
223         struct  recv_priv       recvpriv;
224         struct  sta_priv        stapriv;
225         struct  security_priv   securitypriv;
226         struct  registry_priv   registrypriv;
227         struct  pwrctrl_priv    pwrctrlpriv;
228         struct  eeprom_priv eeprompriv;
229         struct  led_priv        ledpriv;
230
231         u32     setband;
232
233         void *HalData;
234
235         s32     bDriverStopped;
236         s32     bSurpriseRemoved;
237         s32  bCardDisableWOHSM;
238
239         u32     IsrContent;
240         u32     ImrContent;
241
242         u8      EepromAddressSize;
243         u8      hw_init_completed;
244         u8      bDriverIsGoingToUnload;
245         u8      init_adpt_in_progress;
246         u8      bHaltInProgress;
247
248         struct net_device *pnetdev;
249
250         /*  used by rtw_rereg_nd_name related function */
251         int bup;
252         struct net_device_stats stats;
253
254         struct wireless_dev *rtw_wdev;
255         int net_closed;
256
257         u8 bFWReady;
258         u8 bReadPortCancel;
259         u8 bWritePortCancel;
260         /* The driver will show the desired chan nor when this flag is 1. */
261         u8 bNotifyChannelChange;
262         struct rtw_adapter *pbuddy_adapter;
263
264         /* extend to support multi interface */
265         /* IFACE_ID0 is equals to PRIMARY_ADAPTER */
266         /* IFACE_ID1 is equals to SECONDARY_ADAPTER */
267         u8 iface_id;
268 };
269
270 #define adapter_to_dvobj(adapter) (adapter->dvobj)
271
272 int rtw_handle_dualmac23a(struct rtw_adapter *adapter, bool init);
273
274 static inline u8 *myid(struct eeprom_priv *peepriv)
275 {
276         return peepriv->mac_addr;
277 }
278
279 #endif /* __DRV_TYPES_H__ */