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 * 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 28#include <linux/module.h> 29#include <linux/types.h> 30#include <linux/pci.h> 31#include <linux/etherdevice.h> 32#include <linux/skbuff.h> 33#include <linux/interrupt.h> 34#include <linux/crc32.h> 35#include <net/mac80211.h> 36 37/* device specific */ 38 39#include "device_cfg.h" 40#include "card.h" 41#include "srom.h" 42#include "desc.h" 43#include "key.h" 44#include "mac.h" 45 46/*--------------------- Export Definitions -------------------------*/ 47 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 60#define MAX_RATE 12 61 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 69/* Antenna Mode */ 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 77#define BB_VGA_LEVEL 4 78#define BB_VGA_CHANGE_THRESHOLD 16 79 80#define MAKE_BEACON_RESERVED 10 /* (us) */ 81 82/* BUILD OBJ mode */ 83 84#define AVAIL_TD(p, q) ((p)->opts.tx_descs[(q)] - ((p)->iTDUsed[(q)])) 85 86/* 0:11A 1:11B 2:11G */ 87#define BB_TYPE_11A 0 88#define BB_TYPE_11B 1 89#define BB_TYPE_11G 2 90 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 96 97#define OWNED_BY_HOST 0 98#define OWNED_BY_NIC 1 99 100struct 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}; 110 111struct vnt_private { 112 struct pci_dev *pcid; 113 /* mac80211 */ 114 struct ieee80211_hw *hw; 115 struct ieee80211_vif *vif; 116 unsigned long key_entry_inuse; 117 u32 basic_rates; 118 u16 current_aid; 119 int mc_list_count; 120 u8 mac_hw; 121 122/* dma addr, rx/tx pool */ 123 dma_addr_t pool_dma; 124 dma_addr_t rd0_pool_dma; 125 dma_addr_t rd1_pool_dma; 126 127 dma_addr_t td0_pool_dma; 128 dma_addr_t td1_pool_dma; 129 130 dma_addr_t tx_bufs_dma0; 131 dma_addr_t tx_bufs_dma1; 132 dma_addr_t tx_beacon_dma; 133 134 unsigned char *tx0_bufs; 135 unsigned char *tx1_bufs; 136 unsigned char *tx_beacon_bufs; 137 138 void __iomem *PortOffset; 139 u32 memaddr; 140 u32 ioaddr; 141 142 unsigned char byRxMode; 143 144 spinlock_t lock; 145 146 volatile int iTDUsed[TYPE_MAXTD]; 147 148 struct vnt_tx_desc *apCurrTD[TYPE_MAXTD]; 149 struct vnt_tx_desc *apTailTD[TYPE_MAXTD]; 150 151 struct vnt_tx_desc *apTD0Rings; 152 struct vnt_tx_desc *apTD1Rings; 153 154 struct vnt_rx_desc *aRD0Ring; 155 struct vnt_rx_desc *aRD1Ring; 156 struct vnt_rx_desc *pCurrRD[TYPE_MAXRD]; 157 158 struct vnt_options opts; 159 160 u32 flags; 161 162 u32 rx_buf_sz; 163 u8 rx_rate; 164 165 u32 rx_bytes; 166 167 /* Version control */ 168 unsigned char byLocalID; 169 unsigned char byRFType; 170 171 unsigned char byMaxPwrLevel; 172 unsigned char byZoneType; 173 bool bZoneRegExist; 174 unsigned char byOriginalZonetype; 175 176 unsigned char abyCurrentNetAddr[ETH_ALEN]; __aligned(2) 177 bool bLinkPass; /* link status: OK or fail */ 178 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; 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 */ 197 unsigned char bySIFS; 198 unsigned char byDIFS; 199 unsigned char byEIFS; 200 unsigned char bySlot; 201 unsigned char byCWMaxMin; 202 203 u8 byBBType; /* 0:11A, 1:11B, 2:11G */ 204 u8 byPacketType; /* 205 * 0:11a,1:11b,2:11gb (only CCK 206 * in BasicRate), 3:11ga (OFDM in 207 * Basic Rate) 208 */ 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; 216 217 unsigned char byPreambleType; 218 unsigned char byShortPreamble; 219 220 unsigned short wCurrentRate; 221 unsigned char byShortRetryLimit; 222 unsigned char byLongRetryLimit; 223 enum nl80211_iftype op_mode; 224 bool bBSSIDFilter; 225 unsigned short wMaxTransmitMSDULifetime; 226 227 bool bEncryptionEnable; 228 bool bLongHeader; 229 bool bShortSlotTime; 230 bool bProtectMode; 231 bool bNonERPPresent; 232 bool bBarkerPreambleMd; 233 234 bool bRadioControlOff; 235 bool bRadioOff; 236 bool bEnablePSMode; 237 unsigned short wListenInterval; 238 bool bPWBitOn; 239 240 /* GPIO Radio Control */ 241 unsigned char byRadioCtl; 242 unsigned char byGPIO; 243 bool bHWRadioOff; 244 bool bPrvActive4RadioOFF; 245 bool bGPIOBlockRead; 246 247 /* Beacon related */ 248 unsigned short wSeqCounter; 249 unsigned short wBCNBufLen; 250 bool bBeaconBufReady; 251 bool bBeaconSent; 252 bool bIsBeaconBufReadySet; 253 unsigned int cbBeaconBufReadySetCnt; 254 bool bFixRate; 255 u16 byCurrentCh; 256 257 bool bAES; 258 259 unsigned char byAutoFBCtrl; 260 261 /* For Update BaseBand VGA Gain Offset */ 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]; 268 269 unsigned char byBBPreEDRSSI; 270 unsigned char byBBPreEDIndex; 271 272 unsigned long dwDiagRefCount; 273 274 /* For FOE Tuning */ 275 unsigned char byFOETuning; 276 277 /* For RF Power table */ 278 unsigned char byCCKPwr; 279 unsigned char byOFDMPwrG; 280 unsigned char byCurPwr; 281 char byCurPwrdBm; 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]; 288 289 /* BaseBand Loopback Use */ 290 unsigned char byBBCR4d; 291 unsigned char byBBCRc9; 292 unsigned char byBBCR88; 293 unsigned char byBBCR09; 294 295 unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */ 296 297 unsigned short wBeaconInterval; 298 u16 wake_up_count; 299 300 struct work_struct interrupt_work; 301 302 struct ieee80211_low_level_stats low_stats; 303}; 304 305#endif 306