2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
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.
21 * Purpose:The header file of descriptor
34 #include <linux/types.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
55 #define RX_BLOCKS 64 // form 0x60 to 0xA0
56 #define TX_BLOCKS 32 // from 0xA0 to 0xC0
58 #define CB_MAX_RX_DESC 128 // max # of descriptor
59 #define CB_MIN_RX_DESC 16 // min # of rx descriptor
60 #define CB_MAX_TX_DESC 128 // max # of descriptor
61 #define CB_MIN_TX_DESC 16 // min # of tx descriptor
63 #define CB_RD_NUM 64 // default # of RD
64 #define CB_TD_NUM 64 // default # of TD
69 // Bits in the RSR register
71 #define RSR_ADDRBROAD 0x80 // 1000 0000
72 #define RSR_ADDRMULTI 0x40 // 0100 0000
73 #define RSR_ADDRUNI 0x00 // 0000 0000
74 #define RSR_IVLDTYP 0x20 // 0010 0000 , invalid packet type
75 #define RSR_IVLDLEN 0x10 // 0001 0000 , invalid len (> 2312 byte)
76 #define RSR_BSSIDOK 0x08 // 0000 1000
77 #define RSR_CRCOK 0x04 // 0000 0100
78 #define RSR_BCNSSIDOK 0x02 // 0000 0010
79 #define RSR_ADDROK 0x01 // 0000 0001
82 // Bits in the new RSR register
84 #define NEWRSR_DECRYPTOK 0x10 // 0001 0000
85 #define NEWRSR_CFPIND 0x08 // 0000 1000
86 #define NEWRSR_HWUTSF 0x04 // 0000 0100
87 #define NEWRSR_BCNHITAID 0x02 // 0000 0010
88 #define NEWRSR_BCNHITAID0 0x01 // 0000 0001
92 // Bits in the TSR register
94 #define TSR_RETRYTMO 0x08 // 0000 1000
95 #define TSR_TMO 0x04 // 0000 0100
96 #define TSR_ACKDATA 0x02 // 0000 0010
97 #define TSR_VALID 0x01 // 0000 0001
100 #define CB_PROTOCOL_RESERVED_SECTION 16
104 // if retrys excess 15 times , tx will abort, and
105 // if tx fifo underflow, tx will fail
106 // we should try to resend it
107 #define CB_MAX_TX_ABORT_RETRY 3
110 #define FIFOCTL_AUTO_FB_1 0x1000 // 0001 0000 0000 0000
111 #define FIFOCTL_AUTO_FB_0 0x0800 // 0000 1000 0000 0000
112 #define FIFOCTL_GRPACK 0x0400 // 0000 0100 0000 0000
113 #define FIFOCTL_11GA 0x0300 // 0000 0011 0000 0000
114 #define FIFOCTL_11GB 0x0200 // 0000 0010 0000 0000
115 #define FIFOCTL_11B 0x0100 // 0000 0001 0000 0000
116 #define FIFOCTL_11A 0x0000 // 0000 0000 0000 0000
117 #define FIFOCTL_RTS 0x0080 // 0000 0000 1000 0000
118 #define FIFOCTL_ISDMA0 0x0040 // 0000 0000 0100 0000
119 #define FIFOCTL_GENINT 0x0020 // 0000 0000 0010 0000
120 #define FIFOCTL_TMOEN 0x0010 // 0000 0000 0001 0000
121 #define FIFOCTL_LRETRY 0x0008 // 0000 0000 0000 1000
122 #define FIFOCTL_CRCDIS 0x0004 // 0000 0000 0000 0100
123 #define FIFOCTL_NEEDACK 0x0002 // 0000 0000 0000 0010
124 #define FIFOCTL_LHEAD 0x0001 // 0000 0000 0000 0001
126 //WMAC definition Frag Control
127 #define FRAGCTL_AES 0x0300 // 0000 0011 0000 0000
128 #define FRAGCTL_TKIP 0x0200 // 0000 0010 0000 0000
129 #define FRAGCTL_LEGACY 0x0100 // 0000 0001 0000 0000
130 #define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000
131 //#define FRAGCTL_AC3 0x000C // 0000 0000 0000 1100
132 //#define FRAGCTL_AC2 0x0008 // 0000 0000 0000 1000
133 //#define FRAGCTL_AC1 0x0004 // 0000 0000 0000 0100
134 //#define FRAGCTL_AC0 0x0000 // 0000 0000 0000 0000
135 #define FRAGCTL_ENDFRAG 0x0003 // 0000 0000 0000 0011
136 #define FRAGCTL_MIDFRAG 0x0002 // 0000 0000 0000 0010
137 #define FRAGCTL_STAFRAG 0x0001 // 0000 0000 0000 0001
138 #define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000
141 //#define TYPE_AC0DMA 0
142 //#define TYPE_TXDMA0 1
143 #define TYPE_TXDMA0 0
144 #define TYPE_AC0DMA 1
145 #define TYPE_ATIMDMA 2
146 #define TYPE_SYNCDMA 3
149 #define TYPE_BEACONDMA 4
151 #define TYPE_RXDMA0 0
152 #define TYPE_RXDMA1 1
157 // TD_INFO flags control bit
158 #define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb
159 #define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap)
160 #define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit
161 //#define TD_FLAGS_NETIF_SKB 0x04
163 /*--------------------- Export Types ------------------------------*/
167 // RsvTime buffer header
169 typedef struct tagSRrvTime_gRTS
{
170 WORD wRTSTxRrvTime_ba
;
171 WORD wRTSTxRrvTime_aa
;
172 WORD wRTSTxRrvTime_bb
;
176 }__attribute__ ((__packed__
))
177 SRrvTime_gRTS
, *PSRrvTime_gRTS
;
178 typedef const SRrvTime_gRTS
*PCSRrvTime_gRTS
;
180 typedef struct tagSRrvTime_gCTS
{
181 WORD wCTSTxRrvTime_ba
;
185 }__attribute__ ((__packed__
))
186 SRrvTime_gCTS
, *PSRrvTime_gCTS
;
187 typedef const SRrvTime_gCTS
*PCSRrvTime_gCTS
;
189 typedef struct tagSRrvTime_ab
{
192 }__attribute__ ((__packed__
))
193 SRrvTime_ab
, *PSRrvTime_ab
;
194 typedef const SRrvTime_ab
*PCSRrvTime_ab
;
196 typedef struct tagSRrvTime_atim
{
197 WORD wCTSTxRrvTime_ba
;
199 }__attribute__ ((__packed__
))
200 SRrvTime_atim
, *PSRrvTime_atim
;
201 typedef const SRrvTime_atim
*PCSRrvTime_atim
;
206 typedef struct tagSRTSData
{
209 BYTE abyRA
[U_ETHER_ADDR_LEN
];
210 BYTE abyTA
[U_ETHER_ADDR_LEN
];
211 }__attribute__ ((__packed__
))
212 SRTSData
, *PSRTSData
;
213 typedef const SRTSData
*PCSRTSData
;
215 typedef struct tagSRTS_g
{
216 BYTE bySignalField_b
;
217 BYTE byServiceField_b
;
218 WORD wTransmitLength_b
;
219 BYTE bySignalField_a
;
220 BYTE byServiceField_a
;
221 WORD wTransmitLength_a
;
227 }__attribute__ ((__packed__
))
229 typedef const SRTS_g
*PCSRTS_g
;
232 typedef struct tagSRTS_g_FB
{
233 BYTE bySignalField_b
;
234 BYTE byServiceField_b
;
235 WORD wTransmitLength_b
;
236 BYTE bySignalField_a
;
237 BYTE byServiceField_a
;
238 WORD wTransmitLength_a
;
243 WORD wRTSDuration_ba_f0
;
244 WORD wRTSDuration_aa_f0
;
245 WORD wRTSDuration_ba_f1
;
246 WORD wRTSDuration_aa_f1
;
248 }__attribute__ ((__packed__
))
249 SRTS_g_FB
, *PSRTS_g_FB
;
250 typedef const SRTS_g_FB
*PCSRTS_g_FB
;
253 typedef struct tagSRTS_ab
{
256 WORD wTransmitLength
;
260 }__attribute__ ((__packed__
))
262 typedef const SRTS_ab
*PCSRTS_ab
;
265 typedef struct tagSRTS_a_FB
{
268 WORD wTransmitLength
;
271 WORD wRTSDuration_f0
;
272 WORD wRTSDuration_f1
;
274 }__attribute__ ((__packed__
))
275 SRTS_a_FB
, *PSRTS_a_FB
;
276 typedef const SRTS_a_FB
*PCSRTS_a_FB
;
282 typedef struct tagSCTSData
{
285 BYTE abyRA
[U_ETHER_ADDR_LEN
];
287 }__attribute__ ((__packed__
))
288 SCTSData
, *PSCTSData
;
290 typedef struct tagSCTS
{
291 BYTE bySignalField_b
;
292 BYTE byServiceField_b
;
293 WORD wTransmitLength_b
;
297 }__attribute__ ((__packed__
))
299 typedef const SCTS
*PCSCTS
;
301 typedef struct tagSCTS_FB
{
302 BYTE bySignalField_b
;
303 BYTE byServiceField_b
;
304 WORD wTransmitLength_b
;
307 WORD wCTSDuration_ba_f0
;
308 WORD wCTSDuration_ba_f1
;
310 }__attribute__ ((__packed__
))
312 typedef const SCTS_FB
*PCSCTS_FB
;
318 typedef struct tagSTxBufHead
{
324 }__attribute__ ((__packed__
))
325 STxBufHead
, *PSTxBufHead
;
326 typedef const STxBufHead
*PCSTxBufHead
;
328 typedef struct tagSTxShortBufHead
{
331 }__attribute__ ((__packed__
))
332 STxShortBufHead
, *PSTxShortBufHead
;
333 typedef const STxShortBufHead
*PCSTxShortBufHead
;
338 typedef struct tagSTxDataHead_g
{
339 BYTE bySignalField_b
;
340 BYTE byServiceField_b
;
341 WORD wTransmitLength_b
;
342 BYTE bySignalField_a
;
343 BYTE byServiceField_a
;
344 WORD wTransmitLength_a
;
347 WORD wTimeStampOff_b
;
348 WORD wTimeStampOff_a
;
349 }__attribute__ ((__packed__
))
350 STxDataHead_g
, *PSTxDataHead_g
;
351 typedef const STxDataHead_g
*PCSTxDataHead_g
;
353 typedef struct tagSTxDataHead_g_FB
{
354 BYTE bySignalField_b
;
355 BYTE byServiceField_b
;
356 WORD wTransmitLength_b
;
357 BYTE bySignalField_a
;
358 BYTE byServiceField_a
;
359 WORD wTransmitLength_a
;
364 WORD wTimeStampOff_b
;
365 WORD wTimeStampOff_a
;
366 }__attribute__ ((__packed__
))
367 STxDataHead_g_FB
, *PSTxDataHead_g_FB
;
368 typedef const STxDataHead_g_FB
*PCSTxDataHead_g_FB
;
371 typedef struct tagSTxDataHead_ab
{
374 WORD wTransmitLength
;
377 }__attribute__ ((__packed__
))
378 STxDataHead_ab
, *PSTxDataHead_ab
;
379 typedef const STxDataHead_ab
*PCSTxDataHead_ab
;
382 typedef struct tagSTxDataHead_a_FB
{
385 WORD wTransmitLength
;
390 }__attribute__ ((__packed__
))
391 STxDataHead_a_FB
, *PSTxDataHead_a_FB
;
392 typedef const STxDataHead_a_FB
*PCSTxDataHead_a_FB
;
395 // MICHDR data header
397 typedef struct tagSMICHDRHead
{
401 }__attribute__ ((__packed__
))
402 SMICHDRHead
, *PSMICHDRHead
;
403 typedef const SMICHDRHead
*PCSMICHDRHead
;
405 typedef struct tagSBEACONCtl
{
410 }__attribute__ ((__packed__
))
414 typedef struct tagSSecretKey
{
417 }__attribute__ ((__packed__
))
420 typedef struct tagSKeyEntry
{
429 }__attribute__ ((__packed__
))
431 /*--------------------- Export Macros ------------------------------*/
433 /*--------------------- Export Classes ----------------------------*/
435 /*--------------------- Export Variables --------------------------*/
437 /*--------------------- Export Functions --------------------------*/