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