Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[cascardo/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
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  * TX FIFO header
148  */
149
150 typedef struct tagSTxShortBufHead {
151     u16    wFIFOCtl;
152     u16    wTimeStamp;
153 } __attribute__ ((__packed__))
154 STxShortBufHead, *PSTxShortBufHead;
155 typedef const STxShortBufHead *PCSTxShortBufHead;
156
157 typedef struct tagSBEACONCtl {
158         u32 BufReady:1;
159         u32 TSF:15;
160         u32 BufLen:11;
161         u32 Reserved:5;
162 } __attribute__ ((__packed__))
163 SBEACONCtl;
164
165 typedef struct tagSSecretKey {
166         u32 dwLowDword;
167     u8    byHighByte;
168 } __attribute__ ((__packed__))
169 SSecretKey;
170
171 typedef struct tagSKeyEntry {
172     u8  abyAddrHi[2];
173     u16  wKCTL;
174     u8  abyAddrLo[4];
175         u32 dwKey0[4];
176         u32 dwKey1[4];
177         u32 dwKey2[4];
178         u32 dwKey3[4];
179         u32 dwKey4[4];
180 } __attribute__ ((__packed__))
181 SKeyEntry;
182
183 #endif /* __DESC_H__ */