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