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	qos_priv	{
40 	/* bit mask option: u-apsd, s-apsd, ts, block ack... */
41 	unsigned int qos_option;
42 };
43 
44 #include "rtl871x_ht.h"
45 #include "rtl871x_cmd.h"
46 #include "rtl871x_xmit.h"
47 #include "rtl871x_recv.h"
48 #include "rtl871x_security.h"
49 #include "rtl871x_pwrctrl.h"
50 #include "rtl871x_io.h"
51 #include "rtl871x_eeprom.h"
52 #include "sta_info.h"
53 #include "rtl871x_mlme.h"
54 #include "rtl871x_mp.h"
55 #include "rtl871x_debug.h"
56 #include "rtl871x_rf.h"
57 #include "rtl871x_event.h"
58 #include "rtl871x_led.h"
59 
60 #define SPEC_DEV_ID_DISABLE_HT BIT(1)
61 
62 struct specific_device_id {
63 	u32		flags;
64 	u16		idVendor;
65 	u16		idProduct;
66 
67 };
68 
69 struct registry_priv {
70 	u8	chip_version;
71 	u8	rfintfs;
72 	u8	lbkmode;
73 	u8	hci;
74 	u8	network_mode;	/*infra, ad-hoc, auto*/
75 	struct ndis_802_11_ssid	ssid;
76 	u8	channel;/* ad-hoc support requirement */
77 	u8	wireless_mode;/* A, B, G, auto */
78 	u8	vrtl_carrier_sense; /*Enable, Disable, Auto*/
79 	u8	vcs_type;/*RTS/CTS, CTS-to-self*/
80 	u16	rts_thresh;
81 	u16  frag_thresh;
82 	u8	preamble;/*long, short, auto*/
83 	u8  scan_mode;/*active, passive*/
84 	u8  adhoc_tx_pwr;
85 	u8  soft_ap;
86 	u8  smart_ps;
87 	u8 power_mgnt;
88 	u8 radio_enable;
89 	u8 long_retry_lmt;
90 	u8 short_retry_lmt;
91 	u16 busy_thresh;
92 	u8 ack_policy;
93 	u8 mp_mode;
94 	u8 software_encrypt;
95 	u8 software_decrypt;
96 	/* UAPSD */
97 	u8 wmm_enable;
98 	u8 uapsd_enable;
99 	u8 uapsd_max_sp;
100 	u8 uapsd_acbk_en;
101 	u8 uapsd_acbe_en;
102 	u8 uapsd_acvi_en;
103 	u8 uapsd_acvo_en;
104 
105 	struct wlan_bssid_ex dev_network;
106 
107 	u8 ht_enable;
108 	u8 cbw40_enable;
109 	u8 ampdu_enable;/*for tx*/
110 	u8 rf_config;
111 	u8 low_power;
112 	u8 wifi_test;
113 };
114 
115 struct dvobj_priv {
116 	struct _adapter *padapter;
117 	u32 nr_endpoint;
118 	u8   ishighspeed;
119 	uint (*inirp_init)(struct _adapter *adapter);
120 	uint (*inirp_deinit)(struct _adapter *adapter);
121 	struct usb_device *pusbdev;
122 };
123 
124 /**
125  * struct _adapter - the main adapter structure for this device.
126  *
127  * bup: True indicates that the interface is up.
128  */
129 struct _adapter {
130 	struct	dvobj_priv dvobjpriv;
131 	struct	mlme_priv mlmepriv;
132 	struct	cmd_priv	cmdpriv;
133 	struct	evt_priv	evtpriv;
134 	struct	io_queue	*pio_queue;
135 	struct	xmit_priv	xmitpriv;
136 	struct	recv_priv	recvpriv;
137 	struct	sta_priv	stapriv;
138 	struct	security_priv	securitypriv;
139 	struct	registry_priv	registrypriv;
140 	struct	wlan_acl_pool	acl_list;
141 	struct	pwrctrl_priv	pwrctrlpriv;
142 	struct	eeprom_priv eeprompriv;
143 	struct	hal_priv	halpriv;
144 	struct	led_priv	ledpriv;
145 	struct mp_priv  mppriv;
146 	bool	driver_stopped;
147 	bool	surprise_removed;
148 	bool	suspended;
149 	u8	eeprom_address_size;
150 	u8	hw_init_completed;
151 	struct task_struct *cmd_thread;
152 	uint (*dvobj_init)(struct _adapter *adapter);
153 	void (*dvobj_deinit)(struct _adapter *adapter);
154 	struct net_device *pnetdev;
155 	int bup;
156 	struct net_device_stats stats;
157 	struct iw_statistics iwstats;
158 	int pid; /*process id from UI*/
159 	struct work_struct wk_filter_rx_ff0;
160 	u8 blnEnableRxFF0Filter;
161 	spinlock_t lock_rx_ff0_filter;
162 	const struct firmware *fw;
163 	struct usb_interface *pusb_intf;
164 	struct mutex mutex_start;
165 	struct completion rtl8712_fw_ready;
166 };
167 
myid(struct eeprom_priv * peepriv)168 static inline u8 *myid(struct eeprom_priv *peepriv)
169 {
170 	return peepriv->mac_addr;
171 }
172 
173 u8 r8712_usb_hal_bus_init(struct _adapter *adapter);
174 
175 #endif /*__DRV_TYPES_H__*/
176 
177