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#include "device.h"
49#include "tmacro.h"
50#include "card.h"
51#include "baseband.h"
52#include "mac.h"
53#include "desc.h"
54#include "rf.h"
55#include "power.h"
56#include "key.h"
57#include "rc4.h"
58#include "country.h"
59#include "datarate.h"
60#include "rndis.h"
61#include "control.h"
62
63
64static int msglevel =MSG_LEVEL_INFO;
65
66
67
68
69const u16 cwRXBCNTSFOff[MAX_RATE] =
70{192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3};
71
72
73
74
75
76
77
78
79
80
81
82void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel)
83{
84
85 if (pDevice->byBBType == BB_TYPE_11A) {
86 if ((uConnectionChannel < (CB_MAX_CHANNEL_24G+1)) || (uConnectionChannel > CB_MAX_CHANNEL))
87 uConnectionChannel = (CB_MAX_CHANNEL_24G+1);
88 } else {
89 if ((uConnectionChannel > CB_MAX_CHANNEL_24G) || (uConnectionChannel == 0))
90 uConnectionChannel = 1;
91 }
92
93
94 MACvRegBitsOn(pDevice, MAC_REG_MACCR, MACCR_CLRNAV);
95
96
97 MACvRegBitsOff(pDevice, MAC_REG_CHANNEL, 0x80);
98
99
100
101
102 CONTROLnsRequestOut(pDevice,
103 MESSAGE_TYPE_SELECT_CHANNLE,
104 (u16) uConnectionChannel,
105 0,
106 0,
107 NULL
108 );
109
110
111
112
113 if (pDevice->byBBType == BB_TYPE_11A) {
114 pDevice->byCurPwr = 0xFF;
115 RFbRawSetPower(pDevice, pDevice->abyOFDMAPwrTbl[uConnectionChannel-15], RATE_54M);
116 } else if (pDevice->byBBType == BB_TYPE_11G) {
117 pDevice->byCurPwr = 0xFF;
118 RFbRawSetPower(pDevice, pDevice->abyOFDMPwrTbl[uConnectionChannel-1], RATE_54M);
119 } else {
120 pDevice->byCurPwr = 0xFF;
121 RFbRawSetPower(pDevice, pDevice->abyCCKPwrTbl[uConnectionChannel-1], RATE_1M);
122 }
123 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_CHANNEL,(u8)(uConnectionChannel|0x80));
124}
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139static u16 swGetCCKControlRate(struct vnt_private *pDevice, u16 wRateIdx)
140{
141 u16 ui = wRateIdx;
142
143 while (ui > RATE_1M) {
144 if (pDevice->wBasicRate & (1 << ui))
145 return ui;
146 ui--;
147 }
148
149 return RATE_1M;
150}
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx)
166{
167 u16 ui = wRateIdx;
168
169 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n",
170 pDevice->wBasicRate);
171
172 if (!CARDbIsOFDMinBasicRate(pDevice)) {
173 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
174 "swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx);
175 if (wRateIdx > RATE_24M)
176 wRateIdx = RATE_24M;
177 return wRateIdx;
178 }
179
180 while (ui > RATE_11M) {
181 if (pDevice->wBasicRate & (1 << ui)) {
182 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
183 "swGetOFDMControlRate: %d\n", ui);
184 return ui;
185 }
186 ui--;
187 }
188
189 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"swGetOFDMControlRate: 6M\n");
190
191 return RATE_24M;
192}
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208void
209CARDvCalculateOFDMRParameter (
210 u16 wRate,
211 u8 byBBType,
212 u8 * pbyTxRate,
213 u8 * pbyRsvTime
214 )
215{
216 switch (wRate) {
217 case RATE_6M :
218 if (byBBType == BB_TYPE_11A) {
219 *pbyTxRate = 0x9B;
220 *pbyRsvTime = 24;
221 }
222 else {
223 *pbyTxRate = 0x8B;
224 *pbyRsvTime = 30;
225 }
226 break;
227
228 case RATE_9M :
229 if (byBBType == BB_TYPE_11A) {
230 *pbyTxRate = 0x9F;
231 *pbyRsvTime = 16;
232 }
233 else {
234 *pbyTxRate = 0x8F;
235 *pbyRsvTime = 22;
236 }
237 break;
238
239 case RATE_12M :
240 if (byBBType == BB_TYPE_11A) {
241 *pbyTxRate = 0x9A;
242 *pbyRsvTime = 12;
243 }
244 else {
245 *pbyTxRate = 0x8A;
246 *pbyRsvTime = 18;
247 }
248 break;
249
250 case RATE_18M :
251 if (byBBType == BB_TYPE_11A) {
252 *pbyTxRate = 0x9E;
253 *pbyRsvTime = 8;
254 }
255 else {
256 *pbyTxRate = 0x8E;
257 *pbyRsvTime = 14;
258 }
259 break;
260
261 case RATE_36M :
262 if (byBBType == BB_TYPE_11A) {
263 *pbyTxRate = 0x9D;
264 *pbyRsvTime = 4;
265 }
266 else {
267 *pbyTxRate = 0x8D;
268 *pbyRsvTime = 10;
269 }
270 break;
271
272 case RATE_48M :
273 if (byBBType == BB_TYPE_11A) {
274 *pbyTxRate = 0x98;
275 *pbyRsvTime = 4;
276 }
277 else {
278 *pbyTxRate = 0x88;
279 *pbyRsvTime = 10;
280 }
281 break;
282
283 case RATE_54M :
284 if (byBBType == BB_TYPE_11A) {
285 *pbyTxRate = 0x9C;
286 *pbyRsvTime = 4;
287 }
288 else {
289 *pbyTxRate = 0x8C;
290 *pbyRsvTime = 10;
291 }
292 break;
293
294 case RATE_24M :
295 default :
296 if (byBBType == BB_TYPE_11A) {
297 *pbyTxRate = 0x99;
298 *pbyRsvTime = 8;
299 }
300 else {
301 *pbyTxRate = 0x89;
302 *pbyRsvTime = 14;
303 }
304 break;
305 }
306}
307
308
309
310
311
312
313
314
315
316
317
318
319
320void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType)
321{
322 u8 abyServ[4] = {0, 0, 0, 0};
323 u8 abySignal[4] = {0, 0, 0, 0};
324 u16 awLen[4] = {0, 0, 0, 0};
325 u8 abyTxRate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
326 u8 abyRsvTime[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
327 u8 abyData[34];
328 int i;
329
330
331 BBvCalculateParameter(pDevice,
332 14,
333 swGetCCKControlRate(pDevice, RATE_1M),
334 PK_TYPE_11B,
335 &awLen[0],
336 &abyServ[0],
337 &abySignal[0]
338 );
339
340
341 BBvCalculateParameter(pDevice,
342 14,
343 swGetCCKControlRate(pDevice, RATE_2M),
344 PK_TYPE_11B,
345 &awLen[1],
346 &abyServ[1],
347 &abySignal[1]
348 );
349
350
351 BBvCalculateParameter(pDevice,
352 14,
353 swGetCCKControlRate(pDevice, RATE_5M),
354 PK_TYPE_11B,
355 &awLen[2],
356 &abyServ[2],
357 &abySignal[2]
358 );
359
360
361 BBvCalculateParameter(pDevice,
362 14,
363 swGetCCKControlRate(pDevice, RATE_11M),
364 PK_TYPE_11B,
365 &awLen[3],
366 &abyServ[3],
367 &abySignal[3]
368 );
369
370
371 CARDvCalculateOFDMRParameter (RATE_6M,
372 byBBType,
373 &abyTxRate[0],
374 &abyRsvTime[0]);
375
376
377 CARDvCalculateOFDMRParameter (RATE_9M,
378 byBBType,
379 &abyTxRate[1],
380 &abyRsvTime[1]);
381
382
383 CARDvCalculateOFDMRParameter (RATE_12M,
384 byBBType,
385 &abyTxRate[2],
386 &abyRsvTime[2]);
387
388
389 CARDvCalculateOFDMRParameter (RATE_18M,
390 byBBType,
391 &abyTxRate[3],
392 &abyRsvTime[3]);
393
394
395 CARDvCalculateOFDMRParameter (RATE_24M,
396 byBBType,
397 &abyTxRate[4],
398 &abyRsvTime[4]);
399
400
401 CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_36M),
402 byBBType,
403 &abyTxRate[5],
404 &abyRsvTime[5]);
405
406
407 CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_48M),
408 byBBType,
409 &abyTxRate[6],
410 &abyRsvTime[6]);
411
412
413 CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_54M),
414 byBBType,
415 &abyTxRate[7],
416 &abyRsvTime[7]);
417
418
419 CARDvCalculateOFDMRParameter (swGetOFDMControlRate(pDevice, RATE_54M),
420 byBBType,
421 &abyTxRate[8],
422 &abyRsvTime[8]);
423
424 abyData[0] = (u8)(awLen[0]&0xFF);
425 abyData[1] = (u8)(awLen[0]>>8);
426 abyData[2] = abySignal[0];
427 abyData[3] = abyServ[0];
428
429 abyData[4] = (u8)(awLen[1]&0xFF);
430 abyData[5] = (u8)(awLen[1]>>8);
431 abyData[6] = abySignal[1];
432 abyData[7] = abyServ[1];
433
434 abyData[8] = (u8)(awLen[2]&0xFF);
435 abyData[9] = (u8)(awLen[2]>>8);
436 abyData[10] = abySignal[2];
437 abyData[11] = abyServ[2];
438
439 abyData[12] = (u8)(awLen[3]&0xFF);
440 abyData[13] = (u8)(awLen[3]>>8);
441 abyData[14] = abySignal[3];
442 abyData[15] = abyServ[3];
443
444 for (i = 0; i < 9; i++) {
445 abyData[16+i*2] = abyTxRate[i];
446 abyData[16+i*2+1] = abyRsvTime[i];
447 }
448
449 CONTROLnsRequestOut(pDevice,
450 MESSAGE_TYPE_WRITE,
451 MAC_REG_RSPINF_B_1,
452 MESSAGE_REQUEST_MACREG,
453 34,
454 &abyData[0]);
455
456}
457
458
459
460
461
462
463
464
465
466
467
468
469
470void vUpdateIFS(struct vnt_private *pDevice)
471{
472 u8 byMaxMin = 0;
473 u8 byData[4];
474
475 if (pDevice->byPacketType==PK_TYPE_11A) {
476 pDevice->uSlot = C_SLOT_SHORT;
477 pDevice->uSIFS = C_SIFS_A;
478 pDevice->uDIFS = C_SIFS_A + 2*C_SLOT_SHORT;
479 pDevice->uCwMin = C_CWMIN_A;
480 byMaxMin = 4;
481 }
482 else if (pDevice->byPacketType==PK_TYPE_11B) {
483 pDevice->uSlot = C_SLOT_LONG;
484 pDevice->uSIFS = C_SIFS_BG;
485 pDevice->uDIFS = C_SIFS_BG + 2*C_SLOT_LONG;
486 pDevice->uCwMin = C_CWMIN_B;
487 byMaxMin = 5;
488 }
489 else {
490 u8 byRate = 0;
491 bool bOFDMRate = false;
492 unsigned int ii = 0;
493 PWLAN_IE_SUPP_RATES pItemRates = NULL;
494
495 pDevice->uSIFS = C_SIFS_BG;
496 if (pDevice->bShortSlotTime) {
497 pDevice->uSlot = C_SLOT_SHORT;
498 } else {
499 pDevice->uSlot = C_SLOT_LONG;
500 }
501 pDevice->uDIFS = C_SIFS_BG + 2*pDevice->uSlot;
502
503 pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt.abyCurrSuppRates;
504 for (ii = 0; ii < pItemRates->len; ii++) {
505 byRate = (u8)(pItemRates->abyRates[ii]&0x7F);
506 if (RATEwGetRateIdx(byRate) > RATE_11M) {
507 bOFDMRate = true;
508 break;
509 }
510 }
511 if (bOFDMRate == false) {
512 pItemRates = (PWLAN_IE_SUPP_RATES)pDevice->vnt_mgmt
513 .abyCurrExtSuppRates;
514 for (ii = 0; ii < pItemRates->len; ii++) {
515 byRate = (u8)(pItemRates->abyRates[ii]&0x7F);
516 if (RATEwGetRateIdx(byRate) > RATE_11M) {
517 bOFDMRate = true;
518 break;
519 }
520 }
521 }
522 if (bOFDMRate == true) {
523 pDevice->uCwMin = C_CWMIN_A;
524 byMaxMin = 4;
525 } else {
526 pDevice->uCwMin = C_CWMIN_B;
527 byMaxMin = 5;
528 }
529 }
530
531 pDevice->uCwMax = C_CWMAX;
532 pDevice->uEIFS = C_EIFS;
533
534 byData[0] = (u8)pDevice->uSIFS;
535 byData[1] = (u8)pDevice->uDIFS;
536 byData[2] = (u8)pDevice->uEIFS;
537 byData[3] = (u8)pDevice->uSlot;
538 CONTROLnsRequestOut(pDevice,
539 MESSAGE_TYPE_WRITE,
540 MAC_REG_SIFS,
541 MESSAGE_REQUEST_MACREG,
542 4,
543 &byData[0]);
544
545 byMaxMin |= 0xA0;
546 CONTROLnsRequestOut(pDevice,
547 MESSAGE_TYPE_WRITE,
548 MAC_REG_CWMAXMIN0,
549 MESSAGE_REQUEST_MACREG,
550 1,
551 &byMaxMin);
552}
553
554void CARDvUpdateBasicTopRate(struct vnt_private *pDevice)
555{
556 u8 byTopOFDM = RATE_24M, byTopCCK = RATE_1M;
557 u8 ii;
558
559
560 for (ii = RATE_54M; ii >= RATE_6M; ii --) {
561 if ( (pDevice->wBasicRate) & ((u16)(1<<ii)) ) {
562 byTopOFDM = ii;
563 break;
564 }
565 }
566 pDevice->byTopOFDMBasicRate = byTopOFDM;
567
568 for (ii = RATE_11M;; ii --) {
569 if ( (pDevice->wBasicRate) & ((u16)(1<<ii)) ) {
570 byTopCCK = ii;
571 break;
572 }
573 if (ii == RATE_1M)
574 break;
575 }
576 pDevice->byTopCCKBasicRate = byTopCCK;
577 }
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592void CARDbAddBasicRate(struct vnt_private *pDevice, u16 wRateIdx)
593{
594 u16 wRate = (1 << wRateIdx);
595
596 pDevice->wBasicRate |= wRate;
597
598
599 CARDvUpdateBasicTopRate(pDevice);
600}
601
602int CARDbIsOFDMinBasicRate(struct vnt_private *pDevice)
603{
604 int ii;
605
606 for (ii = RATE_54M; ii >= RATE_6M; ii --) {
607 if ((pDevice->wBasicRate) & ((u16)(1<<ii)))
608 return true;
609 }
610 return false;
611}
612
613u8 CARDbyGetPktType(struct vnt_private *pDevice)
614{
615
616 if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) {
617 return (u8)pDevice->byBBType;
618 }
619 else if (CARDbIsOFDMinBasicRate(pDevice)) {
620 return PK_TYPE_11GA;
621 }
622 else {
623 return PK_TYPE_11GB;
624 }
625}
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642u64 CARDqGetTSFOffset(u8 byRxRate, u64 qwTSF1, u64 qwTSF2)
643{
644 u64 qwTSFOffset = 0;
645 u16 wRxBcnTSFOffst = 0;
646
647 wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate % MAX_RATE];
648
649 qwTSF2 += (u64)wRxBcnTSFOffst;
650
651 qwTSFOffset = qwTSF1 - qwTSF2;
652
653 return qwTSFOffset;
654}
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate,
672 u64 qwBSSTimestamp, u64 qwLocalTSF)
673{
674 u64 qwTSFOffset = 0;
675 u8 pbyData[8];
676
677 qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF);
678
679
680
681 pbyData[0] = (u8)qwTSFOffset;
682 pbyData[1] = (u8)(qwTSFOffset >> 8);
683 pbyData[2] = (u8)(qwTSFOffset >> 16);
684 pbyData[3] = (u8)(qwTSFOffset >> 24);
685 pbyData[4] = (u8)(qwTSFOffset >> 32);
686 pbyData[5] = (u8)(qwTSFOffset >> 40);
687 pbyData[6] = (u8)(qwTSFOffset >> 48);
688 pbyData[7] = (u8)(qwTSFOffset >> 56);
689
690 CONTROLnsRequestOut(pDevice,
691 MESSAGE_TYPE_SET_TSFTBTT,
692 MESSAGE_REQUEST_TSF,
693 0,
694 8,
695 pbyData
696 );
697
698}
699
700
701
702
703
704
705
706
707
708
709
710
711
712bool CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF)
713{
714
715 *pqwCurrTSF = pDevice->qwCurrTSF;
716
717 return true;
718}
719
720
721
722
723
724
725
726
727
728
729
730
731bool CARDbClearCurrentTSF(struct vnt_private *pDevice)
732{
733
734 MACvRegBitsOn(pDevice, MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
735
736 pDevice->qwCurrTSF = 0;
737
738 return true;
739}
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval)
756{
757
758 unsigned int uLowNextTBTT;
759 unsigned int uHighRemain, uLowRemain;
760 unsigned int uBeaconInterval;
761
762 uBeaconInterval = wBeaconInterval * 1024;
763
764 uLowNextTBTT = ((qwTSF & 0xffffffffU) >> 10) << 10;
765 uLowRemain = (uLowNextTBTT) % uBeaconInterval;
766 uHighRemain = ((0x80000000 % uBeaconInterval) * 2 * (u32)(qwTSF >> 32))
767 % uBeaconInterval;
768 uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
769 uLowRemain = uBeaconInterval - uLowRemain;
770
771
772 if ((~uLowNextTBTT) < uLowRemain)
773 qwTSF = ((qwTSF >> 32) + 1) << 32;
774
775 qwTSF = (qwTSF & 0xffffffff00000000ULL) |
776 (u64)(uLowNextTBTT + uLowRemain);
777
778 return (qwTSF);
779}
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, u16 wBeaconInterval)
796{
797 u64 qwNextTBTT = 0;
798 u8 pbyData[8];
799
800 CARDbClearCurrentTSF(pDevice);
801
802 qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
803
804
805 pbyData[0] = (u8)qwNextTBTT;
806 pbyData[1] = (u8)(qwNextTBTT >> 8);
807 pbyData[2] = (u8)(qwNextTBTT >> 16);
808 pbyData[3] = (u8)(qwNextTBTT >> 24);
809 pbyData[4] = (u8)(qwNextTBTT >> 32);
810 pbyData[5] = (u8)(qwNextTBTT >> 40);
811 pbyData[6] = (u8)(qwNextTBTT >> 48);
812 pbyData[7] = (u8)(qwNextTBTT >> 56);
813
814 CONTROLnsRequestOut(pDevice,
815 MESSAGE_TYPE_SET_TSFTBTT,
816 MESSAGE_REQUEST_TBTT,
817 0,
818 8,
819 pbyData
820 );
821
822 return;
823}
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF,
841 u16 wBeaconInterval)
842{
843 u8 pbyData[8];
844
845 qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval);
846
847
848
849 pbyData[0] = (u8)qwTSF;
850 pbyData[1] = (u8)(qwTSF >> 8);
851 pbyData[2] = (u8)(qwTSF >> 16);
852 pbyData[3] = (u8)(qwTSF >> 24);
853 pbyData[4] = (u8)(qwTSF >> 32);
854 pbyData[5] = (u8)(qwTSF >> 40);
855 pbyData[6] = (u8)(qwTSF >> 48);
856 pbyData[7] = (u8)(qwTSF >> 56);
857
858 CONTROLnsRequestOut(pDevice,
859 MESSAGE_TYPE_SET_TSFTBTT,
860 MESSAGE_REQUEST_TBTT,
861 0,
862 8,
863 pbyData
864 );
865
866 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
867 "Card:Update Next TBTT[%8lx]\n", (unsigned long)qwTSF);
868
869 return;
870}
871
872
873
874
875
876
877
878
879
880
881
882
883
884int CARDbRadioPowerOff(struct vnt_private *pDevice)
885{
886 int bResult = true;
887
888
889
890
891 pDevice->bRadioOff = true;
892
893 switch (pDevice->byRFType) {
894 case RF_AL2230:
895 case RF_AL2230S:
896 case RF_AIROHA7230:
897 case RF_VT3226:
898 case RF_VT3226D0:
899 case RF_VT3342A0:
900 MACvRegBitsOff(pDevice, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
901 break;
902 }
903
904 MACvRegBitsOff(pDevice, MAC_REG_HOSTCR, HOSTCR_RXON);
905
906 BBvSetDeepSleep(pDevice);
907
908 return bResult;
909}
910
911
912
913
914
915
916
917
918
919
920
921
922
923int CARDbRadioPowerOn(struct vnt_private *pDevice)
924{
925 int bResult = true;
926
927 if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) {
928 return false;
929 }
930
931
932
933
934 pDevice->bRadioOff = false;
935
936 BBvExitDeepSleep(pDevice);
937
938 MACvRegBitsOn(pDevice, MAC_REG_HOSTCR, HOSTCR_RXON);
939
940 switch (pDevice->byRFType) {
941 case RF_AL2230:
942 case RF_AL2230S:
943 case RF_AIROHA7230:
944 case RF_VT3226:
945 case RF_VT3226D0:
946 case RF_VT3342A0:
947 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
948 break;
949 }
950
951 return bResult;
952}
953
954void CARDvSetBSSMode(struct vnt_private *pDevice)
955{
956
957
958 if( (pDevice->byRFType == RF_AIROHA7230 ) && (pDevice->byBBType == BB_TYPE_11A) )
959 {
960 MACvSetBBType(pDevice, BB_TYPE_11G);
961 }
962 else
963 {
964 MACvSetBBType(pDevice, pDevice->byBBType);
965 }
966 pDevice->byPacketType = CARDbyGetPktType(pDevice);
967
968 if (pDevice->byBBType == BB_TYPE_11A) {
969 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03);
970 } else if (pDevice->byBBType == BB_TYPE_11B) {
971 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02);
972 } else if (pDevice->byBBType == BB_TYPE_11G) {
973 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x08);
974 }
975
976 vUpdateIFS(pDevice);
977 CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType);
978
979 if ( pDevice->byBBType == BB_TYPE_11A ) {
980
981 if (pDevice->byRFType == RF_AIROHA7230) {
982 pDevice->abyBBVGA[0] = 0x20;
983 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, pDevice->abyBBVGA[0]);
984 }
985 pDevice->abyBBVGA[2] = 0x10;
986 pDevice->abyBBVGA[3] = 0x10;
987 } else {
988
989 if (pDevice->byRFType == RF_AIROHA7230) {
990 pDevice->abyBBVGA[0] = 0x1C;
991 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, pDevice->abyBBVGA[0]);
992 }
993 pDevice->abyBBVGA[2] = 0x0;
994 pDevice->abyBBVGA[3] = 0x0;
995 }
996}
997