1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5  *
6  * Modifications for inclusion into the Linux staging tree are
7  * Copyright(c) 2010 Larry Finger. All rights reserved.
8  *
9  * Contact information:
10  * WLAN FAE <wlanfae@realtek.com>
11  * Larry Finger <Larry.Finger@lwfinger.net>
12  *
13  ******************************************************************************/
14 /* ---------------------------------------------------------------------
15  *
16  *	For type defines and data structure defines
17  *
18  * ---------------------------------------------------------------------
19  */
20 #ifndef __DRV_TYPES_H__
21 #define __DRV_TYPES_H__
22 
23 struct _adapter;
24 
25 #include "osdep_service.h"
26 #include "wlan_bssdef.h"
27 #include "rtl8712_spec.h"
28 #include "rtl8712_hal.h"
29 #include <linux/mutex.h>
30 #include <linux/completion.h>
31 
32 enum _NIC_VERSION {
33 	RTL8711_NIC,
34 	RTL8712_NIC,
35 	RTL8713_NIC,
36 	RTL8716_NIC
37 };
38 
39 struct _adapter;
40 
41 struct	qos_priv	{
42 	/* bit mask option: u-apsd, s-apsd, ts, block ack... */
43 	unsigned int qos_option;
44 };
45 
46 #include "rtl871x_ht.h"
47 #include "rtl871x_cmd.h"
48 #include "rtl871x_xmit.h"
49 #include "rtl871x_recv.h"
50 #include "rtl871x_security.h"
51 #include "rtl871x_pwrctrl.h"
52 #include "rtl871x_io.h"
53 #include "rtl871x_eeprom.h"
54 #include "sta_info.h"
55 #include "rtl871x_mlme.h"
56 #include "rtl871x_mp.h"
57 #include "rtl871x_debug.h"
58 #include "rtl871x_rf.h"
59 #include "rtl871x_event.h"
60 #include "rtl871x_led.h"
61 
62 #define SPEC_DEV_ID_DISABLE_HT BIT(1)
63 
64 struct specific_device_id {
65 	u32		flags;
66 	u16		idVendor;
67 	u16		idProduct;
68 
69 };
70 
71 struct registry_priv {
72 	u8	chip_version;
73 	u8	rfintfs;
74 	u8	lbkmode;
75 	u8	hci;
76 	u8	network_mode;	/*infra, ad-hoc, auto*/
77 	struct ndis_802_11_ssid	ssid;
78 	u8	channel;/* ad-hoc support requirement */
79 	u8	wireless_mode;/* A, B, G, auto */
80 	u8	vrtl_carrier_sense; /*Enable, Disable, Auto*/
81 	u8	vcs_type;/*RTS/CTS, CTS-to-self*/
82 	u16	rts_thresh;
83 	u16  frag_thresh;
84 	u8	preamble;/*long, short, auto*/
85 	u8  scan_mode;/*active, passive*/
86 	u8  adhoc_tx_pwr;
87 	u8  soft_ap;
88 	u8  smart_ps;
89 	u8 power_mgnt;
90 	u8 radio_enable;
91 	u8 long_retry_lmt;
92 	u8 short_retry_lmt;
93 	u16 busy_thresh;
94 	u8 ack_policy;
95 	u8 mp_mode;
96 	u8 software_encrypt;
97 	u8 software_decrypt;
98 	/* UAPSD */
99 	u8 wmm_enable;
100 	u8 uapsd_enable;
101 	u8 uapsd_max_sp;
102 	u8 uapsd_acbk_en;
103 	u8 uapsd_acbe_en;
104 	u8 uapsd_acvi_en;
105 	u8 uapsd_acvo_en;
106 
107 	struct wlan_bssid_ex dev_network;
108 
109 	u8 ht_enable;
110 	u8 cbw40_enable;
111 	u8 ampdu_enable;/*for tx*/
112 	u8 rf_config;
113 	u8 low_power;
114 	u8 wifi_test;
115 };
116 
117 struct dvobj_priv {
118 	struct _adapter *padapter;
119 	u32 nr_endpoint;
120 	u8   ishighspeed;
121 	uint (*inirp_init)(struct _adapter *adapter);
122 	uint (*inirp_deinit)(struct _adapter *adapter);
123 	struct usb_device *pusbdev;
124 };
125 
126 /**
127  * struct _adapter - the main adapter structure for this device.
128  *
129  * bup: True indicates that the interface is up.
130  */
131 struct _adapter {
132 	struct	dvobj_priv dvobjpriv;
133 	struct	mlme_priv mlmepriv;
134 	struct	cmd_priv	cmdpriv;
135 	struct	evt_priv	evtpriv;
136 	struct	io_queue	*pio_queue;
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	wlan_acl_pool	acl_list;
143 	struct	pwrctrl_priv	pwrctrlpriv;
144 	struct	eeprom_priv eeprompriv;
145 	struct	hal_priv	halpriv;
146 	struct	led_priv	ledpriv;
147 	struct mp_priv  mppriv;
148 	bool	driver_stopped;
149 	bool	surprise_removed;
150 	bool	suspended;
151 	u8	eeprom_address_size;
152 	u8	hw_init_completed;
153 	struct task_struct *cmd_thread;
154 	uint (*dvobj_init)(struct _adapter *adapter);
155 	void (*dvobj_deinit)(struct _adapter *adapter);
156 	struct net_device *pnetdev;
157 	int bup;
158 	struct net_device_stats stats;
159 	struct iw_statistics iwstats;
160 	int pid; /*process id from UI*/
161 	struct work_struct wk_filter_rx_ff0;
162 	u8 blnEnableRxFF0Filter;
163 	spinlock_t lock_rx_ff0_filter;
164 	const struct firmware *fw;
165 	struct usb_interface *pusb_intf;
166 	struct mutex mutex_start;
167 	struct completion rtl8712_fw_ready;
168 };
169 
myid(struct eeprom_priv * peepriv)170 static inline u8 *myid(struct eeprom_priv *peepriv)
171 {
172 	return peepriv->mac_addr;
173 }
174 
175 u8 r8712_usb_hal_bus_init(struct _adapter *adapter);
176 
177 #endif /*__DRV_TYPES_H__*/
178 
179