device.h 7.4 KB

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