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