blob: 7b43ceabecc0d5b0f88f0b7a8a104104d9e83a52 [file] [log] [blame]
Forest Bond92b96792009-06-13 07:38:31 -04001/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 *
20 * File: baseband.c
21 *
22 * Purpose: Implement functions to access baseband
23 *
24 * Author: Jerry Chen
25 *
26 * Date: Jun. 5, 2002
27 *
28 * Functions:
29 * BBuGetFrameTime - Calculate data frame transmitting time
30 * BBvCaculateParameter - Caculate PhyLength, PhyService and Phy Signal parameter for baseband Tx
31 * BBbVT3184Init - VIA VT3184 baseband chip init code
32 * BBvLoopbackOn - Turn on BaseBand Loopback mode
33 * BBvLoopbackOff - Turn off BaseBand Loopback mode
34 *
35 * Revision History:
36 *
37 *
38 */
39
40
41#if !defined(__TMACRO_H__)
42#include "tmacro.h"
43#endif
44#if !defined(__TBIT_H__)
45#include "tbit.h"
46#endif
47#if !defined(__TETHER_H__)
48#include "tether.h"
49#endif
50#if !defined(__MAC_H__)
51#include "mac.h"
52#endif
53#if !defined(__BASEBAND_H__)
54#include "baseband.h"
55#endif
56#if !defined(__RF_H__)
57#include "rf.h"
58#endif
59#if !defined(__SROM_H__)
60#include "srom.h"
61#endif
62#if !defined(__CONTROL_H__)
63#include "control.h"
64#endif
65#if !defined(__DATARATE_H__)
66#include "datarate.h"
67#endif
68#if !defined(__RNDIS_H__)
69#include "rndis.h"
70#endif
71#if !defined(__CONTROL_H__)
72#include "control.h"
73#endif
74
75/*--------------------- Static Definitions -------------------------*/
76static int msglevel =MSG_LEVEL_INFO;
77//static int msglevel =MSG_LEVEL_DEBUG;
78
79/*--------------------- Static Classes ----------------------------*/
80
81/*--------------------- Static Variables --------------------------*/
82
83/*--------------------- Static Functions --------------------------*/
84
85/*--------------------- Export Variables --------------------------*/
86
87/*--------------------- Static Definitions -------------------------*/
88
89/*--------------------- Static Classes ----------------------------*/
90
91/*--------------------- Static Variables --------------------------*/
92
93
94BYTE abyVT3184_AGC[] = {
95 0x00, //0
96 0x00, //1
97 0x02, //2
98 0x02, //3 //RobertYu:20060505, 0x04, //3
99 0x04, //4
100 0x04, //5 //RobertYu:20060505, 0x06, //5
101 0x06, //6
102 0x06, //7
103 0x08, //8
104 0x08, //9
105 0x0A, //A
106 0x0A, //B
107 0x0C, //C
108 0x0C, //D
109 0x0E, //E
110 0x0E, //F
111 0x10, //10
112 0x10, //11
113 0x12, //12
114 0x12, //13
115 0x14, //14
116 0x14, //15
117 0x16, //16
118 0x16, //17
119 0x18, //18
120 0x18, //19
121 0x1A, //1A
122 0x1A, //1B
123 0x1C, //1C
124 0x1C, //1D
125 0x1E, //1E
126 0x1E, //1F
127 0x20, //20
128 0x20, //21
129 0x22, //22
130 0x22, //23
131 0x24, //24
132 0x24, //25
133 0x26, //26
134 0x26, //27
135 0x28, //28
136 0x28, //29
137 0x2A, //2A
138 0x2A, //2B
139 0x2C, //2C
140 0x2C, //2D
141 0x2E, //2E
142 0x2E, //2F
143 0x30, //30
144 0x30, //31
145 0x32, //32
146 0x32, //33
147 0x34, //34
148 0x34, //35
149 0x36, //36
150 0x36, //37
151 0x38, //38
152 0x38, //39
153 0x3A, //3A
154 0x3A, //3B
155 0x3C, //3C
156 0x3C, //3D
157 0x3E, //3E
158 0x3E //3F
159};
160
161
162BYTE abyVT3184_AL2230[] = {
163 0x31,//00
164 0x00,
165 0x00,
166 0x00,
167 0x00,
168 0x80,
169 0x00,
170 0x00,
171 0x70,
172 0x45,//tx //0x64 for FPGA
173 0x2A,
174 0x76,
175 0x00,
176 0x00,
177 0x80,
178 0x00,
179 0x00,//10
180 0x00,
181 0x00,
182 0x00,
183 0x00,
184 0x00,
185 0x00,
186 0x00,
187 0x00,
188 0x00,
189 0x00,
190 0x8e, //RobertYu:20060522, //0x8d,
191 0x0a, //RobertYu:20060515, //0x09,
192 0x00,
193 0x00,
194 0x00,
195 0x00,//20
196 0x00,
197 0x00,
198 0x00,
199 0x00,
200 0x4a,
201 0x00,
202 0x00,
203 0x00,
204 0x00,
205 0x00,
206 0x00,
207 0x00,
208 0x4a,
209 0x00,
210 0x0c, //RobertYu:20060522, //0x10,
211 0x26,//30
212 0x5b,
213 0x00,
214 0x00,
215 0x00,
216 0x00,
217 0xaa,
218 0xaa,
219 0xff,
220 0xff,
221 0x79,
222 0x00,
223 0x00,
224 0x0b,
225 0x48,
226 0x04,
227 0x00,//40
228 0x08,
229 0x00,
230 0x08,
231 0x08,
232 0x14,
233 0x05,
234 0x09,
235 0x00,
236 0x00,
237 0x00,
238 0x00,
239 0x09,
240 0x73,
241 0x00,
242 0xc5,
243 0x00,//50 //RobertYu:20060505, //0x15,//50
244 0x19,
245 0x00,
246 0x00,
247 0x00,
248 0x00,
249 0x00,
250 0x00,
251 0x00,
252 0xd0, //RobertYu:20060505, //0xb0,
253 0x00,
254 0x00,
255 0x00,
256 0x00,
257 0x00,
258 0x00,
259 0xe4,//60
260 0x80,
261 0x00,
262 0x00,
263 0x00,
264 0x00,
265 0x98,
266 0x0a,
267 0x00,
268 0x00,
269 0x00,
270 0x00,
271 0x00, //0x80 for FPGA
272 0x03,
273 0x01,
274 0x00,
275 0x00,//70
276 0x00,
277 0x00,
278 0x00,
279 0x00,
280 0x00,
281 0x00,
282 0x00,
283 0x00,
284 0x00,
285 0x00,
286 0x00,
287 0x00,
288 0x00,
289 0x00,
290 0x00,
291 0x8c,//80
292 0x01,
293 0x09,
294 0x00,
295 0x00,
296 0x00,
297 0x00,
298 0x00,
299 0x08,
300 0x00,
301 0x1f, //RobertYu:20060516, //0x0f,
302 0xb7,
303 0x88,
304 0x47,
305 0xaa,
306 0x00, //RobertYu:20060505, //0x02,
307 0x20,//90 //RobertYu:20060505, //0x22,//90
308 0x00,
309 0x00,
310 0x00,
311 0x00,
312 0x00,
313 0x00,
314 0xeb,
315 0x00,
316 0x00,
317 0x00,
318 0x00,
319 0x00,
320 0x00,
321 0x00,
322 0x01,
323 0x00,//a0
324 0x00,
325 0x00,
326 0x00,
327 0x00,
328 0x00,
329 0x10,
330 0x00,
331 0x18,
332 0x00,
333 0x00,
334 0x00,
335 0x00,
336 0x15, //RobertYu:20060516, //0x00,
337 0x00,
338 0x18,
339 0x38,//b0
340 0x30,
341 0x00,
342 0x00,
343 0xff,
344 0x0f,
345 0xe4,
346 0xe2,
347 0x00,
348 0x00,
349 0x00,
350 0x03,
351 0x01,
352 0x00,
353 0x00,
354 0x00,
355 0x18,//c0
356 0x20,
357 0x07,
358 0x18,
359 0xff,
360 0xff, //RobertYu:20060509, //0x2c,
361 0x0e, //RobertYu:20060530, //0x0c,
362 0x0a,
363 0x0e,
364 0x00, //RobertYu:20060505, //0x01,
365 0x82, //RobertYu:20060516, //0x8f,
366 0xa7,
367 0x3c,
368 0x10,
369 0x30, //RobertYu:20060627, //0x0b,
370 0x05, //RobertYu:20060516, //0x25,
371 0x40,//d0
372 0x12,
373 0x00,
374 0x00,
375 0x10,
376 0x28,
377 0x80,
378 0x2A,
379 0x00,
380 0x00,
381 0x00,
382 0x00,
383 0x00,
384 0x00,
385 0x00,
386 0x00,
387 0x00,//e0
388 0xf3, //RobertYu:20060516, //0xd3,
389 0x00,
390 0x00,
391 0x00,
392 0x10,
393 0x00,
394 0x12, //RobertYu:20060627, //0x10,
395 0x00,
396 0xf4,
397 0x00,
398 0xff,
399 0x79,
400 0x20,
401 0x30,
402 0x05, //RobertYu:20060516, //0x0c,
403 0x00,//f0
404 0x3e,
405 0x00,
406 0x00,
407 0x00,
408 0x00,
409 0x00,
410 0x00,
411 0x00,
412 0x00,
413 0x00,
414 0x00,
415 0x00,
416 0x00,
417 0x00,
418 0x00
419};
420
421
422
423//{{RobertYu:20060515, new BB setting for VT3226D0
424BYTE abyVT3184_VT3226D0[] = {
425 0x31,//00
426 0x00,
427 0x00,
428 0x00,
429 0x00,
430 0x80,
431 0x00,
432 0x00,
433 0x70,
434 0x45,//tx //0x64 for FPGA
435 0x2A,
436 0x76,
437 0x00,
438 0x00,
439 0x80,
440 0x00,
441 0x00,//10
442 0x00,
443 0x00,
444 0x00,
445 0x00,
446 0x00,
447 0x00,
448 0x00,
449 0x00,
450 0x00,
451 0x00,
452 0x8e, //RobertYu:20060525, //0x8d,
453 0x0a, //RobertYu:20060515, //0x09,
454 0x00,
455 0x00,
456 0x00,
457 0x00,//20
458 0x00,
459 0x00,
460 0x00,
461 0x00,
462 0x4a,
463 0x00,
464 0x00,
465 0x00,
466 0x00,
467 0x00,
468 0x00,
469 0x00,
470 0x4a,
471 0x00,
472 0x0c, //RobertYu:20060525, //0x10,
473 0x26,//30
474 0x5b,
475 0x00,
476 0x00,
477 0x00,
478 0x00,
479 0xaa,
480 0xaa,
481 0xff,
482 0xff,
483 0x79,
484 0x00,
485 0x00,
486 0x0b,
487 0x48,
488 0x04,
489 0x00,//40
490 0x08,
491 0x00,
492 0x08,
493 0x08,
494 0x14,
495 0x05,
496 0x09,
497 0x00,
498 0x00,
499 0x00,
500 0x00,
501 0x09,
502 0x73,
503 0x00,
504 0xc5,
505 0x00,//50 //RobertYu:20060505, //0x15,//50
506 0x19,
507 0x00,
508 0x00,
509 0x00,
510 0x00,
511 0x00,
512 0x00,
513 0x00,
514 0xd0, //RobertYu:20060505, //0xb0,
515 0x00,
516 0x00,
517 0x00,
518 0x00,
519 0x00,
520 0x00,
521 0xe4,//60
522 0x80,
523 0x00,
524 0x00,
525 0x00,
526 0x00,
527 0x98,
528 0x0a,
529 0x00,
530 0x00,
531 0x00,
532 0x00,
533 0x00, //0x80 for FPGA
534 0x03,
535 0x01,
536 0x00,
537 0x00,//70
538 0x00,
539 0x00,
540 0x00,
541 0x00,
542 0x00,
543 0x00,
544 0x00,
545 0x00,
546 0x00,
547 0x00,
548 0x00,
549 0x00,
550 0x00,
551 0x00,
552 0x00,
553 0x8c,//80
554 0x01,
555 0x09,
556 0x00,
557 0x00,
558 0x00,
559 0x00,
560 0x00,
561 0x08,
562 0x00,
563 0x1f, //RobertYu:20060515, //0x0f,
564 0xb7,
565 0x88,
566 0x47,
567 0xaa,
568 0x00, //RobertYu:20060505, //0x02,
569 0x20,//90 //RobertYu:20060505, //0x22,//90
570 0x00,
571 0x00,
572 0x00,
573 0x00,
574 0x00,
575 0x00,
576 0xeb,
577 0x00,
578 0x00,
579 0x00,
580 0x00,
581 0x00,
582 0x00,
583 0x00,
584 0x01,
585 0x00,//a0
586 0x00,
587 0x00,
588 0x00,
589 0x00,
590 0x00,
591 0x10,
592 0x00,
593 0x18,
594 0x00,
595 0x00,
596 0x00,
597 0x00,
598 0x00,
599 0x00,
600 0x18,
601 0x38,//b0
602 0x30,
603 0x00,
604 0x00,
605 0xff,
606 0x0f,
607 0xe4,
608 0xe2,
609 0x00,
610 0x00,
611 0x00,
612 0x03,
613 0x01,
614 0x00,
615 0x00,
616 0x00,
617 0x18,//c0
618 0x20,
619 0x07,
620 0x18,
621 0xff,
622 0xff, //RobertYu:20060509, //0x2c,
623 0x10, //RobertYu:20060525, //0x0c,
624 0x0a,
625 0x0e,
626 0x00, //RobertYu:20060505, //0x01,
627 0x84, //RobertYu:20060525, //0x8f,
628 0xa7,
629 0x3c,
630 0x10,
631 0x24, //RobertYu:20060627, //0x18,
632 0x05, //RobertYu:20060515, //0x25,
633 0x40,//d0
634 0x12,
635 0x00,
636 0x00,
637 0x10,
638 0x28,
639 0x80,
640 0x2A,
641 0x00,
642 0x00,
643 0x00,
644 0x00,
645 0x00,
646 0x00,
647 0x00,
648 0x00,
649 0x00,//e0
650 0xf3, //RobertYu:20060515, //0xd3,
651 0x00,
652 0x00,
653 0x00,
654 0x10,
655 0x00,
656 0x10, //RobertYu:20060627, //0x0e,
657 0x00,
658 0xf4,
659 0x00,
660 0xff,
661 0x79,
662 0x20,
663 0x30,
664 0x08, //RobertYu:20060515, //0x0c,
665 0x00,//f0
666 0x3e,
667 0x00,
668 0x00,
669 0x00,
670 0x00,
671 0x00,
672 0x00,
673 0x00,
674 0x00,
675 0x00,
676 0x00,
677 0x00,
678 0x00,
679 0x00,
680 0x00,
681};
682
683const WORD awcFrameTime[MAX_RATE] =
684{10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216};
685
686/*--------------------- Static Functions --------------------------*/
687
688/*
689static
690ULONG
691s_ulGetLowSQ3(PSDevice pDevice);
692
693static
694ULONG
695s_ulGetRatio(PSDevice pDevice);
696
697static
698void
699s_vClearSQ3Value(PSDevice pDevice);
700*/
701
702/*--------------------- Export Variables --------------------------*/
703/*
704 * Description: Calculate data frame transmitting time
705 *
706 * Parameters:
707 * In:
708 * byPreambleType - Preamble Type
709 * byPktType - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA
710 * cbFrameLength - Baseband Type
711 * wRate - Tx Rate
712 * Out:
713 *
714 * Return Value: FrameTime
715 *
716 */
717UINT
718BBuGetFrameTime (
719 IN BYTE byPreambleType,
720 IN BYTE byPktType,
721 IN UINT cbFrameLength,
722 IN WORD wRate
723 )
724{
725 UINT uFrameTime;
726 UINT uPreamble;
727 UINT uTmp;
728 UINT uRateIdx = (UINT)wRate;
729 UINT uRate = 0;
730
731
732 if (uRateIdx > RATE_54M) {
733 ASSERT(0);
734 return 0;
735 }
736
737 uRate = (UINT)awcFrameTime[uRateIdx];
738
739 if (uRateIdx <= 3) { //CCK mode
740
741 if (byPreambleType == 1) {//Short
742 uPreamble = 96;
743 } else {
744 uPreamble = 192;
745 }
746 uFrameTime = (cbFrameLength * 80) / uRate;
747 uTmp = (uFrameTime * uRate) / 80;
748 if (cbFrameLength != uTmp) {
749 uFrameTime ++;
750 }
751
752 return (uPreamble + uFrameTime);
753 }
754 else {
755 uFrameTime = (cbFrameLength * 8 + 22) / uRate;
756 uTmp = ((uFrameTime * uRate) - 22) / 8;
757 if(cbFrameLength != uTmp) {
758 uFrameTime ++;
759 }
760 uFrameTime = uFrameTime * 4;
761 if(byPktType != PK_TYPE_11A) {
762 uFrameTime += 6;
763 }
764 return (20 + uFrameTime);
765 }
766}
767
768/*
769 * Description: Caculate Length, Service, and Signal fields of Phy for Tx
770 *
771 * Parameters:
772 * In:
773 * pDevice - Device Structure
774 * cbFrameLength - Tx Frame Length
775 * wRate - Tx Rate
776 * Out:
777 * pwPhyLen - pointer to Phy Length field
778 * pbyPhySrv - pointer to Phy Service field
779 * pbyPhySgn - pointer to Phy Signal field
780 *
781 * Return Value: none
782 *
783 */
784VOID
785BBvCaculateParameter (
786 IN PSDevice pDevice,
787 IN UINT cbFrameLength,
788 IN WORD wRate,
789 IN BYTE byPacketType,
790 OUT PWORD pwPhyLen,
791 OUT PBYTE pbyPhySrv,
792 OUT PBYTE pbyPhySgn
793 )
794{
795 UINT cbBitCount;
796 UINT cbUsCount = 0;
797 UINT cbTmp;
798 BOOL bExtBit;
799 BYTE byPreambleType = pDevice->byPreambleType;
800 BOOL bCCK = pDevice->bCCK;
801
802 cbBitCount = cbFrameLength * 8;
803 bExtBit = FALSE;
804
805 switch (wRate) {
806 case RATE_1M :
807 cbUsCount = cbBitCount;
808 *pbyPhySgn = 0x00;
809 break;
810
811 case RATE_2M :
812 cbUsCount = cbBitCount / 2;
813 if (byPreambleType == 1)
814 *pbyPhySgn = 0x09;
815 else // long preamble
816 *pbyPhySgn = 0x01;
817 break;
818
819 case RATE_5M :
820 if (bCCK == FALSE)
821 cbBitCount ++;
822 cbUsCount = (cbBitCount * 10) / 55;
823 cbTmp = (cbUsCount * 55) / 10;
824 if (cbTmp != cbBitCount)
825 cbUsCount ++;
826 if (byPreambleType == 1)
827 *pbyPhySgn = 0x0a;
828 else // long preamble
829 *pbyPhySgn = 0x02;
830 break;
831
832 case RATE_11M :
833
834 if (bCCK == FALSE)
835 cbBitCount ++;
836 cbUsCount = cbBitCount / 11;
837 cbTmp = cbUsCount * 11;
838 if (cbTmp != cbBitCount) {
839 cbUsCount ++;
840 if ((cbBitCount - cbTmp) <= 3)
841 bExtBit = TRUE;
842 }
843 if (byPreambleType == 1)
844 *pbyPhySgn = 0x0b;
845 else // long preamble
846 *pbyPhySgn = 0x03;
847 break;
848
849 case RATE_6M :
850 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
851 *pbyPhySgn = 0x9B; //1001 1011
852 }
853 else {//11g, 2.4GHZ
854 *pbyPhySgn = 0x8B; //1000 1011
855 }
856 break;
857
858 case RATE_9M :
859 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
860 *pbyPhySgn = 0x9F; //1001 1111
861 }
862 else {//11g, 2.4GHZ
863 *pbyPhySgn = 0x8F; //1000 1111
864 }
865 break;
866
867 case RATE_12M :
868 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
869 *pbyPhySgn = 0x9A; //1001 1010
870 }
871 else {//11g, 2.4GHZ
872 *pbyPhySgn = 0x8A; //1000 1010
873 }
874 break;
875
876 case RATE_18M :
877 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
878 *pbyPhySgn = 0x9E; //1001 1110
879 }
880 else {//11g, 2.4GHZ
881 *pbyPhySgn = 0x8E; //1000 1110
882 }
883 break;
884
885 case RATE_24M :
886 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
887 *pbyPhySgn = 0x99; //1001 1001
888 }
889 else {//11g, 2.4GHZ
890 *pbyPhySgn = 0x89; //1000 1001
891 }
892 break;
893
894 case RATE_36M :
895 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
896 *pbyPhySgn = 0x9D; //1001 1101
897 }
898 else {//11g, 2.4GHZ
899 *pbyPhySgn = 0x8D; //1000 1101
900 }
901 break;
902
903 case RATE_48M :
904 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
905 *pbyPhySgn = 0x98; //1001 1000
906 }
907 else {//11g, 2.4GHZ
908 *pbyPhySgn = 0x88; //1000 1000
909 }
910 break;
911
912 case RATE_54M :
913 if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
914 *pbyPhySgn = 0x9C; //1001 1100
915 }
916 else {//11g, 2.4GHZ
917 *pbyPhySgn = 0x8C; //1000 1100
918 }
919 break;
920
921 default :
922 if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
923 *pbyPhySgn = 0x9C; //1001 1100
924 }
925 else {//11g, 2.4GHZ
926 *pbyPhySgn = 0x8C; //1000 1100
927 }
928 break;
929 }
930
931 if (byPacketType == PK_TYPE_11B) {
932 *pbyPhySrv = 0x00;
933 if (bExtBit)
934 *pbyPhySrv = *pbyPhySrv | 0x80;
935 *pwPhyLen = (WORD) cbUsCount;
936 }
937 else {
938 *pbyPhySrv = 0x00;
939 *pwPhyLen = (WORD)cbFrameLength;
940 }
941}
942
943
944/*
945 * Description: Set Antenna mode
946 *
947 * Parameters:
948 * In:
949 * pDevice - Device Structure
950 * byAntennaMode - Antenna Mode
951 * Out:
952 * none
953 *
954 * Return Value: none
955 *
956 */
957VOID
958BBvSetAntennaMode (PSDevice pDevice, BYTE byAntennaMode)
959{
960 //{{ RobertYu: 20041124, ABG Mode, VC1/VC2 define, make the ANT_A, ANT_B inverted
961 /*if ( (pDevice->byRFType == RF_MAXIM2829) ||
962 (pDevice->byRFType == RF_UW2452) ||
963 (pDevice->byRFType == RF_AIROHA7230) ) { // RobertYu: 20041210, 20050104
964
965 switch (byAntennaMode) {
966 case ANT_TXA:
967 byAntennaMode = ANT_TXB;
968 break;
969 case ANT_TXB:
970 byAntennaMode = ANT_TXA;
971 break;
972 case ANT_RXA:
973 byAntennaMode = ANT_RXB;
974 break;
975 case ANT_RXB:
976 byAntennaMode = ANT_RXA;
977 break;
978 }
979 }*/
980
981 switch (byAntennaMode) {
982 case ANT_TXA:
983 break;
984 case ANT_TXB:
985 break;
986 case ANT_RXA:
987 pDevice->byBBRxConf &= 0xFC;
988 break;
989 case ANT_RXB:
990 pDevice->byBBRxConf &= 0xFE;
991 pDevice->byBBRxConf |= 0x02;;
992 break;
993 }
994
995
996 CONTROLnsRequestOut(pDevice,
997 MESSAGE_TYPE_SET_ANTMD,
998 (WORD) byAntennaMode,
999 0,
1000 0,
1001 NULL);
1002}
1003
1004/*
1005 * Description: Set Antenna mode
1006 *
1007 * Parameters:
1008 * In:
1009 * pDevice - Device Structure
1010 * byAntennaMode - Antenna Mode
1011 * Out:
1012 * none
1013 *
1014 * Return Value: none
1015 *
1016 */
1017BOOL
1018BBbVT3184Init (PSDevice pDevice)
1019{
1020 NTSTATUS ntStatus;
1021 WORD wLength;
1022 PBYTE pbyAddr;
1023 PBYTE pbyAgc;
1024 WORD wLengthAgc;
1025 BYTE abyArray[256];
1026
1027 ntStatus = CONTROLnsRequestIn(pDevice,
1028 MESSAGE_TYPE_READ,
1029 0,
1030 MESSAGE_REQUEST_EEPROM,
1031 EEP_MAX_CONTEXT_SIZE,
1032 pDevice->abyEEPROM);
1033 if (ntStatus != STATUS_SUCCESS) {
1034 return FALSE;
1035 }
1036
1037
1038 //20080215-01,<Add> by Mike Liu
1039// if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04)
1040// return FALSE;
1041
1042//20080804-01,<Add> by Mike Liu
1043//zonetype initial
1044 pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
1045 if(pDevice->config_file.ZoneType >= 0) { //read zonetype file ok!
1046 if ((pDevice->config_file.ZoneType == 0)&&
1047 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] !=0x00)){ //for USA
1048 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
1049 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
1050 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :USA\n");
1051 }
1052 else if((pDevice->config_file.ZoneType == 1)&&
1053 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x01)){ //for Japan
1054 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
1055 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
1056 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Japan\n");
1057 }
1058 else if((pDevice->config_file.ZoneType == 2)&&
1059 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x02)){ //for Europe
1060 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
1061 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
1062 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Europe\n");
1063 }
1064else {
1065 if(pDevice->config_file.ZoneType !=pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
1066 printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",pDevice->config_file.ZoneType,pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
1067 else
1068 printk("Read Zonetype file sucess,use default zonetype setting[%02x]\n",pDevice->config_file.ZoneType);
1069 }
1070}
1071
1072 if ( !pDevice->bZoneRegExist ) {
1073 pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
1074 }
1075 pDevice->byRFType = pDevice->abyEEPROM[EEP_OFS_RFTYPE];
1076
1077 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Zone Type %x\n", pDevice->byZoneType);
1078 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RF Type %d\n", pDevice->byRFType);
1079
1080 if ((pDevice->byRFType == RF_AL2230) || (pDevice->byRFType == RF_AL2230S)) {
1081 pDevice->byBBRxConf = abyVT3184_AL2230[10];
1082 wLength = sizeof(abyVT3184_AL2230);
1083 pbyAddr = abyVT3184_AL2230;
1084 pbyAgc = abyVT3184_AGC;
1085 wLengthAgc = sizeof(abyVT3184_AGC);
1086
1087 pDevice->abyBBVGA[0] = 0x1C;
1088 pDevice->abyBBVGA[1] = 0x10;
1089 pDevice->abyBBVGA[2] = 0x0;
1090 pDevice->abyBBVGA[3] = 0x0;
1091 pDevice->ldBmThreshold[0] = -70;
1092 pDevice->ldBmThreshold[1] = -48;
1093 pDevice->ldBmThreshold[2] = 0;
1094 pDevice->ldBmThreshold[3] = 0;
1095 }
1096 else if (pDevice->byRFType == RF_AIROHA7230) {
1097 pDevice->byBBRxConf = abyVT3184_AL2230[10];
1098 wLength = sizeof(abyVT3184_AL2230);
1099 pbyAddr = abyVT3184_AL2230;
1100 pbyAgc = abyVT3184_AGC;
1101 wLengthAgc = sizeof(abyVT3184_AGC);
1102
1103 // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1104 //pbyAddr[0x09] = 0x41;
1105 // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1106 //pbyAddr[0x0a] = 0x28;
1107 // Select VC1/VC2, CR215 = 0x02->0x06
1108 pbyAddr[0xd7] = 0x06;
1109
1110 pDevice->abyBBVGA[0] = 0x1C;
1111 pDevice->abyBBVGA[1] = 0x10;
1112 pDevice->abyBBVGA[2] = 0x0;
1113 pDevice->abyBBVGA[3] = 0x0;
1114 pDevice->ldBmThreshold[0] = -70;
1115 pDevice->ldBmThreshold[1] = -48;
1116 pDevice->ldBmThreshold[2] = 0;
1117 pDevice->ldBmThreshold[3] = 0;
1118 }
1119 else if ( (pDevice->byRFType == RF_VT3226) || (pDevice->byRFType == RF_VT3226D0) ) {
1120 pDevice->byBBRxConf = abyVT3184_VT3226D0[10]; //RobertYu:20060515
1121 wLength = sizeof(abyVT3184_VT3226D0); //RobertYu:20060515
1122 pbyAddr = abyVT3184_VT3226D0; //RobertYu:20060515
1123 pbyAgc = abyVT3184_AGC;
1124 wLengthAgc = sizeof(abyVT3184_AGC);
1125
1126 pDevice->abyBBVGA[0] = 0x20; //RobertYu:20060104, reguest by Jack
1127 pDevice->abyBBVGA[1] = 0x10;
1128 pDevice->abyBBVGA[2] = 0x0;
1129 pDevice->abyBBVGA[3] = 0x0;
1130 pDevice->ldBmThreshold[0] = -70;
1131 pDevice->ldBmThreshold[1] = -48;
1132 pDevice->ldBmThreshold[2] = 0;
1133 pDevice->ldBmThreshold[3] = 0;
1134 // Fix VT3226 DFC system timing issue
1135 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
1136 //}}
1137 //{{RobertYu:20060609
1138 } else if ( (pDevice->byRFType == RF_VT3342A0) ) {
1139 pDevice->byBBRxConf = abyVT3184_VT3226D0[10];
1140 wLength = sizeof(abyVT3184_VT3226D0);
1141 pbyAddr = abyVT3184_VT3226D0;
1142 pbyAgc = abyVT3184_AGC;
1143 wLengthAgc = sizeof(abyVT3184_AGC);
1144
1145 pDevice->abyBBVGA[0] = 0x20;
1146 pDevice->abyBBVGA[1] = 0x10;
1147 pDevice->abyBBVGA[2] = 0x0;
1148 pDevice->abyBBVGA[3] = 0x0;
1149 pDevice->ldBmThreshold[0] = -70;
1150 pDevice->ldBmThreshold[1] = -48;
1151 pDevice->ldBmThreshold[2] = 0;
1152 pDevice->ldBmThreshold[3] = 0;
1153 // Fix VT3226 DFC system timing issue
1154 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
1155 //}}
1156 } else {
1157 return TRUE;
1158 }
1159
1160 memcpy(abyArray, pbyAddr, wLength);
1161 CONTROLnsRequestOut(pDevice,
1162 MESSAGE_TYPE_WRITE,
1163 0,
1164 MESSAGE_REQUEST_BBREG,
1165 wLength,
1166 abyArray
1167 );
1168
1169 memcpy(abyArray, pbyAgc, wLengthAgc);
1170 CONTROLnsRequestOut(pDevice,
1171 MESSAGE_TYPE_WRITE,
1172 0,
1173 MESSAGE_REQUEST_BBAGC,
1174 wLengthAgc,
1175 abyArray
1176 );
1177
1178
1179 if ((pDevice->byRFType == RF_VT3226) || //RobertYu:20051116, 20060111 remove VT3226D0
1180 (pDevice->byRFType == RF_VT3342A0) //RobertYu:20060609
1181 ) {
1182 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x23);
1183 MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
1184 }
1185 else if (pDevice->byRFType == RF_VT3226D0)
1186 {
1187 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x11);
1188 MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
1189 }
1190
1191
1192 ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x04,0x7F);
1193 ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01);
1194
1195 RFbRFTableDownload(pDevice);
1196 return TRUE;//ntStatus;
1197}
1198
1199
1200/*
1201 * Description: Turn on BaseBand Loopback mode
1202 *
1203 * Parameters:
1204 * In:
1205 * pDevice - Device Structure
1206 *
1207 * Out:
1208 * none
1209 *
1210 * Return Value: none
1211 *
1212 */
1213void BBvLoopbackOn (PSDevice pDevice)
1214{
1215 BYTE byData;
1216
1217 //CR C9 = 0x00
1218 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xC9, &pDevice->byBBCRc9);//CR201
1219 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0);
1220 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x4D, &pDevice->byBBCR4d);//CR77
1221 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, 0x90);
1222
1223 //CR 88 = 0x02(CCK), 0x03(OFDM)
1224 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x88, &pDevice->byBBCR88);//CR136
1225
1226 if (pDevice->wCurrentRate <= RATE_11M) { //CCK
1227 // Enable internal digital loopback: CR33 |= 0000 0001
1228 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33
1229 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData | 0x01));//CR33
1230 // CR154 = 0x00
1231 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, 0); //CR154
1232
1233 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02);//CR239
1234 }
1235 else { //OFDM
1236 // Enable internal digital loopback:CR154 |= 0000 0001
1237 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154
1238 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData | 0x01));//CR154
1239 // CR33 = 0x00
1240 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, 0); //CR33
1241
1242 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03);//CR239
1243 }
1244
1245 //CR14 = 0x00
1246 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, 0);//CR14
1247
1248 // Disable TX_IQUN
1249 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x09, &pDevice->byBBCR09);
1250 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, (BYTE)(pDevice->byBBCR09 & 0xDE));
1251}
1252
1253/*
1254 * Description: Turn off BaseBand Loopback mode
1255 *
1256 * Parameters:
1257 * In:
1258 * pDevice - Device Structure
1259 *
1260 * Out:
1261 * none
1262 *
1263 * Return Value: none
1264 *
1265 */
1266void BBvLoopbackOff (PSDevice pDevice)
1267{
1268 BYTE byData;
1269
1270 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, pDevice->byBBCRc9);//CR201
1271 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, pDevice->byBBCR88);//CR136
1272 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, pDevice->byBBCR09);//CR136
1273 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, pDevice->byBBCR4d);//CR77
1274
1275 if (pDevice->wCurrentRate <= RATE_11M) { // CCK
1276 // Set the CR33 Bit2 to disable internal Loopback.
1277 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33
1278 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData & 0xFE));//CR33
1279 }
1280 else { // OFDM
1281 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154
1282 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData & 0xFE));//CR154
1283 }
1284 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x0E, &byData);//CR14
1285 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, (BYTE)(byData | 0x80));//CR14
1286
1287}
1288
1289
1290/*
1291 * Description: Set ShortSlotTime mode
1292 *
1293 * Parameters:
1294 * In:
1295 * pDevice - Device Structure
1296 * Out:
1297 * none
1298 *
1299 * Return Value: none
1300 *
1301 */
1302VOID
1303BBvSetShortSlotTime (PSDevice pDevice)
1304{
1305 BYTE byBBVGA=0;
1306
1307 if (pDevice->bShortSlotTime) {
1308 pDevice->byBBRxConf &= 0xDF;//1101 1111
1309 } else {
1310 pDevice->byBBRxConf |= 0x20;//0010 0000
1311 }
1312
1313 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xE7, &byBBVGA);
1314 if (byBBVGA == pDevice->abyBBVGA[0]) {
1315 pDevice->byBBRxConf |= 0x20;//0010 0000
1316 }
1317
1318 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);
1319
1320}
1321
1322
1323VOID BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData)
1324{
1325
1326 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData);
1327
1328 // patch for 3253B0 Baseband with Cardbus module
1329 if (byData == pDevice->abyBBVGA[0]) {
1330 pDevice->byBBRxConf |= 0x20;//0010 0000
1331 } else if (pDevice->bShortSlotTime) {
1332 pDevice->byBBRxConf &= 0xDF;//1101 1111
1333 } else {
1334 pDevice->byBBRxConf |= 0x20;//0010 0000
1335 }
1336 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10
1337}
1338
1339
1340/*
1341 * Description: Baseband SoftwareReset
1342 *
1343 * Parameters:
1344 * In:
1345 * dwIoBase - I/O base address
1346 * Out:
1347 * none
1348 *
1349 * Return Value: none
1350 *
1351 */
1352VOID
1353BBvSoftwareReset (PSDevice pDevice)
1354{
1355 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40);
1356 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0);
1357 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0x01);
1358 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0);
1359}
1360
1361/*
1362 * Description: BBvSetDeepSleep
1363 *
1364 * Parameters:
1365 * In:
1366 * pDevice - Device Structure
1367 * Out:
1368 * none
1369 *
1370 * Return Value: none
1371 *
1372 */
1373VOID
1374BBvSetDeepSleep (PSDevice pDevice)
1375{
1376 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12
1377 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13
1378}
1379
1380VOID
1381BBvExitDeepSleep (PSDevice pDevice)
1382{
1383 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12
1384 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13
1385}
1386
1387
1388static
1389ULONG
1390s_ulGetLowSQ3(PSDevice pDevice)
1391{
1392int ii;
1393ULONG ulSQ3 = 0;
1394ULONG ulMaxPacket;
1395
1396 ulMaxPacket = pDevice->aulPktNum[RATE_54M];
1397 if ( pDevice->aulPktNum[RATE_54M] != 0 ) {
1398 ulSQ3 = pDevice->aulSQ3Val[RATE_54M] / pDevice->aulPktNum[RATE_54M];
1399 }
1400 for ( ii=RATE_48M;ii>=RATE_6M;ii-- ) {
1401 if ( pDevice->aulPktNum[ii] > ulMaxPacket ) {
1402 ulMaxPacket = pDevice->aulPktNum[ii];
1403 ulSQ3 = pDevice->aulSQ3Val[ii] / pDevice->aulPktNum[ii];
1404 }
1405 }
1406
1407 return ulSQ3;
1408}
1409
1410
1411
1412static
1413ULONG
1414s_ulGetRatio (PSDevice pDevice)
1415{
1416int ii,jj;
1417ULONG ulRatio = 0;
1418ULONG ulMaxPacket;
1419ULONG ulPacketNum;
1420
1421 //This is a thousand-ratio
1422 ulMaxPacket = pDevice->aulPktNum[RATE_54M];
1423 if ( pDevice->aulPktNum[RATE_54M] != 0 ) {
1424 ulPacketNum = pDevice->aulPktNum[RATE_54M];
1425 ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
1426 ulRatio += TOP_RATE_54M;
1427 }
1428 for ( ii=RATE_48M;ii>=RATE_1M;ii-- ) {
1429 if ( pDevice->aulPktNum[ii] > ulMaxPacket ) {
1430 ulPacketNum = 0;
1431 for ( jj=RATE_54M;jj>=ii;jj--)
1432 ulPacketNum += pDevice->aulPktNum[jj];
1433 ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
1434 ulRatio += TOP_RATE_48M;
1435 ulMaxPacket = pDevice->aulPktNum[ii];
1436 }
1437
1438 }
1439
1440 return ulRatio;
1441}
1442
1443
1444static
1445void
1446s_vClearSQ3Value (PSDevice pDevice)
1447{
1448 int ii;
1449 pDevice->uDiversityCnt = 0;
1450
1451 for ( ii=RATE_1M;ii<MAX_RATE;ii++) {
1452 pDevice->aulPktNum[ii] = 0;
1453 pDevice->aulSQ3Val[ii] = 0;
1454 }
1455}
1456
1457
1458/*
1459 * Description: Antenna Diversity
1460 *
1461 * Parameters:
1462 * In:
1463 * pDevice - Device Structure
1464 * byRSR - RSR from received packet
1465 * bySQ3 - SQ3 value from received packet
1466 * Out:
1467 * none
1468 *
1469 * Return Value: none
1470 *
1471 */
1472
1473VOID
1474BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3)
1475{
1476
1477 pDevice->uDiversityCnt++;
1478 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt);
1479
1480 if (byRxRate == 2) {
1481 pDevice->aulPktNum[RATE_1M]++;
1482 }
1483 else if (byRxRate==4) {
1484 pDevice->aulPktNum[RATE_2M]++;
1485 }
1486 else if (byRxRate==11) {
1487 pDevice->aulPktNum[RATE_5M]++;
1488 }
1489 else if (byRxRate==22) {
1490 pDevice->aulPktNum[RATE_11M]++;
1491 }
1492 else if(byRxRate==12){
1493 pDevice->aulPktNum[RATE_6M]++;
1494 pDevice->aulSQ3Val[RATE_6M] += bySQ3;
1495 }
1496 else if(byRxRate==18){
1497 pDevice->aulPktNum[RATE_9M]++;
1498 pDevice->aulSQ3Val[RATE_9M] += bySQ3;
1499 }
1500 else if(byRxRate==24){
1501 pDevice->aulPktNum[RATE_12M]++;
1502 pDevice->aulSQ3Val[RATE_12M] += bySQ3;
1503 }
1504 else if(byRxRate==36){
1505 pDevice->aulPktNum[RATE_18M]++;
1506 pDevice->aulSQ3Val[RATE_18M] += bySQ3;
1507 }
1508 else if(byRxRate==48){
1509 pDevice->aulPktNum[RATE_24M]++;
1510 pDevice->aulSQ3Val[RATE_24M] += bySQ3;
1511 }
1512 else if(byRxRate==72){
1513 pDevice->aulPktNum[RATE_36M]++;
1514 pDevice->aulSQ3Val[RATE_36M] += bySQ3;
1515 }
1516 else if(byRxRate==96){
1517 pDevice->aulPktNum[RATE_48M]++;
1518 pDevice->aulSQ3Val[RATE_48M] += bySQ3;
1519 }
1520 else if(byRxRate==108){
1521 pDevice->aulPktNum[RATE_54M]++;
1522 pDevice->aulSQ3Val[RATE_54M] += bySQ3;
1523 }
1524
1525 if (pDevice->byAntennaState == 0) {
1526
1527 if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) {
1528 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n",(int)pDevice->ulDiversityNValue, (int)pDevice->aulPktNum[RATE_54M]);
1529
1530 pDevice->ulSQ3_State0 = s_ulGetLowSQ3(pDevice);
1531 pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
1532 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, SQ3= [%08x] rate = [%08x]\n",(int)pDevice->ulSQ3_State0,(int)pDevice->ulRatio_State0);
1533
1534 if ( ((pDevice->aulPktNum[RATE_54M] < pDevice->ulDiversityNValue/2) &&
1535 (pDevice->ulSQ3_State0 > pDevice->ulSQ3TH) ) ||
1536 (pDevice->ulSQ3_State0 == 0 ) ) {
1537
1538 if ( pDevice->byTMax == 0 )
1539 return;
1540
1541 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1542
1543 pDevice->byAntennaState = 1;
1544
1545 del_timer(&pDevice->TimerSQ3Tmax3);
1546 del_timer(&pDevice->TimerSQ3Tmax2);
1547 pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
1548 add_timer(&pDevice->TimerSQ3Tmax1);
1549
1550 } else {
1551 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1552 add_timer(&pDevice->TimerSQ3Tmax3);
1553 }
1554 s_vClearSQ3Value(pDevice);
1555
1556 }
1557 } else { //byAntennaState == 1
1558
1559 if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) {
1560
1561 del_timer(&pDevice->TimerSQ3Tmax1);
1562 pDevice->ulSQ3_State1 = s_ulGetLowSQ3(pDevice);
1563 pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
1564 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n",(int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1);
1565
1566 if ( ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 != 0)) ||
1567 ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 == 0) && (pDevice->ulRatio_State1 < pDevice->ulRatio_State0)) ||
1568 ((pDevice->ulSQ3_State1 != 0) && (pDevice->ulSQ3_State0 != 0) && (pDevice->ulSQ3_State0 < pDevice->ulSQ3_State1))
1569 ) {
1570
1571 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1572
1573 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1574 pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
1575 add_timer(&pDevice->TimerSQ3Tmax3);
1576 add_timer(&pDevice->TimerSQ3Tmax2);
1577
1578 }
1579 pDevice->byAntennaState = 0;
1580 s_vClearSQ3Value(pDevice);
1581 }
1582 } //byAntennaState
1583}
1584
1585
1586/*+
1587 *
1588 * Description:
1589 * Timer for SQ3 antenna diversity
1590 *
1591 * Parameters:
1592 * In:
1593 * pvSysSpec1
1594 * hDeviceContext - Pointer to the adapter
1595 * pvSysSpec2
1596 * pvSysSpec3
1597 * Out:
1598 * none
1599 *
1600 * Return Value: none
1601 *
1602-*/
1603
1604VOID
1605TimerSQ3CallBack (
1606 IN HANDLE hDeviceContext
1607 )
1608{
1609 PSDevice pDevice = (PSDevice)hDeviceContext;
1610
1611 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack...");
1612 spin_lock_irq(&pDevice->lock);
1613
1614 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1615 pDevice->byAntennaState = 0;
1616 s_vClearSQ3Value(pDevice);
1617 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1618 pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
1619 add_timer(&pDevice->TimerSQ3Tmax3);
1620 add_timer(&pDevice->TimerSQ3Tmax2);
1621
1622
1623 spin_unlock_irq(&pDevice->lock);
1624 return;
1625}
1626
1627
1628/*+
1629 *
1630 * Description:
1631 * Timer for SQ3 antenna diversity
1632 *
1633 * Parameters:
1634 * In:
1635 * pvSysSpec1
1636 * hDeviceContext - Pointer to the adapter
1637 * pvSysSpec2
1638 * pvSysSpec3
1639 * Out:
1640 * none
1641 *
1642 * Return Value: none
1643 *
1644-*/
1645
1646VOID
1647TimerSQ3Tmax3CallBack (
1648 IN HANDLE hDeviceContext
1649 )
1650{
1651 PSDevice pDevice = (PSDevice)hDeviceContext;
1652
1653 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack...");
1654 spin_lock_irq(&pDevice->lock);
1655
1656 pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
1657 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0 = [%08x]\n",(int)pDevice->ulRatio_State0);
1658
1659 s_vClearSQ3Value(pDevice);
1660 if ( pDevice->byTMax == 0 ) {
1661 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1662 add_timer(&pDevice->TimerSQ3Tmax3);
1663 spin_unlock_irq(&pDevice->lock);
1664 return;
1665 }
1666
1667 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1668 pDevice->byAntennaState = 1;
1669 del_timer(&pDevice->TimerSQ3Tmax3);
1670 del_timer(&pDevice->TimerSQ3Tmax2);
1671 pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
1672 add_timer(&pDevice->TimerSQ3Tmax1);
1673
1674 spin_unlock_irq(&pDevice->lock);
1675 return;
1676}
1677
1678VOID
1679BBvUpdatePreEDThreshold(
1680 IN PSDevice pDevice,
1681 IN BOOL bScanning)
1682{
1683
1684
1685 switch(pDevice->byRFType)
1686 {
1687 case RF_AL2230:
1688 case RF_AL2230S:
1689 case RF_AIROHA7230:
1690 //RobertYu:20060627, update new table
1691
1692 if( bScanning )
1693 { // need Max sensitivity //RSSI -69, -70,....
1694 if(pDevice->byBBPreEDIndex == 0) break;
1695 pDevice->byBBPreEDIndex = 0;
1696 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1697 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1698 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70, -71,...\n");
1699 break;
1700 }
1701
1702 if(pDevice->byBBPreEDRSSI <= 45) { // RSSI 0, -1,-2,....-45
1703 if(pDevice->byBBPreEDIndex == 20) break;
1704 pDevice->byBBPreEDIndex = 20;
1705 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1706 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1707 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-45\n");
1708 } else if(pDevice->byBBPreEDRSSI <= 46) { //RSSI -46
1709 if(pDevice->byBBPreEDIndex == 19) break;
1710 pDevice->byBBPreEDIndex = 19;
1711 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x1A); //CR201(0xC9)
1712 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1713 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46\n");
1714 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -47
1715 if(pDevice->byBBPreEDIndex == 18) break;
1716 pDevice->byBBPreEDIndex = 18;
1717 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x15); //CR201(0xC9)
1718 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1719 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -47\n");
1720 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1721 if(pDevice->byBBPreEDIndex == 17) break;
1722 pDevice->byBBPreEDIndex = 17;
1723 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0E); //CR201(0xC9)
1724 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1725 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1726 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1727 if(pDevice->byBBPreEDIndex == 16) break;
1728 pDevice->byBBPreEDIndex = 16;
1729 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x09); //CR201(0xC9)
1730 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1731 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1732 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1733 if(pDevice->byBBPreEDIndex == 15) break;
1734 pDevice->byBBPreEDIndex = 15;
1735 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x06); //CR201(0xC9)
1736 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1737 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1738 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1739 if(pDevice->byBBPreEDIndex == 14) break;
1740 pDevice->byBBPreEDIndex = 14;
1741 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x03); //CR201(0xC9)
1742 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1743 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1744 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1745 if(pDevice->byBBPreEDIndex == 13) break;
1746 pDevice->byBBPreEDIndex = 13;
1747 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1748 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE)
1749 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1750 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1751 if(pDevice->byBBPreEDIndex == 12) break;
1752 pDevice->byBBPreEDIndex = 12;
1753 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1754 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x20); //CR206(0xCE)
1755 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1756 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1757 if(pDevice->byBBPreEDIndex == 11) break;
1758 pDevice->byBBPreEDIndex = 11;
1759 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1760 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE)
1761 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1762 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1763 if(pDevice->byBBPreEDIndex == 10) break;
1764 pDevice->byBBPreEDIndex = 10;
1765 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1766 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x54); //CR206(0xCE)
1767 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1768 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1769 if(pDevice->byBBPreEDIndex == 9) break;
1770 pDevice->byBBPreEDIndex = 9;
1771 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1772 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x18); //CR206(0xCE)
1773 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1774 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1775 if(pDevice->byBBPreEDIndex == 8) break;
1776 pDevice->byBBPreEDIndex = 8;
1777 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1778 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xE3); //CR206(0xCE)
1779 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
1780 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
1781 if(pDevice->byBBPreEDIndex == 7) break;
1782 pDevice->byBBPreEDIndex = 7;
1783 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1784 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB9); //CR206(0xCE)
1785 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
1786 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
1787 if(pDevice->byBBPreEDIndex == 6) break;
1788 pDevice->byBBPreEDIndex = 6;
1789 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1790 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x93); //CR206(0xCE)
1791 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
1792 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
1793 if(pDevice->byBBPreEDIndex == 5) break;
1794 pDevice->byBBPreEDIndex = 5;
1795 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1796 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x79); //CR206(0xCE)
1797 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
1798 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
1799 if(pDevice->byBBPreEDIndex == 4) break;
1800 pDevice->byBBPreEDIndex = 4;
1801 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1802 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x62); //CR206(0xCE)
1803 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
1804 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
1805 if(pDevice->byBBPreEDIndex == 3) break;
1806 pDevice->byBBPreEDIndex = 3;
1807 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1808 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x51); //CR206(0xCE)
1809 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
1810 } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67
1811 if(pDevice->byBBPreEDIndex == 2) break;
1812 pDevice->byBBPreEDIndex = 2;
1813 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1814 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
1815 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n");
1816 } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68
1817 if(pDevice->byBBPreEDIndex == 1) break;
1818 pDevice->byBBPreEDIndex = 1;
1819 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1820 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE)
1821 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n");
1822 } else { //RSSI -69, -70,....
1823 if(pDevice->byBBPreEDIndex == 0) break;
1824 pDevice->byBBPreEDIndex = 0;
1825 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1826 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1827 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,...\n");
1828 }
1829 break;
1830
1831 case RF_VT3226:
1832 case RF_VT3226D0:
1833 //RobertYu:20060627, update new table
1834
1835 if( bScanning )
1836 { // need Max sensitivity //RSSI -69, -70, ...
1837 if(pDevice->byBBPreEDIndex == 0) break;
1838 pDevice->byBBPreEDIndex = 0;
1839 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1840 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
1841 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n");
1842 break;
1843 }
1844
1845 if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41
1846 if(pDevice->byBBPreEDIndex == 22) break;
1847 pDevice->byBBPreEDIndex = 22;
1848 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1849 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1850 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1851 } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42
1852 if(pDevice->byBBPreEDIndex == 21) break;
1853 pDevice->byBBPreEDIndex = 21;
1854 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9)
1855 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1856 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n");
1857 } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43
1858 if(pDevice->byBBPreEDIndex == 20) break;
1859 pDevice->byBBPreEDIndex = 20;
1860 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9)
1861 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1862 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n");
1863 } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45
1864 if(pDevice->byBBPreEDIndex == 19) break;
1865 pDevice->byBBPreEDIndex = 19;
1866 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9)
1867 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1868 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n");
1869 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47
1870 if(pDevice->byBBPreEDIndex == 18) break;
1871 pDevice->byBBPreEDIndex = 18;
1872 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9)
1873 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1874 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n");
1875 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1876 if(pDevice->byBBPreEDIndex == 17) break;
1877 pDevice->byBBPreEDIndex = 17;
1878 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9)
1879 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1880 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1881 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1882 if(pDevice->byBBPreEDIndex == 16) break;
1883 pDevice->byBBPreEDIndex = 16;
1884 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9)
1885 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1886 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1887 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1888 if(pDevice->byBBPreEDIndex == 15) break;
1889 pDevice->byBBPreEDIndex = 15;
1890 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9)
1891 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1892 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1893 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1894 if(pDevice->byBBPreEDIndex == 14) break;
1895 pDevice->byBBPreEDIndex = 14;
1896 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1897 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1898 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1899 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1900 if(pDevice->byBBPreEDIndex == 13) break;
1901 pDevice->byBBPreEDIndex = 13;
1902 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1903 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1904 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1905 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1906 if(pDevice->byBBPreEDIndex == 12) break;
1907 pDevice->byBBPreEDIndex = 12;
1908 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1909 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE)
1910 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1911 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1912 if(pDevice->byBBPreEDIndex == 11) break;
1913 pDevice->byBBPreEDIndex = 11;
1914 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1915 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE)
1916 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1917 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1918 if(pDevice->byBBPreEDIndex == 10) break;
1919 pDevice->byBBPreEDIndex = 10;
1920 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1921 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1922 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1923 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1924 if(pDevice->byBBPreEDIndex == 9) break;
1925 pDevice->byBBPreEDIndex = 9;
1926 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1927 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE)
1928 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1929 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1930 if(pDevice->byBBPreEDIndex == 8) break;
1931 pDevice->byBBPreEDIndex = 8;
1932 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1933 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1934 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
1935 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
1936 if(pDevice->byBBPreEDIndex == 7) break;
1937 pDevice->byBBPreEDIndex = 7;
1938 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1939 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE)
1940 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
1941 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
1942 if(pDevice->byBBPreEDIndex == 6) break;
1943 pDevice->byBBPreEDIndex = 6;
1944 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1945 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE)
1946 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
1947 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
1948 if(pDevice->byBBPreEDIndex == 5) break;
1949 pDevice->byBBPreEDIndex = 5;
1950 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1951 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE)
1952 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
1953 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
1954 if(pDevice->byBBPreEDIndex == 4) break;
1955 pDevice->byBBPreEDIndex = 4;
1956 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1957 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE)
1958 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
1959 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
1960 if(pDevice->byBBPreEDIndex == 3) break;
1961 pDevice->byBBPreEDIndex = 3;
1962 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1963 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
1964 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
1965 } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67
1966 if(pDevice->byBBPreEDIndex == 2) break;
1967 pDevice->byBBPreEDIndex = 2;
1968 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1969 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE)
1970 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n");
1971 } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68
1972 if(pDevice->byBBPreEDIndex == 1) break;
1973 pDevice->byBBPreEDIndex = 1;
1974 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1975 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x2D); //CR206(0xCE)
1976 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n");
1977 } else { //RSSI -69, -70, ...
1978 if(pDevice->byBBPreEDIndex == 0) break;
1979 pDevice->byBBPreEDIndex = 0;
1980 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1981 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
1982 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n");
1983 }
1984 break;
1985
1986 case RF_VT3342A0: //RobertYu:20060627, testing table
1987 if( bScanning )
1988 { // need Max sensitivity //RSSI -67, -68, ...
1989 if(pDevice->byBBPreEDIndex == 0) break;
1990 pDevice->byBBPreEDIndex = 0;
1991 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1992 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
1993 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n");
1994 break;
1995 }
1996
1997 if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41
1998 if(pDevice->byBBPreEDIndex == 20) break;
1999 pDevice->byBBPreEDIndex = 20;
2000 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
2001 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2002 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
2003 } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42
2004 if(pDevice->byBBPreEDIndex == 19) break;
2005 pDevice->byBBPreEDIndex = 19;
2006 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9)
2007 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2008 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n");
2009 } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43
2010 if(pDevice->byBBPreEDIndex == 18) break;
2011 pDevice->byBBPreEDIndex = 18;
2012 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9)
2013 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2014 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n");
2015 } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45
2016 if(pDevice->byBBPreEDIndex == 17) break;
2017 pDevice->byBBPreEDIndex = 17;
2018 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9)
2019 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2020 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n");
2021 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47
2022 if(pDevice->byBBPreEDIndex == 16) break;
2023 pDevice->byBBPreEDIndex = 16;
2024 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9)
2025 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2026 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n");
2027 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
2028 if(pDevice->byBBPreEDIndex == 15) break;
2029 pDevice->byBBPreEDIndex = 15;
2030 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9)
2031 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2032 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
2033 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
2034 if(pDevice->byBBPreEDIndex == 14) break;
2035 pDevice->byBBPreEDIndex = 14;
2036 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9)
2037 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2038 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
2039 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
2040 if(pDevice->byBBPreEDIndex == 13) break;
2041 pDevice->byBBPreEDIndex = 13;
2042 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9)
2043 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2044 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
2045 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
2046 if(pDevice->byBBPreEDIndex == 12) break;
2047 pDevice->byBBPreEDIndex = 12;
2048 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
2049 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
2050 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
2051 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
2052 if(pDevice->byBBPreEDIndex == 11) break;
2053 pDevice->byBBPreEDIndex = 11;
2054 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
2055 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
2056 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
2057 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
2058 if(pDevice->byBBPreEDIndex == 10) break;
2059 pDevice->byBBPreEDIndex = 10;
2060 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
2061 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE)
2062 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
2063 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
2064 if(pDevice->byBBPreEDIndex == 9) break;
2065 pDevice->byBBPreEDIndex = 9;
2066 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
2067 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE)
2068 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
2069 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
2070 if(pDevice->byBBPreEDIndex == 8) break;
2071 pDevice->byBBPreEDIndex = 8;
2072 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
2073 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
2074 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
2075 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
2076 if(pDevice->byBBPreEDIndex == 7) break;
2077 pDevice->byBBPreEDIndex = 7;
2078 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2079 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE)
2080 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
2081 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
2082 if(pDevice->byBBPreEDIndex == 6) break;
2083 pDevice->byBBPreEDIndex = 6;
2084 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2085 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
2086 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
2087 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
2088 if(pDevice->byBBPreEDIndex == 5) break;
2089 pDevice->byBBPreEDIndex = 5;
2090 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2091 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE)
2092 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
2093 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
2094 if(pDevice->byBBPreEDIndex == 4) break;
2095 pDevice->byBBPreEDIndex = 4;
2096 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2097 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE)
2098 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
2099 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
2100 if(pDevice->byBBPreEDIndex == 3) break;
2101 pDevice->byBBPreEDIndex = 3;
2102 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2103 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE)
2104 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
2105 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
2106 if(pDevice->byBBPreEDIndex == 2) break;
2107 pDevice->byBBPreEDIndex = 2;
2108 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2109 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE)
2110 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
2111 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
2112 if(pDevice->byBBPreEDIndex == 1) break;
2113 pDevice->byBBPreEDIndex = 1;
2114 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2115 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
2116 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
2117 } else { //RSSI -67, -68, ...
2118 if(pDevice->byBBPreEDIndex == 0) break;
2119 pDevice->byBBPreEDIndex = 0;
2120 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2121 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
2122 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n");
2123 }
2124 break;
2125
2126 }
2127
2128}
2129