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