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.
22 * Purpose: Implement functions to access baseband
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
50 /*--------------------- Static Definitions -------------------------*/
51 static int msglevel
=MSG_LEVEL_INFO
;
52 //static int msglevel =MSG_LEVEL_DEBUG;
54 /*--------------------- Static Classes ----------------------------*/
56 /*--------------------- Static Variables --------------------------*/
58 /*--------------------- Static Functions --------------------------*/
60 /*--------------------- Export Variables --------------------------*/
62 /*--------------------- Static Definitions -------------------------*/
64 /*--------------------- Static Classes ----------------------------*/
66 /*--------------------- Static Variables --------------------------*/
69 BYTE abyVT3184_AGC
[] = {
73 0x02, //3 //RobertYu:20060505, 0x04, //3
75 0x04, //5 //RobertYu:20060505, 0x06, //5
137 BYTE abyVT3184_AL2230
[] = {
147 0x45,//tx //0x64 for FPGA
165 0x8e, //RobertYu:20060522, //0x8d,
166 0x0a, //RobertYu:20060515, //0x09,
185 0x0c, //RobertYu:20060522, //0x10,
218 0x00,//50 //RobertYu:20060505, //0x15,//50
227 0xd0, //RobertYu:20060505, //0xb0,
246 0x00, //0x80 for FPGA
276 0x1f, //RobertYu:20060516, //0x0f,
281 0x00, //RobertYu:20060505, //0x02,
282 0x20,//90 //RobertYu:20060505, //0x22,//90
311 0x15, //RobertYu:20060516, //0x00,
335 0xff, //RobertYu:20060509, //0x2c,
336 0x0e, //RobertYu:20060530, //0x0c,
339 0x00, //RobertYu:20060505, //0x01,
340 0x82, //RobertYu:20060516, //0x8f,
344 0x30, //RobertYu:20060627, //0x0b,
345 0x05, //RobertYu:20060516, //0x25,
363 0xf3, //RobertYu:20060516, //0xd3,
369 0x12, //RobertYu:20060627, //0x10,
377 0x05, //RobertYu:20060516, //0x0c,
398 //{{RobertYu:20060515, new BB setting for VT3226D0
399 BYTE abyVT3184_VT3226D0
[] = {
409 0x45,//tx //0x64 for FPGA
427 0x8e, //RobertYu:20060525, //0x8d,
428 0x0a, //RobertYu:20060515, //0x09,
447 0x0c, //RobertYu:20060525, //0x10,
480 0x00,//50 //RobertYu:20060505, //0x15,//50
489 0xd0, //RobertYu:20060505, //0xb0,
508 0x00, //0x80 for FPGA
538 0x1f, //RobertYu:20060515, //0x0f,
543 0x00, //RobertYu:20060505, //0x02,
544 0x20,//90 //RobertYu:20060505, //0x22,//90
597 0xff, //RobertYu:20060509, //0x2c,
598 0x10, //RobertYu:20060525, //0x0c,
601 0x00, //RobertYu:20060505, //0x01,
602 0x84, //RobertYu:20060525, //0x8f,
606 0x24, //RobertYu:20060627, //0x18,
607 0x05, //RobertYu:20060515, //0x25,
625 0xf3, //RobertYu:20060515, //0xd3,
631 0x10, //RobertYu:20060627, //0x0e,
639 0x08, //RobertYu:20060515, //0x0c,
658 const WORD awcFrameTime
[MAX_RATE
] =
659 {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216};
661 /*--------------------- Static Functions --------------------------*/
666 s_ulGetLowSQ3(PSDevice pDevice);
670 s_ulGetRatio(PSDevice pDevice);
674 s_vClearSQ3Value(PSDevice pDevice);
677 /*--------------------- Export Variables --------------------------*/
679 * Description: Calculate data frame transmitting time
683 * byPreambleType - Preamble Type
684 * byPktType - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA
685 * cbFrameLength - Baseband Type
689 * Return Value: FrameTime
696 unsigned int cbFrameLength
,
700 unsigned int uFrameTime
;
701 unsigned int uPreamble
;
703 unsigned int uRateIdx
= (unsigned int)wRate
;
704 unsigned int uRate
= 0;
707 if (uRateIdx
> RATE_54M
) {
712 uRate
= (unsigned int)awcFrameTime
[uRateIdx
];
714 if (uRateIdx
<= 3) { //CCK mode
716 if (byPreambleType
== 1) {//Short
721 uFrameTime
= (cbFrameLength
* 80) / uRate
; //?????
722 uTmp
= (uFrameTime
* uRate
) / 80;
723 if (cbFrameLength
!= uTmp
) {
727 return (uPreamble
+ uFrameTime
);
730 uFrameTime
= (cbFrameLength
* 8 + 22) / uRate
; //????????
731 uTmp
= ((uFrameTime
* uRate
) - 22) / 8;
732 if(cbFrameLength
!= uTmp
) {
735 uFrameTime
= uFrameTime
* 4; //???????
736 if(byPktType
!= PK_TYPE_11A
) {
739 return (20 + uFrameTime
); //??????
744 * Description: Caculate Length, Service, and Signal fields of Phy for Tx
748 * pDevice - Device Structure
749 * cbFrameLength - Tx Frame Length
752 * pwPhyLen - pointer to Phy Length field
753 * pbyPhySrv - pointer to Phy Service field
754 * pbyPhySgn - pointer to Phy Signal field
760 BBvCaculateParameter (
762 unsigned int cbFrameLength
,
770 unsigned int cbBitCount
;
771 unsigned int cbUsCount
= 0;
774 BYTE byPreambleType
= pDevice
->byPreambleType
;
775 BOOL bCCK
= pDevice
->bCCK
;
777 cbBitCount
= cbFrameLength
* 8;
782 cbUsCount
= cbBitCount
;
787 cbUsCount
= cbBitCount
/ 2;
788 if (byPreambleType
== 1)
790 else // long preamble
797 cbUsCount
= (cbBitCount
* 10) / 55;
798 cbTmp
= (cbUsCount
* 55) / 10;
799 if (cbTmp
!= cbBitCount
)
801 if (byPreambleType
== 1)
803 else // long preamble
811 cbUsCount
= cbBitCount
/ 11;
812 cbTmp
= cbUsCount
* 11;
813 if (cbTmp
!= cbBitCount
) {
815 if ((cbBitCount
- cbTmp
) <= 3)
818 if (byPreambleType
== 1)
820 else // long preamble
825 if(byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
826 *pbyPhySgn
= 0x9B; //1001 1011
829 *pbyPhySgn
= 0x8B; //1000 1011
834 if(byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
835 *pbyPhySgn
= 0x9F; //1001 1111
838 *pbyPhySgn
= 0x8F; //1000 1111
843 if(byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
844 *pbyPhySgn
= 0x9A; //1001 1010
847 *pbyPhySgn
= 0x8A; //1000 1010
852 if(byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
853 *pbyPhySgn
= 0x9E; //1001 1110
856 *pbyPhySgn
= 0x8E; //1000 1110
861 if(byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
862 *pbyPhySgn
= 0x99; //1001 1001
865 *pbyPhySgn
= 0x89; //1000 1001
870 if(byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
871 *pbyPhySgn
= 0x9D; //1001 1101
874 *pbyPhySgn
= 0x8D; //1000 1101
879 if(byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
880 *pbyPhySgn
= 0x98; //1001 1000
883 *pbyPhySgn
= 0x88; //1000 1000
888 if (byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
889 *pbyPhySgn
= 0x9C; //1001 1100
892 *pbyPhySgn
= 0x8C; //1000 1100
897 if (byPacketType
== PK_TYPE_11A
) {//11a, 5GHZ
898 *pbyPhySgn
= 0x9C; //1001 1100
901 *pbyPhySgn
= 0x8C; //1000 1100
906 if (byPacketType
== PK_TYPE_11B
) {
909 *pbyPhySrv
= *pbyPhySrv
| 0x80;
910 *pwPhyLen
= (WORD
) cbUsCount
;
914 *pwPhyLen
= (WORD
)cbFrameLength
;
920 * Description: Set Antenna mode
924 * pDevice - Device Structure
925 * byAntennaMode - Antenna Mode
933 BBvSetAntennaMode (PSDevice pDevice
, BYTE byAntennaMode
)
935 //{{ RobertYu: 20041124, ABG Mode, VC1/VC2 define, make the ANT_A, ANT_B inverted
936 /*if ( (pDevice->byRFType == RF_MAXIM2829) ||
937 (pDevice->byRFType == RF_UW2452) ||
938 (pDevice->byRFType == RF_AIROHA7230) ) { // RobertYu: 20041210, 20050104
940 switch (byAntennaMode) {
942 byAntennaMode = ANT_TXB;
945 byAntennaMode = ANT_TXA;
948 byAntennaMode = ANT_RXB;
951 byAntennaMode = ANT_RXA;
956 switch (byAntennaMode
) {
962 pDevice
->byBBRxConf
&= 0xFC;
965 pDevice
->byBBRxConf
&= 0xFE;
966 pDevice
->byBBRxConf
|= 0x02;;
971 CONTROLnsRequestOut(pDevice
,
972 MESSAGE_TYPE_SET_ANTMD
,
973 (WORD
) byAntennaMode
,
980 * Description: Set Antenna mode
984 * pDevice - Device Structure
985 * byAntennaMode - Antenna Mode
993 BOOL
BBbVT3184Init(PSDevice pDevice
)
1002 ntStatus
= CONTROLnsRequestIn(pDevice
,
1005 MESSAGE_REQUEST_EEPROM
,
1006 EEP_MAX_CONTEXT_SIZE
,
1007 pDevice
->abyEEPROM
);
1008 if (ntStatus
!= STATUS_SUCCESS
) {
1013 // if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04)
1017 pDevice
->byOriginalZonetype
= pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
];
1018 if(pDevice
->config_file
.ZoneType
>= 0) { //read zonetype file ok!
1019 if ((pDevice
->config_file
.ZoneType
== 0)&&
1020 (pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
] !=0x00)){ //for USA
1021 pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
] = 0;
1022 pDevice
->abyEEPROM
[EEP_OFS_MAXCHANNEL
] = 0x0B;
1023 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Init Zone Type :USA\n");
1025 else if((pDevice
->config_file
.ZoneType
== 1)&&
1026 (pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
]!=0x01)){ //for Japan
1027 pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
] = 0x01;
1028 pDevice
->abyEEPROM
[EEP_OFS_MAXCHANNEL
] = 0x0D;
1029 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Init Zone Type :Japan\n");
1031 else if((pDevice
->config_file
.ZoneType
== 2)&&
1032 (pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
]!=0x02)){ //for Europe
1033 pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
] = 0x02;
1034 pDevice
->abyEEPROM
[EEP_OFS_MAXCHANNEL
] = 0x0D;
1035 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Init Zone Type :Europe\n");
1038 if(pDevice
->config_file
.ZoneType
!=pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
])
1039 printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",pDevice
->config_file
.ZoneType
,pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
]);
1041 printk("Read Zonetype file success,use default zonetype setting[%02x]\n",pDevice
->config_file
.ZoneType
);
1045 if ( !pDevice
->bZoneRegExist
) {
1046 pDevice
->byZoneType
= pDevice
->abyEEPROM
[EEP_OFS_ZONETYPE
];
1048 pDevice
->byRFType
= pDevice
->abyEEPROM
[EEP_OFS_RFTYPE
];
1050 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Zone Type %x\n", pDevice
->byZoneType
);
1051 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"RF Type %d\n", pDevice
->byRFType
);
1053 if ((pDevice
->byRFType
== RF_AL2230
) || (pDevice
->byRFType
== RF_AL2230S
)) {
1054 pDevice
->byBBRxConf
= abyVT3184_AL2230
[10];
1055 wLength
= sizeof(abyVT3184_AL2230
);
1056 pbyAddr
= abyVT3184_AL2230
;
1057 pbyAgc
= abyVT3184_AGC
;
1058 wLengthAgc
= sizeof(abyVT3184_AGC
);
1060 pDevice
->abyBBVGA
[0] = 0x1C;
1061 pDevice
->abyBBVGA
[1] = 0x10;
1062 pDevice
->abyBBVGA
[2] = 0x0;
1063 pDevice
->abyBBVGA
[3] = 0x0;
1064 pDevice
->ldBmThreshold
[0] = -70;
1065 pDevice
->ldBmThreshold
[1] = -48;
1066 pDevice
->ldBmThreshold
[2] = 0;
1067 pDevice
->ldBmThreshold
[3] = 0;
1069 else if (pDevice
->byRFType
== RF_AIROHA7230
) {
1070 pDevice
->byBBRxConf
= abyVT3184_AL2230
[10];
1071 wLength
= sizeof(abyVT3184_AL2230
);
1072 pbyAddr
= abyVT3184_AL2230
;
1073 pbyAgc
= abyVT3184_AGC
;
1074 wLengthAgc
= sizeof(abyVT3184_AGC
);
1076 // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1077 //pbyAddr[0x09] = 0x41;
1078 // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1079 //pbyAddr[0x0a] = 0x28;
1080 // Select VC1/VC2, CR215 = 0x02->0x06
1081 pbyAddr
[0xd7] = 0x06;
1083 pDevice
->abyBBVGA
[0] = 0x1C;
1084 pDevice
->abyBBVGA
[1] = 0x10;
1085 pDevice
->abyBBVGA
[2] = 0x0;
1086 pDevice
->abyBBVGA
[3] = 0x0;
1087 pDevice
->ldBmThreshold
[0] = -70;
1088 pDevice
->ldBmThreshold
[1] = -48;
1089 pDevice
->ldBmThreshold
[2] = 0;
1090 pDevice
->ldBmThreshold
[3] = 0;
1092 else if ( (pDevice
->byRFType
== RF_VT3226
) || (pDevice
->byRFType
== RF_VT3226D0
) ) {
1093 pDevice
->byBBRxConf
= abyVT3184_VT3226D0
[10]; //RobertYu:20060515
1094 wLength
= sizeof(abyVT3184_VT3226D0
); //RobertYu:20060515
1095 pbyAddr
= abyVT3184_VT3226D0
; //RobertYu:20060515
1096 pbyAgc
= abyVT3184_AGC
;
1097 wLengthAgc
= sizeof(abyVT3184_AGC
);
1099 pDevice
->abyBBVGA
[0] = 0x20; //RobertYu:20060104, reguest by Jack
1100 pDevice
->abyBBVGA
[1] = 0x10;
1101 pDevice
->abyBBVGA
[2] = 0x0;
1102 pDevice
->abyBBVGA
[3] = 0x0;
1103 pDevice
->ldBmThreshold
[0] = -70;
1104 pDevice
->ldBmThreshold
[1] = -48;
1105 pDevice
->ldBmThreshold
[2] = 0;
1106 pDevice
->ldBmThreshold
[3] = 0;
1107 // Fix VT3226 DFC system timing issue
1108 MACvRegBitsOn(pDevice
, MAC_REG_SOFTPWRCTL2
, SOFTPWRCTL_RFLEOPT
);
1110 //{{RobertYu:20060609
1111 } else if ( (pDevice
->byRFType
== RF_VT3342A0
) ) {
1112 pDevice
->byBBRxConf
= abyVT3184_VT3226D0
[10];
1113 wLength
= sizeof(abyVT3184_VT3226D0
);
1114 pbyAddr
= abyVT3184_VT3226D0
;
1115 pbyAgc
= abyVT3184_AGC
;
1116 wLengthAgc
= sizeof(abyVT3184_AGC
);
1118 pDevice
->abyBBVGA
[0] = 0x20;
1119 pDevice
->abyBBVGA
[1] = 0x10;
1120 pDevice
->abyBBVGA
[2] = 0x0;
1121 pDevice
->abyBBVGA
[3] = 0x0;
1122 pDevice
->ldBmThreshold
[0] = -70;
1123 pDevice
->ldBmThreshold
[1] = -48;
1124 pDevice
->ldBmThreshold
[2] = 0;
1125 pDevice
->ldBmThreshold
[3] = 0;
1126 // Fix VT3226 DFC system timing issue
1127 MACvRegBitsOn(pDevice
, MAC_REG_SOFTPWRCTL2
, SOFTPWRCTL_RFLEOPT
);
1133 memcpy(abyArray
, pbyAddr
, wLength
);
1134 CONTROLnsRequestOut(pDevice
,
1137 MESSAGE_REQUEST_BBREG
,
1142 memcpy(abyArray
, pbyAgc
, wLengthAgc
);
1143 CONTROLnsRequestOut(pDevice
,
1146 MESSAGE_REQUEST_BBAGC
,
1152 if ((pDevice
->byRFType
== RF_VT3226
) || //RobertYu:20051116, 20060111 remove VT3226D0
1153 (pDevice
->byRFType
== RF_VT3342A0
) //RobertYu:20060609
1155 ControlvWriteByte(pDevice
,MESSAGE_REQUEST_MACREG
,MAC_REG_ITRTMSET
,0x23);
1156 MACvRegBitsOn(pDevice
,MAC_REG_PAPEDELAY
,0x01);
1158 else if (pDevice
->byRFType
== RF_VT3226D0
)
1160 ControlvWriteByte(pDevice
,MESSAGE_REQUEST_MACREG
,MAC_REG_ITRTMSET
,0x11);
1161 MACvRegBitsOn(pDevice
,MAC_REG_PAPEDELAY
,0x01);
1165 ControlvWriteByte(pDevice
,MESSAGE_REQUEST_BBREG
,0x04,0x7F);
1166 ControlvWriteByte(pDevice
,MESSAGE_REQUEST_BBREG
,0x0D,0x01);
1168 RFbRFTableDownload(pDevice
);
1169 return TRUE
;//ntStatus;
1174 * Description: Turn on BaseBand Loopback mode
1178 * pDevice - Device Structure
1183 * Return Value: none
1186 void BBvLoopbackOn (PSDevice pDevice
)
1191 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, &pDevice
->byBBCRc9
);//CR201
1192 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0);
1193 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0x4D, &pDevice
->byBBCR4d
);//CR77
1194 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x4D, 0x90);
1196 //CR 88 = 0x02(CCK), 0x03(OFDM)
1197 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0x88, &pDevice
->byBBCR88
);//CR136
1199 if (pDevice
->wCurrentRate
<= RATE_11M
) { //CCK
1200 // Enable internal digital loopback: CR33 |= 0000 0001
1201 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0x21, &byData
);//CR33
1202 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x21, (BYTE
)(byData
| 0x01));//CR33
1204 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x9A, 0); //CR154
1206 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x88, 0x02);//CR239
1209 // Enable internal digital loopback:CR154 |= 0000 0001
1210 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0x9A, &byData
);//CR154
1211 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x9A, (BYTE
)(byData
| 0x01));//CR154
1213 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x21, 0); //CR33
1215 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x88, 0x03);//CR239
1219 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x0E, 0);//CR14
1222 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0x09, &pDevice
->byBBCR09
);
1223 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x09, (BYTE
)(pDevice
->byBBCR09
& 0xDE));
1227 * Description: Turn off BaseBand Loopback mode
1231 * pDevice - Device Structure
1236 * Return Value: none
1239 void BBvLoopbackOff (PSDevice pDevice
)
1243 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, pDevice
->byBBCRc9
);//CR201
1244 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x88, pDevice
->byBBCR88
);//CR136
1245 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x09, pDevice
->byBBCR09
);//CR136
1246 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x4D, pDevice
->byBBCR4d
);//CR77
1248 if (pDevice
->wCurrentRate
<= RATE_11M
) { // CCK
1249 // Set the CR33 Bit2 to disable internal Loopback.
1250 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0x21, &byData
);//CR33
1251 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x21, (BYTE
)(byData
& 0xFE));//CR33
1254 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0x9A, &byData
);//CR154
1255 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x9A, (BYTE
)(byData
& 0xFE));//CR154
1257 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0x0E, &byData
);//CR14
1258 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x0E, (BYTE
)(byData
| 0x80));//CR14
1264 * Description: Set ShortSlotTime mode
1268 * pDevice - Device Structure
1272 * Return Value: none
1276 BBvSetShortSlotTime (PSDevice pDevice
)
1280 if (pDevice
->bShortSlotTime
) {
1281 pDevice
->byBBRxConf
&= 0xDF;//1101 1111
1283 pDevice
->byBBRxConf
|= 0x20;//0010 0000
1286 ControlvReadByte (pDevice
, MESSAGE_REQUEST_BBREG
, 0xE7, &byBBVGA
);
1287 if (byBBVGA
== pDevice
->abyBBVGA
[0]) {
1288 pDevice
->byBBRxConf
|= 0x20;//0010 0000
1291 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x0A, pDevice
->byBBRxConf
);
1296 void BBvSetVGAGainOffset(PSDevice pDevice
, BYTE byData
)
1299 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xE7, byData
);
1301 // patch for 3253B0 Baseband with Cardbus module
1302 if (byData
== pDevice
->abyBBVGA
[0]) {
1303 pDevice
->byBBRxConf
|= 0x20;//0010 0000
1304 } else if (pDevice
->bShortSlotTime
) {
1305 pDevice
->byBBRxConf
&= 0xDF;//1101 1111
1307 pDevice
->byBBRxConf
|= 0x20;//0010 0000
1309 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x0A, pDevice
->byBBRxConf
);//CR10
1314 * Description: Baseband SoftwareReset
1318 * dwIoBase - I/O base address
1322 * Return Value: none
1326 BBvSoftwareReset (PSDevice pDevice
)
1328 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x50, 0x40);
1329 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x50, 0);
1330 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x9C, 0x01);
1331 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x9C, 0);
1335 * Description: BBvSetDeepSleep
1339 * pDevice - Device Structure
1343 * Return Value: none
1347 BBvSetDeepSleep (PSDevice pDevice
)
1349 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x0c, 0x17);//CR12
1350 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x0D, 0xB9);//CR13
1354 BBvExitDeepSleep (PSDevice pDevice
)
1356 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x0C, 0x00);//CR12
1357 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0x0D, 0x01);//CR13
1361 static unsigned long s_ulGetLowSQ3(PSDevice pDevice
)
1364 unsigned long ulSQ3
= 0;
1365 unsigned long ulMaxPacket
;
1367 ulMaxPacket
= pDevice
->aulPktNum
[RATE_54M
];
1368 if ( pDevice
->aulPktNum
[RATE_54M
] != 0 ) {
1369 ulSQ3
= pDevice
->aulSQ3Val
[RATE_54M
] / pDevice
->aulPktNum
[RATE_54M
];
1371 for ( ii
=RATE_48M
;ii
>=RATE_6M
;ii
-- ) {
1372 if ( pDevice
->aulPktNum
[ii
] > ulMaxPacket
) {
1373 ulMaxPacket
= pDevice
->aulPktNum
[ii
];
1374 ulSQ3
= pDevice
->aulSQ3Val
[ii
] / pDevice
->aulPktNum
[ii
];
1381 static unsigned long s_ulGetRatio(PSDevice pDevice
)
1384 unsigned long ulRatio
= 0;
1385 unsigned long ulMaxPacket
;
1386 unsigned long ulPacketNum
;
1388 //This is a thousand-ratio
1389 ulMaxPacket
= pDevice
->aulPktNum
[RATE_54M
];
1390 if ( pDevice
->aulPktNum
[RATE_54M
] != 0 ) {
1391 ulPacketNum
= pDevice
->aulPktNum
[RATE_54M
];
1392 ulRatio
= (ulPacketNum
* 1000 / pDevice
->uDiversityCnt
);
1393 ulRatio
+= TOP_RATE_54M
;
1395 for ( ii
=RATE_48M
;ii
>=RATE_1M
;ii
-- ) {
1396 if ( pDevice
->aulPktNum
[ii
] > ulMaxPacket
) {
1398 for ( jj
=RATE_54M
;jj
>=ii
;jj
--)
1399 ulPacketNum
+= pDevice
->aulPktNum
[jj
];
1400 ulRatio
= (ulPacketNum
* 1000 / pDevice
->uDiversityCnt
);
1401 ulRatio
+= TOP_RATE_48M
;
1402 ulMaxPacket
= pDevice
->aulPktNum
[ii
];
1413 s_vClearSQ3Value (PSDevice pDevice
)
1416 pDevice
->uDiversityCnt
= 0;
1418 for ( ii
=RATE_1M
;ii
<MAX_RATE
;ii
++) {
1419 pDevice
->aulPktNum
[ii
] = 0;
1420 pDevice
->aulSQ3Val
[ii
] = 0;
1426 * Description: Antenna Diversity
1430 * pDevice - Device Structure
1431 * byRSR - RSR from received packet
1432 * bySQ3 - SQ3 value from received packet
1436 * Return Value: none
1441 BBvAntennaDiversity (PSDevice pDevice
, BYTE byRxRate
, BYTE bySQ3
)
1444 pDevice
->uDiversityCnt
++;
1445 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"pDevice->uDiversityCnt = %d\n", (int)pDevice
->uDiversityCnt
);
1447 if (byRxRate
== 2) {
1448 pDevice
->aulPktNum
[RATE_1M
]++;
1450 else if (byRxRate
==4) {
1451 pDevice
->aulPktNum
[RATE_2M
]++;
1453 else if (byRxRate
==11) {
1454 pDevice
->aulPktNum
[RATE_5M
]++;
1456 else if (byRxRate
==22) {
1457 pDevice
->aulPktNum
[RATE_11M
]++;
1459 else if(byRxRate
==12){
1460 pDevice
->aulPktNum
[RATE_6M
]++;
1461 pDevice
->aulSQ3Val
[RATE_6M
] += bySQ3
;
1463 else if(byRxRate
==18){
1464 pDevice
->aulPktNum
[RATE_9M
]++;
1465 pDevice
->aulSQ3Val
[RATE_9M
] += bySQ3
;
1467 else if(byRxRate
==24){
1468 pDevice
->aulPktNum
[RATE_12M
]++;
1469 pDevice
->aulSQ3Val
[RATE_12M
] += bySQ3
;
1471 else if(byRxRate
==36){
1472 pDevice
->aulPktNum
[RATE_18M
]++;
1473 pDevice
->aulSQ3Val
[RATE_18M
] += bySQ3
;
1475 else if(byRxRate
==48){
1476 pDevice
->aulPktNum
[RATE_24M
]++;
1477 pDevice
->aulSQ3Val
[RATE_24M
] += bySQ3
;
1479 else if(byRxRate
==72){
1480 pDevice
->aulPktNum
[RATE_36M
]++;
1481 pDevice
->aulSQ3Val
[RATE_36M
] += bySQ3
;
1483 else if(byRxRate
==96){
1484 pDevice
->aulPktNum
[RATE_48M
]++;
1485 pDevice
->aulSQ3Val
[RATE_48M
] += bySQ3
;
1487 else if(byRxRate
==108){
1488 pDevice
->aulPktNum
[RATE_54M
]++;
1489 pDevice
->aulSQ3Val
[RATE_54M
] += bySQ3
;
1492 if (pDevice
->byAntennaState
== 0) {
1494 if (pDevice
->uDiversityCnt
> pDevice
->ulDiversityNValue
) {
1495 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ulDiversityNValue=[%d],54M-[%d]\n",(int)pDevice
->ulDiversityNValue
, (int)pDevice
->aulPktNum
[RATE_54M
]);
1497 pDevice
->ulSQ3_State0
= s_ulGetLowSQ3(pDevice
);
1498 pDevice
->ulRatio_State0
= s_ulGetRatio(pDevice
);
1499 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"SQ3_State0, SQ3= [%08x] rate = [%08x]\n",(int)pDevice
->ulSQ3_State0
,(int)pDevice
->ulRatio_State0
);
1501 if ( ((pDevice
->aulPktNum
[RATE_54M
] < pDevice
->ulDiversityNValue
/2) &&
1502 (pDevice
->ulSQ3_State0
> pDevice
->ulSQ3TH
) ) ||
1503 (pDevice
->ulSQ3_State0
== 0 ) ) {
1505 if ( pDevice
->byTMax
== 0 )
1508 bScheduleCommand((void *) pDevice
,
1509 WLAN_CMD_CHANGE_ANTENNA
,
1512 pDevice
->byAntennaState
= 1;
1514 del_timer(&pDevice
->TimerSQ3Tmax3
);
1515 del_timer(&pDevice
->TimerSQ3Tmax2
);
1516 pDevice
->TimerSQ3Tmax1
.expires
= RUN_AT(pDevice
->byTMax
* HZ
);
1517 add_timer(&pDevice
->TimerSQ3Tmax1
);
1520 pDevice
->TimerSQ3Tmax3
.expires
= RUN_AT(pDevice
->byTMax3
* HZ
);
1521 add_timer(&pDevice
->TimerSQ3Tmax3
);
1523 s_vClearSQ3Value(pDevice
);
1526 } else { //byAntennaState == 1
1528 if (pDevice
->uDiversityCnt
> pDevice
->ulDiversityMValue
) {
1530 del_timer(&pDevice
->TimerSQ3Tmax1
);
1531 pDevice
->ulSQ3_State1
= s_ulGetLowSQ3(pDevice
);
1532 pDevice
->ulRatio_State1
= s_ulGetRatio(pDevice
);
1533 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"SQ3_State1, rate0 = %08x,rate1 = %08x\n",(int)pDevice
->ulRatio_State0
,(int)pDevice
->ulRatio_State1
);
1535 if ( ((pDevice
->ulSQ3_State1
== 0) && (pDevice
->ulSQ3_State0
!= 0)) ||
1536 ((pDevice
->ulSQ3_State1
== 0) && (pDevice
->ulSQ3_State0
== 0) && (pDevice
->ulRatio_State1
< pDevice
->ulRatio_State0
)) ||
1537 ((pDevice
->ulSQ3_State1
!= 0) && (pDevice
->ulSQ3_State0
!= 0) && (pDevice
->ulSQ3_State0
< pDevice
->ulSQ3_State1
))
1540 bScheduleCommand((void *) pDevice
,
1541 WLAN_CMD_CHANGE_ANTENNA
,
1544 pDevice
->TimerSQ3Tmax3
.expires
= RUN_AT(pDevice
->byTMax3
* HZ
);
1545 pDevice
->TimerSQ3Tmax2
.expires
= RUN_AT(pDevice
->byTMax2
* HZ
);
1546 add_timer(&pDevice
->TimerSQ3Tmax3
);
1547 add_timer(&pDevice
->TimerSQ3Tmax2
);
1550 pDevice
->byAntennaState
= 0;
1551 s_vClearSQ3Value(pDevice
);
1560 * Timer for SQ3 antenna diversity
1565 * hDeviceContext - Pointer to the adapter
1571 * Return Value: none
1575 void TimerSQ3CallBack(void *hDeviceContext
)
1577 PSDevice pDevice
= (PSDevice
)hDeviceContext
;
1579 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"TimerSQ3CallBack...");
1580 spin_lock_irq(&pDevice
->lock
);
1582 bScheduleCommand((void *) pDevice
, WLAN_CMD_CHANGE_ANTENNA
, NULL
);
1583 pDevice
->byAntennaState
= 0;
1584 s_vClearSQ3Value(pDevice
);
1585 pDevice
->TimerSQ3Tmax3
.expires
= RUN_AT(pDevice
->byTMax3
* HZ
);
1586 pDevice
->TimerSQ3Tmax2
.expires
= RUN_AT(pDevice
->byTMax2
* HZ
);
1587 add_timer(&pDevice
->TimerSQ3Tmax3
);
1588 add_timer(&pDevice
->TimerSQ3Tmax2
);
1591 spin_unlock_irq(&pDevice
->lock
);
1599 * Timer for SQ3 antenna diversity
1604 * hDeviceContext - Pointer to the adapter
1610 * Return Value: none
1614 void TimerSQ3Tmax3CallBack(void *hDeviceContext
)
1616 PSDevice pDevice
= (PSDevice
)hDeviceContext
;
1618 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"TimerSQ3Tmax3CallBack...");
1619 spin_lock_irq(&pDevice
->lock
);
1621 pDevice
->ulRatio_State0
= s_ulGetRatio(pDevice
);
1622 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"SQ3_State0 = [%08x]\n",(int)pDevice
->ulRatio_State0
);
1624 s_vClearSQ3Value(pDevice
);
1625 if ( pDevice
->byTMax
== 0 ) {
1626 pDevice
->TimerSQ3Tmax3
.expires
= RUN_AT(pDevice
->byTMax3
* HZ
);
1627 add_timer(&pDevice
->TimerSQ3Tmax3
);
1628 spin_unlock_irq(&pDevice
->lock
);
1632 bScheduleCommand((void *) pDevice
, WLAN_CMD_CHANGE_ANTENNA
, NULL
);
1633 pDevice
->byAntennaState
= 1;
1634 del_timer(&pDevice
->TimerSQ3Tmax3
);
1635 del_timer(&pDevice
->TimerSQ3Tmax2
);
1636 pDevice
->TimerSQ3Tmax1
.expires
= RUN_AT(pDevice
->byTMax
* HZ
);
1637 add_timer(&pDevice
->TimerSQ3Tmax1
);
1639 spin_unlock_irq(&pDevice
->lock
);
1644 BBvUpdatePreEDThreshold(
1650 switch(pDevice
->byRFType
)
1655 //RobertYu:20060627, update new table
1658 { // need Max sensitivity //RSSI -69, -70,....
1659 if(pDevice
->byBBPreEDIndex
== 0) break;
1660 pDevice
->byBBPreEDIndex
= 0;
1661 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1662 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x30); //CR206(0xCE)
1663 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -69, -70, -71,...\n");
1667 if(pDevice
->byBBPreEDRSSI
<= 45) { // RSSI 0, -1,-2,....-45
1668 if(pDevice
->byBBPreEDIndex
== 20) break;
1669 pDevice
->byBBPreEDIndex
= 20;
1670 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0xFF); //CR201(0xC9)
1671 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1672 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI 0, -1,-2,..-45\n");
1673 } else if(pDevice
->byBBPreEDRSSI
<= 46) { //RSSI -46
1674 if(pDevice
->byBBPreEDIndex
== 19) break;
1675 pDevice
->byBBPreEDIndex
= 19;
1676 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x1A); //CR201(0xC9)
1677 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1678 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -46\n");
1679 } else if(pDevice
->byBBPreEDRSSI
<= 47) { //RSSI -47
1680 if(pDevice
->byBBPreEDIndex
== 18) break;
1681 pDevice
->byBBPreEDIndex
= 18;
1682 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x15); //CR201(0xC9)
1683 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1684 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -47\n");
1685 } else if(pDevice
->byBBPreEDRSSI
<= 49) { //RSSI -48, -49
1686 if(pDevice
->byBBPreEDIndex
== 17) break;
1687 pDevice
->byBBPreEDIndex
= 17;
1688 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x0E); //CR201(0xC9)
1689 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1690 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -48,-49\n");
1691 } else if(pDevice
->byBBPreEDRSSI
<= 51) { //RSSI -50, -51
1692 if(pDevice
->byBBPreEDIndex
== 16) break;
1693 pDevice
->byBBPreEDIndex
= 16;
1694 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x09); //CR201(0xC9)
1695 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1696 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -50,-51\n");
1697 } else if(pDevice
->byBBPreEDRSSI
<= 53) { //RSSI -52, -53
1698 if(pDevice
->byBBPreEDIndex
== 15) break;
1699 pDevice
->byBBPreEDIndex
= 15;
1700 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x06); //CR201(0xC9)
1701 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1702 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -52,-53\n");
1703 } else if(pDevice
->byBBPreEDRSSI
<= 55) { //RSSI -54, -55
1704 if(pDevice
->byBBPreEDIndex
== 14) break;
1705 pDevice
->byBBPreEDIndex
= 14;
1706 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x03); //CR201(0xC9)
1707 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1708 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -54,-55\n");
1709 } else if(pDevice
->byBBPreEDRSSI
<= 56) { //RSSI -56
1710 if(pDevice
->byBBPreEDIndex
== 13) break;
1711 pDevice
->byBBPreEDIndex
= 13;
1712 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x02); //CR201(0xC9)
1713 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xA0); //CR206(0xCE)
1714 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -56\n");
1715 } else if(pDevice
->byBBPreEDRSSI
<= 57) { //RSSI -57
1716 if(pDevice
->byBBPreEDIndex
== 12) break;
1717 pDevice
->byBBPreEDIndex
= 12;
1718 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x02); //CR201(0xC9)
1719 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x20); //CR206(0xCE)
1720 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -57\n");
1721 } else if(pDevice
->byBBPreEDRSSI
<= 58) { //RSSI -58
1722 if(pDevice
->byBBPreEDIndex
== 11) break;
1723 pDevice
->byBBPreEDIndex
= 11;
1724 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
1725 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xA0); //CR206(0xCE)
1726 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -58\n");
1727 } else if(pDevice
->byBBPreEDRSSI
<= 59) { //RSSI -59
1728 if(pDevice
->byBBPreEDIndex
== 10) break;
1729 pDevice
->byBBPreEDIndex
= 10;
1730 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
1731 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x54); //CR206(0xCE)
1732 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -59\n");
1733 } else if(pDevice
->byBBPreEDRSSI
<= 60) { //RSSI -60
1734 if(pDevice
->byBBPreEDIndex
== 9) break;
1735 pDevice
->byBBPreEDIndex
= 9;
1736 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
1737 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x18); //CR206(0xCE)
1738 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -60\n");
1739 } else if(pDevice
->byBBPreEDRSSI
<= 61) { //RSSI -61
1740 if(pDevice
->byBBPreEDIndex
== 8) break;
1741 pDevice
->byBBPreEDIndex
= 8;
1742 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1743 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xE3); //CR206(0xCE)
1744 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -61\n");
1745 } else if(pDevice
->byBBPreEDRSSI
<= 62) { //RSSI -62
1746 if(pDevice
->byBBPreEDIndex
== 7) break;
1747 pDevice
->byBBPreEDIndex
= 7;
1748 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1749 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xB9); //CR206(0xCE)
1750 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -62\n");
1751 } else if(pDevice
->byBBPreEDRSSI
<= 63) { //RSSI -63
1752 if(pDevice
->byBBPreEDIndex
== 6) break;
1753 pDevice
->byBBPreEDIndex
= 6;
1754 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1755 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x93); //CR206(0xCE)
1756 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -63\n");
1757 } else if(pDevice
->byBBPreEDRSSI
<= 64) { //RSSI -64
1758 if(pDevice
->byBBPreEDIndex
== 5) break;
1759 pDevice
->byBBPreEDIndex
= 5;
1760 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1761 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x79); //CR206(0xCE)
1762 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -64\n");
1763 } else if(pDevice
->byBBPreEDRSSI
<= 65) { //RSSI -65
1764 if(pDevice
->byBBPreEDIndex
== 4) break;
1765 pDevice
->byBBPreEDIndex
= 4;
1766 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1767 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x62); //CR206(0xCE)
1768 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -65\n");
1769 } else if(pDevice
->byBBPreEDRSSI
<= 66) { //RSSI -66
1770 if(pDevice
->byBBPreEDIndex
== 3) break;
1771 pDevice
->byBBPreEDIndex
= 3;
1772 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1773 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x51); //CR206(0xCE)
1774 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -66\n");
1775 } else if(pDevice
->byBBPreEDRSSI
<= 67) { //RSSI -67
1776 if(pDevice
->byBBPreEDIndex
== 2) break;
1777 pDevice
->byBBPreEDIndex
= 2;
1778 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1779 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x43); //CR206(0xCE)
1780 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -67\n");
1781 } else if(pDevice
->byBBPreEDRSSI
<= 68) { //RSSI -68
1782 if(pDevice
->byBBPreEDIndex
== 1) break;
1783 pDevice
->byBBPreEDIndex
= 1;
1784 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1785 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x36); //CR206(0xCE)
1786 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -68\n");
1787 } else { //RSSI -69, -70,....
1788 if(pDevice
->byBBPreEDIndex
== 0) break;
1789 pDevice
->byBBPreEDIndex
= 0;
1790 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1791 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x30); //CR206(0xCE)
1792 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -69, -70,...\n");
1798 //RobertYu:20060627, update new table
1801 { // need Max sensitivity //RSSI -69, -70, ...
1802 if(pDevice
->byBBPreEDIndex
== 0) break;
1803 pDevice
->byBBPreEDIndex
= 0;
1804 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1805 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x24); //CR206(0xCE)
1806 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -69, -70,..\n");
1810 if(pDevice
->byBBPreEDRSSI
<= 41) { // RSSI 0, -1,-2,....-41
1811 if(pDevice
->byBBPreEDIndex
== 22) break;
1812 pDevice
->byBBPreEDIndex
= 22;
1813 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0xFF); //CR201(0xC9)
1814 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1815 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1816 } else if(pDevice
->byBBPreEDRSSI
<= 42) { //RSSI -42
1817 if(pDevice
->byBBPreEDIndex
== 21) break;
1818 pDevice
->byBBPreEDIndex
= 21;
1819 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x36); //CR201(0xC9)
1820 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1821 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -42\n");
1822 } else if(pDevice
->byBBPreEDRSSI
<= 43) { //RSSI -43
1823 if(pDevice
->byBBPreEDIndex
== 20) break;
1824 pDevice
->byBBPreEDIndex
= 20;
1825 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x26); //CR201(0xC9)
1826 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1827 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -43\n");
1828 } else if(pDevice
->byBBPreEDRSSI
<= 45) { //RSSI -44, -45
1829 if(pDevice
->byBBPreEDIndex
== 19) break;
1830 pDevice
->byBBPreEDIndex
= 19;
1831 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x18); //CR201(0xC9)
1832 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1833 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -44,-45\n");
1834 } else if(pDevice
->byBBPreEDRSSI
<= 47) { //RSSI -46, -47
1835 if(pDevice
->byBBPreEDIndex
== 18) break;
1836 pDevice
->byBBPreEDIndex
= 18;
1837 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x11); //CR201(0xC9)
1838 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1839 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -46,-47\n");
1840 } else if(pDevice
->byBBPreEDRSSI
<= 49) { //RSSI -48, -49
1841 if(pDevice
->byBBPreEDIndex
== 17) break;
1842 pDevice
->byBBPreEDIndex
= 17;
1843 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x0a); //CR201(0xC9)
1844 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1845 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -48,-49\n");
1846 } else if(pDevice
->byBBPreEDRSSI
<= 51) { //RSSI -50, -51
1847 if(pDevice
->byBBPreEDIndex
== 16) break;
1848 pDevice
->byBBPreEDIndex
= 16;
1849 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x07); //CR201(0xC9)
1850 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1851 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -50,-51\n");
1852 } else if(pDevice
->byBBPreEDRSSI
<= 53) { //RSSI -52, -53
1853 if(pDevice
->byBBPreEDIndex
== 15) break;
1854 pDevice
->byBBPreEDIndex
= 15;
1855 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x04); //CR201(0xC9)
1856 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1857 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -52,-53\n");
1858 } else if(pDevice
->byBBPreEDRSSI
<= 55) { //RSSI -54, -55
1859 if(pDevice
->byBBPreEDIndex
== 14) break;
1860 pDevice
->byBBPreEDIndex
= 14;
1861 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x02); //CR201(0xC9)
1862 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xC0); //CR206(0xCE)
1863 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -54,-55\n");
1864 } else if(pDevice
->byBBPreEDRSSI
<= 56) { //RSSI -56
1865 if(pDevice
->byBBPreEDIndex
== 13) break;
1866 pDevice
->byBBPreEDIndex
= 13;
1867 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x02); //CR201(0xC9)
1868 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x30); //CR206(0xCE)
1869 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -56\n");
1870 } else if(pDevice
->byBBPreEDRSSI
<= 57) { //RSSI -57
1871 if(pDevice
->byBBPreEDIndex
== 12) break;
1872 pDevice
->byBBPreEDIndex
= 12;
1873 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
1874 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xB0); //CR206(0xCE)
1875 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -57\n");
1876 } else if(pDevice
->byBBPreEDRSSI
<= 58) { //RSSI -58
1877 if(pDevice
->byBBPreEDIndex
== 11) break;
1878 pDevice
->byBBPreEDIndex
= 11;
1879 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
1880 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x70); //CR206(0xCE)
1881 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -58\n");
1882 } else if(pDevice
->byBBPreEDRSSI
<= 59) { //RSSI -59
1883 if(pDevice
->byBBPreEDIndex
== 10) break;
1884 pDevice
->byBBPreEDIndex
= 10;
1885 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
1886 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x30); //CR206(0xCE)
1887 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -59\n");
1888 } else if(pDevice
->byBBPreEDRSSI
<= 60) { //RSSI -60
1889 if(pDevice
->byBBPreEDIndex
== 9) break;
1890 pDevice
->byBBPreEDIndex
= 9;
1891 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1892 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xEA); //CR206(0xCE)
1893 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -60\n");
1894 } else if(pDevice
->byBBPreEDRSSI
<= 61) { //RSSI -61
1895 if(pDevice
->byBBPreEDIndex
== 8) break;
1896 pDevice
->byBBPreEDIndex
= 8;
1897 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1898 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xC0); //CR206(0xCE)
1899 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -61\n");
1900 } else if(pDevice
->byBBPreEDRSSI
<= 62) { //RSSI -62
1901 if(pDevice
->byBBPreEDIndex
== 7) break;
1902 pDevice
->byBBPreEDIndex
= 7;
1903 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1904 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x9C); //CR206(0xCE)
1905 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -62\n");
1906 } else if(pDevice
->byBBPreEDRSSI
<= 63) { //RSSI -63
1907 if(pDevice
->byBBPreEDIndex
== 6) break;
1908 pDevice
->byBBPreEDIndex
= 6;
1909 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1910 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x80); //CR206(0xCE)
1911 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -63\n");
1912 } else if(pDevice
->byBBPreEDRSSI
<= 64) { //RSSI -64
1913 if(pDevice
->byBBPreEDIndex
== 5) break;
1914 pDevice
->byBBPreEDIndex
= 5;
1915 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1916 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x68); //CR206(0xCE)
1917 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -64\n");
1918 } else if(pDevice
->byBBPreEDRSSI
<= 65) { //RSSI -65
1919 if(pDevice
->byBBPreEDIndex
== 4) break;
1920 pDevice
->byBBPreEDIndex
= 4;
1921 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1922 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x52); //CR206(0xCE)
1923 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -65\n");
1924 } else if(pDevice
->byBBPreEDRSSI
<= 66) { //RSSI -66
1925 if(pDevice
->byBBPreEDIndex
== 3) break;
1926 pDevice
->byBBPreEDIndex
= 3;
1927 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1928 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x43); //CR206(0xCE)
1929 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -66\n");
1930 } else if(pDevice
->byBBPreEDRSSI
<= 67) { //RSSI -67
1931 if(pDevice
->byBBPreEDIndex
== 2) break;
1932 pDevice
->byBBPreEDIndex
= 2;
1933 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1934 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x36); //CR206(0xCE)
1935 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -67\n");
1936 } else if(pDevice
->byBBPreEDRSSI
<= 68) { //RSSI -68
1937 if(pDevice
->byBBPreEDIndex
== 1) break;
1938 pDevice
->byBBPreEDIndex
= 1;
1939 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1940 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x2D); //CR206(0xCE)
1941 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -68\n");
1942 } else { //RSSI -69, -70, ...
1943 if(pDevice
->byBBPreEDIndex
== 0) break;
1944 pDevice
->byBBPreEDIndex
= 0;
1945 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1946 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x24); //CR206(0xCE)
1947 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -69, -70,..\n");
1951 case RF_VT3342A0
: //RobertYu:20060627, testing table
1953 { // need Max sensitivity //RSSI -67, -68, ...
1954 if(pDevice
->byBBPreEDIndex
== 0) break;
1955 pDevice
->byBBPreEDIndex
= 0;
1956 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
1957 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x38); //CR206(0xCE)
1958 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -67, -68,..\n");
1962 if(pDevice
->byBBPreEDRSSI
<= 41) { // RSSI 0, -1,-2,....-41
1963 if(pDevice
->byBBPreEDIndex
== 20) break;
1964 pDevice
->byBBPreEDIndex
= 20;
1965 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0xFF); //CR201(0xC9)
1966 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1967 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1968 } else if(pDevice
->byBBPreEDRSSI
<= 42) { //RSSI -42
1969 if(pDevice
->byBBPreEDIndex
== 19) break;
1970 pDevice
->byBBPreEDIndex
= 19;
1971 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x36); //CR201(0xC9)
1972 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1973 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -42\n");
1974 } else if(pDevice
->byBBPreEDRSSI
<= 43) { //RSSI -43
1975 if(pDevice
->byBBPreEDIndex
== 18) break;
1976 pDevice
->byBBPreEDIndex
= 18;
1977 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x26); //CR201(0xC9)
1978 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1979 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -43\n");
1980 } else if(pDevice
->byBBPreEDRSSI
<= 45) { //RSSI -44, -45
1981 if(pDevice
->byBBPreEDIndex
== 17) break;
1982 pDevice
->byBBPreEDIndex
= 17;
1983 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x18); //CR201(0xC9)
1984 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1985 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -44,-45\n");
1986 } else if(pDevice
->byBBPreEDRSSI
<= 47) { //RSSI -46, -47
1987 if(pDevice
->byBBPreEDIndex
== 16) break;
1988 pDevice
->byBBPreEDIndex
= 16;
1989 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x11); //CR201(0xC9)
1990 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1991 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -46,-47\n");
1992 } else if(pDevice
->byBBPreEDRSSI
<= 49) { //RSSI -48, -49
1993 if(pDevice
->byBBPreEDIndex
== 15) break;
1994 pDevice
->byBBPreEDIndex
= 15;
1995 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x0a); //CR201(0xC9)
1996 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
1997 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -48,-49\n");
1998 } else if(pDevice
->byBBPreEDRSSI
<= 51) { //RSSI -50, -51
1999 if(pDevice
->byBBPreEDIndex
== 14) break;
2000 pDevice
->byBBPreEDIndex
= 14;
2001 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x07); //CR201(0xC9)
2002 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
2003 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -50,-51\n");
2004 } else if(pDevice
->byBBPreEDRSSI
<= 53) { //RSSI -52, -53
2005 if(pDevice
->byBBPreEDIndex
== 13) break;
2006 pDevice
->byBBPreEDIndex
= 13;
2007 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x04); //CR201(0xC9)
2008 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x00); //CR206(0xCE)
2009 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -52,-53\n");
2010 } else if(pDevice
->byBBPreEDRSSI
<= 55) { //RSSI -54, -55
2011 if(pDevice
->byBBPreEDIndex
== 12) break;
2012 pDevice
->byBBPreEDIndex
= 12;
2013 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x02); //CR201(0xC9)
2014 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xC0); //CR206(0xCE)
2015 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -54,-55\n");
2016 } else if(pDevice
->byBBPreEDRSSI
<= 56) { //RSSI -56
2017 if(pDevice
->byBBPreEDIndex
== 11) break;
2018 pDevice
->byBBPreEDIndex
= 11;
2019 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x02); //CR201(0xC9)
2020 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x30); //CR206(0xCE)
2021 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -56\n");
2022 } else if(pDevice
->byBBPreEDRSSI
<= 57) { //RSSI -57
2023 if(pDevice
->byBBPreEDIndex
== 10) break;
2024 pDevice
->byBBPreEDIndex
= 10;
2025 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
2026 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xB0); //CR206(0xCE)
2027 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -57\n");
2028 } else if(pDevice
->byBBPreEDRSSI
<= 58) { //RSSI -58
2029 if(pDevice
->byBBPreEDIndex
== 9) break;
2030 pDevice
->byBBPreEDIndex
= 9;
2031 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
2032 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x70); //CR206(0xCE)
2033 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -58\n");
2034 } else if(pDevice
->byBBPreEDRSSI
<= 59) { //RSSI -59
2035 if(pDevice
->byBBPreEDIndex
== 8) break;
2036 pDevice
->byBBPreEDIndex
= 8;
2037 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x01); //CR201(0xC9)
2038 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x30); //CR206(0xCE)
2039 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -59\n");
2040 } else if(pDevice
->byBBPreEDRSSI
<= 60) { //RSSI -60
2041 if(pDevice
->byBBPreEDIndex
== 7) break;
2042 pDevice
->byBBPreEDIndex
= 7;
2043 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
2044 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xEA); //CR206(0xCE)
2045 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -60\n");
2046 } else if(pDevice
->byBBPreEDRSSI
<= 61) { //RSSI -61
2047 if(pDevice
->byBBPreEDIndex
== 6) break;
2048 pDevice
->byBBPreEDIndex
= 6;
2049 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
2050 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0xC0); //CR206(0xCE)
2051 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -61\n");
2052 } else if(pDevice
->byBBPreEDRSSI
<= 62) { //RSSI -62
2053 if(pDevice
->byBBPreEDIndex
== 5) break;
2054 pDevice
->byBBPreEDIndex
= 5;
2055 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
2056 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x9C); //CR206(0xCE)
2057 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -62\n");
2058 } else if(pDevice
->byBBPreEDRSSI
<= 63) { //RSSI -63
2059 if(pDevice
->byBBPreEDIndex
== 4) break;
2060 pDevice
->byBBPreEDIndex
= 4;
2061 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
2062 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x80); //CR206(0xCE)
2063 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -63\n");
2064 } else if(pDevice
->byBBPreEDRSSI
<= 64) { //RSSI -64
2065 if(pDevice
->byBBPreEDIndex
== 3) break;
2066 pDevice
->byBBPreEDIndex
= 3;
2067 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
2068 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x68); //CR206(0xCE)
2069 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -64\n");
2070 } else if(pDevice
->byBBPreEDRSSI
<= 65) { //RSSI -65
2071 if(pDevice
->byBBPreEDIndex
== 2) break;
2072 pDevice
->byBBPreEDIndex
= 2;
2073 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
2074 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x52); //CR206(0xCE)
2075 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -65\n");
2076 } else if(pDevice
->byBBPreEDRSSI
<= 66) { //RSSI -66
2077 if(pDevice
->byBBPreEDIndex
== 1) break;
2078 pDevice
->byBBPreEDIndex
= 1;
2079 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
2080 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x43); //CR206(0xCE)
2081 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -66\n");
2082 } else { //RSSI -67, -68, ...
2083 if(pDevice
->byBBPreEDIndex
== 0) break;
2084 pDevice
->byBBPreEDIndex
= 0;
2085 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xC9, 0x00); //CR201(0xC9)
2086 ControlvWriteByte(pDevice
, MESSAGE_REQUEST_BBREG
, 0xCE, 0x38); //CR206(0xCE)
2087 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pDevice->byBBPreEDRSSI -67, -68,..\n");