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 * 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
19 ******************************************************************************/
20 /*-------------------------------------------------------------------------------
22 For type defines and data structure defines
24 --------------------------------------------------------------------------------*/
27 #ifndef __DRV_TYPES_H__
28 #define __DRV_TYPES_H__
31 #include <osdep_service.h>
32 #include <wlan_bssdef.h>
45 typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
47 #ifdef CONFIG_80211N_HT
52 #include <wlan_bssdef.h>
58 #include <rtw_security.h>
59 #include <rtw_pwrctrl.h>
61 #include <rtw_eeprom.h>
64 #include <rtw_debug.h>
66 #include <rtw_event.h>
68 #include <rtw_mlme_ext.h>
73 #ifdef CONFIG_WAPI_SUPPORT
77 #ifdef CONFIG_DRVEXT_MODULE
78 #include <drvext_api.h>
82 #include <rtw_br_ext.h>
83 #endif // CONFIG_BR_EXT
85 #ifdef CONFIG_IOCTL_CFG80211
86 #include "ioctl_cfg80211.h"
87 #endif //CONFIG_IOCTL_CFG80211
89 #define SPEC_DEV_ID_NONE BIT(0)
90 #define SPEC_DEV_ID_DISABLE_HT BIT(1)
91 #define SPEC_DEV_ID_ENABLE_PS BIT(2)
92 #define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3)
93 #define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4)
94 #define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5)
96 struct specific_device_id{
111 NDIS_802_11_SSID ssid;
112 u8 network_mode; //infra, ad-hoc, auto
113 u8 channel;//ad-hoc support requirement
114 u8 wireless_mode;//A, B, G, auto
115 u8 scan_mode;//active, passive
117 u8 preamble;//long, short, auto
118 u8 vrtl_carrier_sense;//Enable, Disable, Auto
119 u8 vcs_type;//RTS/CTS, CTS-to-self
133 #ifdef CONFIG_TX_EARLY_MODE
146 WLAN_BSSID_EX dev_network;
148 #ifdef CONFIG_80211N_HT
151 u8 ampdu_enable;//for tx
153 u8 ampdu_amsdu;//A-MPDU Supports A-MSDU is permitted
160 u8 wifi_spec;// !turbo_mode
163 #ifdef CONFIG_BT_COEXIST
169 bool bAcceptAddbaReq;
174 u8 usbss_enable;//0:disable,1:enable
175 u8 hwpdn_mode;//0:disable,1:enable,2:decide by EFUSE config
176 u8 hwpwrp_detect;//0:disable,1:enable
178 u8 hw_wps_pbc;//0:disable,1:enable
180 #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
181 char adaptor_info_caching_file_path[PATH_LENGTH_MAX];
184 #ifdef CONFIG_LAYER2_ROAMING
185 u8 max_roaming_times; // the max number driver will try to roaming
189 u8 fw_iol; //enable iol without other concern
192 #ifdef CONFIG_DUALMAC_CONCURRENT
193 u8 dmsp;//0:disable,1:enable
205 #ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV
206 u8 force_ant;//0 normal,1 main,2 aux
207 u8 force_igi;//0 normal
214 //For registry parameters
215 #define RGTRY_OFT(field) ((ULONG)FIELD_OFFSET(struct registry_priv,field))
216 #define RGTRY_SZ(field) sizeof(((struct registry_priv*) 0)->field)
217 #define BSSID_OFT(field) ((ULONG)FIELD_OFFSET(WLAN_BSSID_EX,field))
218 #define BSSID_SZ(field) sizeof(((PWLAN_BSSID_EX) 0)->field)
220 #define MAX_CONTINUAL_URB_ERR 4
222 #ifdef CONFIG_SDIO_HCI
223 #include <drv_types_sdio.h>
224 #define INTF_DATA SDIO_DATA
225 #elif defined(CONFIG_GSPI_HCI)
226 #include <drv_types_gspi.h>
227 #define INTF_DATA GSPI_DATA
230 #define GET_PRIMARY_ADAPTER(padapter) (((_adapter *)padapter)->dvobj->if1)
232 #define GET_IFACE_NUMS(padapter) (((_adapter *)padapter)->dvobj->iface_nums)
233 #define GET_ADAPTER(padapter, iface_id) (((_adapter *)padapter)->dvobj->padapters[iface_id])
236 IFACE_ID0, //maping to PRIMARY_ADAPTER
237 IFACE_ID1, //maping to SECONDARY_ADAPTER
245 _adapter *if1; //PRIMARY_ADAPTER
246 _adapter *if2; //SECONDARY_ADAPTER
248 //for local/global synchronization
249 _mutex hw_init_mutex;
250 _mutex h2c_fwcmd_mutex;
254 unsigned char oper_channel; //saved channel info when call set_channel_bw
255 unsigned char oper_bwmode;
256 unsigned char oper_ch_offset;//PRIME_CHNL_OFFSET
258 _adapter *padapters[IFACE_ID_MAX];
259 u8 iface_nums; // total number of ifaces used runtime
261 //For 92D, DMDP have 2 interface.
265 //In /Out Pipe information
268 u8 Queue2Pipe[HW_QUEUE_ENTRY];//for out pipe mapping
272 /*-------- below is for SDIO INTERFACE --------*/
278 /*-------- below is for USB INTERFACE --------*/
280 #ifdef CONFIG_USB_HCI
286 int ep_num[5]; //endpoint number
290 struct semaphore usb_suspend_sema;
292 #ifdef CONFIG_USB_VENDOR_REQ_MUTEX
293 _mutex usb_vendor_req_mutex;
296 #ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
297 u8 * usb_alloc_vendor_req_buf;
298 u8 * usb_vendor_req_buf;
301 struct usb_interface *pusbintf;
302 struct usb_device *pusbdev;
303 ATOMIC_T continual_urb_error;
304 #endif//CONFIG_USB_HCI
306 /*-------- below is for PCIE INTERFACE --------*/
308 #ifdef CONFIG_PCI_HCI
310 struct pci_dev *ppcidev;
313 unsigned long pci_mem_end; /* shared mem end */
314 unsigned long pci_mem_start; /* shared mem start */
317 unsigned long pci_base_addr; /* device I/O address */
320 struct pci_priv pcipriv;
324 RT_ISR_CONTENT isr_content;
329 u8 const_amdpci_aspm;
330 u8 const_hwsw_rfoff_d3;
331 u8 const_support_pciaspm;
333 u8 const_hostpci_aspm_setting;
335 u8 const_devicepci_aspm_setting;
336 u8 b_support_aspm; // If it supports ASPM, Offset[560h] = 0x40, otherwise Offset[560h] = 0x00.
337 u8 b_support_backdoor;
339 #endif//CONFIG_PCI_HCI
342 static struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
344 /* todo: get interface type from dvobj and the return the dev accordingly */
345 #ifdef RTW_DVOBJ_CHIP_HW_TYPE
348 #ifdef CONFIG_USB_HCI
349 return &dvobj->pusbintf->dev;
351 #ifdef CONFIG_SDIO_HCI
352 return &dvobj->intf_data.func->dev;
354 #ifdef CONFIG_GSPI_HCI
355 return &dvobj->intf_data.func->dev;
357 #ifdef CONFIG_PCI_HCI
358 return &dvobj->ppcidev->dev;
363 IFACE_PORT0, //mapping to port0 for C/D series chips
364 IFACE_PORT1, //mapping to port1 for C/D series chip
374 typedef enum _DRIVER_STATE{
376 DRIVER_DISAPPEAR = 1,
377 DRIVER_REPLACE_DONGLE = 2,
380 #ifdef CONFIG_INTEL_PROXIM
385 void *proximity_priv;
386 int (*proxim_rx)(_adapter *padapter,
387 union recv_frame *precv_frame);
388 u8 (*proxim_get_var)(_adapter* padapter, u8 type);
390 #endif //CONFIG_INTEL_PROXIM
392 #ifdef CONFIG_MAC_LOOPBACK_DRIVER
393 typedef struct loopbackdata
395 struct semaphore sema;
396 _thread_hdl_ lbkthread;
406 }LOOPBACKDATA, *PLOOPBACKDATA;
410 int DriverState;// for disable driver using module, use dongle to replace module.
411 int pid[3];//process id from UI, 0:wps, 1:hostapd, 2:dhcpcd
412 int bDongle;//build-in module or external dongle
415 u16 interface_type;//USB,SDIO,SPI,PCI
417 struct dvobj_priv *dvobj;
418 struct mlme_priv mlmepriv;
419 struct mlme_ext_priv mlmeextpriv;
420 struct cmd_priv cmdpriv;
421 struct evt_priv evtpriv;
422 //struct io_queue *pio_queue;
423 struct io_priv iopriv;
424 struct xmit_priv xmitpriv;
425 struct recv_priv recvpriv;
426 struct sta_priv stapriv;
427 struct security_priv securitypriv;
428 struct registry_priv registrypriv;
429 struct pwrctrl_priv pwrctrlpriv;
430 struct eeprom_priv eeprompriv;
431 struct led_priv ledpriv;
432 #if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST)
433 //Check BT status for BT Hung.
434 struct workqueue_struct *priv_checkbt_wq;
435 struct delayed_work checkbt_work;
438 #ifdef CONFIG_DRVEXT_MODULE
439 struct drvext_priv drvextpriv;
442 #ifdef CONFIG_AP_MODE
443 struct hostapd_priv *phostapdpriv;
446 #ifdef CONFIG_IOCTL_CFG80211
448 struct cfg80211_wifidirect_info cfg80211_wdinfo;
450 #endif //CONFIG_IOCTL_CFG80211
453 struct wifidirect_info wdinfo;
457 struct tdls_info tdlsinfo;
460 #ifdef CONFIG_WAPI_SUPPORT
467 struct wifi_display_info wfd_info;
472 struct hal_ops HalFunc;
475 s32 bSurpriseRemoved;
476 s32 bCardDisableWOHSM;
481 u8 EepromAddressSize;
482 u8 hw_init_completed;
483 u8 bDriverIsGoingToUnload;
484 u8 init_adpt_in_progress;
487 _thread_hdl_ cmdThread;
488 _thread_hdl_ evtThread;
489 _thread_hdl_ xmitThread;
490 _thread_hdl_ recvThread;
492 void (*intf_start)(_adapter * adapter);
493 void (*intf_stop)(_adapter * adapter);
497 // used by rtw_rereg_nd_name related function
498 struct rereg_nd_name_data {
499 _nic_hdl old_pnetdev;
500 char old_ifname[IFNAMSIZ];
503 } rereg_nd_name_priv;
506 struct net_device_stats stats;
507 struct iw_statistics iwstats;
508 struct proc_dir_entry *dir_dev;// for proc directory
510 #ifdef CONFIG_IOCTL_CFG80211
511 struct wireless_dev *rtw_wdev;
512 #endif //CONFIG_IOCTL_CFG80211
520 // Added by Albert 2012/10/26
521 // The driver will show up the desired channel number when this flag is 1.
522 u8 bNotifyChannelChange;
524 // Added by Albert 2012/12/06
525 // The driver will show the current P2P status when the upper application reads it.
528 #ifdef CONFIG_AUTOSUSPEND
529 u8 bDisableAutosuspend;
532 _adapter *pbuddy_adapter;
534 #if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_DUALMAC_CONCURRENT)
535 u8 isprimary; //is primary adapter or not
537 // if isprimary is true, the adapter_type value is 0, iface_id is IFACE_ID0 for PRIMARY_ADAPTER
538 // if isprimary is false, the adapter_type value is 1, iface_id is IFACE_ID1 for SECONDARY_ADAPTER
539 // refer to iface_id if iface_nums>2 and isprimary is false and the adapter_type value is 0xff.
540 u8 adapter_type;//used only in two inteface case(PRIMARY_ADAPTER and SECONDARY_ADAPTER) .
541 u8 iface_type; //interface port type, it depends on HW port
544 //extend to support multi interface
545 //IFACE_ID0 is equals to PRIMARY_ADAPTER
546 //IFACE_ID1 is equals to SECONDARY_ADAPTER
549 #ifdef CONFIG_DUALMAC_CONCURRENT
550 u8 DualMacConcurrent; // 1: DMSP 0:DMDP
555 //unsigned int macclone_completed;
556 struct nat25_network_db_entry *nethash[NAT25_HASH_SIZE];
557 int pppoe_connection_in_progress;
558 unsigned char pppoe_addr[MACADDRLEN];
559 unsigned char scdb_mac[MACADDRLEN];
560 unsigned char scdb_ip[4];
561 struct nat25_network_db_entry *scdb_entry;
562 unsigned char br_mac[MACADDRLEN];
563 unsigned char br_ip[4];
565 struct br_ext_info ethBrExtInfo;
566 #endif // CONFIG_BR_EXT
568 #ifdef CONFIG_INTEL_PROXIM
569 /* intel Proximity, should be alloc mem
570 * in intel Proximity module and can only
571 * be used in intel Proximity mode */
572 struct proxim proximity;
573 #endif //CONFIG_INTEL_PROXIM
575 #ifdef CONFIG_MAC_LOOPBACK_DRIVER
576 PLOOPBACKDATA ploopback;
581 unsigned char in_cta_test;
585 #define adapter_to_dvobj(adapter) (adapter->dvobj)
587 int rtw_handle_dualmac(_adapter *adapter, bool init);
589 __inline static u8 *myid(struct eeprom_priv *peepriv)
591 return (peepriv->mac_addr);
595 #endif //__DRV_TYPES_H__