Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / vt6656 / desc.h
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * File: desc.h
20 *
21 * Purpose:The header file of descriptor
22 *
23 * Revision History:
24 *
25 * Author: Tevin Chen
26 *
27 * Date: May 21, 1996
28 *
29 */
30
31 #ifndef __DESC_H__
32 #define __DESC_H__
33
34 #include <linux/types.h>
35 #include <linux/mm.h>
36 #include "ttype.h"
37 #include "tether.h"
38
39 /*--------------------- Export Definitions -------------------------*/
40
41 // max transmit or receive buffer size
42 #define CB_MAX_BUF_SIZE 2900U // max buffer size
43 // NOTE: must be multiple of 4
44
45 #define CB_MAX_TX_BUF_SIZE CB_MAX_BUF_SIZE // max Tx buffer size
46 #define CB_MAX_RX_BUF_SIZE_NORMAL CB_MAX_BUF_SIZE // max Rx buffer size when not use Multi-RD
47
48 #define CB_BEACON_BUF_SIZE 512U // default beacon buffer size
49
50 #define MAX_TOTAL_SIZE_WITH_ALL_HEADERS CB_MAX_BUF_SIZE
51
52 #define MAX_INTERRUPT_SIZE 32
53
54
55 #define RX_BLOCKS 64 // form 0x60 to 0xA0
56 #define TX_BLOCKS 32 // from 0xA0 to 0xC0
57
58 #define CB_MAX_RX_DESC 128 // max # of descriptor
59 #define CB_MIN_RX_DESC 16 // min # of rx descriptor
60 #define CB_MAX_TX_DESC 128 // max # of descriptor
61 #define CB_MIN_TX_DESC 16 // min # of tx descriptor
62
63 #define CB_RD_NUM 64 // default # of RD
64 #define CB_TD_NUM 64 // default # of TD
65
66
67
68 //
69 // Bits in the RSR register
70 //
71 #define RSR_ADDRBROAD 0x80 // 1000 0000
72 #define RSR_ADDRMULTI 0x40 // 0100 0000
73 #define RSR_ADDRUNI 0x00 // 0000 0000
74 #define RSR_IVLDTYP 0x20 // 0010 0000 , invalid packet type
75 #define RSR_IVLDLEN 0x10 // 0001 0000 , invalid len (> 2312 byte)
76 #define RSR_BSSIDOK 0x08 // 0000 1000
77 #define RSR_CRCOK 0x04 // 0000 0100
78 #define RSR_BCNSSIDOK 0x02 // 0000 0010
79 #define RSR_ADDROK 0x01 // 0000 0001
80
81 //
82 // Bits in the new RSR register
83 //
84 #define NEWRSR_DECRYPTOK 0x10 // 0001 0000
85 #define NEWRSR_CFPIND 0x08 // 0000 1000
86 #define NEWRSR_HWUTSF 0x04 // 0000 0100
87 #define NEWRSR_BCNHITAID 0x02 // 0000 0010
88 #define NEWRSR_BCNHITAID0 0x01 // 0000 0001
89
90
91 //
92 // Bits in the TSR register
93 //
94 #define TSR_RETRYTMO 0x08 // 0000 1000
95 #define TSR_TMO 0x04 // 0000 0100
96 #define TSR_ACKDATA 0x02 // 0000 0010
97 #define TSR_VALID 0x01 // 0000 0001
98
99
100 #define CB_PROTOCOL_RESERVED_SECTION 16
101
102
103
104 // if retrys excess 15 times , tx will abort, and
105 // if tx fifo underflow, tx will fail
106 // we should try to resend it
107 #define CB_MAX_TX_ABORT_RETRY 3
108
109
110 #define FIFOCTL_AUTO_FB_1 0x1000 // 0001 0000 0000 0000
111 #define FIFOCTL_AUTO_FB_0 0x0800 // 0000 1000 0000 0000
112 #define FIFOCTL_GRPACK 0x0400 // 0000 0100 0000 0000
113 #define FIFOCTL_11GA 0x0300 // 0000 0011 0000 0000
114 #define FIFOCTL_11GB 0x0200 // 0000 0010 0000 0000
115 #define FIFOCTL_11B 0x0100 // 0000 0001 0000 0000
116 #define FIFOCTL_11A 0x0000 // 0000 0000 0000 0000
117 #define FIFOCTL_RTS 0x0080 // 0000 0000 1000 0000
118 #define FIFOCTL_ISDMA0 0x0040 // 0000 0000 0100 0000
119 #define FIFOCTL_GENINT 0x0020 // 0000 0000 0010 0000
120 #define FIFOCTL_TMOEN 0x0010 // 0000 0000 0001 0000
121 #define FIFOCTL_LRETRY 0x0008 // 0000 0000 0000 1000
122 #define FIFOCTL_CRCDIS 0x0004 // 0000 0000 0000 0100
123 #define FIFOCTL_NEEDACK 0x0002 // 0000 0000 0000 0010
124 #define FIFOCTL_LHEAD 0x0001 // 0000 0000 0000 0001
125
126 //WMAC definition Frag Control
127 #define FRAGCTL_AES 0x0300 // 0000 0011 0000 0000
128 #define FRAGCTL_TKIP 0x0200 // 0000 0010 0000 0000
129 #define FRAGCTL_LEGACY 0x0100 // 0000 0001 0000 0000
130 #define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000
131 //#define FRAGCTL_AC3 0x000C // 0000 0000 0000 1100
132 //#define FRAGCTL_AC2 0x0008 // 0000 0000 0000 1000
133 //#define FRAGCTL_AC1 0x0004 // 0000 0000 0000 0100
134 //#define FRAGCTL_AC0 0x0000 // 0000 0000 0000 0000
135 #define FRAGCTL_ENDFRAG 0x0003 // 0000 0000 0000 0011
136 #define FRAGCTL_MIDFRAG 0x0002 // 0000 0000 0000 0010
137 #define FRAGCTL_STAFRAG 0x0001 // 0000 0000 0000 0001
138 #define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000
139
140
141 //#define TYPE_AC0DMA 0
142 //#define TYPE_TXDMA0 1
143 #define TYPE_TXDMA0 0
144 #define TYPE_AC0DMA 1
145 #define TYPE_ATIMDMA 2
146 #define TYPE_SYNCDMA 3
147 #define TYPE_MAXTD 2
148
149 #define TYPE_BEACONDMA 4
150
151 #define TYPE_RXDMA0 0
152 #define TYPE_RXDMA1 1
153 #define TYPE_MAXRD 2
154
155
156
157 // TD_INFO flags control bit
158 #define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb
159 #define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap)
160 #define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit
161 //#define TD_FLAGS_NETIF_SKB 0x04
162
163 /*--------------------- Export Types ------------------------------*/
164
165
166 //
167 // RsvTime buffer header
168 //
169 typedef struct tagSRrvTime_gRTS {
170 WORD wRTSTxRrvTime_ba;
171 WORD wRTSTxRrvTime_aa;
172 WORD wRTSTxRrvTime_bb;
173 WORD wReserved;
174 WORD wTxRrvTime_b;
175 WORD wTxRrvTime_a;
176 }__attribute__ ((__packed__))
177 SRrvTime_gRTS, *PSRrvTime_gRTS;
178 typedef const SRrvTime_gRTS *PCSRrvTime_gRTS;
179
180 typedef struct tagSRrvTime_gCTS {
181 WORD wCTSTxRrvTime_ba;
182 WORD wReserved;
183 WORD wTxRrvTime_b;
184 WORD wTxRrvTime_a;
185 }__attribute__ ((__packed__))
186 SRrvTime_gCTS, *PSRrvTime_gCTS;
187 typedef const SRrvTime_gCTS *PCSRrvTime_gCTS;
188
189 typedef struct tagSRrvTime_ab {
190 WORD wRTSTxRrvTime;
191 WORD wTxRrvTime;
192 }__attribute__ ((__packed__))
193 SRrvTime_ab, *PSRrvTime_ab;
194 typedef const SRrvTime_ab *PCSRrvTime_ab;
195
196 typedef struct tagSRrvTime_atim {
197 WORD wCTSTxRrvTime_ba;
198 WORD wTxRrvTime_a;
199 }__attribute__ ((__packed__))
200 SRrvTime_atim, *PSRrvTime_atim;
201 typedef const SRrvTime_atim *PCSRrvTime_atim;
202
203 //
204 // RTS buffer header
205 //
206 typedef struct tagSRTSData {
207 WORD wFrameControl;
208 WORD wDurationID;
209 BYTE abyRA[ETH_ALEN];
210 BYTE abyTA[ETH_ALEN];
211 }__attribute__ ((__packed__))
212 SRTSData, *PSRTSData;
213 typedef const SRTSData *PCSRTSData;
214
215 typedef struct tagSRTS_g {
216 BYTE bySignalField_b;
217 BYTE byServiceField_b;
218 WORD wTransmitLength_b;
219 BYTE bySignalField_a;
220 BYTE byServiceField_a;
221 WORD wTransmitLength_a;
222 WORD wDuration_ba;
223 WORD wDuration_aa;
224 WORD wDuration_bb;
225 WORD wReserved;
226 SRTSData Data;
227 }__attribute__ ((__packed__))
228 SRTS_g, *PSRTS_g;
229 typedef const SRTS_g *PCSRTS_g;
230
231
232 typedef struct tagSRTS_g_FB {
233 BYTE bySignalField_b;
234 BYTE byServiceField_b;
235 WORD wTransmitLength_b;
236 BYTE bySignalField_a;
237 BYTE byServiceField_a;
238 WORD wTransmitLength_a;
239 WORD wDuration_ba;
240 WORD wDuration_aa;
241 WORD wDuration_bb;
242 WORD wReserved;
243 WORD wRTSDuration_ba_f0;
244 WORD wRTSDuration_aa_f0;
245 WORD wRTSDuration_ba_f1;
246 WORD wRTSDuration_aa_f1;
247 SRTSData Data;
248 }__attribute__ ((__packed__))
249 SRTS_g_FB, *PSRTS_g_FB;
250 typedef const SRTS_g_FB *PCSRTS_g_FB;
251
252
253 typedef struct tagSRTS_ab {
254 BYTE bySignalField;
255 BYTE byServiceField;
256 WORD wTransmitLength;
257 WORD wDuration;
258 WORD wReserved;
259 SRTSData Data;
260 }__attribute__ ((__packed__))
261 SRTS_ab, *PSRTS_ab;
262 typedef const SRTS_ab *PCSRTS_ab;
263
264
265 typedef struct tagSRTS_a_FB {
266 BYTE bySignalField;
267 BYTE byServiceField;
268 WORD wTransmitLength;
269 WORD wDuration;
270 WORD wReserved;
271 WORD wRTSDuration_f0;
272 WORD wRTSDuration_f1;
273 SRTSData Data;
274 }__attribute__ ((__packed__))
275 SRTS_a_FB, *PSRTS_a_FB;
276 typedef const SRTS_a_FB *PCSRTS_a_FB;
277
278
279 //
280 // CTS buffer header
281 //
282 typedef struct tagSCTSData {
283 WORD wFrameControl;
284 WORD wDurationID;
285 BYTE abyRA[ETH_ALEN];
286 WORD wReserved;
287 }__attribute__ ((__packed__))
288 SCTSData, *PSCTSData;
289
290 typedef struct tagSCTS {
291 BYTE bySignalField_b;
292 BYTE byServiceField_b;
293 WORD wTransmitLength_b;
294 WORD wDuration_ba;
295 WORD wReserved;
296 SCTSData Data;
297 }__attribute__ ((__packed__))
298 SCTS, *PSCTS;
299 typedef const SCTS *PCSCTS;
300
301 typedef struct tagSCTS_FB {
302 BYTE bySignalField_b;
303 BYTE byServiceField_b;
304 WORD wTransmitLength_b;
305 WORD wDuration_ba;
306 WORD wReserved;
307 WORD wCTSDuration_ba_f0;
308 WORD wCTSDuration_ba_f1;
309 SCTSData Data;
310 }__attribute__ ((__packed__))
311 SCTS_FB, *PSCTS_FB;
312 typedef const SCTS_FB *PCSCTS_FB;
313
314
315 //
316 // Tx FIFO header
317 //
318 typedef struct tagSTxBufHead {
319 DWORD adwTxKey[4];
320 WORD wFIFOCtl;
321 WORD wTimeStamp;
322 WORD wFragCtl;
323 WORD wReserved;
324 }__attribute__ ((__packed__))
325 STxBufHead, *PSTxBufHead;
326 typedef const STxBufHead *PCSTxBufHead;
327
328 typedef struct tagSTxShortBufHead {
329 WORD wFIFOCtl;
330 WORD wTimeStamp;
331 }__attribute__ ((__packed__))
332 STxShortBufHead, *PSTxShortBufHead;
333 typedef const STxShortBufHead *PCSTxShortBufHead;
334
335 //
336 // Tx data header
337 //
338 typedef struct tagSTxDataHead_g {
339 BYTE bySignalField_b;
340 BYTE byServiceField_b;
341 WORD wTransmitLength_b;
342 BYTE bySignalField_a;
343 BYTE byServiceField_a;
344 WORD wTransmitLength_a;
345 WORD wDuration_b;
346 WORD wDuration_a;
347 WORD wTimeStampOff_b;
348 WORD wTimeStampOff_a;
349 }__attribute__ ((__packed__))
350 STxDataHead_g, *PSTxDataHead_g;
351 typedef const STxDataHead_g *PCSTxDataHead_g;
352
353 typedef struct tagSTxDataHead_g_FB {
354 BYTE bySignalField_b;
355 BYTE byServiceField_b;
356 WORD wTransmitLength_b;
357 BYTE bySignalField_a;
358 BYTE byServiceField_a;
359 WORD wTransmitLength_a;
360 WORD wDuration_b;
361 WORD wDuration_a;
362 WORD wDuration_a_f0;
363 WORD wDuration_a_f1;
364 WORD wTimeStampOff_b;
365 WORD wTimeStampOff_a;
366 }__attribute__ ((__packed__))
367 STxDataHead_g_FB, *PSTxDataHead_g_FB;
368 typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;
369
370
371 typedef struct tagSTxDataHead_ab {
372 BYTE bySignalField;
373 BYTE byServiceField;
374 WORD wTransmitLength;
375 WORD wDuration;
376 WORD wTimeStampOff;
377 }__attribute__ ((__packed__))
378 STxDataHead_ab, *PSTxDataHead_ab;
379 typedef const STxDataHead_ab *PCSTxDataHead_ab;
380
381
382 typedef struct tagSTxDataHead_a_FB {
383 BYTE bySignalField;
384 BYTE byServiceField;
385 WORD wTransmitLength;
386 WORD wDuration;
387 WORD wTimeStampOff;
388 WORD wDuration_f0;
389 WORD wDuration_f1;
390 }__attribute__ ((__packed__))
391 STxDataHead_a_FB, *PSTxDataHead_a_FB;
392 typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
393
394 //
395 // MICHDR data header
396 //
397 typedef struct tagSMICHDRHead {
398 DWORD adwHDR0[4];
399 DWORD adwHDR1[4];
400 DWORD adwHDR2[4];
401 }__attribute__ ((__packed__))
402 SMICHDRHead, *PSMICHDRHead;
403 typedef const SMICHDRHead *PCSMICHDRHead;
404
405 typedef struct tagSBEACONCtl {
406 DWORD BufReady : 1;
407 DWORD TSF : 15;
408 DWORD BufLen : 11;
409 DWORD Reserved : 5;
410 }__attribute__ ((__packed__))
411 SBEACONCtl;
412
413
414 typedef struct tagSSecretKey {
415 DWORD dwLowDword;
416 BYTE byHighByte;
417 }__attribute__ ((__packed__))
418 SSecretKey;
419
420 typedef struct tagSKeyEntry {
421 BYTE abyAddrHi[2];
422 WORD wKCTL;
423 BYTE abyAddrLo[4];
424 DWORD dwKey0[4];
425 DWORD dwKey1[4];
426 DWORD dwKey2[4];
427 DWORD dwKey3[4];
428 DWORD dwKey4[4];
429 }__attribute__ ((__packed__))
430 SKeyEntry;
431 /*--------------------- Export Macros ------------------------------*/
432
433 /*--------------------- Export Classes ----------------------------*/
434
435 /*--------------------- Export Variables --------------------------*/
436
437 /*--------------------- Export Functions --------------------------*/
438
439 #endif /* __DESC_H__ */