Merge branch 'freespace-tree' into for-linus-4.5
[deliverable/linux.git] / drivers / staging / vt6655 / device.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: device.h
20 *
21 * Purpose: MAC Data structure
22 *
23 * Author: Tevin Chen
24 *
25 * Date: Mar 17, 1997
26 *
27 */
28
29 #ifndef __DEVICE_H__
30 #define __DEVICE_H__
31
32 #include <linux/module.h>
33 #include <linux/types.h>
34 #include <linux/pci.h>
35 #include <linux/etherdevice.h>
36 #include <linux/skbuff.h>
37 #include <linux/interrupt.h>
38 #include <linux/crc32.h>
39 #include <net/mac80211.h>
40
41 /* device specific */
42
43 #include "device_cfg.h"
44 #include "card.h"
45 #include "srom.h"
46 #include "desc.h"
47 #include "key.h"
48 #include "mac.h"
49
50 /*--------------------- Export Definitions -------------------------*/
51
52 #define RATE_1M 0
53 #define RATE_2M 1
54 #define RATE_5M 2
55 #define RATE_11M 3
56 #define RATE_6M 4
57 #define RATE_9M 5
58 #define RATE_12M 6
59 #define RATE_18M 7
60 #define RATE_24M 8
61 #define RATE_36M 9
62 #define RATE_48M 10
63 #define RATE_54M 11
64 #define MAX_RATE 12
65
66 #define AUTO_FB_NONE 0
67 #define AUTO_FB_0 1
68 #define AUTO_FB_1 2
69
70 #define FB_RATE0 0
71 #define FB_RATE1 1
72
73 /* Antenna Mode */
74 #define ANT_A 0
75 #define ANT_B 1
76 #define ANT_DIVERSITY 2
77 #define ANT_RXD_TXA 3
78 #define ANT_RXD_TXB 4
79 #define ANT_UNKNOWN 0xFF
80
81 #define BB_VGA_LEVEL 4
82 #define BB_VGA_CHANGE_THRESHOLD 16
83
84 #define MAKE_BEACON_RESERVED 10 /* (us) */
85
86 /* BUILD OBJ mode */
87
88 #define AVAIL_TD(p, q) ((p)->opts.tx_descs[(q)] - ((p)->iTDUsed[(q)]))
89
90 /* 0:11A 1:11B 2:11G */
91 #define BB_TYPE_11A 0
92 #define BB_TYPE_11B 1
93 #define BB_TYPE_11G 2
94
95 /* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */
96 #define PK_TYPE_11A 0
97 #define PK_TYPE_11B 1
98 #define PK_TYPE_11GB 2
99 #define PK_TYPE_11GA 3
100
101 #define OWNED_BY_HOST 0
102 #define OWNED_BY_NIC 1
103
104 struct vnt_options {
105 int rx_descs0; /* Number of RX descriptors0 */
106 int rx_descs1; /* Number of RX descriptors1 */
107 int tx_descs[2]; /* Number of TX descriptors 0, 1 */
108 int int_works; /* interrupt limits */
109 int short_retry;
110 int long_retry;
111 int bbp_type;
112 u32 flags;
113 };
114
115 struct vnt_private {
116 struct pci_dev *pcid;
117 /* mac80211 */
118 struct ieee80211_hw *hw;
119 struct ieee80211_vif *vif;
120 unsigned long key_entry_inuse;
121 u32 basic_rates;
122 u16 current_aid;
123 int mc_list_count;
124 u8 mac_hw;
125
126 /* dma addr, rx/tx pool */
127 dma_addr_t pool_dma;
128 dma_addr_t rd0_pool_dma;
129 dma_addr_t rd1_pool_dma;
130
131 dma_addr_t td0_pool_dma;
132 dma_addr_t td1_pool_dma;
133
134 dma_addr_t tx_bufs_dma0;
135 dma_addr_t tx_bufs_dma1;
136 dma_addr_t tx_beacon_dma;
137
138 unsigned char *tx0_bufs;
139 unsigned char *tx1_bufs;
140 unsigned char *tx_beacon_bufs;
141
142 void __iomem *PortOffset;
143 u32 memaddr;
144 u32 ioaddr;
145
146 unsigned char byRxMode;
147
148 spinlock_t lock;
149
150 volatile int iTDUsed[TYPE_MAXTD];
151
152 struct vnt_tx_desc *apCurrTD[TYPE_MAXTD];
153 struct vnt_tx_desc *apTailTD[TYPE_MAXTD];
154
155 struct vnt_tx_desc *apTD0Rings;
156 struct vnt_tx_desc *apTD1Rings;
157
158 struct vnt_rx_desc *aRD0Ring;
159 struct vnt_rx_desc *aRD1Ring;
160 struct vnt_rx_desc *pCurrRD[TYPE_MAXRD];
161
162 struct vnt_options opts;
163
164 u32 flags;
165
166 u32 rx_buf_sz;
167 u8 rx_rate;
168
169 u32 rx_bytes;
170
171 /* Version control */
172 unsigned char byLocalID;
173 unsigned char byRFType;
174
175 unsigned char byMaxPwrLevel;
176 unsigned char byZoneType;
177 bool bZoneRegExist;
178 unsigned char byOriginalZonetype;
179
180 unsigned char abyCurrentNetAddr[ETH_ALEN]; __aligned(2)
181 bool bLinkPass; /* link status: OK or fail */
182
183 unsigned int uCurrRSSI;
184 unsigned char byCurrSQ;
185
186 unsigned long dwTxAntennaSel;
187 unsigned long dwRxAntennaSel;
188 unsigned char byAntennaCount;
189 unsigned char byRxAntennaMode;
190 unsigned char byTxAntennaMode;
191 bool bTxRxAntInv;
192
193 unsigned char *pbyTmpBuff;
194 unsigned int uSIFS; /* Current SIFS */
195 unsigned int uDIFS; /* Current DIFS */
196 unsigned int uEIFS; /* Current EIFS */
197 unsigned int uSlot; /* Current SlotTime */
198 unsigned int uCwMin; /* Current CwMin */
199 unsigned int uCwMax; /* CwMax is fixed on 1023. */
200 /* PHY parameter */
201 unsigned char bySIFS;
202 unsigned char byDIFS;
203 unsigned char byEIFS;
204 unsigned char bySlot;
205 unsigned char byCWMaxMin;
206
207 u8 byBBType; /* 0:11A, 1:11B, 2:11G */
208 u8 byPacketType; /*
209 * 0:11a,1:11b,2:11gb (only CCK
210 * in BasicRate), 3:11ga (OFDM in
211 * Basic Rate)
212 */
213 unsigned short wBasicRate;
214 unsigned char byACKRate;
215 unsigned char byTopOFDMBasicRate;
216 unsigned char byTopCCKBasicRate;
217
218 unsigned char byMinChannel;
219 unsigned char byMaxChannel;
220
221 unsigned char byPreambleType;
222 unsigned char byShortPreamble;
223
224 unsigned short wCurrentRate;
225 unsigned char byShortRetryLimit;
226 unsigned char byLongRetryLimit;
227 enum nl80211_iftype op_mode;
228 bool bBSSIDFilter;
229 unsigned short wMaxTransmitMSDULifetime;
230
231 bool bEncryptionEnable;
232 bool bLongHeader;
233 bool bShortSlotTime;
234 bool bProtectMode;
235 bool bNonERPPresent;
236 bool bBarkerPreambleMd;
237
238 bool bRadioControlOff;
239 bool bRadioOff;
240 bool bEnablePSMode;
241 unsigned short wListenInterval;
242 bool bPWBitOn;
243
244 /* GPIO Radio Control */
245 unsigned char byRadioCtl;
246 unsigned char byGPIO;
247 bool bHWRadioOff;
248 bool bPrvActive4RadioOFF;
249 bool bGPIOBlockRead;
250
251 /* Beacon related */
252 unsigned short wSeqCounter;
253 unsigned short wBCNBufLen;
254 bool bBeaconBufReady;
255 bool bBeaconSent;
256 bool bIsBeaconBufReadySet;
257 unsigned int cbBeaconBufReadySetCnt;
258 bool bFixRate;
259 u16 byCurrentCh;
260
261 bool bAES;
262
263 unsigned char byAutoFBCtrl;
264
265 /* For Update BaseBand VGA Gain Offset */
266 bool bUpdateBBVGA;
267 unsigned int uBBVGADiffCount;
268 unsigned char byBBVGANew;
269 unsigned char byBBVGACurrent;
270 unsigned char abyBBVGA[BB_VGA_LEVEL];
271 long ldBmThreshold[BB_VGA_LEVEL];
272
273 unsigned char byBBPreEDRSSI;
274 unsigned char byBBPreEDIndex;
275
276 unsigned long dwDiagRefCount;
277
278 /* For FOE Tuning */
279 unsigned char byFOETuning;
280
281 /* For RF Power table */
282 unsigned char byCCKPwr;
283 unsigned char byOFDMPwrG;
284 unsigned char byCurPwr;
285 char byCurPwrdBm;
286 unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1];
287 unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL+1];
288 char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1];
289 char abyOFDMDefaultPwr[CB_MAX_CHANNEL+1];
290 char abyRegPwr[CB_MAX_CHANNEL+1];
291 char abyLocalPwr[CB_MAX_CHANNEL+1];
292
293 /* BaseBand Loopback Use */
294 unsigned char byBBCR4d;
295 unsigned char byBBCRc9;
296 unsigned char byBBCR88;
297 unsigned char byBBCR09;
298
299 unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */
300
301 unsigned short wBeaconInterval;
302 u16 wake_up_count;
303
304 struct work_struct interrupt_work;
305
306 struct ieee80211_low_level_stats low_stats;
307 };
308
309 #endif
This page took 0.037355 seconds and 6 git commands to generate.