1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3 *
4 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
5 *
6 ******************************************************************************/
7 /*-----------------------------------------------------------------------------
8
9 For type defines and data structure defines
10
11 ------------------------------------------------------------------------------*/
12
13
14 #ifndef __DRV_TYPES_H__
15 #define __DRV_TYPES_H__
16
17 #define DRV_NAME "r8188eu"
18
19 #include <osdep_service.h>
20 #include <wlan_bssdef.h>
21 #include <rtw_ht.h>
22 #include <rtw_cmd.h>
23 #include <rtw_xmit.h>
24 #include <rtw_recv.h>
25 #include <hal_intf.h>
26 #include <hal_com.h>
27 #include <rtw_qos.h>
28 #include <rtw_security.h>
29 #include <rtw_pwrctrl.h>
30 #include <rtw_eeprom.h>
31 #include <sta_info.h>
32 #include <rtw_mlme.h>
33 #include <rtw_debug.h>
34 #include <rtw_rf.h>
35 #include <rtw_event.h>
36 #include <rtw_led.h>
37 #include <rtw_mlme_ext.h>
38 #include <rtw_ap.h>
39
40 #define SPEC_DEV_ID_NONE BIT(0)
41 #define SPEC_DEV_ID_DISABLE_HT BIT(1)
42 #define SPEC_DEV_ID_ENABLE_PS BIT(2)
43 #define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3)
44 #define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4)
45 #define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5)
46
47 struct registry_priv {
48 struct ndis_802_11_ssid ssid;
49 u8 channel;/* ad-hoc support requirement */
50 u8 wireless_mode;/* A, B, G, auto */
51 u8 preamble;/* long, short, auto */
52 u8 vrtl_carrier_sense;/* Enable, Disable, Auto */
53 u8 vcs_type;/* RTS/CTS, CTS-to-self */
54 u16 rts_thresh;
55 u16 frag_thresh;
56 u8 power_mgnt;
57 u8 ips_mode;
58 u8 smart_ps;
59 u8 mp_mode;
60 u8 acm_method;
61 /* UAPSD */
62 u8 wmm_enable;
63 u8 uapsd_enable;
64
65 struct wlan_bssid_ex dev_network;
66
67 u8 ht_enable;
68 u8 cbw40_enable;
69 u8 ampdu_enable;/* for tx */
70 u8 rx_stbc;
71 u8 ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
72
73 u8 wifi_spec;/* !turbo_mode */
74
75 u8 channel_plan;
76 bool accept_addba_req; /* true = accept AP's Add BA req */
77
78 u8 antdiv_cfg;
79 u8 antdiv_type;
80
81 u8 usbss_enable;/* 0:disable,1:enable */
82 u8 hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
83
84 u8 max_roaming_times; /* the max number driver will try */
85
86 u8 fw_iol; /* enable iol without other concern */
87
88 u8 enable80211d;
89
90 u8 ifname[16];
91 u8 if2name[16];
92
93 u8 notch_filter;
94 bool monitor_enable;
95 };
96
97 #define MAX_CONTINUAL_URB_ERR 4
98
99 struct dvobj_priv {
100 struct adapter *if1;
101 /* For 92D, DMDP have 2 interface. */
102 u8 InterfaceNumber;
103 u8 NumInterfaces;
104
105 /* In /Out Pipe information */
106 int RtInPipe[2];
107 int RtOutPipe[3];
108 u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
109
110 /*-------- below is for USB INTERFACE --------*/
111 u8 ishighspeed;
112 u8 RtNumInPipes;
113 u8 RtNumOutPipes;
114 struct mutex usb_vendor_req_mutex;
115
116 struct usb_interface *pusbintf;
117 struct usb_device *pusbdev;
118 };
119
dvobj_to_dev(struct dvobj_priv * dvobj)120 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
121 {
122 /* todo: get interface type from dvobj and the return
123 * the dev accordingly
124 */
125 return &dvobj->pusbintf->dev;
126 };
127
128 struct adapter {
129 struct dvobj_priv *dvobj;
130 struct mlme_priv mlmepriv;
131 struct mlme_ext_priv mlmeextpriv;
132 struct cmd_priv cmdpriv;
133 struct xmit_priv xmitpriv;
134 struct recv_priv recvpriv;
135 struct sta_priv stapriv;
136 struct security_priv securitypriv;
137 struct registry_priv registrypriv;
138 struct pwrctrl_priv pwrctrlpriv;
139 struct eeprom_priv eeprompriv;
140 struct led_priv ledpriv;
141
142 struct hal_data_8188e *HalData;
143
144 s32 bDriverStopped;
145 s32 bSurpriseRemoved;
146
147 u8 hw_init_completed;
148
149 void *cmdThread;
150 struct net_device *pnetdev;
151 struct net_device *pmondev;
152
153 int bup;
154 struct net_device_stats stats;
155 struct iw_statistics iwstats;
156 struct proc_dir_entry *dir_dev;/* for proc directory */
157
158 int net_closed;
159 u8 bFWReady;
160 u8 bReadPortCancel;
161 u8 bWritePortCancel;
162
163 struct mutex hw_init_mutex;
164 };
165
166 #define adapter_to_dvobj(adapter) (adapter->dvobj)
167
myid(struct eeprom_priv * peepriv)168 static inline u8 *myid(struct eeprom_priv *peepriv)
169 {
170 return peepriv->mac_addr;
171 }
172
173 #endif /* __DRV_TYPES_H__ */
174