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