Merge 3.9-rc5 into staging-next
[deliverable/linux.git] / drivers / staging / vt6656 / desc.h
CommitLineData
92b96797
FB
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
92b96797
FB
31#ifndef __DESC_H__
32#define __DESC_H__
33
34#include <linux/types.h>
35#include <linux/mm.h>
4fcf9498 36
92b96797 37#include "tether.h"
92b96797 38
c16fdffc
AM
39/* max transmit or receive buffer size */
40#define CB_MAX_BUF_SIZE 2900U /* NOTE: must be multiple of 4 */
92b96797 41
c16fdffc
AM
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
92b96797 46
c16fdffc 47#define CB_BEACON_BUF_SIZE 512U /* default beacon buffer size */
92b96797
FB
48
49#define MAX_TOTAL_SIZE_WITH_ALL_HEADERS CB_MAX_BUF_SIZE
50
51#define MAX_INTERRUPT_SIZE 32
52
c16fdffc
AM
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
92b96797 93
92b96797
FB
94#define CB_PROTOCOL_RESERVED_SECTION 16
95
c16fdffc
AM
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 */
92b96797
FB
101#define CB_MAX_TX_ABORT_RETRY 3
102
c16fdffc
AM
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
92b96797 128
92b96797
FB
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
c16fdffc
AM
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 */
92b96797 145
c16fdffc
AM
146/*
147 * RsvTime buffer header
148 */
92b96797 149typedef struct tagSRrvTime_gRTS {
3eaca0d2
AM
150 u16 wRTSTxRrvTime_ba;
151 u16 wRTSTxRrvTime_aa;
152 u16 wRTSTxRrvTime_bb;
153 u16 wReserved;
154 u16 wTxRrvTime_b;
155 u16 wTxRrvTime_a;
d9d1ccb5 156} __attribute__ ((__packed__))
193a823c 157SRrvTime_gRTS, *PSRrvTime_gRTS;
d9d1ccb5 158
193a823c 159typedef const SRrvTime_gRTS *PCSRrvTime_gRTS;
92b96797
FB
160
161typedef struct tagSRrvTime_gCTS {
3eaca0d2
AM
162 u16 wCTSTxRrvTime_ba;
163 u16 wReserved;
164 u16 wTxRrvTime_b;
165 u16 wTxRrvTime_a;
d9d1ccb5 166} __attribute__ ((__packed__))
193a823c 167SRrvTime_gCTS, *PSRrvTime_gCTS;
d9d1ccb5 168
193a823c 169typedef const SRrvTime_gCTS *PCSRrvTime_gCTS;
92b96797
FB
170
171typedef struct tagSRrvTime_ab {
3eaca0d2
AM
172 u16 wRTSTxRrvTime;
173 u16 wTxRrvTime;
d9d1ccb5 174} __attribute__ ((__packed__))
193a823c 175SRrvTime_ab, *PSRrvTime_ab;
d9d1ccb5 176
193a823c 177typedef const SRrvTime_ab *PCSRrvTime_ab;
92b96797
FB
178
179typedef struct tagSRrvTime_atim {
3eaca0d2
AM
180 u16 wCTSTxRrvTime_ba;
181 u16 wTxRrvTime_a;
d9d1ccb5 182} __attribute__ ((__packed__))
193a823c 183SRrvTime_atim, *PSRrvTime_atim;
d9d1ccb5 184
193a823c 185typedef const SRrvTime_atim *PCSRrvTime_atim;
92b96797 186
c16fdffc
AM
187/*
188 * RTS buffer header
189 */
92b96797 190typedef struct tagSRTSData {
3eaca0d2
AM
191 u16 wFrameControl;
192 u16 wDurationID;
b902fbfe
AM
193 u8 abyRA[ETH_ALEN];
194 u8 abyTA[ETH_ALEN];
d9d1ccb5 195} __attribute__ ((__packed__))
193a823c 196SRTSData, *PSRTSData;
d9d1ccb5 197
193a823c 198typedef const SRTSData *PCSRTSData;
92b96797
FB
199
200typedef struct tagSRTS_g {
b902fbfe
AM
201 u8 bySignalField_b;
202 u8 byServiceField_b;
3eaca0d2 203 u16 wTransmitLength_b;
b902fbfe
AM
204 u8 bySignalField_a;
205 u8 byServiceField_a;
3eaca0d2
AM
206 u16 wTransmitLength_a;
207 u16 wDuration_ba;
208 u16 wDuration_aa;
209 u16 wDuration_bb;
210 u16 wReserved;
92b96797 211 SRTSData Data;
d9d1ccb5 212} __attribute__ ((__packed__))
193a823c
JL
213SRTS_g, *PSRTS_g;
214typedef const SRTS_g *PCSRTS_g;
92b96797 215
92b96797 216typedef struct tagSRTS_g_FB {
b902fbfe
AM
217 u8 bySignalField_b;
218 u8 byServiceField_b;
3eaca0d2 219 u16 wTransmitLength_b;
b902fbfe
AM
220 u8 bySignalField_a;
221 u8 byServiceField_a;
3eaca0d2
AM
222 u16 wTransmitLength_a;
223 u16 wDuration_ba;
224 u16 wDuration_aa;
225 u16 wDuration_bb;
226 u16 wReserved;
227 u16 wRTSDuration_ba_f0;
228 u16 wRTSDuration_aa_f0;
229 u16 wRTSDuration_ba_f1;
230 u16 wRTSDuration_aa_f1;
92b96797 231 SRTSData Data;
d9d1ccb5 232} __attribute__ ((__packed__))
193a823c 233SRTS_g_FB, *PSRTS_g_FB;
92b96797 234
d9d1ccb5 235typedef const SRTS_g_FB *PCSRTS_g_FB;
92b96797
FB
236
237typedef struct tagSRTS_ab {
b902fbfe
AM
238 u8 bySignalField;
239 u8 byServiceField;
3eaca0d2
AM
240 u16 wTransmitLength;
241 u16 wDuration;
242 u16 wReserved;
92b96797 243 SRTSData Data;
d9d1ccb5 244} __attribute__ ((__packed__))
193a823c 245SRTS_ab, *PSRTS_ab;
92b96797 246
d9d1ccb5 247typedef const SRTS_ab *PCSRTS_ab;
92b96797
FB
248
249typedef struct tagSRTS_a_FB {
b902fbfe
AM
250 u8 bySignalField;
251 u8 byServiceField;
3eaca0d2
AM
252 u16 wTransmitLength;
253 u16 wDuration;
254 u16 wReserved;
255 u16 wRTSDuration_f0;
256 u16 wRTSDuration_f1;
92b96797 257 SRTSData Data;
d9d1ccb5 258} __attribute__ ((__packed__))
193a823c 259SRTS_a_FB, *PSRTS_a_FB;
d9d1ccb5 260
193a823c 261typedef const SRTS_a_FB *PCSRTS_a_FB;
92b96797 262
c16fdffc
AM
263/*
264 * CTS buffer header
265 */
92b96797 266typedef struct tagSCTSData {
3eaca0d2
AM
267 u16 wFrameControl;
268 u16 wDurationID;
b902fbfe 269 u8 abyRA[ETH_ALEN];
3eaca0d2 270 u16 wReserved;
d9d1ccb5 271} __attribute__ ((__packed__))
193a823c 272SCTSData, *PSCTSData;
92b96797
FB
273
274typedef struct tagSCTS {
b902fbfe
AM
275 u8 bySignalField_b;
276 u8 byServiceField_b;
3eaca0d2
AM
277 u16 wTransmitLength_b;
278 u16 wDuration_ba;
279 u16 wReserved;
92b96797 280 SCTSData Data;
d9d1ccb5 281} __attribute__ ((__packed__))
193a823c 282SCTS, *PSCTS;
d9d1ccb5 283
193a823c 284typedef const SCTS *PCSCTS;
92b96797
FB
285
286typedef struct tagSCTS_FB {
b902fbfe
AM
287 u8 bySignalField_b;
288 u8 byServiceField_b;
3eaca0d2
AM
289 u16 wTransmitLength_b;
290 u16 wDuration_ba;
291 u16 wReserved;
292 u16 wCTSDuration_ba_f0;
293 u16 wCTSDuration_ba_f1;
92b96797 294 SCTSData Data;
d9d1ccb5 295} __attribute__ ((__packed__))
193a823c 296SCTS_FB, *PSCTS_FB;
92b96797 297
d9d1ccb5 298typedef const SCTS_FB *PCSCTS_FB;
92b96797 299
c16fdffc
AM
300/*
301 * TX FIFO header
302 */
92b96797 303typedef struct tagSTxBufHead {
d3b6f870 304 u32 adwTxKey[4];
3eaca0d2
AM
305 u16 wFIFOCtl;
306 u16 wTimeStamp;
307 u16 wFragCtl;
308 u16 wReserved;
d9d1ccb5 309} __attribute__ ((__packed__))
193a823c
JL
310STxBufHead, *PSTxBufHead;
311typedef const STxBufHead *PCSTxBufHead;
92b96797
FB
312
313typedef struct tagSTxShortBufHead {
3eaca0d2
AM
314 u16 wFIFOCtl;
315 u16 wTimeStamp;
d9d1ccb5 316} __attribute__ ((__packed__))
193a823c
JL
317STxShortBufHead, *PSTxShortBufHead;
318typedef const STxShortBufHead *PCSTxShortBufHead;
92b96797 319
c16fdffc
AM
320/*
321 * TX data header
322 */
92b96797 323typedef struct tagSTxDataHead_g {
b902fbfe
AM
324 u8 bySignalField_b;
325 u8 byServiceField_b;
3eaca0d2 326 u16 wTransmitLength_b;
b902fbfe
AM
327 u8 bySignalField_a;
328 u8 byServiceField_a;
3eaca0d2
AM
329 u16 wTransmitLength_a;
330 u16 wDuration_b;
331 u16 wDuration_a;
332 u16 wTimeStampOff_b;
333 u16 wTimeStampOff_a;
d9d1ccb5 334} __attribute__ ((__packed__))
193a823c 335STxDataHead_g, *PSTxDataHead_g;
d9d1ccb5 336
193a823c 337typedef const STxDataHead_g *PCSTxDataHead_g;
92b96797
FB
338
339typedef struct tagSTxDataHead_g_FB {
b902fbfe
AM
340 u8 bySignalField_b;
341 u8 byServiceField_b;
3eaca0d2 342 u16 wTransmitLength_b;
b902fbfe
AM
343 u8 bySignalField_a;
344 u8 byServiceField_a;
3eaca0d2
AM
345 u16 wTransmitLength_a;
346 u16 wDuration_b;
347 u16 wDuration_a;
348 u16 wDuration_a_f0;
349 u16 wDuration_a_f1;
350 u16 wTimeStampOff_b;
351 u16 wTimeStampOff_a;
d9d1ccb5 352} __attribute__ ((__packed__))
193a823c
JL
353STxDataHead_g_FB, *PSTxDataHead_g_FB;
354typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;
92b96797 355
92b96797 356typedef struct tagSTxDataHead_ab {
b902fbfe
AM
357 u8 bySignalField;
358 u8 byServiceField;
3eaca0d2
AM
359 u16 wTransmitLength;
360 u16 wDuration;
361 u16 wTimeStampOff;
d9d1ccb5 362} __attribute__ ((__packed__))
193a823c
JL
363STxDataHead_ab, *PSTxDataHead_ab;
364typedef const STxDataHead_ab *PCSTxDataHead_ab;
92b96797 365
92b96797 366typedef struct tagSTxDataHead_a_FB {
b902fbfe
AM
367 u8 bySignalField;
368 u8 byServiceField;
3eaca0d2
AM
369 u16 wTransmitLength;
370 u16 wDuration;
371 u16 wTimeStampOff;
372 u16 wDuration_f0;
373 u16 wDuration_f1;
d9d1ccb5 374} __attribute__ ((__packed__))
193a823c
JL
375STxDataHead_a_FB, *PSTxDataHead_a_FB;
376typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
92b96797 377
c16fdffc
AM
378/*
379 * MICHDR data header
380 */
92b96797 381typedef struct tagSMICHDRHead {
d3b6f870
MP
382 u32 adwHDR0[4];
383 u32 adwHDR1[4];
384 u32 adwHDR2[4];
d9d1ccb5 385} __attribute__ ((__packed__))
193a823c 386SMICHDRHead, *PSMICHDRHead;
d9d1ccb5 387
193a823c 388typedef const SMICHDRHead *PCSMICHDRHead;
92b96797
FB
389
390typedef struct tagSBEACONCtl {
d3b6f870
MP
391 u32 BufReady:1;
392 u32 TSF:15;
393 u32 BufLen:11;
394 u32 Reserved:5;
d9d1ccb5 395} __attribute__ ((__packed__))
92b96797
FB
396SBEACONCtl;
397
92b96797 398typedef struct tagSSecretKey {
d3b6f870 399 u32 dwLowDword;
b902fbfe 400 u8 byHighByte;
d9d1ccb5 401} __attribute__ ((__packed__))
92b96797
FB
402SSecretKey;
403
404typedef struct tagSKeyEntry {
b902fbfe 405 u8 abyAddrHi[2];
3eaca0d2 406 u16 wKCTL;
b902fbfe 407 u8 abyAddrLo[4];
d3b6f870
MP
408 u32 dwKey0[4];
409 u32 dwKey1[4];
410 u32 dwKey2[4];
411 u32 dwKey3[4];
412 u32 dwKey4[4];
d9d1ccb5 413} __attribute__ ((__packed__))
92b96797 414SKeyEntry;
92b96797 415
e7b07d1d 416#endif /* __DESC_H__ */
This page took 0.360545 seconds and 5 git commands to generate.