1 /******************************************************************************
3 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
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.
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
14 ******************************************************************************/
15 /*-----------------------------------------------------------------------------
17 For type defines and data structure defines
19 ------------------------------------------------------------------------------*/
22 #ifndef __DRV_TYPES_H__
23 #define __DRV_TYPES_H__
25 #include <osdep_service.h>
26 #include <wlan_bssdef.h>
41 #include <wlan_bssdef.h>
47 #include <rtw_security.h>
48 #include <rtw_pwrctrl.h>
50 #include <rtw_eeprom.h>
53 #include <rtw_debug.h>
55 #include <rtw_event.h>
57 #include <rtw_mlme_ext.h>
61 #include "ioctl_cfg80211.h"
63 #define SPEC_DEV_ID_NONE BIT(0)
64 #define SPEC_DEV_ID_DISABLE_HT BIT(1)
65 #define SPEC_DEV_ID_ENABLE_PS BIT(2)
66 #define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3)
67 #define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4)
68 #define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5)
70 struct specific_device_id {
78 struct registry_priv {
81 struct cfg80211_ssid ssid;
82 u8 channel;/* ad-hoc support requirement */
83 u8 wireless_mode;/* A, B, G, auto */
84 u8 scan_mode;/* active, passive */
85 u8 preamble;/* long, short, auto */
86 u8 vrtl_carrier_sense;/* Enable, Disable, Auto */
87 u8 vcs_type;/* RTS/CTS, CTS-to-self */
106 struct wlan_bssid_ex dev_network;
110 u8 ampdu_enable;/* for tx */
112 u8 ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
118 u8 wifi_spec;/* !turbo_mode */
121 #ifdef CONFIG_8723AU_BT_COEXIST
127 bool bAcceptAddbaReq;
132 u8 usbss_enable;/* 0:disable,1:enable */
133 u8 hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
134 u8 hwpwrp_detect;/* 0:disable,1:enable */
136 u8 hw_wps_pbc;/* 0:disable,1:enable */
138 u8 max_roaming_times; /* max number driver will try to roaming */
151 #define MAX_CONTINUAL_URB_ERR 4
153 #define GET_PRIMARY_ADAPTER(padapter) \
154 (((struct rtw_adapter *)padapter)->dvobj->if1)
157 IFACE_ID0, /* maping to PRIMARY_ADAPTER */
158 IFACE_ID1, /* maping to SECONDARY_ADAPTER */
165 struct rtw_adapter *if1; /* PRIMARY_ADAPTER */
166 struct rtw_adapter *if2; /* SECONDARY_ADAPTER */
168 /* for local/global synchronization */
169 struct mutex hw_init_mutex;
170 struct mutex h2c_fwcmd_mutex;
171 struct mutex setch_mutex;
172 struct mutex setbw_mutex;
174 unsigned char oper_channel; /* saved chan info when set chan bw */
175 unsigned char oper_bwmode;
176 unsigned char oper_ch_offset;/* PRIME_CHNL_OFFSET */
178 struct rtw_adapter *padapters[IFACE_ID_MAX];
179 u8 iface_nums; /* total number of ifaces used runtime */
181 /* For 92D, DMDP have 2 interface. */
185 /* In /Out Pipe information */
188 u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
192 /*-------- below is for USB INTERFACE --------*/
198 int ep_num[5]; /* endpoint number */
202 struct semaphore usb_suspend_sema;
204 struct mutex usb_vendor_req_mutex;
206 u8 *usb_alloc_vendor_req_buf;
207 u8 *usb_vendor_req_buf;
209 struct usb_interface *pusbintf;
210 struct usb_device *pusbdev;
211 atomic_t continual_urb_error;
213 /*-------- below is for PCIE INTERFACE --------*/
217 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
219 /* todo: get interface type from dvobj and the return the dev accordingly */
220 return &dvobj->pusbintf->dev;
224 IFACE_PORT0, /* mapping to port0 for C/D series chips */
225 IFACE_PORT1, /* mapping to port1 for C/D series chip */
236 int pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
237 int bDongle;/* build-in module or external dongle */
241 struct dvobj_priv *dvobj;
242 struct mlme_priv mlmepriv;
243 struct mlme_ext_priv mlmeextpriv;
244 struct cmd_priv cmdpriv;
245 struct evt_priv evtpriv;
246 /* struct io_queue *pio_queue; */
247 struct io_priv iopriv;
248 struct xmit_priv xmitpriv;
249 struct recv_priv recvpriv;
250 struct sta_priv stapriv;
251 struct security_priv securitypriv;
252 struct registry_priv registrypriv;
253 struct pwrctrl_priv pwrctrlpriv;
254 struct eeprom_priv eeprompriv;
255 struct led_priv ledpriv;
257 #ifdef CONFIG_8723AU_AP_MODE
258 struct hostapd_priv *phostapdpriv;
261 struct cfg80211_wifidirect_info cfg80211_wdinfo;
263 struct wifidirect_info wdinfo;
265 #ifdef CONFIG_8723AU_P2P
266 struct wifi_display_info wfd_info;
267 #endif /* CONFIG_8723AU_P2P */
271 struct hal_ops HalFunc;
274 s32 bSurpriseRemoved;
275 s32 bCardDisableWOHSM;
280 u8 EepromAddressSize;
281 u8 hw_init_completed;
282 u8 bDriverIsGoingToUnload;
283 u8 init_adpt_in_progress;
291 void (*intf_start)(struct rtw_adapter *adapter);
292 void (*intf_stop)(struct rtw_adapter *adapter);
294 struct net_device *pnetdev;
296 /* used by rtw_rereg_nd_name related function */
297 struct rereg_nd_name_data {
298 struct net_device *old_pnetdev;
299 char old_ifname[IFNAMSIZ];
302 } rereg_nd_name_priv;
305 struct net_device_stats stats;
306 struct iw_statistics iwstats;
307 struct proc_dir_entry *dir_dev;/* for proc directory */
309 struct wireless_dev *rtw_wdev;
317 /* The driver will show the desired chan nor when this flag is 1. */
318 u8 bNotifyChannelChange;
319 #ifdef CONFIG_8723AU_P2P
320 /* driver will show current P2P status when the application reads it*/
323 struct rtw_adapter *pbuddy_adapter;
325 /* extend to support multi interface */
326 /* IFACE_ID0 is equals to PRIMARY_ADAPTER */
327 /* IFACE_ID1 is equals to SECONDARY_ADAPTER */
332 /* unsigned int macclone_completed; */
333 struct nat25_network_db_entry *nethash[NAT25_HASH_SIZE];
334 int pppoe_connection_in_progress;
335 unsigned char pppoe_addr[MACADDRLEN];
336 unsigned char scdb_mac[MACADDRLEN];
337 unsigned char scdb_ip[4];
338 struct nat25_network_db_entry *scdb_entry;
339 unsigned char br_mac[MACADDRLEN];
340 unsigned char br_ip[4];
342 struct br_ext_info ethBrExtInfo;
343 #endif /* CONFIG_BR_EXT */
347 unsigned char in_cta_test;
351 #define adapter_to_dvobj(adapter) (adapter->dvobj)
353 int rtw_handle_dualmac23a(struct rtw_adapter *adapter, bool init);
355 static inline u8 *myid(struct eeprom_priv *peepriv)
357 return peepriv->mac_addr;
360 #endif /* __DRV_TYPES_H__ */