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