blob: 767112b3c4a9569ac7b5239e3577486848e12c7e [file] [log] [blame]
Forest Bond92b96792009-06-13 07:38:31 -04001/*
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
Forest Bond92b96792009-06-13 07:38:31 -040031#ifndef __DESC_H__
32#define __DESC_H__
33
34#include <linux/types.h>
35#include <linux/mm.h>
Forest Bond92b96792009-06-13 07:38:31 -040036#include "ttype.h"
Forest Bond92b96792009-06-13 07:38:31 -040037#include "tether.h"
Forest Bond92b96792009-06-13 07:38:31 -040038
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
Forest Bond92b96792009-06-13 07:38:31 -040054#define RX_BLOCKS 64 // form 0x60 to 0xA0
55#define TX_BLOCKS 32 // from 0xA0 to 0xC0
56
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
61
62#define CB_RD_NUM 64 // default # of RD
63#define CB_TD_NUM 64 // default # of TD
64
Forest Bond92b96792009-06-13 07:38:31 -040065//
66// Bits in the RSR register
67//
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
77
78//
79// Bits in the new RSR register
80//
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
86
Forest Bond92b96792009-06-13 07:38:31 -040087//
88// Bits in the TSR register
89//
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
94
Forest Bond92b96792009-06-13 07:38:31 -040095#define CB_PROTOCOL_RESERVED_SECTION 16
96
Forest Bond92b96792009-06-13 07:38:31 -040097// 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
101
Forest Bond92b96792009-06-13 07:38:31 -0400102#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
117
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
131
Forest Bond92b96792009-06-13 07:38:31 -0400132//#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
139
140#define TYPE_BEACONDMA 4
141
142#define TYPE_RXDMA0 0
143#define TYPE_RXDMA1 1
144#define TYPE_MAXRD 2
145
Forest Bond92b96792009-06-13 07:38:31 -0400146// 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
151
152/*--------------------- Export Types ------------------------------*/
153
Forest Bond92b96792009-06-13 07:38:31 -0400154//
155// RsvTime buffer header
156//
157typedef 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;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300164} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700165SRrvTime_gRTS, *PSRrvTime_gRTS;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300166
Jim Lieb193a8232009-08-12 14:54:06 -0700167typedef const SRrvTime_gRTS *PCSRrvTime_gRTS;
Forest Bond92b96792009-06-13 07:38:31 -0400168
169typedef struct tagSRrvTime_gCTS {
170 WORD wCTSTxRrvTime_ba;
171 WORD wReserved;
172 WORD wTxRrvTime_b;
173 WORD wTxRrvTime_a;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300174} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700175SRrvTime_gCTS, *PSRrvTime_gCTS;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300176
Jim Lieb193a8232009-08-12 14:54:06 -0700177typedef const SRrvTime_gCTS *PCSRrvTime_gCTS;
Forest Bond92b96792009-06-13 07:38:31 -0400178
179typedef struct tagSRrvTime_ab {
180 WORD wRTSTxRrvTime;
181 WORD wTxRrvTime;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300182} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700183SRrvTime_ab, *PSRrvTime_ab;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300184
Jim Lieb193a8232009-08-12 14:54:06 -0700185typedef const SRrvTime_ab *PCSRrvTime_ab;
Forest Bond92b96792009-06-13 07:38:31 -0400186
187typedef struct tagSRrvTime_atim {
188 WORD wCTSTxRrvTime_ba;
189 WORD wTxRrvTime_a;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300190} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700191SRrvTime_atim, *PSRrvTime_atim;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300192
Jim Lieb193a8232009-08-12 14:54:06 -0700193typedef const SRrvTime_atim *PCSRrvTime_atim;
Forest Bond92b96792009-06-13 07:38:31 -0400194
195//
196// RTS buffer header
197//
198typedef struct tagSRTSData {
199 WORD wFrameControl;
200 WORD wDurationID;
Andres More9a0e7562010-04-13 21:54:48 -0300201 BYTE abyRA[ETH_ALEN];
202 BYTE abyTA[ETH_ALEN];
Andres Mored9d1ccb2010-05-26 20:00:36 -0300203} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700204SRTSData, *PSRTSData;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300205
Jim Lieb193a8232009-08-12 14:54:06 -0700206typedef const SRTSData *PCSRTSData;
Forest Bond92b96792009-06-13 07:38:31 -0400207
208typedef 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;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300220} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700221SRTS_g, *PSRTS_g;
222typedef const SRTS_g *PCSRTS_g;
Forest Bond92b96792009-06-13 07:38:31 -0400223
Forest Bond92b96792009-06-13 07:38:31 -0400224typedef 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;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300240} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700241SRTS_g_FB, *PSRTS_g_FB;
Forest Bond92b96792009-06-13 07:38:31 -0400242
Andres Mored9d1ccb2010-05-26 20:00:36 -0300243typedef const SRTS_g_FB *PCSRTS_g_FB;
Forest Bond92b96792009-06-13 07:38:31 -0400244
245typedef struct tagSRTS_ab {
246 BYTE bySignalField;
247 BYTE byServiceField;
248 WORD wTransmitLength;
249 WORD wDuration;
250 WORD wReserved;
251 SRTSData Data;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300252} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700253SRTS_ab, *PSRTS_ab;
Forest Bond92b96792009-06-13 07:38:31 -0400254
Andres Mored9d1ccb2010-05-26 20:00:36 -0300255typedef const SRTS_ab *PCSRTS_ab;
Forest Bond92b96792009-06-13 07:38:31 -0400256
257typedef 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;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300266} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700267SRTS_a_FB, *PSRTS_a_FB;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300268
Jim Lieb193a8232009-08-12 14:54:06 -0700269typedef const SRTS_a_FB *PCSRTS_a_FB;
Forest Bond92b96792009-06-13 07:38:31 -0400270
271
272//
273// CTS buffer header
274//
275typedef struct tagSCTSData {
276 WORD wFrameControl;
277 WORD wDurationID;
Andres More9a0e7562010-04-13 21:54:48 -0300278 BYTE abyRA[ETH_ALEN];
Forest Bond92b96792009-06-13 07:38:31 -0400279 WORD wReserved;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300280} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700281SCTSData, *PSCTSData;
Forest Bond92b96792009-06-13 07:38:31 -0400282
283typedef struct tagSCTS {
284 BYTE bySignalField_b;
285 BYTE byServiceField_b;
286 WORD wTransmitLength_b;
287 WORD wDuration_ba;
288 WORD wReserved;
289 SCTSData Data;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300290} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700291SCTS, *PSCTS;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300292
Jim Lieb193a8232009-08-12 14:54:06 -0700293typedef const SCTS *PCSCTS;
Forest Bond92b96792009-06-13 07:38:31 -0400294
295typedef 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;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300304} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700305SCTS_FB, *PSCTS_FB;
Forest Bond92b96792009-06-13 07:38:31 -0400306
Andres Mored9d1ccb2010-05-26 20:00:36 -0300307typedef const SCTS_FB *PCSCTS_FB;
Forest Bond92b96792009-06-13 07:38:31 -0400308
309//
310// Tx FIFO header
311//
312typedef struct tagSTxBufHead {
313 DWORD adwTxKey[4];
314 WORD wFIFOCtl;
315 WORD wTimeStamp;
316 WORD wFragCtl;
317 WORD wReserved;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300318} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700319STxBufHead, *PSTxBufHead;
320typedef const STxBufHead *PCSTxBufHead;
Forest Bond92b96792009-06-13 07:38:31 -0400321
322typedef struct tagSTxShortBufHead {
323 WORD wFIFOCtl;
324 WORD wTimeStamp;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300325} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700326STxShortBufHead, *PSTxShortBufHead;
327typedef const STxShortBufHead *PCSTxShortBufHead;
Forest Bond92b96792009-06-13 07:38:31 -0400328
329//
330// Tx data header
331//
332typedef 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;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300343} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700344STxDataHead_g, *PSTxDataHead_g;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300345
Jim Lieb193a8232009-08-12 14:54:06 -0700346typedef const STxDataHead_g *PCSTxDataHead_g;
Forest Bond92b96792009-06-13 07:38:31 -0400347
348typedef 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;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300361} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700362STxDataHead_g_FB, *PSTxDataHead_g_FB;
363typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;
Forest Bond92b96792009-06-13 07:38:31 -0400364
Forest Bond92b96792009-06-13 07:38:31 -0400365typedef struct tagSTxDataHead_ab {
366 BYTE bySignalField;
367 BYTE byServiceField;
368 WORD wTransmitLength;
369 WORD wDuration;
370 WORD wTimeStampOff;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300371} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700372STxDataHead_ab, *PSTxDataHead_ab;
373typedef const STxDataHead_ab *PCSTxDataHead_ab;
Forest Bond92b96792009-06-13 07:38:31 -0400374
Forest Bond92b96792009-06-13 07:38:31 -0400375typedef 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;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300383} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700384STxDataHead_a_FB, *PSTxDataHead_a_FB;
385typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
Forest Bond92b96792009-06-13 07:38:31 -0400386
387//
388// MICHDR data header
389//
390typedef struct tagSMICHDRHead {
391 DWORD adwHDR0[4];
392 DWORD adwHDR1[4];
393 DWORD adwHDR2[4];
Andres Mored9d1ccb2010-05-26 20:00:36 -0300394} __attribute__ ((__packed__))
Jim Lieb193a8232009-08-12 14:54:06 -0700395SMICHDRHead, *PSMICHDRHead;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300396
Jim Lieb193a8232009-08-12 14:54:06 -0700397typedef const SMICHDRHead *PCSMICHDRHead;
Forest Bond92b96792009-06-13 07:38:31 -0400398
399typedef struct tagSBEACONCtl {
400 DWORD BufReady : 1;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300401 DWORD TSF : 15;
402 DWORD BufLen : 11;
Forest Bond92b96792009-06-13 07:38:31 -0400403 DWORD Reserved : 5;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300404} __attribute__ ((__packed__))
Forest Bond92b96792009-06-13 07:38:31 -0400405SBEACONCtl;
406
Forest Bond92b96792009-06-13 07:38:31 -0400407typedef struct tagSSecretKey {
408 DWORD dwLowDword;
409 BYTE byHighByte;
Andres Mored9d1ccb2010-05-26 20:00:36 -0300410} __attribute__ ((__packed__))
Forest Bond92b96792009-06-13 07:38:31 -0400411SSecretKey;
412
413typedef 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];
Andres Mored9d1ccb2010-05-26 20:00:36 -0300422} __attribute__ ((__packed__))
Forest Bond92b96792009-06-13 07:38:31 -0400423SKeyEntry;
424/*--------------------- Export Macros ------------------------------*/
425
426/*--------------------- Export Classes ----------------------------*/
427
428/*--------------------- Export Variables --------------------------*/
429
430/*--------------------- Export Functions --------------------------*/
431
Andres Moree7b07d12010-05-01 19:12:26 -0300432#endif /* __DESC_H__ */