1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2007 - 2012 Realtek Corporation. */
4 /*-----------------------------------------------------------------------------
6 For type defines and data structure defines
8 ------------------------------------------------------------------------------*/
10 #ifndef __DRV_TYPES_H__
11 #define __DRV_TYPES_H__
13 #define DRV_NAME "r8188eu"
14 #define CONFIG_88EU_AP_MODE 1
15 #define CONFIG_88EU_P2P 1
17 #include <osdep_service.h>
18 #include <wlan_bssdef.h>
25 #include <rtw_security.h>
26 #include <rtw_pwrctrl.h>
28 #include <rtw_eeprom.h>
31 #include <rtw_debug.h>
33 #include <rtw_event.h>
35 #include <rtw_mlme_ext.h>
39 #include <rtw_br_ext.h>
41 #define DRIVERVERSION "v4.1.4_6773.20130222"
50 #define SPEC_DEV_ID_NONE BIT(0)
51 #define SPEC_DEV_ID_DISABLE_HT BIT(1)
52 #define SPEC_DEV_ID_ENABLE_PS BIT(2)
53 #define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3)
54 #define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4)
55 #define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5)
57 struct specific_device_id {
63 struct registry_priv {
68 struct ndis_802_11_ssid ssid;
69 u8 network_mode; /* infra, ad-hoc, auto */
70 u8 channel;/* ad-hoc support requirement */
71 u8 wireless_mode;/* A, B, G, auto */
72 u8 scan_mode;/* active, passive */
74 u8 preamble;/* long, short, auto */
75 u8 vrtl_carrier_sense;/* Enable, Disable, Auto */
76 u8 vcs_type;/* RTS/CTS, CTS-to-self */
103 struct wlan_bssid_ex dev_network;
107 u8 ampdu_enable;/* for tx */
109 u8 ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
115 u8 wifi_spec;/* !turbo_mode */
118 bool bAcceptAddbaReq;
123 u8 usbss_enable;/* 0:disable,1:enable */
124 u8 hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
125 u8 hwpwrp_detect;/* 0:disable,1:enable */
127 u8 hw_wps_pbc;/* 0:disable,1:enable */
129 u8 max_roaming_times; /* the max number driver will try */
131 u8 fw_iol; /* enable iol without other concern */
141 /* For registry parameters */
142 #define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
143 #define RGTRY_SZ(field) sizeof(((struct registry_priv *)0)->field)
144 #define BSSID_OFT(field) ((u32)FIELD_OFFSET(struct wlan_bssid_ex, field))
145 #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *)0)->field)
147 #define MAX_CONTINUAL_URB_ERR 4
158 /* For 92D, DMDP have 2 interface. */
162 /* In /Out Pipe information */
165 u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
169 struct rt_firmware firmware;
171 /*-------- below is for USB INTERFACE --------*/
177 int ep_num[5]; /* endpoint number */
179 struct semaphore usb_suspend_sema;
180 struct mutex usb_vendor_req_mutex;
182 u8 *usb_alloc_vendor_req_buf;
183 u8 *usb_vendor_req_buf;
185 struct usb_interface *pusbintf;
186 struct usb_device *pusbdev;
188 ATOMIC_T continual_urb_error;
192 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
194 /* todo: get interface type from dvobj and the return
195 * the dev accordingly */
196 return &dvobj->pusbintf->dev;
200 IFACE_PORT0, /* mapping to port0 for C/D series chips */
201 IFACE_PORT1, /* mapping to port1 for C/D series chip */
213 DRIVER_DISAPPEAR = 1,
214 DRIVER_REPLACE_DONGLE = 2,
218 int DriverState;/* for disable driver using module, use dongle toi
220 int pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
221 int bDongle;/* build-in module or external dongle */
224 u16 interface_type;/* USB,SDIO,SPI,PCI */
226 struct dvobj_priv *dvobj;
227 struct mlme_priv mlmepriv;
228 struct mlme_ext_priv mlmeextpriv;
229 struct cmd_priv cmdpriv;
230 struct evt_priv evtpriv;
231 struct io_priv iopriv;
232 struct xmit_priv xmitpriv;
233 struct recv_priv recvpriv;
234 struct sta_priv stapriv;
235 struct security_priv securitypriv;
236 struct registry_priv registrypriv;
237 struct pwrctrl_priv pwrctrlpriv;
238 struct eeprom_priv eeprompriv;
239 struct led_priv ledpriv;
240 struct mp_priv mppriv;
242 #ifdef CONFIG_88EU_AP_MODE
243 struct hostapd_priv *phostapdpriv;
246 struct wifidirect_info wdinfo;
250 struct hal_ops HalFunc;
253 s32 bSurpriseRemoved;
254 s32 bCardDisableWOHSM;
259 u8 EepromAddressSize;
260 u8 hw_init_completed;
261 u8 bDriverIsGoingToUnload;
262 u8 init_adpt_in_progress;
270 void (*intf_start)(struct adapter *adapter);
271 void (*intf_stop)(struct adapter *adapter);
272 struct net_device *pnetdev;
274 /* used by rtw_rereg_nd_name related function */
275 struct rereg_nd_name_data {
276 struct net_device *old_pnetdev;
277 char old_ifname[IFNAMSIZ];
280 } rereg_nd_name_priv;
283 struct net_device_stats stats;
284 struct iw_statistics iwstats;
285 struct proc_dir_entry *dir_dev;/* for proc directory */
293 /* The driver will show up the desired channel number
294 * when this flag is 1. */
295 u8 bNotifyChannelChange;
296 #ifdef CONFIG_88EU_P2P
297 /* The driver will show the current P2P status when the
298 * upper application reads it. */
301 struct adapter *pbuddy_adapter;
303 struct mutex *hw_init_mutex;
305 spinlock_t br_ext_lock;
306 struct nat25_network_db_entry *nethash[NAT25_HASH_SIZE];
307 int pppoe_connection_in_progress;
308 unsigned char pppoe_addr[MACADDRLEN];
309 unsigned char scdb_mac[MACADDRLEN];
310 unsigned char scdb_ip[4];
311 struct nat25_network_db_entry *scdb_entry;
312 unsigned char br_mac[MACADDRLEN];
313 unsigned char br_ip[4];
314 struct br_ext_info ethBrExtInfo;
318 unsigned char in_cta_test;
321 #define adapter_to_dvobj(adapter) (adapter->dvobj)
323 int rtw_handle_dualmac(struct adapter *adapter, bool init);
325 static inline u8 *myid(struct eeprom_priv *peepriv)
327 return peepriv->mac_addr;
330 #endif /* __DRV_TYPES_H__ */