1 /******************************************************************************
3 * Copyright(c) 2009-2014 Realtek Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
22 * Larry Finger <Larry.Finger@lwfinger.net>
24 *****************************************************************************/
26 #ifndef __RTL92E_TRX_H__
27 #define __RTL92E_TRX_H__
29 #if (DMA_IS_64BIT == 1)
30 #if (RTL8192EE_SEG_NUM == 2)
31 #define TX_BD_DESC_SIZE 128
32 #elif (RTL8192EE_SEG_NUM == 1)
33 #define TX_BD_DESC_SIZE 64
34 #elif (RTL8192EE_SEG_NUM == 0)
35 #define TX_BD_DESC_SIZE 32
38 #if (RTL8192EE_SEG_NUM == 2)
39 #define TX_BD_DESC_SIZE 64
40 #elif (RTL8192EE_SEG_NUM == 1)
41 #define TX_BD_DESC_SIZE 32
42 #elif (RTL8192EE_SEG_NUM == 0)
43 #define TX_BD_DESC_SIZE 16
47 #define TX_DESC_SIZE 64
49 #define RX_DRV_INFO_SIZE_UNIT 8
51 #define TX_DESC_NEXT_DESC_OFFSET 40
52 #define USB_HWDESC_HEADER_LEN 40
54 #define RX_DESC_SIZE 24
55 #define MAX_RECEIVE_BUFFER_SIZE 8192
57 #define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \
58 SET_BITS_TO_LE_4BYTE(__pdesc, 0, 16, __val)
59 #define SET_TX_DESC_OFFSET(__pdesc, __val) \
60 SET_BITS_TO_LE_4BYTE(__pdesc, 16, 8, __val)
61 #define SET_TX_DESC_BMC(__pdesc, __val) \
62 SET_BITS_TO_LE_4BYTE(__pdesc, 24, 1, __val)
63 #define SET_TX_DESC_HTC(__pdesc, __val) \
64 SET_BITS_TO_LE_4BYTE(__pdesc, 25, 1, __val)
65 #define SET_TX_DESC_LAST_SEG(__pdesc, __val) \
66 SET_BITS_TO_LE_4BYTE(__pdesc, 26, 1, __val)
67 #define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \
68 SET_BITS_TO_LE_4BYTE(__pdesc, 27, 1, __val)
69 #define SET_TX_DESC_LINIP(__pdesc, __val) \
70 SET_BITS_TO_LE_4BYTE(__pdesc, 28, 1, __val)
71 #define SET_TX_DESC_NO_ACM(__pdesc, __val) \
72 SET_BITS_TO_LE_4BYTE(__pdesc, 29, 1, __val)
73 #define SET_TX_DESC_GF(__pdesc, __val) \
74 SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val)
75 #define SET_TX_DESC_OWN(__pdesc, __val) \
76 SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
78 #define GET_TX_DESC_PKT_SIZE(__pdesc) \
79 LE_BITS_TO_4BYTE(__pdesc, 0, 16)
80 #define GET_TX_DESC_OFFSET(__pdesc) \
81 LE_BITS_TO_4BYTE(__pdesc, 16, 8)
82 #define GET_TX_DESC_BMC(__pdesc) \
83 LE_BITS_TO_4BYTE(__pdesc, 24, 1)
84 #define GET_TX_DESC_HTC(__pdesc) \
85 LE_BITS_TO_4BYTE(__pdesc, 25, 1)
86 #define GET_TX_DESC_LAST_SEG(__pdesc) \
87 LE_BITS_TO_4BYTE(__pdesc, 26, 1)
88 #define GET_TX_DESC_FIRST_SEG(__pdesc) \
89 LE_BITS_TO_4BYTE(__pdesc, 27, 1)
90 #define GET_TX_DESC_LINIP(__pdesc) \
91 LE_BITS_TO_4BYTE(__pdesc, 28, 1)
92 #define GET_TX_DESC_NO_ACM(__pdesc) \
93 LE_BITS_TO_4BYTE(__pdesc, 29, 1)
94 #define GET_TX_DESC_GF(__pdesc) \
95 LE_BITS_TO_4BYTE(__pdesc, 30, 1)
96 #define GET_TX_DESC_OWN(__pdesc) \
97 LE_BITS_TO_4BYTE(__pdesc, 31, 1)
99 #define SET_TX_DESC_MACID(__pdesc, __val) \
100 SET_BITS_TO_LE_4BYTE(__pdesc+4, 0, 7, __val)
101 #define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \
102 SET_BITS_TO_LE_4BYTE(__pdesc+4, 8, 5, __val)
103 #define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \
104 SET_BITS_TO_LE_4BYTE(__pdesc+4, 13, 1, __val)
105 #define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \
106 SET_BITS_TO_LE_4BYTE(__pdesc+4, 14, 1, __val)
107 #define SET_TX_DESC_PIFS(__pdesc, __val) \
108 SET_BITS_TO_LE_4BYTE(__pdesc+4, 15, 1, __val)
109 #define SET_TX_DESC_RATE_ID(__pdesc, __val) \
110 SET_BITS_TO_LE_4BYTE(__pdesc+4, 16, 5, __val)
111 #define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \
112 SET_BITS_TO_LE_4BYTE(__pdesc+4, 21, 1, __val)
113 #define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \
114 SET_BITS_TO_LE_4BYTE(__pdesc+4, 22, 2, __val)
115 #define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \
116 SET_BITS_TO_LE_4BYTE(__pdesc+4, 24, 5, __val)
117 #define SET_TX_DESC_MORE_DATA(__pdesc, __val) \
118 SET_BITS_TO_LE_4BYTE(__pdesc+4, 29, 1, __val)
119 #define SET_TX_DESC_TXOP_PS_CAP(__pdesc, __val) \
120 SET_BITS_TO_LE_4BYTE(__pdesc+4, 30, 1, __val)
121 #define SET_TX_DESC_TXOP_PS_MODE(__pdesc, __val) \
122 SET_BITS_TO_LE_4BYTE(__pdesc+4, 31, 1, __val)
124 #define GET_TX_DESC_MACID(__pdesc) \
125 LE_BITS_TO_4BYTE(__pdesc+4, 0, 5)
126 #define GET_TX_DESC_AGG_ENABLE(__pdesc) \
127 LE_BITS_TO_4BYTE(__pdesc+4, 5, 1)
128 #define GET_TX_DESC_AGG_BREAK(__pdesc) \
129 LE_BITS_TO_4BYTE(__pdesc+4, 6, 1)
130 #define GET_TX_DESC_RDG_ENABLE(__pdesc) \
131 LE_BITS_TO_4BYTE(__pdesc+4, 7, 1)
132 #define GET_TX_DESC_QUEUE_SEL(__pdesc) \
133 LE_BITS_TO_4BYTE(__pdesc+4, 8, 5)
134 #define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \
135 LE_BITS_TO_4BYTE(__pdesc+4, 13, 1)
136 #define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \
137 LE_BITS_TO_4BYTE(__pdesc+4, 14, 1)
138 #define GET_TX_DESC_PIFS(__pdesc) \
139 LE_BITS_TO_4BYTE(__pdesc+4, 15, 1)
140 #define GET_TX_DESC_RATE_ID(__pdesc) \
141 LE_BITS_TO_4BYTE(__pdesc+4, 16, 4)
142 #define GET_TX_DESC_NAV_USE_HDR(__pdesc) \
143 LE_BITS_TO_4BYTE(__pdesc+4, 20, 1)
144 #define GET_TX_DESC_EN_DESC_ID(__pdesc) \
145 LE_BITS_TO_4BYTE(__pdesc+4, 21, 1)
146 #define GET_TX_DESC_SEC_TYPE(__pdesc) \
147 LE_BITS_TO_4BYTE(__pdesc+4, 22, 2)
148 #define GET_TX_DESC_PKT_OFFSET(__pdesc) \
149 LE_BITS_TO_4BYTE(__pdesc+4, 24, 5)
151 #define SET_TX_DESC_PAID(__pdesc, __val) \
152 SET_BITS_TO_LE_4BYTE(__pdesc+8, 0, 9, __val)
153 #define SET_TX_DESC_CCA_RTS(__pdesc, __val) \
154 SET_BITS_TO_LE_4BYTE(__pdesc+8, 10, 2, __val)
155 #define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \
156 SET_BITS_TO_LE_4BYTE(__pdesc+8, 12, 1, __val)
157 #define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \
158 SET_BITS_TO_LE_4BYTE(__pdesc+8, 13, 1, __val)
159 #define SET_TX_DESC_NULL_0(__pdesc, __val) \
160 SET_BITS_TO_LE_4BYTE(__pdesc+8, 14, 1, __val)
161 #define SET_TX_DESC_NULL_1(__pdesc, __val) \
162 SET_BITS_TO_LE_4BYTE(__pdesc+8, 15, 1, __val)
163 #define SET_TX_DESC_BK(__pdesc, __val) \
164 SET_BITS_TO_LE_4BYTE(__pdesc+8, 16, 1, __val)
165 #define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \
166 SET_BITS_TO_LE_4BYTE(__pdesc+8, 17, 1, __val)
167 #define SET_TX_DESC_RAW(__pdesc, __val) \
168 SET_BITS_TO_LE_4BYTE(__pdesc+8, 18, 1, __val)
169 #define SET_TX_DESC_SPE_RPT(__pdesc, __val) \
170 SET_BITS_TO_LE_4BYTE(__pdesc+8, 19, 1, __val)
171 #define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \
172 SET_BITS_TO_LE_4BYTE(__pdesc+8, 20, 3, __val)
173 #define SET_TX_DESC_BT_NULL(__pdesc, __val) \
174 SET_BITS_TO_LE_4BYTE(__pdesc+8, 23, 1, __val)
175 #define SET_TX_DESC_GID(__pdesc, __val) \
176 SET_BITS_TO_LE_4BYTE(__pdesc+8, 24, 6, __val)
178 #define SET_TX_DESC_WHEADER_LEN(__pdesc, __val) \
179 SET_BITS_TO_LE_4BYTE(__pdesc+12, 0, 4, __val)
180 #define SET_TX_DESC_CHK_EN(__pdesc, __val) \
181 SET_BITS_TO_LE_4BYTE(__pdesc+12, 4, 1, __val)
182 #define SET_TX_DESC_EARLY_RATE(__pdesc, __val) \
183 SET_BITS_TO_LE_4BYTE(__pdesc+12, 5, 1, __val)
184 #define SET_TX_DESC_HWSEQ_SEL(__pdesc, __val) \
185 SET_BITS_TO_LE_4BYTE(__pdesc+12, 6, 2, __val)
186 #define SET_TX_DESC_USE_RATE(__pdesc, __val) \
187 SET_BITS_TO_LE_4BYTE(__pdesc+12, 8, 1, __val)
188 #define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \
189 SET_BITS_TO_LE_4BYTE(__pdesc+12, 9, 1, __val)
190 #define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \
191 SET_BITS_TO_LE_4BYTE(__pdesc+12, 10, 1, __val)
192 #define SET_TX_DESC_CTS2SELF(__pdesc, __val) \
193 SET_BITS_TO_LE_4BYTE(__pdesc+12, 11, 1, __val)
194 #define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \
195 SET_BITS_TO_LE_4BYTE(__pdesc+12, 12, 1, __val)
196 #define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \
197 SET_BITS_TO_LE_4BYTE(__pdesc+12, 13, 1, __val)
198 #define SET_TX_DESC_HW_PORT_ID(__pdesc, __val) \
199 SET_BITS_TO_LE_4BYTE(__pdesc+12, 14, 1, __val)
200 #define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \
201 SET_BITS_TO_LE_4BYTE(__pdesc+12, 15, 1, __val)
202 #define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \
203 SET_BITS_TO_LE_4BYTE(__pdesc+12, 16, 1, __val)
204 #define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \
205 SET_BITS_TO_LE_4BYTE(__pdesc+12, 17, 5, __val)
206 #define SET_TX_DESC_NDPA(__pdesc, __val) \
207 SET_BITS_TO_LE_4BYTE(__pdesc+12, 22, 2, __val)
208 #define SET_TX_DESC_AMPDU_MAX_TIME(__pdesc, __val) \
209 SET_BITS_TO_LE_4BYTE(__pdesc+12, 24, 8, __val)
212 #define SET_TX_DESC_TX_RATE(__pdesc, __val) \
213 SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 7, __val)
214 #define SET_TX_DESC_TRY_RATE(__pdesc, __val) \
215 SET_BITS_TO_LE_4BYTE(__pdesc+16, 7, 1, __val)
216 #define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \
217 SET_BITS_TO_LE_4BYTE(__pdesc+16, 8, 5, __val)
218 #define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \
219 SET_BITS_TO_LE_4BYTE(__pdesc+16, 13, 4, __val)
220 #define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \
221 SET_BITS_TO_LE_4BYTE(__pdesc+16, 17, 1, __val)
222 #define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \
223 SET_BITS_TO_LE_4BYTE(__pdesc+16, 18, 6, __val)
224 #define SET_TX_DESC_RTS_RATE(__pdesc, __val) \
225 SET_BITS_TO_LE_4BYTE(__pdesc+16, 24, 5, __val)
226 #define SET_TX_DESC_PCTS_ENABLE(__pdesc, __val) \
227 SET_BITS_TO_LE_4BYTE(__pdesc+16, 29, 1, __val)
228 #define SET_TX_DESC_PCTS_MASK_IDX(__pdesc, __val) \
229 SET_BITS_TO_LE_4BYTE(__pdesc+16, 30, 2, __val)
232 #define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \
233 SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 4, __val)
234 #define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \
235 SET_BITS_TO_LE_4BYTE(__pdesc+20, 4, 1, __val)
236 #define SET_TX_DESC_DATA_BW(__pdesc, __val) \
237 SET_BITS_TO_LE_4BYTE(__pdesc+20, 5, 2, __val)
238 #define SET_TX_DESC_DATA_LDPC(__pdesc, __val) \
239 SET_BITS_TO_LE_4BYTE(__pdesc+20, 7, 1, __val)
240 #define SET_TX_DESC_DATA_STBC(__pdesc, __val) \
241 SET_BITS_TO_LE_4BYTE(__pdesc+20, 8, 2, __val)
242 #define SET_TX_DESC_VCS_STBC(__pdesc, __val) \
243 SET_BITS_TO_LE_4BYTE(__pdesc+20, 10, 2, __val)
244 #define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \
245 SET_BITS_TO_LE_4BYTE(__pdesc+20, 12, 1, __val)
246 #define SET_TX_DESC_RTS_SC(__pdesc, __val) \
247 SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val)
248 #define SET_TX_DESC_TX_ANT(__pdesc, __val) \
249 SET_BITS_TO_LE_4BYTE(__pdesc+20, 24, 4, __val)
250 #define SET_TX_DESC_TX_POWER_0_PSET(__pdesc, __val) \
251 SET_BITS_TO_LE_4BYTE(__pdesc+20, 28, 3, __val)
254 #define SET_TX_DESC_SW_DEFINE(__pdesc, __val) \
255 SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 12, __val)
256 #define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \
257 SET_BITS_TO_LE_4BYTE(__pdesc+24, 16, 3, __val)
258 #define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \
259 SET_BITS_TO_LE_4BYTE(__pdesc+24, 19, 3, __val)
260 #define SET_TX_DESC_ANTSEL_C(__pdesc, __val) \
261 SET_BITS_TO_LE_4BYTE(__pdesc+24, 22, 3, __val)
262 #define SET_TX_DESC_ANTSEL_D(__pdesc, __val) \
263 SET_BITS_TO_LE_4BYTE(__pdesc+24, 25, 3, __val)
266 #define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \
267 SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val)
268 #define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \
269 SET_BITS_TO_LE_4BYTE(__pdesc+28, 24, 8, __val)
272 #define SET_TX_DESC_RTS_RC(__pdesc, __val) \
273 SET_BITS_TO_LE_4BYTE(__pdesc+32, 0, 6, __val)
274 #define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \
275 SET_BITS_TO_LE_4BYTE(__pdesc+32, 6, 2, __val)
276 #define SET_TX_DESC_DATA_RC(__pdesc, __val) \
277 SET_BITS_TO_LE_4BYTE(__pdesc+32, 8, 6, __val)
278 #define SET_TX_DESC_ENABLE_HW_SELECT(__pdesc, __val) \
279 SET_BITS_TO_LE_4BYTE(__pdesc+32, 15, 1, __val)
280 #define SET_TX_DESC_NEXT_HEAD_PAGE(__pdesc, __val) \
281 SET_BITS_TO_LE_4BYTE(__pdesc+32, 16, 8, __val)
282 #define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \
283 SET_BITS_TO_LE_4BYTE(__pdesc+32, 24, 8, __val)
286 #define SET_TX_DESC_PADDING_LENGTH(__pdesc, __val) \
287 SET_BITS_TO_LE_4BYTE(__pdesc+36, 0, 11, __val)
288 #define SET_TX_DESC_TXBF_PATH(__pdesc, __val) \
289 SET_BITS_TO_LE_4BYTE(__pdesc+36, 11, 1, __val)
290 #define SET_TX_DESC_SEQ(__pdesc, __val) \
291 SET_BITS_TO_LE_4BYTE(__pdesc+36, 12, 12, __val)
292 #define SET_TX_DESC_FINAL_DATA_RATE(__pdesc, __val) \
293 SET_BITS_TO_LE_4BYTE(__pdesc+36, 24, 8, __val)
296 #define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \
297 SET_BITS_TO_LE_4BYTE(__pdesc+40, 0, 32, __val)
300 #define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \
301 SET_BITS_TO_LE_4BYTE(__pdesc+48, 0, 32, __val)
303 #define SET_EARLYMODE_PKTNUM(__paddr, __val) \
304 SET_BITS_TO_LE_4BYTE(__paddr, 0, 4, __val)
305 #define SET_EARLYMODE_LEN0(__paddr, __val) \
306 SET_BITS_TO_LE_4BYTE(__paddr, 4, 15, __val)
307 #define SET_EARLYMODE_LEN1(__paddr, __val) \
308 SET_BITS_TO_LE_4BYTE(__paddr, 16, 2, __val)
309 #define SET_EARLYMODE_LEN1_1(__paddr, __val) \
310 SET_BITS_TO_LE_4BYTE(__paddr, 19, 13, __val)
311 #define SET_EARLYMODE_LEN1_2(__paddr, __val) \
312 SET_BITS_TO_LE_4BYTE(__paddr+4, 0, 2, __val)
313 #define SET_EARLYMODE_LEN2(__paddr, __val) \
314 SET_BITS_TO_LE_4BYTE(__paddr+4, 2, 15, __val)
315 #define SET_EARLYMODE_LEN2_1(__paddr, __val) \
316 SET_BITS_TO_LE_4BYTE(__paddr, 2, 4, __val)
317 #define SET_EARLYMODE_LEN2_2(__paddr, __val) \
318 SET_BITS_TO_LE_4BYTE(__paddr+4, 0, 8, __val)
319 #define SET_EARLYMODE_LEN3(__paddr, __val) \
320 SET_BITS_TO_LE_4BYTE(__paddr+4, 17, 15, __val)
321 #define SET_EARLYMODE_LEN4(__paddr, __val) \
322 SET_BITS_TO_LE_4BYTE(__paddr+4, 20, 12, __val)
324 /* TX/RX buffer descriptor */
326 #define SET_TX_EXTBUFF_DESC_LEN(__pdesc, __val, __set) \
327 SET_BITS_TO_LE_4BYTE(__pdesc+(__set*16), 0, 16, __val)
328 #define SET_TX_EXTBUFF_DESC_ADDR_LOW(__pdesc, __val, __set)\
329 SET_BITS_TO_LE_4BYTE(__pdesc+(__set*16)+4, 0, 32, __val)
330 #define SET_TX_EXTBUFF_DESC_ADDR_HIGH(__pdesc, __val, __set)\
331 SET_BITS_TO_LE_4BYTE(__pdesc+(__set*16)+8, 0, 32, __val)
333 /* for Txfilldescroptor92ee, fill the desc content. */
334 #if (DMA_IS_64BIT == 1)
335 #define SET_TXBUFFER_DESC_LEN_WITH_OFFSET(__pdesc, __offset, __val) \
336 SET_BITS_TO_LE_4BYTE(__pdesc+(__offset*16), 0, 16, __val)
337 #define SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(__pdesc, __offset, __val) \
338 SET_BITS_TO_LE_4BYTE(__pdesc+(__offset*16), 31, 1, __val)
339 #define SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(__pdesc, __offset, __val) \
340 SET_BITS_TO_LE_4BYTE(__pdesc+(__offset*16)+4, 0, 32, __val)
341 #define SET_TXBUFFER_DESC_ADD_HIGT_WITH_OFFSET(__pdesc, __offset, __val)\
342 SET_BITS_TO_LE_4BYTE(__pdesc+(__offset*16)+8, 0, 32, __val)
343 #define GET_TXBUFFER_DESC_ADDR_LOW(__pdesc, __offset) \
344 LE_BITS_TO_4BYTE(__pdesc+(__offset*16)+4, 0, 32)
346 #define SET_TXBUFFER_DESC_LEN_WITH_OFFSET(__pdesc, __offset, __val) \
347 SET_BITS_TO_LE_4BYTE(__pdesc+(__offset*8), 0, 16, __val)
348 #define SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(__pdesc, __offset, __val) \
349 SET_BITS_TO_LE_4BYTE(__pdesc+(__offset*8), 31, 1, __val)
350 #define SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(__pdesc, __offset, __val) \
351 SET_BITS_TO_LE_4BYTE(__pdesc+(__offset*8)+4, 0, 32, __val)
352 #define SET_TXBUFFER_DESC_ADD_HIGT_WITH_OFFSET(__pdesc, __offset, __val)
353 #define GET_TXBUFFER_DESC_ADDR_LOW(__pdesc, __offset) \
354 LE_BITS_TO_4BYTE(__pdesc+(__offset*8)+4, 0, 32)
358 #define SET_TX_BUFF_DESC_LEN_0(__pdesc, __val) \
359 SET_BITS_TO_LE_4BYTE(__pdesc, 0, 14, __val)
360 #define SET_TX_BUFF_DESC_PSB(__pdesc, __val) \
361 SET_BITS_TO_LE_4BYTE(__pdesc, 16, 15, __val)
362 #define SET_TX_BUFF_DESC_OWN(__pdesc, __val) \
363 SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
366 #define SET_TX_BUFF_DESC_ADDR_LOW_0(__pdesc, __val) \
367 SET_BITS_TO_LE_4BYTE(__pdesc+4, 0, 32, __val)
368 #if (DMA_IS_64BIT == 1)
370 #define SET_TX_BUFF_DESC_ADDR_HIGH_0(__pdesc, __val) \
371 SET_BITS_TO_LE_4BYTE(__pdesc+8, 0, 32, __val)
372 /* Dword 3 / RESERVED 0 */
374 #define SET_TX_BUFF_DESC_LEN_1(__pdesc, __val) \
375 SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 16, __val)
376 #define SET_TX_BUFF_DESC_AMSDU_1(__pdesc, __val) \
377 SET_BITS_TO_LE_4BYTE(__pdesc+16, 31, 1, __val)
379 #define SET_TX_BUFF_DESC_ADDR_LOW_1(__pdesc, __val) \
380 SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 32, __val)
382 #define SET_TX_BUFF_DESC_ADDR_HIGH_1(__pdesc, __val) \
383 SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 32, __val)
384 /* Dword 7 / RESERVED 0 */
386 #define SET_TX_BUFF_DESC_LEN_2(__pdesc, __val) \
387 SET_BITS_TO_LE_4BYTE(__pdesc+32, 0, 16, __val)
388 #define SET_TX_BUFF_DESC_AMSDU_2(__pdesc, __val) \
389 SET_BITS_TO_LE_4BYTE(__pdesc+32, 31, 1, __val)
391 #define SET_TX_BUFF_DESC_ADDR_LOW_2(__pdesc, __val) \
392 SET_BITS_TO_LE_4BYTE(__pdesc+36, 0, 32, __val)
394 #define SET_TX_BUFF_DESC_ADDR_HIGH_2(__pdesc, __val) \
395 SET_BITS_TO_LE_4BYTE(__pdesc+40, 0, 32, __val)
396 /* Dword 11 / RESERVED 0 */
398 #define SET_TX_BUFF_DESC_LEN_3(__pdesc, __val) \
399 SET_BITS_TO_LE_4BYTE(__pdesc+48, 0, 16, __val)
400 #define SET_TX_BUFF_DESC_AMSDU_3(__pdesc, __val) \
401 SET_BITS_TO_LE_4BYTE(__pdesc+48, 31, 1, __val)
403 #define SET_TX_BUFF_DESC_ADDR_LOW_3(__pdesc, __val) \
404 SET_BITS_TO_LE_4BYTE(__pdesc+52, 0, 32, __val)
406 #define SET_TX_BUFF_DESC_ADDR_HIGH_3(__pdesc, __val) \
407 SET_BITS_TO_LE_4BYTE(__pdesc+56, 0, 32, __val)
408 /* Dword 15 / RESERVED 0 */
410 #define SET_TX_BUFF_DESC_ADDR_HIGH_0(__pdesc, __val)
412 #define SET_TX_BUFF_DESC_LEN_1(__pdesc, __val) \
413 SET_BITS_TO_LE_4BYTE(__pdesc+8, 0, 16, __val)
414 #define SET_TX_BUFF_DESC_AMSDU_1(__pdesc, __val) \
415 SET_BITS_TO_LE_4BYTE(__pdesc+8, 31, 1, __val)
417 #define SET_TX_BUFF_DESC_ADDR_LOW_1(__pdesc, __val) \
418 SET_BITS_TO_LE_4BYTE(__pdesc+12, 0, 32, __val)
419 #define SET_TX_BUFF_DESC_ADDR_HIGH_1(__pdesc, __val)
421 #define SET_TX_BUFF_DESC_LEN_2(__pdesc, __val) \
422 SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 16, __val)
423 #define SET_TX_BUFF_DESC_AMSDU_2(__pdesc, __val) \
424 SET_BITS_TO_LE_4BYTE(__pdesc+16, 31, 1, __val)
426 #define SET_TX_BUFF_DESC_ADDR_LOW_2(__pdesc, __val) \
427 SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 32, __val)
428 #define SET_TX_BUFF_DESC_ADDR_HIGH_2(__pdesc, __val)
430 #define SET_TX_BUFF_DESC_LEN_3(__pdesc, __val) \
431 SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 16, __val)
432 #define SET_TX_BUFF_DESC_AMSDU_3(__pdesc, __val) \
433 SET_BITS_TO_LE_4BYTE(__pdesc+24, 31, 1, __val)
435 #define SET_TX_BUFF_DESC_ADDR_LOW_3(__pdesc, __val) \
436 SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 32, __val)
437 #define SET_TX_BUFF_DESC_ADDR_HIGH_3(__pdesc, __val)
443 #define SET_RX_BUFFER_DESC_DATA_LENGTH(__status, __val) \
444 SET_BITS_TO_LE_4BYTE(__status, 0, 14, __val)
445 #define SET_RX_BUFFER_DESC_LS(__status, __val) \
446 SET_BITS_TO_LE_4BYTE(__status, 15, 1, __val)
447 #define SET_RX_BUFFER_DESC_FS(__status, __val) \
448 SET_BITS_TO_LE_4BYTE(__status, 16, 1, __val)
449 #define SET_RX_BUFFER_DESC_TOTAL_LENGTH(__status, __val) \
450 SET_BITS_TO_LE_4BYTE(__status, 16, 15, __val)
452 #define GET_RX_BUFFER_DESC_OWN(__status) \
453 LE_BITS_TO_4BYTE(__status, 31, 1)
454 #define GET_RX_BUFFER_DESC_LS(__status) \
455 LE_BITS_TO_4BYTE(__status, 15, 1)
456 #define GET_RX_BUFFER_DESC_FS(__status) \
457 LE_BITS_TO_4BYTE(__status, 16, 1)
458 #define GET_RX_BUFFER_DESC_TOTAL_LENGTH(__status) \
459 LE_BITS_TO_4BYTE(__status, 16, 15)
462 #define SET_RX_BUFFER_PHYSICAL_LOW(__status, __val) \
463 SET_BITS_TO_LE_4BYTE(__status+4, 0, 32, __val)
466 #define SET_RX_BUFFER_PHYSICAL_HIGH(__status, __val) \
467 SET_BITS_TO_LE_4BYTE(__status+8, 0, 32, __val)
469 #define GET_RX_DESC_PKT_LEN(__pdesc) \
470 LE_BITS_TO_4BYTE(__pdesc, 0, 14)
471 #define GET_RX_DESC_CRC32(__pdesc) \
472 LE_BITS_TO_4BYTE(__pdesc, 14, 1)
473 #define GET_RX_DESC_ICV(__pdesc) \
474 LE_BITS_TO_4BYTE(__pdesc, 15, 1)
475 #define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \
476 LE_BITS_TO_4BYTE(__pdesc, 16, 4)
477 #define GET_RX_DESC_SECURITY(__pdesc) \
478 LE_BITS_TO_4BYTE(__pdesc, 20, 3)
479 #define GET_RX_DESC_QOS(__pdesc) \
480 LE_BITS_TO_4BYTE(__pdesc, 23, 1)
481 #define GET_RX_DESC_SHIFT(__pdesc) \
482 LE_BITS_TO_4BYTE(__pdesc, 24, 2)
483 #define GET_RX_DESC_PHYST(__pdesc) \
484 LE_BITS_TO_4BYTE(__pdesc, 26, 1)
485 #define GET_RX_DESC_SWDEC(__pdesc) \
486 LE_BITS_TO_4BYTE(__pdesc, 27, 1)
487 #define GET_RX_DESC_LS(__pdesc) \
488 LE_BITS_TO_4BYTE(__pdesc, 28, 1)
489 #define GET_RX_DESC_FS(__pdesc) \
490 LE_BITS_TO_4BYTE(__pdesc, 29, 1)
491 #define GET_RX_DESC_EOR(__pdesc) \
492 LE_BITS_TO_4BYTE(__pdesc, 30, 1)
493 #define GET_RX_DESC_OWN(__pdesc) \
494 LE_BITS_TO_4BYTE(__pdesc, 31, 1)
496 #define SET_RX_DESC_PKT_LEN(__pdesc, __val) \
497 SET_BITS_TO_LE_4BYTE(__pdesc, 0, 14, __val)
498 #define SET_RX_DESC_EOR(__pdesc, __val) \
499 SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val)
500 #define SET_RX_DESC_OWN(__pdesc, __val) \
501 SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
503 #define GET_RX_DESC_MACID(__pdesc) \
504 LE_BITS_TO_4BYTE(__pdesc+4, 0, 7)
505 #define GET_RX_DESC_TID(__pdesc) \
506 LE_BITS_TO_4BYTE(__pdesc+4, 8, 4)
507 #define GET_RX_DESC_MACID_VLD(__pdesc) \
508 LE_BITS_TO_4BYTE(__pdesc+4, 12, 1)
509 #define GET_RX_DESC_AMSDU(__pdesc) \
510 LE_BITS_TO_4BYTE(__pdesc+4, 13, 1)
511 #define GET_RX_DESC_RXID_MATCH(__pdesc) \
512 LE_BITS_TO_4BYTE(__pdesc+4, 14, 1)
513 #define GET_RX_DESC_PAGGR(__pdesc) \
514 LE_BITS_TO_4BYTE(__pdesc+4, 15, 1)
515 #define GET_RX_DESC_A1_FIT(__pdesc) \
516 LE_BITS_TO_4BYTE(__pdesc+4, 16, 4)
517 #define GET_RX_DESC_TCPOFFLOAD_CHKERR(__pdesc) \
518 LE_BITS_TO_4BYTE(__pdesc+4, 20, 1)
519 #define GET_RX_DESC_TCPOFFLOAD_IPVER(__pdesc) \
520 LE_BITS_TO_4BYTE(__pdesc+4, 21, 1)
521 #define GET_RX_DESC_TCPOFFLOAD_IS_TCPUDP(__pdesc) \
522 LE_BITS_TO_4BYTE(__pdesc+4, 22, 1)
523 #define GET_RX_DESC_TCPOFFLOAD_CHK_VLD(__pdesc) \
524 LE_BITS_TO_4BYTE(__pdesc+4, 23, 1)
525 #define GET_RX_DESC_PAM(__pdesc) \
526 LE_BITS_TO_4BYTE(__pdesc+4, 24, 1)
527 #define GET_RX_DESC_PWR(__pdesc) \
528 LE_BITS_TO_4BYTE(__pdesc+4, 25, 1)
529 #define GET_RX_DESC_MD(__pdesc) \
530 LE_BITS_TO_4BYTE(__pdesc+4, 26, 1)
531 #define GET_RX_DESC_MF(__pdesc) \
532 LE_BITS_TO_4BYTE(__pdesc+4, 27, 1)
533 #define GET_RX_DESC_TYPE(__pdesc) \
534 LE_BITS_TO_4BYTE(__pdesc+4, 28, 2)
535 #define GET_RX_DESC_MC(__pdesc) \
536 LE_BITS_TO_4BYTE(__pdesc+4, 30, 1)
537 #define GET_RX_DESC_BC(__pdesc) \
538 LE_BITS_TO_4BYTE(__pdesc+4, 31, 1)
539 #define GET_RX_DESC_SEQ(__pdesc) \
540 LE_BITS_TO_4BYTE(__pdesc+8, 0, 12)
541 #define GET_RX_DESC_FRAG(__pdesc) \
542 LE_BITS_TO_4BYTE(__pdesc+8, 12, 4)
543 #define GET_RX_DESC_RX_IS_QOS(__pdesc) \
544 LE_BITS_TO_4BYTE(__pdesc+8, 16, 1)
545 #define GET_RX_STATUS_DESC_RPT_SEL(__pdesc) \
546 LE_BITS_TO_4BYTE(__pdesc+8, 28, 1)
548 #define GET_RX_DESC_RXMCS(__pdesc) \
549 LE_BITS_TO_4BYTE(__pdesc+12, 0, 7)
550 #define GET_RX_DESC_HTC(__pdesc) \
551 LE_BITS_TO_4BYTE(__pdesc+12, 10, 1)
552 #define GET_RX_STATUS_DESC_EOSP(__pdesc) \
553 LE_BITS_TO_4BYTE(__pdesc+12, 11, 1)
554 #define GET_RX_STATUS_DESC_BSSID_FIT(__pdesc) \
555 LE_BITS_TO_4BYTE(__pdesc+12, 12, 2)
556 #define GET_RX_STATUS_DESC_DMA_AGG_NUM(__pdesc) \
557 LE_BITS_TO_4BYTE(__pdesc+12, 16, 8)
558 #define GET_RX_STATUS_DESC_PATTERN_MATCH(__pdesc) \
559 LE_BITS_TO_4BYTE(__pdesc+12, 29, 1)
560 #define GET_RX_STATUS_DESC_UNICAST_MATCH(__pdesc) \
561 LE_BITS_TO_4BYTE(__pdesc+12, 30, 1)
562 #define GET_RX_STATUS_DESC_MAGIC_MATCH(__pdesc) \
563 LE_BITS_TO_4BYTE(__pdesc+12, 31, 1)
565 #define GET_RX_DESC_TSFL(__pdesc) \
566 LE_BITS_TO_4BYTE(__pdesc+20, 0, 32)
568 #define GET_RX_DESC_BUFF_ADDR(__pdesc) \
569 LE_BITS_TO_4BYTE(__pdesc+24, 0, 32)
570 #define GET_RX_DESC_BUFF_ADDR64(__pdesc) \
571 LE_BITS_TO_4BYTE(__pdesc+28, 0, 32)
573 #define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \
574 SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 32, __val)
575 #define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \
576 SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 32, __val)
578 /* TX report 2 format in Rx desc*/
580 #define GET_RX_RPT2_DESC_PKT_LEN(__status) \
581 LE_BITS_TO_4BYTE(__status, 0, 9)
582 #define GET_RX_RPT2_DESC_MACID_VALID_1(__status) \
583 LE_BITS_TO_4BYTE(__status+16, 0, 32)
584 #define GET_RX_RPT2_DESC_MACID_VALID_2(__status) \
585 LE_BITS_TO_4BYTE(__status+20, 0, 32)
587 #define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \
589 if (_size > TX_DESC_NEXT_DESC_OFFSET) \
590 memset(__pdesc, 0, TX_DESC_NEXT_DESC_OFFSET); \
592 memset(__pdesc, 0, _size); \
595 #define RTL92EE_RX_HAL_IS_CCK_RATE(rxmcs)\
596 (rxmcs == DESC_RATE1M ||\
597 rxmcs == DESC_RATE2M ||\
598 rxmcs == DESC_RATE5_5M ||\
599 rxmcs == DESC_RATE11M)
601 #define IS_LITTLE_ENDIAN 1
603 struct phy_rx_agc_info_t
{
611 struct phy_status_rpt
{
612 struct phy_rx_agc_info_t path_agc
[2];
614 u8 cck_sig_qual_ofdm_pwdb_all
;
615 u8 cck_agc_rpt_ofdm_cfosho_a
;
616 u8 cck_rpt_b_ofdm_cfosho_b
;
618 u8 noise_power_db_msb
;
623 u8 noise_power_db_lsb
;
626 u8 stream_target_csi
[2];
630 u8 antsel_rx_keep_2
:1; /*ex_intf_flg:1;*/
637 #else /* _BIG_ENDIAN_ */
644 u8 antsel_rx_keep_2
:1; /*ex_intf_flg:1;*/
742 u32 rtsrate_fb_lmt
:4;
767 u32 nextdescaddress64
;
769 u32 reserve_pass_pcie_mm_limit
[4];
830 void rtl92ee_rx_check_dma_ok(struct ieee80211_hw
*hw
, u8
*header_desc
,
832 u16
rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw
*hw
,
834 u16
rtl92ee_get_available_desc(struct ieee80211_hw
*hw
, u8 queue_index
);
835 void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw
*hw
,
836 u8
*tx_bd_desc
, u8
*desc
, u8 queue_index
,
837 struct sk_buff
*skb
, dma_addr_t addr
);
839 void rtl92ee_tx_fill_desc(struct ieee80211_hw
*hw
,
840 struct ieee80211_hdr
*hdr
, u8
*pdesc_tx
,
842 struct ieee80211_tx_info
*info
,
843 struct ieee80211_sta
*sta
,
845 u8 hw_queue
, struct rtl_tcb_desc
*ptcb_desc
);
846 bool rtl92ee_rx_query_desc(struct ieee80211_hw
*hw
,
847 struct rtl_stats
*status
,
848 struct ieee80211_rx_status
*rx_status
,
849 u8
*pdesc
, struct sk_buff
*skb
);
850 void rtl92ee_set_desc(struct ieee80211_hw
*hw
, u8
*pdesc
, bool istx
,
851 u8 desc_name
, u8
*val
);
853 u32
rtl92ee_get_desc(u8
*pdesc
, bool istx
, u8 desc_name
);
854 bool rtl92ee_is_tx_desc_closed(struct ieee80211_hw
*hw
, u8 hw_queue
, u16 index
);
855 void rtl92ee_tx_polling(struct ieee80211_hw
*hw
, u8 hw_queue
);
856 void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw
*hw
, u8
*pdesc
,
857 bool firstseg
, bool lastseg
,
858 struct sk_buff
*skb
);
859 u32
rtl92ee_rx_command_packet(struct ieee80211_hw
*hw
,
860 struct rtl_stats status
,
861 struct sk_buff
*skb
);