2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
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.
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.
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.
20 * Purpose: Provide functions to setup NIC operation mode
22 * s_vSafeResetTx - Rest Tx
23 * CARDvSetRSPINF - Set RSPINF
24 * vUpdateIFS - Update slotTime,SIFS,DIFS, and EIFS
25 * CARDvUpdateBasicTopRate - Update BasicTopRate
26 * CARDbAddBasicRate - Add to BasicRateSet
27 * CARDbSetBasicRate - Set Basic Tx Rate
28 * CARDbIsOFDMinBasicRate - Check if any OFDM rate is in BasicRateSet
29 * CARDvSetLoopbackMode - Set Loopback mode
30 * CARDbSoftwareReset - Sortware reset NIC
31 * CARDqGetTSFOffset - Caculate TSFOffset
32 * CARDbGetCurrentTSF - Read Current NIC TSF counter
33 * CARDqGetNextTBTT - Caculate Next Beacon TSF counter
34 * CARDvSetFirstNextTBTT - Set NIC Beacon time
35 * CARDvUpdateNextTBTT - Sync. NIC Beacon time
36 * CARDbRadioPowerOff - Turn Off NIC Radio Power
37 * CARDbRadioPowerOn - Turn On NIC Radio Power
38 * CARDbSetWEPMode - Set NIC Wep mode
39 * CARDbSetTxPower - Set NIC tx power
42 * 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec.
43 * 08-26-2003 Kyle Hsu: Modify the defination type of dwIoBase.
44 * 09-01-2003 Bryan YC Fan: Add vUpdateIFS().
60 /*--------------------- Static Definitions -------------------------*/
62 //static int msglevel =MSG_LEVEL_DEBUG;
63 static int msglevel
=MSG_LEVEL_INFO
;
65 #define C_SIFS_A 16 // micro sec.
68 #define C_EIFS 80 // micro sec.
71 #define C_SLOT_SHORT 9 // micro sec.
72 #define C_SLOT_LONG 20
74 #define C_CWMIN_A 15 // slot time
77 #define C_CWMAX 1023 // slot time
79 #define CARD_MAX_CHANNEL_TBL 56
81 #define WAIT_BEACON_TX_DOWN_TMO 3 // Times
83 typedef struct tagSChannelTblElement
{
88 }SChannelTblElement
, *PSChannelTblElement
;
90 //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
91 static BYTE abyDefaultSuppRatesG
[] = {WLAN_EID_SUPP_RATES
, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
93 static BYTE abyDefaultExtSuppRatesG
[] = {WLAN_EID_EXTSUPP_RATES
, 4, 0x0C, 0x12, 0x18, 0x60};
94 //6M, 9M, 12M, 18M, 24M, 36M, 48M, 54M
95 static BYTE abyDefaultSuppRatesA
[] = {WLAN_EID_SUPP_RATES
, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
97 static BYTE abyDefaultSuppRatesB
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
101 /*--------------------- Static Classes ----------------------------*/
103 /*--------------------- Static Variables --------------------------*/
106 const WORD cwRXBCNTSFOff
[MAX_RATE
] =
107 {17, 17, 17, 17, 34, 23, 17, 11, 8, 5, 4, 3};
109 static SChannelTblElement sChannelTbl
[CARD_MAX_CHANNEL_TBL
+1] =
126 {183, 4915, TRUE
, 0},
127 {184, 4920, TRUE
, 0},
128 {185, 4925, TRUE
, 0},
129 {187, 4935, TRUE
, 0},
130 {188, 4940, TRUE
, 0},
131 {189, 4945, TRUE
, 0},
132 {192, 4960, TRUE
, 0},
133 {196, 4980, TRUE
, 0},
152 {100, 5500, TRUE
, 0},
153 {104, 5520, TRUE
, 0},
154 {108, 5540, TRUE
, 0},
155 {112, 5560, TRUE
, 0},
156 {116, 5580, TRUE
, 0},
157 {120, 5600, TRUE
, 0},
158 {124, 5620, TRUE
, 0},
159 {128, 5640, TRUE
, 0},
160 {132, 5660, TRUE
, 0},
161 {136, 5680, TRUE
, 0},
162 {140, 5700, TRUE
, 0},
163 {149, 5745, TRUE
, 0},
164 {153, 5765, TRUE
, 0},
165 {157, 5785, TRUE
, 0},
166 {161, 5805, TRUE
, 0},
171 /************************************************************************
172 * The Radar regulation rules for each country
173 ************************************************************************/
174 SCountryTable ChannelRuleTab
[CCODE_MAX
+1] =
176 /************************************************************************
177 * This table is based on Athero driver rules
178 ************************************************************************/
179 /* Country Available channels, ended with 0 */
180 /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 */
181 {CCODE_FCC
, {'U','S'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}
182 , { 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} },
183 {CCODE_TELEC
, {'J','P'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
184 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0}
218 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 0} },
219 {CCODE_ARMENIA
, {'A','M'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
220 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 18, 0, 18, 0, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
221 {CCODE_AUSTRALIA
, {'A','U'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}
222 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 23, 0, 23, 0, 23, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} },
223 {CCODE_AUSTRIA
, {'A','T'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 1, 1, 1, 1, 1}
240 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} },
241 {CCODE_BULGARIA
, {'B','G'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
242 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 23, 0, 23, 0, 23, 23, 23, 0, 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0} },
243 {CCODE_CANADA
, {'C','A'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}
244 , { 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} },
245 {CCODE_CHILE
, {'C','L'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
257 {CCODE_CZECH
, {'C','Z'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
258 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
259 {CCODE_DENMARK
, {'D','K'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
260 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
261 {CCODE_DOMINICAN_REPUBLIC
, {'D','O'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}
262 , { 27, 27, 27, 27, 27, 27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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
268 , { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
269 {CCODE_ESTONIA
, {'E','E'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
270 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
271 {CCODE_FINLAND
, {'F','I'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
272 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
273 {CCODE_FRANCE
, {'F','R'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}
296 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} },
297 {CCODE_IRELAND
, {'I','E'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
298 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
299 {CCODE_ITALY
, {'I','T'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
300 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
301 {CCODE_ISRAEL
, {'I','L'}, { 0, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
318 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
319 {CCODE_LUXEMBURG
, {'L','U'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
320 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
321 {CCODE_MACAU
, {'M','O'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}
322 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 23, 0, 23, 0, 23, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} },
323 {CCODE_MACEDONIA
, {'M','K'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0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 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}
352 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30} },
353 {CCODE_POLAND
, {'P','L'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
354 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
355 {CCODE_PORTUGAL
, {'P','T'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
356 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27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0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}
368 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 20, 20, 20} },
369 {CCODE_SLOVAKIA
, {'S','K'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0}
370 , { 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 16, 0, 16, 0, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 0} },
371 {CCODE_SLOVENIA
, {'S','I'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
372 , { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 20, 0, 20, 20, 20, 20, 20, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0} },
373 {CCODE_SOUTH_AFRICA
, {'Z','A'}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
418 , { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }
419 /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 */
423 /*--------------------- Static Functions --------------------------*/
427 s_vCaculateOFDMRParameter(
429 IN CARD_PHY_TYPE ePHYType
,
435 /*--------------------- Export Variables --------------------------*/
437 /*--------------------- Export Functions --------------------------*/
440 /*--------------------- Export function -------------------------*/
441 /************************************************************************
442 * Country Channel Valid
443 * Input: CountryCode, ChannelNum
444 * ChanneIndex is defined as VT3253 MAC channel:
448 * 14 = 2.4G channel 14
449 * 15 = 4.9G channel 183
450 * 16 = 4.9G channel 184
452 * Output: TRUE if the specified 5GHz band is allowed to be used.
454 // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22)
456 // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64,
457 // 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56)
458 ************************************************************************/
459 //2008-8-4 <add> by chester
461 ChannelValid(UINT CountryCode
, UINT ChannelIndex
)
467 * If Channel Index is invalid, return invalid
469 if ((ChannelIndex
> CB_MAX_CHANNEL
) ||
476 bValid
= sChannelTbl
[ChannelIndex
].bValid
;
481 } /* end ChannelValid */
485 * Description: Caculate TxRate and RsvTime fields for RSPINF in OFDM mode.
490 * byPktType - Tx Packet type
492 * pbyTxRate - pointer to RSPINF TxRate field
493 * pbyRsvTime - pointer to RSPINF RsvTime field
500 s_vCaculateOFDMRParameter (
502 IN CARD_PHY_TYPE ePHYType
,
509 if (ePHYType
== PHY_TYPE_11A
) {//5GHZ
520 if (ePHYType
== PHY_TYPE_11A
) {//5GHZ
531 if (ePHYType
== PHY_TYPE_11A
) {//5GHZ
542 if (ePHYType
== PHY_TYPE_11A
) {//5GHZ
553 if (ePHYType
== PHY_TYPE_11A
) {//5GHZ
564 if (ePHYType
== PHY_TYPE_11A
) {//5GHZ
575 if (ePHYType
== PHY_TYPE_11A
) {//5GHZ
587 if (ePHYType
== PHY_TYPE_11A
) {//5GHZ
602 * Description: Set RSPINF
606 * pDevice - The adapter to be set
610 * Return Value: None.
615 s_vSetRSPINF (PSDevice pDevice
, CARD_PHY_TYPE ePHYType
, PVOID pvSupportRateIEs
, PVOID pvExtSupportRateIEs
)
617 BYTE byServ
= 0, bySignal
= 0; // For CCK
619 BYTE byTxRate
= 0, byRsvTime
= 0; // For OFDM
622 MACvSelectPage1(pDevice
->PortOffset
);
625 BBvCaculateParameter(pDevice
,
627 VNTWIFIbyGetACKTxRate(RATE_1M
, pvSupportRateIEs
, pvExtSupportRateIEs
),
634 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_RSPINF_B_1
, MAKEDWORD(wLen
,MAKEWORD(bySignal
,byServ
)));
636 BBvCaculateParameter(pDevice
,
638 VNTWIFIbyGetACKTxRate(RATE_2M
, pvSupportRateIEs
, pvExtSupportRateIEs
),
645 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_RSPINF_B_2
, MAKEDWORD(wLen
,MAKEWORD(bySignal
,byServ
)));
647 BBvCaculateParameter(pDevice
,
649 VNTWIFIbyGetACKTxRate(RATE_5M
, pvSupportRateIEs
, pvExtSupportRateIEs
),
656 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_RSPINF_B_5
, MAKEDWORD(wLen
,MAKEWORD(bySignal
,byServ
)));
658 BBvCaculateParameter(pDevice
,
660 VNTWIFIbyGetACKTxRate(RATE_11M
, pvSupportRateIEs
, pvExtSupportRateIEs
),
667 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_RSPINF_B_11
, MAKEDWORD(wLen
,MAKEWORD(bySignal
,byServ
)));
669 s_vCaculateOFDMRParameter(RATE_6M
,
673 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_6
, MAKEWORD(byTxRate
,byRsvTime
));
675 s_vCaculateOFDMRParameter(RATE_9M
,
679 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_9
, MAKEWORD(byTxRate
,byRsvTime
));
681 s_vCaculateOFDMRParameter(RATE_12M
,
685 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_12
, MAKEWORD(byTxRate
,byRsvTime
));
687 s_vCaculateOFDMRParameter(RATE_18M
,
691 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_18
, MAKEWORD(byTxRate
,byRsvTime
));
693 s_vCaculateOFDMRParameter(RATE_24M
,
697 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_24
, MAKEWORD(byTxRate
,byRsvTime
));
699 s_vCaculateOFDMRParameter(
700 VNTWIFIbyGetACKTxRate(RATE_36M
, pvSupportRateIEs
, pvExtSupportRateIEs
),
704 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_36
, MAKEWORD(byTxRate
,byRsvTime
));
706 s_vCaculateOFDMRParameter(
707 VNTWIFIbyGetACKTxRate(RATE_48M
, pvSupportRateIEs
, pvExtSupportRateIEs
),
711 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_48
, MAKEWORD(byTxRate
,byRsvTime
));
713 s_vCaculateOFDMRParameter(
714 VNTWIFIbyGetACKTxRate(RATE_54M
, pvSupportRateIEs
, pvExtSupportRateIEs
),
718 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_54
, MAKEWORD(byTxRate
,byRsvTime
));
720 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_72
, MAKEWORD(byTxRate
,byRsvTime
));
722 MACvSelectPage0(pDevice
->PortOffset
);
728 /*--------------------- Export Variables --------------------------*/
730 /*--------------------- Export Functions --------------------------*/
731 BYTE
CARDbyGetChannelMapping (PVOID pDeviceHandler
, BYTE byChannelNumber
, CARD_PHY_TYPE ePhyType
)
735 if ((ePhyType
== PHY_TYPE_11B
) || (ePhyType
== PHY_TYPE_11G
)) {
736 return (byChannelNumber
);
739 for(ii
= (CB_MAX_CHANNEL_24G
+ 1); ii
<= CB_MAX_CHANNEL
; ) {
740 if (sChannelTbl
[ii
].byChannelNumber
== byChannelNumber
) {
749 BYTE
CARDbyGetChannelNumber (PVOID pDeviceHandler
, BYTE byChannelIndex
)
751 // PSDevice pDevice = (PSDevice) pDeviceHandler;
752 return(sChannelTbl
[byChannelIndex
].byChannelNumber
);
756 * Description: Set NIC media channel
760 * pDeviceHandler - The adapter to be set
761 * uConnectionChannel - Channel to be set
765 * Return Value: TRUE if succeeded; FALSE if failed.
768 BOOL
CARDbSetChannel (PVOID pDeviceHandler
, UINT uConnectionChannel
)
770 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
774 if (pDevice
->byCurrentCh
== uConnectionChannel
) {
778 if (sChannelTbl
[uConnectionChannel
].bValid
== FALSE
) {
782 if ((uConnectionChannel
> CB_MAX_CHANNEL_24G
) &&
783 (pDevice
->eCurrentPHYType
!= PHY_TYPE_11A
)) {
784 CARDbSetPhyParameter(pDevice
, PHY_TYPE_11A
, 0, 0, NULL
, NULL
);
785 } else if ((uConnectionChannel
<= CB_MAX_CHANNEL_24G
) &&
786 (pDevice
->eCurrentPHYType
== PHY_TYPE_11A
)) {
787 CARDbSetPhyParameter(pDevice
, PHY_TYPE_11G
, 0, 0, NULL
, NULL
);
790 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_MACCR
, MACCR_CLRNAV
);
792 //{{ RobertYu: 20041202
793 //// TX_PE will reserve 3 us for MAX2829 A mode only, it is for better TX throughput
795 if ( pDevice
->byRFType
== RF_AIROHA7230
)
797 RFbAL7230SelectChannelPostProcess(pDevice
->PortOffset
, pDevice
->byCurrentCh
, (BYTE
)uConnectionChannel
);
802 pDevice
->byCurrentCh
= (BYTE
)uConnectionChannel
;
803 bResult
&= RFbSelectChannel(pDevice
->PortOffset
, pDevice
->byRFType
, (BYTE
)uConnectionChannel
);
805 // Init Synthesizer Table
806 if (pDevice
->bEnablePSMode
== TRUE
)
807 RFvWriteWakeProgSyn(pDevice
->PortOffset
, pDevice
->byRFType
, uConnectionChannel
);
810 //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDbSetMediaChannel: %d\n", (BYTE)uConnectionChannel);
811 BBvSoftwareReset(pDevice
->PortOffset
);
813 if (pDevice
->byLocalID
> REV_ID_VT3253_B1
) {
814 // set HW default power register
815 MACvSelectPage1(pDevice
->PortOffset
);
816 RFbSetPower(pDevice
, RATE_1M
, pDevice
->byCurrentCh
);
817 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_PWRCCK
, pDevice
->byCurPwr
);
818 RFbSetPower(pDevice
, RATE_6M
, pDevice
->byCurrentCh
);
819 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_PWROFDM
, pDevice
->byCurPwr
);
820 MACvSelectPage0(pDevice
->PortOffset
);
823 if (pDevice
->eCurrentPHYType
== PHY_TYPE_11B
) {
825 //printk("Func:CARDbSetChannel:call RFbSetPower:11B\n");
827 RFbSetPower(pDevice
, RATE_1M
, pDevice
->byCurrentCh
);
830 //printk("Func:CARDbSetChannel:call RFbSetPower\n");
832 RFbSetPower(pDevice
, RATE_6M
, pDevice
->byCurrentCh
);
841 * Description: Card Send packet function
845 * pDeviceHandler - The adapter to be set
846 * pPacket - Packet buffer pointer
847 * ePktType - Packet type
848 * uLength - Packet length
852 * Return Value: TRUE if succeeded; FALSE if failed.
856 BOOL CARDbSendPacket (PVOID pDeviceHandler, PVOID pPacket, CARD_PKT_TYPE ePktType, UINT uLength)
858 PSDevice pDevice = (PSDevice) pDeviceHandler;
859 if (ePktType == PKT_TYPE_802_11_MNG) {
860 return TXbTD0Send(pDevice, pPacket, uLength);
861 } else if (ePktType == PKT_TYPE_802_11_BCN) {
862 return TXbBeaconSend(pDevice, pPacket, uLength);
863 } if (ePktType == PKT_TYPE_802_11_DATA) {
864 return TXbTD1Send(pDevice, pPacket, uLength);
873 * Description: Get Card short preamble option value
877 * pDevice - The adapter to be set
881 * Return Value: TRUE if short preamble; otherwise FALSE
884 BOOL
CARDbIsShortPreamble (PVOID pDeviceHandler
)
886 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
887 if (pDevice
->byPreambleType
== 0) {
894 * Description: Get Card short slot time option value
898 * pDevice - The adapter to be set
902 * Return Value: TRUE if short slot time; otherwise FALSE
905 BOOL
CARDbIsShorSlotTime (PVOID pDeviceHandler
)
907 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
908 return(pDevice
->bShortSlotTime
);
913 * Description: Update IFS
917 * pDevice - The adapter to be set
921 * Return Value: None.
924 BOOL
CARDbSetPhyParameter (PVOID pDeviceHandler
, CARD_PHY_TYPE ePHYType
, WORD wCapInfo
, BYTE byERPField
, PVOID pvSupportRateIEs
, PVOID pvExtSupportRateIEs
)
926 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
932 // PWLAN_IE_SUPP_RATES pRates = NULL;
933 PWLAN_IE_SUPP_RATES pSupportRates
= (PWLAN_IE_SUPP_RATES
) pvSupportRateIEs
;
934 PWLAN_IE_SUPP_RATES pExtSupportRates
= (PWLAN_IE_SUPP_RATES
) pvExtSupportRateIEs
;
937 //Set SIFS, DIFS, EIFS, SlotTime, CwMin
938 if (ePHYType
== PHY_TYPE_11A
) {
939 if (pSupportRates
== NULL
) {
940 pSupportRates
= (PWLAN_IE_SUPP_RATES
) abyDefaultSuppRatesA
;
942 if (pDevice
->byRFType
== RF_AIROHA7230
) {
943 // AL7230 use single PAPE and connect to PAPE_2.4G
944 MACvSetBBType(pDevice
->PortOffset
, BB_TYPE_11G
);
945 pDevice
->abyBBVGA
[0] = 0x20;
946 pDevice
->abyBBVGA
[2] = 0x10;
947 pDevice
->abyBBVGA
[3] = 0x10;
948 BBbReadEmbeded(pDevice
->PortOffset
, 0xE7, &byData
);
949 if (byData
== 0x1C) {
950 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE7, pDevice
->abyBBVGA
[0]);
952 } else if (pDevice
->byRFType
== RF_UW2452
) {
953 MACvSetBBType(pDevice
->PortOffset
, BB_TYPE_11A
);
954 pDevice
->abyBBVGA
[0] = 0x18;
955 BBbReadEmbeded(pDevice
->PortOffset
, 0xE7, &byData
);
956 if (byData
== 0x14) {
957 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE7, pDevice
->abyBBVGA
[0]);
958 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE1, 0x57);
961 MACvSetBBType(pDevice
->PortOffset
, BB_TYPE_11A
);
963 BBbWriteEmbeded(pDevice
->PortOffset
, 0x88, 0x03);
964 bySlot
= C_SLOT_SHORT
;
966 byDIFS
= C_SIFS_A
+ 2*C_SLOT_SHORT
;
968 } else if (ePHYType
== PHY_TYPE_11B
) {
969 if (pSupportRates
== NULL
) {
970 pSupportRates
= (PWLAN_IE_SUPP_RATES
) abyDefaultSuppRatesB
;
972 MACvSetBBType(pDevice
->PortOffset
, BB_TYPE_11B
);
973 if (pDevice
->byRFType
== RF_AIROHA7230
) {
974 pDevice
->abyBBVGA
[0] = 0x1C;
975 pDevice
->abyBBVGA
[2] = 0x00;
976 pDevice
->abyBBVGA
[3] = 0x00;
977 BBbReadEmbeded(pDevice
->PortOffset
, 0xE7, &byData
);
978 if (byData
== 0x20) {
979 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE7, pDevice
->abyBBVGA
[0]);
981 } else if (pDevice
->byRFType
== RF_UW2452
) {
982 pDevice
->abyBBVGA
[0] = 0x14;
983 BBbReadEmbeded(pDevice
->PortOffset
, 0xE7, &byData
);
984 if (byData
== 0x18) {
985 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE7, pDevice
->abyBBVGA
[0]);
986 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE1, 0xD3);
989 BBbWriteEmbeded(pDevice
->PortOffset
, 0x88, 0x02);
990 bySlot
= C_SLOT_LONG
;
992 byDIFS
= C_SIFS_BG
+ 2*C_SLOT_LONG
;
994 } else {// PK_TYPE_11GA & PK_TYPE_11GB
995 if (pSupportRates
== NULL
) {
996 pSupportRates
= (PWLAN_IE_SUPP_RATES
) abyDefaultSuppRatesG
;
997 pExtSupportRates
= (PWLAN_IE_SUPP_RATES
) abyDefaultExtSuppRatesG
;
999 MACvSetBBType(pDevice
->PortOffset
, BB_TYPE_11G
);
1000 if (pDevice
->byRFType
== RF_AIROHA7230
) {
1001 pDevice
->abyBBVGA
[0] = 0x1C;
1002 pDevice
->abyBBVGA
[2] = 0x00;
1003 pDevice
->abyBBVGA
[3] = 0x00;
1004 BBbReadEmbeded(pDevice
->PortOffset
, 0xE7, &byData
);
1005 if (byData
== 0x20) {
1006 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE7, pDevice
->abyBBVGA
[0]);
1008 } else if (pDevice
->byRFType
== RF_UW2452
) {
1009 pDevice
->abyBBVGA
[0] = 0x14;
1010 BBbReadEmbeded(pDevice
->PortOffset
, 0xE7, &byData
);
1011 if (byData
== 0x18) {
1012 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE7, pDevice
->abyBBVGA
[0]);
1013 BBbWriteEmbeded(pDevice
->PortOffset
, 0xE1, 0xD3);
1016 BBbWriteEmbeded(pDevice
->PortOffset
, 0x88, 0x08);
1018 if(VNTWIFIbIsShortSlotTime(wCapInfo
)) {
1019 bySlot
= C_SLOT_SHORT
;
1020 byDIFS
= C_SIFS_BG
+ 2*C_SLOT_SHORT
;
1022 bySlot
= C_SLOT_LONG
;
1023 byDIFS
= C_SIFS_BG
+ 2*C_SLOT_LONG
;
1025 if (VNTWIFIbyGetMaxSupportRate(pSupportRates
, pExtSupportRates
) > RATE_11M
) {
1030 if (pDevice
->bProtectMode
!= VNTWIFIbIsProtectMode(byERPField
)) {
1031 pDevice
->bProtectMode
= VNTWIFIbIsProtectMode(byERPField
);
1032 if (pDevice
->bProtectMode
) {
1033 MACvEnableProtectMD(pDevice
->PortOffset
);
1035 MACvDisableProtectMD(pDevice
->PortOffset
);
1038 if (pDevice
->bBarkerPreambleMd
!= VNTWIFIbIsBarkerMode(byERPField
)) {
1039 pDevice
->bBarkerPreambleMd
= VNTWIFIbIsBarkerMode(byERPField
);
1040 if (pDevice
->bBarkerPreambleMd
) {
1041 MACvEnableBarkerPreambleMd(pDevice
->PortOffset
);
1043 MACvDisableBarkerPreambleMd(pDevice
->PortOffset
);
1048 if (pDevice
->byRFType
== RF_RFMD2959
) {
1049 // bcs TX_PE will reserve 3 us
1050 // hardware's processing time here is 2 us.
1053 //{{ RobertYu: 20041202
1054 //// TX_PE will reserve 3 us for MAX2829 A mode only, it is for better TX throughput
1055 //// MAC will need 2 us to process, so the SIFS, DIFS can be shorter by 2 us.
1058 if (pDevice
->bySIFS
!= bySIFS
) {
1059 pDevice
->bySIFS
= bySIFS
;
1060 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_SIFS
, pDevice
->bySIFS
);
1062 if (pDevice
->byDIFS
!= byDIFS
) {
1063 pDevice
->byDIFS
= byDIFS
;
1064 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_DIFS
, pDevice
->byDIFS
);
1066 if (pDevice
->byEIFS
!= C_EIFS
) {
1067 pDevice
->byEIFS
= C_EIFS
;
1068 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_EIFS
, pDevice
->byEIFS
);
1070 if (pDevice
->bySlot
!= bySlot
) {
1071 pDevice
->bySlot
= bySlot
;
1072 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_SLOT
, pDevice
->bySlot
);
1073 if (pDevice
->bySlot
== C_SLOT_SHORT
) {
1074 pDevice
->bShortSlotTime
= TRUE
;
1076 pDevice
->bShortSlotTime
= FALSE
;
1078 BBvSetShortSlotTime(pDevice
);
1080 if (pDevice
->byCWMaxMin
!= byCWMaxMin
) {
1081 pDevice
->byCWMaxMin
= byCWMaxMin
;
1082 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_CWMAXMIN0
, pDevice
->byCWMaxMin
);
1084 if (VNTWIFIbIsShortPreamble(wCapInfo
)) {
1085 pDevice
->byPreambleType
= pDevice
->byShortPreamble
;
1087 pDevice
->byPreambleType
= 0;
1089 s_vSetRSPINF(pDevice
, ePHYType
, pSupportRates
, pExtSupportRates
);
1090 pDevice
->eCurrentPHYType
= ePHYType
;
1091 // set for NDIS OID_802_11SUPPORTED_RATES
1096 * Description: Sync. TSF counter to BSS
1097 * Get TSF offset and write to HW
1101 * pDevice - The adapter to be sync.
1102 * byRxRate - data rate of receive beacon
1103 * qwBSSTimestamp - Rx BCN's TSF
1104 * qwLocalTSF - Local TSF
1108 * Return Value: none
1111 BOOL
CARDbUpdateTSF (PVOID pDeviceHandler
, BYTE byRxRate
, QWORD qwBSSTimestamp
, QWORD qwLocalTSF
)
1113 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1116 HIDWORD(qwTSFOffset
) = 0;
1117 LODWORD(qwTSFOffset
) = 0;
1119 if ((HIDWORD(qwBSSTimestamp
) != HIDWORD(qwLocalTSF
)) ||
1120 (LODWORD(qwBSSTimestamp
) != LODWORD(qwLocalTSF
))) {
1121 qwTSFOffset
= CARDqGetTSFOffset(byRxRate
, qwBSSTimestamp
, qwLocalTSF
);
1123 // HW's TSF add TSF Offset reg
1124 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_TSFOFST
, LODWORD(qwTSFOffset
));
1125 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_TSFOFST
+ 4, HIDWORD(qwTSFOffset
));
1126 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_TFTCTL
, TFTCTL_TSFSYNCEN
);
1133 * Description: Set NIC TSF counter for first Beacon time
1134 * Get NEXTTBTT from adjusted TSF and Beacon Interval
1138 * pDevice - The adapter to be set.
1139 * wBeaconInterval - Beacon Interval
1143 * Return Value: TRUE if succeed; otherwise FALSE
1146 BOOL
CARDbSetBeaconPeriod (PVOID pDeviceHandler
, WORD wBeaconInterval
)
1148 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1149 UINT uBeaconInterval
= 0;
1150 UINT uLowNextTBTT
= 0;
1151 UINT uHighRemain
= 0;
1152 UINT uLowRemain
= 0;
1155 HIDWORD(qwNextTBTT
) = 0;
1156 LODWORD(qwNextTBTT
) = 0;
1157 CARDbGetCurrentTSF(pDevice
->PortOffset
, &qwNextTBTT
); //Get Local TSF counter
1158 uBeaconInterval
= wBeaconInterval
* 1024;
1159 // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval
1160 uLowNextTBTT
= (LODWORD(qwNextTBTT
) >> 10) << 10;
1161 uLowRemain
= (uLowNextTBTT
) % uBeaconInterval
;
1162 // high dword (mod) bcn
1163 uHighRemain
= (((0xffffffff % uBeaconInterval
) + 1) * HIDWORD(qwNextTBTT
))
1165 uLowRemain
= (uHighRemain
+ uLowRemain
) % uBeaconInterval
;
1166 uLowRemain
= uBeaconInterval
- uLowRemain
;
1168 // check if carry when add one beacon interval
1169 if ((~uLowNextTBTT
) < uLowRemain
) {
1170 HIDWORD(qwNextTBTT
) ++ ;
1172 LODWORD(qwNextTBTT
) = uLowNextTBTT
+ uLowRemain
;
1174 // set HW beacon interval
1175 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_BI
, wBeaconInterval
);
1176 pDevice
->wBeaconInterval
= wBeaconInterval
;
1178 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_NEXTTBTT
, LODWORD(qwNextTBTT
));
1179 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_NEXTTBTT
+ 4, HIDWORD(qwNextTBTT
));
1180 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_TFTCTL
, TFTCTL_TBTTSYNCEN
);
1188 * Description: Card Stop Hardware Tx
1192 * pDeviceHandler - The adapter to be set
1193 * ePktType - Packet type to stop
1197 * Return Value: TRUE if all data packet complete; otherwise FALSE.
1200 BOOL
CARDbStopTxPacket (PVOID pDeviceHandler
, CARD_PKT_TYPE ePktType
)
1202 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1205 if (ePktType
== PKT_TYPE_802_11_ALL
) {
1206 pDevice
->bStopBeacon
= TRUE
;
1207 pDevice
->bStopTx0Pkt
= TRUE
;
1208 pDevice
->bStopDataPkt
= TRUE
;
1209 } else if (ePktType
== PKT_TYPE_802_11_BCN
) {
1210 pDevice
->bStopBeacon
= TRUE
;
1211 } else if (ePktType
== PKT_TYPE_802_11_MNG
) {
1212 pDevice
->bStopTx0Pkt
= TRUE
;
1213 } else if (ePktType
== PKT_TYPE_802_11_DATA
) {
1214 pDevice
->bStopDataPkt
= TRUE
;
1217 if (pDevice
->bStopBeacon
== TRUE
) {
1218 if (pDevice
->bIsBeaconBufReadySet
== TRUE
) {
1219 if (pDevice
->cbBeaconBufReadySetCnt
< WAIT_BEACON_TX_DOWN_TMO
) {
1220 pDevice
->cbBeaconBufReadySetCnt
++;
1224 pDevice
->bIsBeaconBufReadySet
= FALSE
;
1225 pDevice
->cbBeaconBufReadySetCnt
= 0;
1226 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_TCR
, TCR_AUTOBCNTX
);
1228 // wait all TD0 complete
1229 if (pDevice
->bStopTx0Pkt
== TRUE
) {
1230 if (pDevice
->iTDUsed
[TYPE_TXDMA0
] != 0){
1234 // wait all Data TD complete
1235 if (pDevice
->bStopDataPkt
== TRUE
) {
1236 if (pDevice
->iTDUsed
[TYPE_AC0DMA
] != 0){
1246 * Description: Card Start Hardware Tx
1250 * pDeviceHandler - The adapter to be set
1251 * ePktType - Packet type to start
1255 * Return Value: TRUE if success; FALSE if failed.
1258 BOOL
CARDbStartTxPacket (PVOID pDeviceHandler
, CARD_PKT_TYPE ePktType
)
1260 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1263 if (ePktType
== PKT_TYPE_802_11_ALL
) {
1264 pDevice
->bStopBeacon
= FALSE
;
1265 pDevice
->bStopTx0Pkt
= FALSE
;
1266 pDevice
->bStopDataPkt
= FALSE
;
1267 } else if (ePktType
== PKT_TYPE_802_11_BCN
) {
1268 pDevice
->bStopBeacon
= FALSE
;
1269 } else if (ePktType
== PKT_TYPE_802_11_MNG
) {
1270 pDevice
->bStopTx0Pkt
= FALSE
;
1271 } else if (ePktType
== PKT_TYPE_802_11_DATA
) {
1272 pDevice
->bStopDataPkt
= FALSE
;
1275 if ((pDevice
->bStopBeacon
== FALSE
) &&
1276 (pDevice
->bBeaconBufReady
== TRUE
) &&
1277 (pDevice
->eOPMode
== OP_MODE_ADHOC
)) {
1278 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_TCR
, TCR_AUTOBCNTX
);
1287 * Description: Card Set BSSID value
1291 * pDeviceHandler - The adapter to be set
1292 * pbyBSSID - pointer to BSSID field
1293 * bAdhoc - flag to indicate IBSS
1297 * Return Value: TRUE if success; FALSE if failed.
1300 BOOL
CARDbSetBSSID(PVOID pDeviceHandler
, PBYTE pbyBSSID
, CARD_OP_MODE eOPMode
)
1302 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1304 MACvWriteBSSIDAddress(pDevice
->PortOffset
, pbyBSSID
);
1305 memcpy(pDevice
->abyBSSID
, pbyBSSID
, WLAN_BSSID_LEN
);
1306 if (eOPMode
== OP_MODE_ADHOC
) {
1307 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_HOSTCR
, HOSTCR_ADHOC
);
1309 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_HOSTCR
, HOSTCR_ADHOC
);
1311 if (eOPMode
== OP_MODE_AP
) {
1312 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_HOSTCR
, HOSTCR_AP
);
1314 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_HOSTCR
, HOSTCR_AP
);
1316 if (eOPMode
== OP_MODE_UNKNOWN
) {
1317 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_RCR
, RCR_BSSID
);
1318 pDevice
->bBSSIDFilter
= FALSE
;
1319 pDevice
->byRxMode
&= ~RCR_BSSID
;
1320 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"wcmd: rx_mode = %x\n", pDevice
->byRxMode
);
1322 if (IS_NULL_ADDRESS(pDevice
->abyBSSID
) == FALSE
) {
1323 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_RCR
, RCR_BSSID
);
1324 pDevice
->bBSSIDFilter
= TRUE
;
1325 pDevice
->byRxMode
|= RCR_BSSID
;
1327 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"wmgr: rx_mode = %x\n", pDevice
->byRxMode
);
1329 // Adopt BSS state in Adapter Device Object
1330 pDevice
->eOPMode
= eOPMode
;
1336 * Description: Card indicate status
1340 * pDeviceHandler - The adapter to be set
1345 * Return Value: TRUE if success; FALSE if failed.
1353 * Description: Save Assoc info. contain in assoc. response frame
1357 * pDevice - The adapter to be set
1358 * wCapabilityInfo - Capability information
1359 * wStatus - Status code
1361 * uLen - Length of IEs
1362 * pbyIEs - pointer to IEs
1366 * Return Value: TRUE if succeed; otherwise FALSE
1369 BOOL
CARDbSetTxDataRate(
1370 PVOID pDeviceHandler
,
1374 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1376 pDevice
->wCurrentRate
= wDataRate
;
1382 * Routine Description:
1383 * Consider to power down when no more packets to tx or rx.
1387 * pDevice - The adapter to be set
1391 * Return Value: TRUE if power down success; otherwise FALSE
1396 PVOID pDeviceHandler
1399 PSDevice pDevice
= (PSDevice
)pDeviceHandler
;
1402 // check if already in Doze mode
1403 if (MACbIsRegBitsOn(pDevice
->PortOffset
, MAC_REG_PSCTL
, PSCTL_PS
))
1407 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_PSCTL
, PSCTL_PSEN
);
1409 // check if all TD are empty,
1411 for (uIdx
= 0; uIdx
< TYPE_MAXTD
; uIdx
++) {
1412 if (pDevice
->iTDUsed
[uIdx
] != 0)
1416 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_PSCTL
, PSCTL_GO2DOZE
);
1417 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Go to Doze ZZZZZZZZZZZZZZZ\n");
1422 * Description: Turn off Radio power
1426 * pDevice - The adapter to be turned off
1430 * Return Value: TRUE if success; otherwise FALSE
1433 BOOL
CARDbRadioPowerOff (PVOID pDeviceHandler
)
1435 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1436 BOOL bResult
= TRUE
;
1438 if (pDevice
->bRadioOff
== TRUE
)
1442 switch (pDevice
->byRFType
) {
1445 MACvWordRegBitsOff(pDevice
->PortOffset
, MAC_REG_SOFTPWRCTL
, SOFTPWRCTL_TXPEINV
);
1446 MACvWordRegBitsOn(pDevice
->PortOffset
, MAC_REG_SOFTPWRCTL
, SOFTPWRCTL_SWPE1
);
1451 case RF_AIROHA7230
: //RobertYu:20050104
1452 MACvWordRegBitsOff(pDevice
->PortOffset
, MAC_REG_SOFTPWRCTL
, SOFTPWRCTL_SWPE2
);
1453 MACvWordRegBitsOff(pDevice
->PortOffset
, MAC_REG_SOFTPWRCTL
, SOFTPWRCTL_SWPE3
);
1458 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_HOSTCR
, HOSTCR_RXON
);
1460 BBvSetDeepSleep(pDevice
->PortOffset
, pDevice
->byLocalID
);
1462 pDevice
->bRadioOff
= TRUE
;
1463 //2007-0409-03,<Add> by chester
1464 printk("chester power off\n");
1465 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_GPIOCTL0
, LED_ACTSET
); //LED issue
1471 * Description: Turn on Radio power
1475 * pDevice - The adapter to be turned on
1479 * Return Value: TRUE if success; otherwise FALSE
1482 BOOL
CARDbRadioPowerOn (PVOID pDeviceHandler
)
1484 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1485 BOOL bResult
= TRUE
;
1486 printk("chester power on\n");
1487 if (pDevice
->bRadioControlOff
== TRUE
){
1488 if (pDevice
->bHWRadioOff
== TRUE
) printk("chester bHWRadioOff\n");
1489 if (pDevice
->bRadioControlOff
== TRUE
) printk("chester bRadioControlOff\n");
1492 if (pDevice
->bRadioOff
== FALSE
)
1494 printk("chester pbRadioOff\n");
1497 BBvExitDeepSleep(pDevice
->PortOffset
, pDevice
->byLocalID
);
1499 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_HOSTCR
, HOSTCR_RXON
);
1501 switch (pDevice
->byRFType
) {
1504 MACvWordRegBitsOn(pDevice
->PortOffset
, MAC_REG_SOFTPWRCTL
, SOFTPWRCTL_TXPEINV
);
1505 MACvWordRegBitsOff(pDevice
->PortOffset
, MAC_REG_SOFTPWRCTL
, SOFTPWRCTL_SWPE1
);
1510 case RF_AIROHA7230
: //RobertYu:20050104
1511 MACvWordRegBitsOn(pDevice
->PortOffset
, MAC_REG_SOFTPWRCTL
, (SOFTPWRCTL_SWPE2
|
1517 pDevice
->bRadioOff
= FALSE
;
1518 // 2007-0409-03,<Add> by chester
1519 printk("chester power on\n");
1520 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_GPIOCTL0
, LED_ACTSET
); //LED issue
1526 BOOL
CARDbRemoveKey (PVOID pDeviceHandler
, PBYTE pbyBSSID
)
1528 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1530 KeybRemoveAllKey(&(pDevice
->sKey
), pbyBSSID
, pDevice
->PortOffset
);
1538 * Add BSSID in PMKID Candidate list.
1542 * hDeviceContext - device structure point
1543 * pbyBSSID - BSSID address for adding
1544 * wRSNCap - BSS's RSN capability
1548 * Return Value: none.
1552 CARDbAdd_PMKID_Candidate (
1553 IN PVOID pDeviceHandler
,
1555 IN BOOL bRSNCapExist
,
1559 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1560 PPMKID_CANDIDATE pCandidateList
;
1563 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice
->gsPMKIDCandidate
.NumCandidates
);
1565 if (pDevice
->gsPMKIDCandidate
.NumCandidates
>= MAX_PMKIDLIST
) {
1566 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"vFlush_PMKID_Candidate: 3\n");
1567 memset(&pDevice
->gsPMKIDCandidate
, 0, sizeof(SPMKIDCandidateEvent
));
1570 for (ii
= 0; ii
< 6; ii
++) {
1571 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"%02X ", *(pbyBSSID
+ ii
));
1573 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"\n");
1576 // Update Old Candidate
1577 for (ii
= 0; ii
< pDevice
->gsPMKIDCandidate
.NumCandidates
; ii
++) {
1578 pCandidateList
= &pDevice
->gsPMKIDCandidate
.CandidateList
[ii
];
1579 if ( !memcmp(pCandidateList
->BSSID
, pbyBSSID
, U_ETHER_ADDR_LEN
)) {
1580 if ((bRSNCapExist
== TRUE
) && (wRSNCap
& BIT0
)) {
1581 pCandidateList
->Flags
|= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED
;
1583 pCandidateList
->Flags
&= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED
);
1590 pCandidateList
= &pDevice
->gsPMKIDCandidate
.CandidateList
[pDevice
->gsPMKIDCandidate
.NumCandidates
];
1591 if ((bRSNCapExist
== TRUE
) && (wRSNCap
& BIT0
)) {
1592 pCandidateList
->Flags
|= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED
;
1594 pCandidateList
->Flags
&= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED
);
1596 memcpy(pCandidateList
->BSSID
, pbyBSSID
, U_ETHER_ADDR_LEN
);
1597 pDevice
->gsPMKIDCandidate
.NumCandidates
++;
1598 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"NumCandidates:%d\n", (int)pDevice
->gsPMKIDCandidate
.NumCandidates
);
1603 CARDpGetCurrentAddress (
1604 IN PVOID pDeviceHandler
1607 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1609 return (pDevice
->abyCurrentNetAddr
);
1614 VOID
CARDvInitChannelTable (PVOID pDeviceHandler
)
1616 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1617 BOOL bMultiBand
= FALSE
;
1620 for(ii
=1;ii
<=CARD_MAX_CHANNEL_TBL
;ii
++) {
1621 sChannelTbl
[ii
].bValid
= FALSE
;
1624 switch (pDevice
->byRFType
) {
1630 // printk("chester-false\n");
1633 case RF_AIROHA7230
:
1641 if ((pDevice
->dwDiagRefCount
!= 0) ||
1642 (pDevice
->b11hEnable
== TRUE
)) {
1643 if (bMultiBand
== TRUE
) {
1644 for(ii
=0;ii
<CARD_MAX_CHANNEL_TBL
;ii
++) {
1645 sChannelTbl
[ii
+1].bValid
= TRUE
;
1646 pDevice
->abyRegPwr
[ii
+1] = pDevice
->abyOFDMDefaultPwr
[ii
+1];
1647 pDevice
->abyLocalPwr
[ii
+1] = pDevice
->abyOFDMDefaultPwr
[ii
+1];
1649 for(ii
=0;ii
<CHANNEL_MAX_24G
;ii
++) {
1650 pDevice
->abyRegPwr
[ii
+1] = pDevice
->abyCCKDefaultPwr
[ii
+1];
1651 pDevice
->abyLocalPwr
[ii
+1] = pDevice
->abyCCKDefaultPwr
[ii
+1];
1654 for(ii
=0;ii
<CHANNEL_MAX_24G
;ii
++) {
1655 //2008-8-4 <add> by chester
1656 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] != 0) {
1657 sChannelTbl
[ii
+1].bValid
= TRUE
;
1658 pDevice
->abyRegPwr
[ii
+1] = pDevice
->abyCCKDefaultPwr
[ii
+1];
1659 pDevice
->abyLocalPwr
[ii
+1] = pDevice
->abyCCKDefaultPwr
[ii
+1];
1663 } else if (pDevice
->byZoneType
<= CCODE_MAX
) {
1664 if (bMultiBand
== TRUE
) {
1665 for(ii
=0;ii
<CARD_MAX_CHANNEL_TBL
;ii
++) {
1666 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] != 0) {
1667 sChannelTbl
[ii
+1].bValid
= TRUE
;
1668 pDevice
->abyRegPwr
[ii
+1] = ChannelRuleTab
[pDevice
->byZoneType
].byPower
[ii
];
1669 pDevice
->abyLocalPwr
[ii
+1] = ChannelRuleTab
[pDevice
->byZoneType
].byPower
[ii
];
1673 for(ii
=0;ii
<CHANNEL_MAX_24G
;ii
++) {
1674 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] != 0) {
1675 sChannelTbl
[ii
+1].bValid
= TRUE
;
1676 pDevice
->abyRegPwr
[ii
+1] = ChannelRuleTab
[pDevice
->byZoneType
].byPower
[ii
];
1677 pDevice
->abyLocalPwr
[ii
+1] = ChannelRuleTab
[pDevice
->byZoneType
].byPower
[ii
];
1682 DBG_PRT(MSG_LEVEL_NOTICE
, KERN_INFO
"Zone=[%d][%c][%c]!!\n",pDevice
->byZoneType
,ChannelRuleTab
[pDevice
->byZoneType
].chCountryCode
[0],ChannelRuleTab
[pDevice
->byZoneType
].chCountryCode
[1]);
1683 for(ii
=0;ii
<CARD_MAX_CHANNEL_TBL
;ii
++) {
1684 if (pDevice
->abyRegPwr
[ii
+1] == 0) {
1685 pDevice
->abyRegPwr
[ii
+1] = pDevice
->abyOFDMDefaultPwr
[ii
+1];
1687 if (pDevice
->abyLocalPwr
[ii
+1] == 0) {
1688 pDevice
->abyLocalPwr
[ii
+1] = pDevice
->abyOFDMDefaultPwr
[ii
+1];
1698 * Start Spectrum Measure defined in 802.11h
1702 * hDeviceContext - device structure point
1706 * Return Value: none.
1711 IN PVOID pDeviceHandler
,
1712 IN PVOID pvMeasureEIDs
,
1713 IN UINT uNumOfMeasureEIDs
1716 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1717 PWLAN_IE_MEASURE_REQ pEID
= (PWLAN_IE_MEASURE_REQ
) pvMeasureEIDs
;
1720 BOOL bExpired
= TRUE
;
1723 if ((pEID
== NULL
) ||
1724 (uNumOfMeasureEIDs
== 0)) {
1727 CARDbGetCurrentTSF(pDevice
->PortOffset
, &qwCurrTSF
);
1728 if (pDevice
->bMeasureInProgress
== TRUE
) {
1729 pDevice
->bMeasureInProgress
= FALSE
;
1730 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_RCR
, pDevice
->byOrgRCR
);
1731 MACvSelectPage1(pDevice
->PortOffset
);
1732 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_MAR0
, pDevice
->dwOrgMAR0
);
1733 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_MAR4
, pDevice
->dwOrgMAR4
);
1734 // clear measure control
1735 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_MSRCTL
, MSRCTL_EN
);
1736 MACvSelectPage0(pDevice
->PortOffset
);
1737 CARDbSetChannel(pDevice
, pDevice
->byOrgChannel
);
1738 MACvSelectPage1(pDevice
->PortOffset
);
1739 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_MSRCTL
+1, MSRCTL1_TXPAUSE
);
1740 MACvSelectPage0(pDevice
->PortOffset
);
1742 pDevice
->uNumOfMeasureEIDs
= uNumOfMeasureEIDs
;
1745 pDevice
->pCurrMeasureEID
= pEID
;
1747 pDevice
->uNumOfMeasureEIDs
--;
1749 if (pDevice
->byLocalID
> REV_ID_VT3253_B1
) {
1750 HIDWORD(qwStartTSF
) = HIDWORD(*((PQWORD
) (pDevice
->pCurrMeasureEID
->sReq
.abyStartTime
)));
1751 LODWORD(qwStartTSF
) = LODWORD(*((PQWORD
) (pDevice
->pCurrMeasureEID
->sReq
.abyStartTime
)));
1752 wDuration
= *((PWORD
) (pDevice
->pCurrMeasureEID
->sReq
.abyDuration
));
1753 wDuration
+= 1; // 1 TU for channel switching
1755 if ((LODWORD(qwStartTSF
) == 0) && (HIDWORD(qwStartTSF
) == 0)) {
1756 // start imediately by setting start TSF == current TSF + 2 TU
1757 LODWORD(qwStartTSF
) = LODWORD(qwCurrTSF
) + 2048;
1758 HIDWORD(qwStartTSF
) = HIDWORD(qwCurrTSF
);
1759 if (LODWORD(qwCurrTSF
) > LODWORD(qwStartTSF
)) {
1760 HIDWORD(qwStartTSF
)++;
1765 // start at setting start TSF - 1TU(for channel switching)
1766 if (LODWORD(qwStartTSF
) < 1024) {
1767 HIDWORD(qwStartTSF
)--;
1769 LODWORD(qwStartTSF
) -= 1024;
1772 if ((HIDWORD(qwCurrTSF
) < HIDWORD(qwStartTSF
)) ||
1773 ((HIDWORD(qwCurrTSF
) == HIDWORD(qwStartTSF
)) &&
1774 (LODWORD(qwCurrTSF
) < LODWORD(qwStartTSF
)))
1779 VNTWIFIbMeasureReport( pDevice
->pMgmt
,
1781 pDevice
->pCurrMeasureEID
,
1783 pDevice
->byBasicMap
,
1784 pDevice
->byCCAFraction
,
1788 // hardware do not support measure
1789 VNTWIFIbMeasureReport( pDevice
->pMgmt
,
1791 pDevice
->pCurrMeasureEID
,
1792 MEASURE_MODE_INCAPABLE
,
1793 pDevice
->byBasicMap
,
1794 pDevice
->byCCAFraction
,
1798 } while (pDevice
->uNumOfMeasureEIDs
!= 0);
1800 if (bExpired
== FALSE
) {
1801 MACvSelectPage1(pDevice
->PortOffset
);
1802 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_MSRSTART
, LODWORD(qwStartTSF
));
1803 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_MSRSTART
+ 4, HIDWORD(qwStartTSF
));
1804 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_MSRDURATION
, wDuration
);
1805 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_MSRCTL
, MSRCTL_EN
);
1806 MACvSelectPage0(pDevice
->PortOffset
);
1808 // all measure start time expired we should complete action
1809 VNTWIFIbMeasureReport( pDevice
->pMgmt
,
1813 pDevice
->byBasicMap
,
1814 pDevice
->byCCAFraction
,
1825 * Do Channel Switch defined in 802.11h
1829 * hDeviceContext - device structure point
1833 * Return Value: none.
1837 CARDbChannelSwitch (
1838 IN PVOID pDeviceHandler
,
1840 IN BYTE byNewChannel
,
1844 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1845 BOOL bResult
= TRUE
;
1848 bResult
= CARDbSetChannel(pDevice
, byNewChannel
);
1849 VNTWIFIbChannelSwitch(pDevice
->pMgmt
, byNewChannel
);
1850 MACvSelectPage1(pDevice
->PortOffset
);
1851 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_MSRCTL
+1, MSRCTL1_TXPAUSE
);
1852 MACvSelectPage0(pDevice
->PortOffset
);
1855 pDevice
->byChannelSwitchCount
= byCount
;
1856 pDevice
->byNewChannel
= byNewChannel
;
1857 pDevice
->bChannelSwitch
= TRUE
;
1859 bResult
=CARDbStopTxPacket(pDevice
, PKT_TYPE_802_11_ALL
);
1868 * Handle Quiet EID defined in 802.11h
1872 * hDeviceContext - device structure point
1876 * Return Value: none.
1881 IN PVOID pDeviceHandler
,
1882 IN BOOL bResetQuiet
,
1883 IN BYTE byQuietCount
,
1884 IN BYTE byQuietPeriod
,
1885 IN WORD wQuietDuration
,
1886 IN WORD wQuietOffset
1889 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1892 if (bResetQuiet
== TRUE
) {
1893 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_MSRCTL
, (MSRCTL_QUIETTXCHK
| MSRCTL_QUIETEN
));
1894 for(ii
=0;ii
<MAX_QUIET_COUNT
;ii
++) {
1895 pDevice
->sQuiet
[ii
].bEnable
= FALSE
;
1897 pDevice
->uQuietEnqueue
= 0;
1898 pDevice
->bEnableFirstQuiet
= FALSE
;
1899 pDevice
->bQuietEnable
= FALSE
;
1900 pDevice
->byQuietStartCount
= byQuietCount
;
1902 if (pDevice
->sQuiet
[pDevice
->uQuietEnqueue
].bEnable
== FALSE
) {
1903 pDevice
->sQuiet
[pDevice
->uQuietEnqueue
].bEnable
= TRUE
;
1904 pDevice
->sQuiet
[pDevice
->uQuietEnqueue
].byPeriod
= byQuietPeriod
;
1905 pDevice
->sQuiet
[pDevice
->uQuietEnqueue
].wDuration
= wQuietDuration
;
1906 pDevice
->sQuiet
[pDevice
->uQuietEnqueue
].dwStartTime
= (DWORD
) byQuietCount
;
1907 pDevice
->sQuiet
[pDevice
->uQuietEnqueue
].dwStartTime
*= pDevice
->wBeaconInterval
;
1908 pDevice
->sQuiet
[pDevice
->uQuietEnqueue
].dwStartTime
+= wQuietOffset
;
1909 pDevice
->uQuietEnqueue
++;
1910 pDevice
->uQuietEnqueue
%= MAX_QUIET_COUNT
;
1911 if (pDevice
->byQuietStartCount
< byQuietCount
) {
1912 pDevice
->byQuietStartCount
= byQuietCount
;
1915 // we can not handle Quiet EID more
1924 * Do Quiet, It will called by either ISR (after start) or VNTWIFI (before start) so do not need SPINLOCK
1928 * hDeviceContext - device structure point
1932 * Return Value: none.
1937 IN PVOID pDeviceHandler
1940 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
1942 DWORD dwStartTime
= 0xFFFFFFFF;
1943 UINT uCurrentQuietIndex
= 0;
1944 DWORD dwNextTime
= 0;
1946 DWORD dwDuration
= 0;
1948 for(ii
=0;ii
<MAX_QUIET_COUNT
;ii
++) {
1949 if ((pDevice
->sQuiet
[ii
].bEnable
== TRUE
) &&
1950 (dwStartTime
> pDevice
->sQuiet
[ii
].dwStartTime
)) {
1951 dwStartTime
= pDevice
->sQuiet
[ii
].dwStartTime
;
1952 uCurrentQuietIndex
= ii
;
1955 if (dwStartTime
== 0xFFFFFFFF) {
1957 pDevice
->bQuietEnable
= FALSE
;
1958 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_MSRCTL
, (MSRCTL_QUIETTXCHK
| MSRCTL_QUIETEN
));
1960 if (pDevice
->bQuietEnable
== FALSE
) {
1962 pDevice
->byQuietStartCount
--;
1963 dwNextTime
= pDevice
->sQuiet
[uCurrentQuietIndex
].dwStartTime
;
1964 dwNextTime
%= pDevice
->wBeaconInterval
;
1965 MACvSelectPage1(pDevice
->PortOffset
);
1966 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_QUIETINIT
, (WORD
) dwNextTime
);
1967 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_QUIETDUR
, (WORD
) pDevice
->sQuiet
[uCurrentQuietIndex
].wDuration
);
1968 if (pDevice
->byQuietStartCount
== 0) {
1969 pDevice
->bEnableFirstQuiet
= FALSE
;
1970 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_MSRCTL
, (MSRCTL_QUIETTXCHK
| MSRCTL_QUIETEN
));
1972 pDevice
->bEnableFirstQuiet
= TRUE
;
1974 MACvSelectPage0(pDevice
->PortOffset
);
1976 if (pDevice
->dwCurrentQuietEndTime
> pDevice
->sQuiet
[uCurrentQuietIndex
].dwStartTime
) {
1977 // overlap with previous Quiet
1978 dwGap
= pDevice
->dwCurrentQuietEndTime
- pDevice
->sQuiet
[uCurrentQuietIndex
].dwStartTime
;
1979 if (dwGap
>= pDevice
->sQuiet
[uCurrentQuietIndex
].wDuration
) {
1980 // return FALSE to indicate next quiet expired, should call this function again
1983 dwDuration
= pDevice
->sQuiet
[uCurrentQuietIndex
].wDuration
- dwGap
;
1986 dwGap
= pDevice
->sQuiet
[uCurrentQuietIndex
].dwStartTime
- pDevice
->dwCurrentQuietEndTime
;
1987 dwDuration
= pDevice
->sQuiet
[uCurrentQuietIndex
].wDuration
;
1989 // set GAP and Next duration
1990 MACvSelectPage1(pDevice
->PortOffset
);
1991 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_QUIETGAP
, (WORD
) dwGap
);
1992 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_QUIETDUR
, (WORD
) dwDuration
);
1993 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_MSRCTL
, MSRCTL_QUIETRPT
);
1994 MACvSelectPage0(pDevice
->PortOffset
);
1996 pDevice
->bQuietEnable
= TRUE
;
1997 pDevice
->dwCurrentQuietEndTime
= pDevice
->sQuiet
[uCurrentQuietIndex
].dwStartTime
;
1998 pDevice
->dwCurrentQuietEndTime
+= pDevice
->sQuiet
[uCurrentQuietIndex
].wDuration
;
1999 if (pDevice
->sQuiet
[uCurrentQuietIndex
].byPeriod
== 0) {
2000 // not period disable current quiet element
2001 pDevice
->sQuiet
[uCurrentQuietIndex
].bEnable
= FALSE
;
2003 // set next period start time
2004 dwNextTime
= (DWORD
) pDevice
->sQuiet
[uCurrentQuietIndex
].byPeriod
;
2005 dwNextTime
*= pDevice
->wBeaconInterval
;
2006 pDevice
->sQuiet
[uCurrentQuietIndex
].dwStartTime
= dwNextTime
;
2008 if (pDevice
->dwCurrentQuietEndTime
> 0x80010000) {
2009 // decreament all time to avoid wrap around
2010 for(ii
=0;ii
<MAX_QUIET_COUNT
;ii
++) {
2011 if (pDevice
->sQuiet
[ii
].bEnable
== TRUE
) {
2012 pDevice
->sQuiet
[ii
].dwStartTime
-= 0x80000000;
2015 pDevice
->dwCurrentQuietEndTime
-= 0x80000000;
2025 * Set Channel Info of Country
2029 * hDeviceContext - device structure point
2033 * Return Value: none.
2037 CARDvSetCountryInfo (
2038 IN PVOID pDeviceHandler
,
2039 IN CARD_PHY_TYPE ePHYType
,
2043 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2047 UINT uNumOfCountryInfo
= 0;
2049 PWLAN_IE_COUNTRY pIE_Country
= (PWLAN_IE_COUNTRY
) pIE
;
2052 uNumOfCountryInfo
= (pIE_Country
->len
- 3);
2053 uNumOfCountryInfo
/= 3;
2055 if (ePHYType
== PHY_TYPE_11A
) {
2056 pDevice
->bCountryInfo5G
= TRUE
;
2057 for(ii
=CB_MAX_CHANNEL_24G
+1;ii
<=CARD_MAX_CHANNEL_TBL
;ii
++) {
2058 sChannelTbl
[ii
].bValid
= FALSE
;
2062 pDevice
->bCountryInfo24G
= TRUE
;
2063 for(ii
=1;ii
<=CB_MAX_CHANNEL_24G
;ii
++) {
2064 sChannelTbl
[ii
].bValid
= FALSE
;
2068 pDevice
->abyCountryCode
[0] = pIE_Country
->abyCountryString
[0];
2069 pDevice
->abyCountryCode
[1] = pIE_Country
->abyCountryString
[1];
2070 pDevice
->abyCountryCode
[2] = pIE_Country
->abyCountryString
[2];
2072 for(ii
=0;ii
<uNumOfCountryInfo
;ii
++) {
2073 for(uu
=0;uu
<pIE_Country
->abyCountryInfo
[ii
*3+1];uu
++) {
2074 byCh
= CARDbyGetChannelMapping(pDevice
, (BYTE
)(pIE_Country
->abyCountryInfo
[ii
*3]+step
*uu
), ePHYType
);
2075 sChannelTbl
[byCh
].bValid
= TRUE
;
2076 pDevice
->abyRegPwr
[byCh
] = pIE_Country
->abyCountryInfo
[ii
*3+2];
2084 * Set Local Power Constraint
2088 * hDeviceContext - device structure point
2092 * Return Value: none.
2096 CARDvSetPowerConstraint (
2097 IN PVOID pDeviceHandler
,
2102 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2104 if (byChannel
> CB_MAX_CHANNEL_24G
) {
2105 if (pDevice
->bCountryInfo5G
== TRUE
) {
2106 pDevice
->abyLocalPwr
[byChannel
] = pDevice
->abyRegPwr
[byChannel
] - byPower
;
2109 if (pDevice
->bCountryInfo24G
== TRUE
) {
2110 pDevice
->abyLocalPwr
[byChannel
] = pDevice
->abyRegPwr
[byChannel
] - byPower
;
2119 * Set Local Power Constraint
2123 * hDeviceContext - device structure point
2127 * Return Value: none.
2131 CARDvGetPowerCapability (
2132 IN PVOID pDeviceHandler
,
2133 OUT PBYTE pbyMinPower
,
2134 OUT PBYTE pbyMaxPower
2137 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2140 *pbyMaxPower
= pDevice
->abyOFDMDefaultPwr
[pDevice
->byCurrentCh
];
2141 byDec
= pDevice
->abyOFDMPwrTbl
[pDevice
->byCurrentCh
];
2142 if (pDevice
->byRFType
== RF_UW2452
) {
2148 *pbyMinPower
= pDevice
->abyOFDMDefaultPwr
[pDevice
->byCurrentCh
] - byDec
;
2155 * Set Support Channels IE defined in 802.11h
2159 * hDeviceContext - device structure point
2163 * Return Value: none.
2167 CARDbySetSupportChannels (
2168 IN PVOID pDeviceHandler
,
2172 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2175 PWLAN_IE_SUPP_CH pIE
= (PWLAN_IE_SUPP_CH
) pbyIEs
;
2180 pIE
->byElementID
= WLAN_EID_SUPP_CH
;
2182 pbyChTupple
= pIE
->abyChannelTuple
;
2186 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[28] == TRUE
) {
2187 for (ii
=28;ii
<36;ii
+=2) {
2188 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] == TRUE
) {
2192 *pbyChTupple
++ = 34;
2193 *pbyChTupple
++ = byCount
;
2195 } else if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[29] == TRUE
) {
2196 for (ii
=29;ii
<36;ii
+=2) {
2197 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] == TRUE
) {
2201 *pbyChTupple
++ = 36;
2202 *pbyChTupple
++ = byCount
;
2207 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[36] == TRUE
) {
2208 for (ii
=36;ii
<40;ii
++) {
2209 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] == TRUE
) {
2213 *pbyChTupple
++ = 52;
2214 *pbyChTupple
++ = byCount
;
2219 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[40] == TRUE
) {
2220 for (ii
=40;ii
<51;ii
++) {
2221 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] == TRUE
) {
2225 *pbyChTupple
++ = 100;
2226 *pbyChTupple
++ = byCount
;
2228 } else if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[51] == TRUE
) {
2229 for (ii
=51;ii
<56;ii
++) {
2230 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] == TRUE
) {
2234 *pbyChTupple
++ = 149;
2235 *pbyChTupple
++ = byCount
;
2238 pIE
->len
+= (byLen
- 2);
2246 * Get Current Tx Power
2250 * hDeviceContext - device structure point
2254 * Return Value: none.
2258 CARDbyGetTransmitPower (
2259 IN PVOID pDeviceHandler
2262 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2264 return (pDevice
->byCurPwrdBm
);
2269 CARDbChannelGetList (
2270 IN UINT uCountryCodeIdx
,
2271 OUT PBYTE pbyChannelTable
2274 if (uCountryCodeIdx
>= CCODE_MAX
) {
2277 memcpy(pbyChannelTable
, ChannelRuleTab
[uCountryCodeIdx
].bChannelIdxList
, CB_MAX_CHANNEL
);
2284 IN PVOID pDeviceHandler
,
2288 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2290 PWLAN_IE_COUNTRY pIECountry
= (PWLAN_IE_COUNTRY
) pIE
;
2292 pIECountry
->byElementID
= WLAN_EID_COUNTRY
;
2293 pIECountry
->len
= 0;
2294 pIECountry
->abyCountryString
[0] = ChannelRuleTab
[pDevice
->byZoneType
].chCountryCode
[0];
2295 pIECountry
->abyCountryString
[1] = ChannelRuleTab
[pDevice
->byZoneType
].chCountryCode
[1];
2296 pIECountry
->abyCountryString
[2] = ' ';
2297 for (ii
= CB_MAX_CHANNEL_24G
; ii
< CB_MAX_CHANNEL
; ii
++ ) {
2298 if (ChannelRuleTab
[pDevice
->byZoneType
].bChannelIdxList
[ii
] != 0) {
2299 pIECountry
->abyCountryInfo
[pIECountry
->len
++] = sChannelTbl
[ii
+1].byChannelNumber
;
2300 pIECountry
->abyCountryInfo
[pIECountry
->len
++] = 1;
2301 pIECountry
->abyCountryInfo
[pIECountry
->len
++] = ChannelRuleTab
[pDevice
->byZoneType
].byPower
[ii
];
2304 pIECountry
->len
+= 3;
2309 CARDbGetChannelMapInfo(
2310 IN PVOID pDeviceHandler
,
2311 IN UINT uChannelIndex
,
2312 OUT PBYTE pbyChannelNumber
,
2316 // PSDevice pDevice = (PSDevice) pDeviceHandler;
2318 if (uChannelIndex
> CB_MAX_CHANNEL
) {
2321 *pbyChannelNumber
= sChannelTbl
[uChannelIndex
].byChannelNumber
;
2322 *pbyMap
= sChannelTbl
[uChannelIndex
].byMAP
;
2323 return sChannelTbl
[uChannelIndex
].bValid
;
2328 CARDvSetChannelMapInfo(
2329 IN PVOID pDeviceHandler
,
2330 IN UINT uChannelIndex
,
2334 // PSDevice pDevice = (PSDevice) pDeviceHandler;
2336 if (uChannelIndex
> CB_MAX_CHANNEL
) {
2339 sChannelTbl
[uChannelIndex
].byMAP
|= byMap
;
2344 CARDvClearChannelMapInfo(
2345 IN PVOID pDeviceHandler
2348 // PSDevice pDevice = (PSDevice) pDeviceHandler;
2351 for (ii
= 1; ii
<= CB_MAX_CHANNEL
; ii
++) {
2352 sChannelTbl
[ii
].byMAP
= 0;
2358 CARDbyAutoChannelSelect(
2359 IN PVOID pDeviceHandler
,
2360 CARD_PHY_TYPE ePHYType
2363 // PSDevice pDevice = (PSDevice) pDeviceHandler;
2365 BYTE byOptionChannel
= 0;
2366 INT aiWeight
[CB_MAX_CHANNEL_24G
+1] = {-1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
2368 if (ePHYType
== PHY_TYPE_11A
) {
2369 for(ii
=CB_MAX_CHANNEL_24G
+1;ii
<=CB_MAX_CHANNEL
;ii
++) {
2370 if (sChannelTbl
[ii
].bValid
== TRUE
) {
2371 if (byOptionChannel
== 0) {
2372 byOptionChannel
= (BYTE
) ii
;
2374 if (sChannelTbl
[ii
].byMAP
== 0) {
2376 } else if ( !(sChannelTbl
[ii
].byMAP
& 0x08)) {
2377 byOptionChannel
= (BYTE
) ii
;
2382 byOptionChannel
= 0;
2383 for(ii
=1;ii
<=CB_MAX_CHANNEL_24G
;ii
++) {
2384 if (sChannelTbl
[ii
].bValid
== TRUE
) {
2385 if (sChannelTbl
[ii
].byMAP
== 0) {
2386 aiWeight
[ii
] += 100;
2387 } else if (sChannelTbl
[ii
].byMAP
& 0x01) {
2389 aiWeight
[ii
-3] -= 10;
2392 aiWeight
[ii
-2] -= 20;
2395 aiWeight
[ii
-1] -= 40;
2398 if (ii
< CB_MAX_CHANNEL_24G
) {
2399 aiWeight
[ii
+1] -= 40;
2401 if (ii
< (CB_MAX_CHANNEL_24G
- 1)) {
2402 aiWeight
[ii
+2] -= 20;
2404 if (ii
< (CB_MAX_CHANNEL_24G
- 2)) {
2405 aiWeight
[ii
+3] -= 10;
2410 for(ii
=1;ii
<=CB_MAX_CHANNEL_24G
;ii
++) {
2411 if ((sChannelTbl
[ii
].bValid
== TRUE
) &&
2412 (aiWeight
[ii
] > aiWeight
[byOptionChannel
])) {
2413 byOptionChannel
= (BYTE
) ii
;
2417 return (byOptionChannel
);
2425 IN PVOID pDeviceHandler
2428 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2432 // initialize TD index
2433 pDevice
->apTailTD
[0] = pDevice
->apCurrTD
[0] = &(pDevice
->apTD0Rings
[0]);
2434 pDevice
->apTailTD
[1] = pDevice
->apCurrTD
[1] = &(pDevice
->apTD1Rings
[0]);
2436 for (uu
= 0; uu
< TYPE_MAXTD
; uu
++)
2437 pDevice
->iTDUsed
[uu
] = 0;
2439 for (uu
= 0; uu
< pDevice
->sOpts
.nTxDescs
[0]; uu
++) {
2440 pCurrTD
= &(pDevice
->apTD0Rings
[uu
]);
2441 pCurrTD
->m_td0TD0
.f1Owner
= OWNED_BY_HOST
;
2442 // init all Tx Packet pointer to NULL
2444 for (uu
= 0; uu
< pDevice
->sOpts
.nTxDescs
[1]; uu
++) {
2445 pCurrTD
= &(pDevice
->apTD1Rings
[uu
]);
2446 pCurrTD
->m_td0TD0
.f1Owner
= OWNED_BY_HOST
;
2447 // init all Tx Packet pointer to NULL
2450 // set MAC TD pointer
2451 MACvSetCurrTXDescAddr(TYPE_TXDMA0
, pDevice
->PortOffset
,
2452 (pDevice
->td0_pool_dma
));
2454 MACvSetCurrTXDescAddr(TYPE_AC0DMA
, pDevice
->PortOffset
,
2455 (pDevice
->td1_pool_dma
));
2457 // set MAC Beacon TX pointer
2458 MACvSetCurrBCNTxDescAddr(pDevice
->PortOffset
,
2459 (pDevice
->tx_beacon_dma
));
2472 * pDevice - Pointer to the adapter
2476 * Return Value: none
2481 IN PVOID pDeviceHandler
2484 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2490 // initialize RD index
2491 pDevice
->pCurrRD
[0]=&(pDevice
->aRD0Ring
[0]);
2492 pDevice
->pCurrRD
[1]=&(pDevice
->aRD1Ring
[0]);
2494 // init state, all RD is chip's
2495 for (uu
= 0; uu
< pDevice
->sOpts
.nRxDescs0
; uu
++) {
2496 pDesc
=&(pDevice
->aRD0Ring
[uu
]);
2497 pDesc
->m_rd0RD0
.wResCount
= (WORD
)(pDevice
->rx_buf_sz
);
2498 pDesc
->m_rd0RD0
.f1Owner
=OWNED_BY_NIC
;
2499 pDesc
->m_rd1RD1
.wReqCount
= (WORD
)(pDevice
->rx_buf_sz
);
2502 // init state, all RD is chip's
2503 for (uu
= 0; uu
< pDevice
->sOpts
.nRxDescs1
; uu
++) {
2504 pDesc
=&(pDevice
->aRD1Ring
[uu
]);
2505 pDesc
->m_rd0RD0
.wResCount
= (WORD
)(pDevice
->rx_buf_sz
);
2506 pDesc
->m_rd0RD0
.f1Owner
=OWNED_BY_NIC
;
2507 pDesc
->m_rd1RD1
.wReqCount
= (WORD
)(pDevice
->rx_buf_sz
);
2510 pDevice
->cbDFCB
= CB_MAX_RX_FRAG
;
2511 pDevice
->cbFreeDFCB
= pDevice
->cbDFCB
;
2514 MACvRx0PerPktMode(pDevice
->PortOffset
);
2515 MACvRx1PerPktMode(pDevice
->PortOffset
);
2516 // set MAC RD pointer
2517 MACvSetCurrRx0DescAddr(pDevice
->PortOffset
,
2518 pDevice
->rd0_pool_dma
);
2520 MACvSetCurrRx1DescAddr(pDevice
->PortOffset
,
2521 pDevice
->rd1_pool_dma
);
2528 * Description: Get response Control frame rate in CCK mode
2532 * pDevice - The adapter to be set
2533 * wRateIdx - Receiving data rate
2537 * Return Value: response Control frame rate
2540 WORD
CARDwGetCCKControlRate(PVOID pDeviceHandler
, WORD wRateIdx
)
2542 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2543 UINT ui
= (UINT
)wRateIdx
;
2545 while (ui
> RATE_1M
) {
2546 if (pDevice
->wBasicRate
& ((WORD
)1 << ui
)) {
2551 return (WORD
)RATE_1M
;
2555 * Description: Get response Control frame rate in OFDM mode
2559 * pDevice - The adapter to be set
2560 * wRateIdx - Receiving data rate
2564 * Return Value: response Control frame rate
2567 WORD
CARDwGetOFDMControlRate (PVOID pDeviceHandler
, WORD wRateIdx
)
2569 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2570 UINT ui
= (UINT
)wRateIdx
;
2572 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"BASIC RATE: %X\n", pDevice
->wBasicRate
);
2574 if (!CARDbIsOFDMinBasicRate((PVOID
)pDevice
)) {
2575 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx
);
2576 if (wRateIdx
> RATE_24M
)
2577 wRateIdx
= RATE_24M
;
2580 while (ui
> RATE_11M
) {
2581 if (pDevice
->wBasicRate
& ((WORD
)1 << ui
)) {
2582 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"CARDwGetOFDMControlRate : %d\n", ui
);
2587 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"CARDwGetOFDMControlRate: 6M\n");
2588 return (WORD
)RATE_24M
;
2593 * Description: Set RSPINF
2597 * pDevice - The adapter to be set
2601 * Return Value: None.
2604 void CARDvSetRSPINF (PVOID pDeviceHandler
, CARD_PHY_TYPE ePHYType
)
2606 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2607 BYTE byServ
= 0x00, bySignal
= 0x00; //For CCK
2609 BYTE byTxRate
, byRsvTime
; //For OFDM
2612 MACvSelectPage1(pDevice
->PortOffset
);
2615 BBvCaculateParameter(pDevice
,
2617 CARDwGetCCKControlRate((PVOID
)pDevice
, RATE_1M
),
2624 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_RSPINF_B_1
, MAKEDWORD(wLen
,MAKEWORD(bySignal
,byServ
)));
2626 BBvCaculateParameter(pDevice
,
2628 CARDwGetCCKControlRate((PVOID
)pDevice
, RATE_2M
),
2635 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_RSPINF_B_2
, MAKEDWORD(wLen
,MAKEWORD(bySignal
,byServ
)));
2637 BBvCaculateParameter(pDevice
,
2639 CARDwGetCCKControlRate((PVOID
)pDevice
, RATE_5M
),
2646 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_RSPINF_B_5
, MAKEDWORD(wLen
,MAKEWORD(bySignal
,byServ
)));
2648 BBvCaculateParameter(pDevice
,
2650 CARDwGetCCKControlRate((PVOID
)pDevice
, RATE_11M
),
2657 VNSvOutPortD(pDevice
->PortOffset
+ MAC_REG_RSPINF_B_11
, MAKEDWORD(wLen
,MAKEWORD(bySignal
,byServ
)));
2659 s_vCaculateOFDMRParameter(RATE_6M
,
2663 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_6
, MAKEWORD(byTxRate
,byRsvTime
));
2665 s_vCaculateOFDMRParameter(RATE_9M
,
2669 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_9
, MAKEWORD(byTxRate
,byRsvTime
));
2671 s_vCaculateOFDMRParameter(RATE_12M
,
2675 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_12
, MAKEWORD(byTxRate
,byRsvTime
));
2677 s_vCaculateOFDMRParameter(RATE_18M
,
2681 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_18
, MAKEWORD(byTxRate
,byRsvTime
));
2683 s_vCaculateOFDMRParameter(RATE_24M
,
2687 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_24
, MAKEWORD(byTxRate
,byRsvTime
));
2689 s_vCaculateOFDMRParameter(CARDwGetOFDMControlRate((PVOID
)pDevice
, RATE_36M
),
2693 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_36
, MAKEWORD(byTxRate
,byRsvTime
));
2695 s_vCaculateOFDMRParameter(CARDwGetOFDMControlRate((PVOID
)pDevice
, RATE_48M
),
2699 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_48
, MAKEWORD(byTxRate
,byRsvTime
));
2701 s_vCaculateOFDMRParameter(CARDwGetOFDMControlRate((PVOID
)pDevice
, RATE_54M
),
2705 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_54
, MAKEWORD(byTxRate
,byRsvTime
));
2708 s_vCaculateOFDMRParameter(CARDwGetOFDMControlRate((PVOID
)pDevice
, RATE_54M
),
2712 VNSvOutPortW(pDevice
->PortOffset
+ MAC_REG_RSPINF_A_72
, MAKEWORD(byTxRate
,byRsvTime
));
2714 MACvSelectPage0(pDevice
->PortOffset
);
2718 * Description: Update IFS
2722 * pDevice - The adapter to be set
2726 * Return Value: None.
2729 void vUpdateIFS (PVOID pDeviceHandler
)
2731 //Set SIFS, DIFS, EIFS, SlotTime, CwMin
2732 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2735 if (pDevice
->byPacketType
==PK_TYPE_11A
) {//0000 0000 0000 0000,11a
2736 pDevice
->uSlot
= C_SLOT_SHORT
;
2737 pDevice
->uSIFS
= C_SIFS_A
;
2738 pDevice
->uDIFS
= C_SIFS_A
+ 2*C_SLOT_SHORT
;
2739 pDevice
->uCwMin
= C_CWMIN_A
;
2742 else if (pDevice
->byPacketType
==PK_TYPE_11B
) {//0000 0001 0000 0000,11b
2743 pDevice
->uSlot
= C_SLOT_LONG
;
2744 pDevice
->uSIFS
= C_SIFS_BG
;
2745 pDevice
->uDIFS
= C_SIFS_BG
+ 2*C_SLOT_LONG
;
2746 pDevice
->uCwMin
= C_CWMIN_B
;
2749 else { // PK_TYPE_11GA & PK_TYPE_11GB
2750 pDevice
->uSIFS
= C_SIFS_BG
;
2751 if (pDevice
->bShortSlotTime
) {
2752 pDevice
->uSlot
= C_SLOT_SHORT
;
2754 pDevice
->uSlot
= C_SLOT_LONG
;
2756 pDevice
->uDIFS
= C_SIFS_BG
+ 2*pDevice
->uSlot
;
2757 if (pDevice
->wBasicRate
& 0x0150) { //0000 0001 0101 0000,24M,12M,6M
2758 pDevice
->uCwMin
= C_CWMIN_A
;
2762 pDevice
->uCwMin
= C_CWMIN_B
;
2767 pDevice
->uCwMax
= C_CWMAX
;
2768 pDevice
->uEIFS
= C_EIFS
;
2769 if (pDevice
->byRFType
== RF_RFMD2959
) {
2770 // bcs TX_PE will reserve 3 us
2771 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_SIFS
, (BYTE
)(pDevice
->uSIFS
- 3));
2772 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_DIFS
, (BYTE
)(pDevice
->uDIFS
- 3));
2774 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_SIFS
, (BYTE
)pDevice
->uSIFS
);
2775 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_DIFS
, (BYTE
)pDevice
->uDIFS
);
2777 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_EIFS
, (BYTE
)pDevice
->uEIFS
);
2778 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_SLOT
, (BYTE
)pDevice
->uSlot
);
2779 byMaxMin
|= 0xA0;//1010 1111,C_CWMAX = 1023
2780 VNSvOutPortB(pDevice
->PortOffset
+ MAC_REG_CWMAXMIN0
, (BYTE
)byMaxMin
);
2783 void CARDvUpdateBasicTopRate (PVOID pDeviceHandler
)
2785 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2786 BYTE byTopOFDM
= RATE_24M
, byTopCCK
= RATE_1M
;
2789 //Determines the highest basic rate.
2790 for (ii
= RATE_54M
; ii
>= RATE_6M
; ii
--) {
2791 if ( (pDevice
->wBasicRate
) & ((WORD
)(1<<ii
)) )
2795 pDevice
->byTopOFDMBasicRate
= byTopOFDM
;
2797 for (ii
= RATE_11M
;; ii
--) {
2798 if ( (pDevice
->wBasicRate
) & ((WORD
)(1<<ii
)) )
2804 pDevice
->byTopCCKBasicRate
= byTopCCK
;
2809 * Description: Set NIC Tx Basic Rate
2813 * pDevice - The adapter to be set
2814 * wBasicRate - Basic Rate to be set
2818 * Return Value: TRUE if succeeded; FALSE if failed.
2821 BOOL
CARDbAddBasicRate (PVOID pDeviceHandler
, WORD wRateIdx
)
2823 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2824 WORD wRate
= (WORD
)(1<<wRateIdx
);
2826 pDevice
->wBasicRate
|= wRate
;
2828 //Determines the highest basic rate.
2829 CARDvUpdateBasicTopRate((PVOID
)pDevice
);
2834 BOOL
CARDbIsOFDMinBasicRate (PVOID pDeviceHandler
)
2836 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2839 for (ii
= RATE_54M
; ii
>= RATE_6M
; ii
--) {
2840 if ((pDevice
->wBasicRate
) & ((WORD
)(1<<ii
)))
2846 BYTE
CARDbyGetPktType (PVOID pDeviceHandler
)
2848 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2850 if (pDevice
->byBBType
== BB_TYPE_11A
|| pDevice
->byBBType
== BB_TYPE_11B
) {
2851 return (BYTE
)pDevice
->byBBType
;
2853 else if (CARDbIsOFDMinBasicRate((PVOID
)pDevice
)) {
2854 return PK_TYPE_11GA
;
2857 return PK_TYPE_11GB
;
2862 * Description: Set NIC Loopback mode
2866 * pDevice - The adapter to be set
2867 * wLoopbackMode - Loopback mode to be set
2871 * Return Value: none
2874 void CARDvSetLoopbackMode (DWORD_PTR dwIoBase
, WORD wLoopbackMode
)
2876 switch(wLoopbackMode
) {
2886 MACvSetLoopbackMode(dwIoBase
, LOBYTE(wLoopbackMode
));
2887 // set Baseband loopback
2892 * Description: Software Reset NIC
2896 * pDevice - The adapter to be reset
2900 * Return Value: none
2903 BOOL
CARDbSoftwareReset (PVOID pDeviceHandler
)
2905 PSDevice pDevice
= (PSDevice
) pDeviceHandler
;
2908 if (!MACbSafeSoftwareReset(pDevice
->PortOffset
))
2916 * Description: Caculate TSF offset of two TSF input
2917 * Get TSF Offset from RxBCN's TSF and local TSF
2921 * pDevice - The adapter to be sync.
2922 * qwTSF1 - Rx BCN's TSF
2923 * qwTSF2 - Local TSF
2927 * Return Value: TSF Offset value
2930 QWORD
CARDqGetTSFOffset (BYTE byRxRate
, QWORD qwTSF1
, QWORD qwTSF2
)
2933 WORD wRxBcnTSFOffst
= 0;;
2935 HIDWORD(qwTSFOffset
) = 0;
2936 LODWORD(qwTSFOffset
) = 0;
2937 wRxBcnTSFOffst
= cwRXBCNTSFOff
[byRxRate
%MAX_RATE
];
2938 (qwTSF2
).u
.dwLowDword
+= (DWORD
)(wRxBcnTSFOffst
);
2939 if ((qwTSF2
).u
.dwLowDword
< (DWORD
)(wRxBcnTSFOffst
)) {
2940 (qwTSF2
).u
.dwHighDword
++;
2942 LODWORD(qwTSFOffset
) = LODWORD(qwTSF1
) - LODWORD(qwTSF2
);
2943 if (LODWORD(qwTSF1
) < LODWORD(qwTSF2
)) {
2945 HIDWORD(qwTSFOffset
) = HIDWORD(qwTSF1
) - HIDWORD(qwTSF2
) - 1 ;
2948 HIDWORD(qwTSFOffset
) = HIDWORD(qwTSF1
) - HIDWORD(qwTSF2
);
2950 return (qwTSFOffset
);
2955 * Description: Read NIC TSF counter
2956 * Get local TSF counter
2960 * pDevice - The adapter to be read
2962 * qwCurrTSF - Current TSF counter
2964 * Return Value: TRUE if success; otherwise FALSE
2967 BOOL
CARDbGetCurrentTSF (DWORD_PTR dwIoBase
, PQWORD pqwCurrTSF
)
2972 MACvRegBitsOn(dwIoBase
, MAC_REG_TFTCTL
, TFTCTL_TSFCNTRRD
);
2973 for (ww
= 0; ww
< W_MAX_TIMEOUT
; ww
++) {
2974 VNSvInPortB(dwIoBase
+ MAC_REG_TFTCTL
, &byData
);
2975 if ( !(byData
& TFTCTL_TSFCNTRRD
))
2978 if (ww
== W_MAX_TIMEOUT
)
2980 VNSvInPortD(dwIoBase
+ MAC_REG_TSFCNTR
, &LODWORD(*pqwCurrTSF
));
2981 VNSvInPortD(dwIoBase
+ MAC_REG_TSFCNTR
+ 4, &HIDWORD(*pqwCurrTSF
));
2988 * Description: Read NIC TSF counter
2989 * Get NEXTTBTT from adjusted TSF and Beacon Interval
2993 * qwTSF - Current TSF counter
2994 * wbeaconInterval - Beacon Interval
2996 * qwCurrTSF - Current TSF counter
2998 * Return Value: TSF value of next Beacon
3001 QWORD
CARDqGetNextTBTT (QWORD qwTSF
, WORD wBeaconInterval
)
3005 UINT uHighRemain
, uLowRemain
;
3006 UINT uBeaconInterval
;
3008 uBeaconInterval
= wBeaconInterval
* 1024;
3009 // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval
3010 uLowNextTBTT
= (LODWORD(qwTSF
) >> 10) << 10;
3011 // low dword (mod) bcn
3012 uLowRemain
= (uLowNextTBTT
) % uBeaconInterval
;
3013 // uHighRemain = ((0x80000000 % uBeaconInterval)* 2 * HIDWORD(qwTSF))
3014 // % uBeaconInterval;
3015 // high dword (mod) bcn
3016 uHighRemain
= (((0xffffffff % uBeaconInterval
) + 1) * HIDWORD(qwTSF
))
3018 uLowRemain
= (uHighRemain
+ uLowRemain
) % uBeaconInterval
;
3019 uLowRemain
= uBeaconInterval
- uLowRemain
;
3021 // check if carry when add one beacon interval
3022 if ((~uLowNextTBTT
) < uLowRemain
)
3025 LODWORD(qwTSF
) = uLowNextTBTT
+ uLowRemain
;
3032 * Description: Set NIC TSF counter for first Beacon time
3033 * Get NEXTTBTT from adjusted TSF and Beacon Interval
3037 * dwIoBase - IO Base
3038 * wBeaconInterval - Beacon Interval
3042 * Return Value: none
3045 void CARDvSetFirstNextTBTT (DWORD_PTR dwIoBase
, WORD wBeaconInterval
)
3050 HIDWORD(qwNextTBTT
) = 0;
3051 LODWORD(qwNextTBTT
) = 0;
3052 CARDbGetCurrentTSF(dwIoBase
, &qwNextTBTT
); //Get Local TSF counter
3053 qwNextTBTT
= CARDqGetNextTBTT(qwNextTBTT
, wBeaconInterval
);
3055 VNSvOutPortD(dwIoBase
+ MAC_REG_NEXTTBTT
, LODWORD(qwNextTBTT
));
3056 VNSvOutPortD(dwIoBase
+ MAC_REG_NEXTTBTT
+ 4, HIDWORD(qwNextTBTT
));
3057 MACvRegBitsOn(dwIoBase
, MAC_REG_TFTCTL
, TFTCTL_TBTTSYNCEN
);
3058 //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:First Next TBTT[%8xh:%8xh] \n", HIDWORD(qwNextTBTT), LODWORD(qwNextTBTT));
3064 * Description: Sync NIC TSF counter for Beacon time
3065 * Get NEXTTBTT and write to HW
3069 * pDevice - The adapter to be set
3070 * qwTSF - Current TSF counter
3071 * wBeaconInterval - Beacon Interval
3075 * Return Value: none
3078 void CARDvUpdateNextTBTT (DWORD_PTR dwIoBase
, QWORD qwTSF
, WORD wBeaconInterval
)
3081 qwTSF
= CARDqGetNextTBTT(qwTSF
, wBeaconInterval
);
3083 VNSvOutPortD(dwIoBase
+ MAC_REG_NEXTTBTT
, LODWORD(qwTSF
));
3084 VNSvOutPortD(dwIoBase
+ MAC_REG_NEXTTBTT
+ 4, HIDWORD(qwTSF
));
3085 MACvRegBitsOn(dwIoBase
, MAC_REG_TFTCTL
, TFTCTL_TBTTSYNCEN
);
3086 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Card:Update Next TBTT[%8xh:%8xh] \n",(UINT
)HIDWORD(qwTSF
), (UINT
)LODWORD(qwTSF
));