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