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
694 IN BYTE byPreambleType,
696 IN UINT cbFrameLength,
703 UINT uRateIdx = (UINT)wRate;
707 if (uRateIdx > RATE_54M) {
712 uRate = (UINT)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 IN UINT cbFrameLength,
764 IN BYTE byPacketType,
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 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 //20080215-01,<Add> by Mike Liu
1014 // if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04)
1017 //20080804-01,<Add> by Mike Liu
1019 pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
1020 if(pDevice->config_file.ZoneType >= 0) { //read zonetype file ok!
1021 if ((pDevice->config_file.ZoneType == 0)&&
1022 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] !=0x00)){ //for USA
1023 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
1024 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
1025 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :USA\n");
1027 else if((pDevice->config_file.ZoneType == 1)&&
1028 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x01)){ //for Japan
1029 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
1030 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
1031 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Japan\n");
1033 else if((pDevice->config_file.ZoneType == 2)&&
1034 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x02)){ //for Europe
1035 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
1036 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
1037 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Europe\n");
1040 if(pDevice->config_file.ZoneType !=pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
1041 printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",pDevice->config_file.ZoneType,pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
1043 printk("Read Zonetype file success,use default zonetype setting[%02x]\n",pDevice->config_file.ZoneType);
1047 if ( !pDevice->bZoneRegExist ) {
1048 pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
1050 pDevice->byRFType = pDevice->abyEEPROM[EEP_OFS_RFTYPE];
1052 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Zone Type %x\n", pDevice->byZoneType);
1053 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RF Type %d\n", pDevice->byRFType);
1055 if ((pDevice->byRFType == RF_AL2230) || (pDevice->byRFType == RF_AL2230S)) {
1056 pDevice->byBBRxConf = abyVT3184_AL2230[10];
1057 wLength = sizeof(abyVT3184_AL2230);
1058 pbyAddr = abyVT3184_AL2230;
1059 pbyAgc = abyVT3184_AGC;
1060 wLengthAgc = sizeof(abyVT3184_AGC);
1062 pDevice->abyBBVGA[0] = 0x1C;
1063 pDevice->abyBBVGA[1] = 0x10;
1064 pDevice->abyBBVGA[2] = 0x0;
1065 pDevice->abyBBVGA[3] = 0x0;
1066 pDevice->ldBmThreshold[0] = -70;
1067 pDevice->ldBmThreshold[1] = -48;
1068 pDevice->ldBmThreshold[2] = 0;
1069 pDevice->ldBmThreshold[3] = 0;
1071 else if (pDevice->byRFType == RF_AIROHA7230) {
1072 pDevice->byBBRxConf = abyVT3184_AL2230[10];
1073 wLength = sizeof(abyVT3184_AL2230);
1074 pbyAddr = abyVT3184_AL2230;
1075 pbyAgc = abyVT3184_AGC;
1076 wLengthAgc = sizeof(abyVT3184_AGC);
1078 // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1079 //pbyAddr[0x09] = 0x41;
1080 // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1081 //pbyAddr[0x0a] = 0x28;
1082 // Select VC1/VC2, CR215 = 0x02->0x06
1083 pbyAddr[0xd7] = 0x06;
1085 pDevice->abyBBVGA[0] = 0x1C;
1086 pDevice->abyBBVGA[1] = 0x10;
1087 pDevice->abyBBVGA[2] = 0x0;
1088 pDevice->abyBBVGA[3] = 0x0;
1089 pDevice->ldBmThreshold[0] = -70;
1090 pDevice->ldBmThreshold[1] = -48;
1091 pDevice->ldBmThreshold[2] = 0;
1092 pDevice->ldBmThreshold[3] = 0;
1094 else if ( (pDevice->byRFType == RF_VT3226) || (pDevice->byRFType == RF_VT3226D0) ) {
1095 pDevice->byBBRxConf = abyVT3184_VT3226D0[10]; //RobertYu:20060515
1096 wLength = sizeof(abyVT3184_VT3226D0); //RobertYu:20060515
1097 pbyAddr = abyVT3184_VT3226D0; //RobertYu:20060515
1098 pbyAgc = abyVT3184_AGC;
1099 wLengthAgc = sizeof(abyVT3184_AGC);
1101 pDevice->abyBBVGA[0] = 0x20; //RobertYu:20060104, reguest by Jack
1102 pDevice->abyBBVGA[1] = 0x10;
1103 pDevice->abyBBVGA[2] = 0x0;
1104 pDevice->abyBBVGA[3] = 0x0;
1105 pDevice->ldBmThreshold[0] = -70;
1106 pDevice->ldBmThreshold[1] = -48;
1107 pDevice->ldBmThreshold[2] = 0;
1108 pDevice->ldBmThreshold[3] = 0;
1109 // Fix VT3226 DFC system timing issue
1110 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
1112 //{{RobertYu:20060609
1113 } else if ( (pDevice->byRFType == RF_VT3342A0) ) {
1114 pDevice->byBBRxConf = abyVT3184_VT3226D0[10];
1115 wLength = sizeof(abyVT3184_VT3226D0);
1116 pbyAddr = abyVT3184_VT3226D0;
1117 pbyAgc = abyVT3184_AGC;
1118 wLengthAgc = sizeof(abyVT3184_AGC);
1120 pDevice->abyBBVGA[0] = 0x20;
1121 pDevice->abyBBVGA[1] = 0x10;
1122 pDevice->abyBBVGA[2] = 0x0;
1123 pDevice->abyBBVGA[3] = 0x0;
1124 pDevice->ldBmThreshold[0] = -70;
1125 pDevice->ldBmThreshold[1] = -48;
1126 pDevice->ldBmThreshold[2] = 0;
1127 pDevice->ldBmThreshold[3] = 0;
1128 // Fix VT3226 DFC system timing issue
1129 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
1135 memcpy(abyArray, pbyAddr, wLength);
1136 CONTROLnsRequestOut(pDevice,
1139 MESSAGE_REQUEST_BBREG,
1144 memcpy(abyArray, pbyAgc, wLengthAgc);
1145 CONTROLnsRequestOut(pDevice,
1148 MESSAGE_REQUEST_BBAGC,
1154 if ((pDevice->byRFType == RF_VT3226) || //RobertYu:20051116, 20060111 remove VT3226D0
1155 (pDevice->byRFType == RF_VT3342A0) //RobertYu:20060609
1157 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x23);
1158 MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
1160 else if (pDevice->byRFType == RF_VT3226D0)
1162 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x11);
1163 MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
1167 ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x04,0x7F);
1168 ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01);
1170 RFbRFTableDownload(pDevice);
1171 return TRUE;//ntStatus;
1176 * Description: Turn on BaseBand Loopback mode
1180 * pDevice - Device Structure
1185 * Return Value: none
1188 void BBvLoopbackOn (PSDevice pDevice)
1193 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xC9, &pDevice->byBBCRc9);//CR201
1194 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0);
1195 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x4D, &pDevice->byBBCR4d);//CR77
1196 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, 0x90);
1198 //CR 88 = 0x02(CCK), 0x03(OFDM)
1199 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x88, &pDevice->byBBCR88);//CR136
1201 if (pDevice->wCurrentRate <= RATE_11M) { //CCK
1202 // Enable internal digital loopback: CR33 |= 0000 0001
1203 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33
1204 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData | 0x01));//CR33
1206 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, 0); //CR154
1208 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02);//CR239
1211 // Enable internal digital loopback:CR154 |= 0000 0001
1212 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154
1213 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData | 0x01));//CR154
1215 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, 0); //CR33
1217 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03);//CR239
1221 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, 0);//CR14
1224 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x09, &pDevice->byBBCR09);
1225 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, (BYTE)(pDevice->byBBCR09 & 0xDE));
1229 * Description: Turn off BaseBand Loopback mode
1233 * pDevice - Device Structure
1238 * Return Value: none
1241 void BBvLoopbackOff (PSDevice pDevice)
1245 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, pDevice->byBBCRc9);//CR201
1246 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, pDevice->byBBCR88);//CR136
1247 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, pDevice->byBBCR09);//CR136
1248 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, pDevice->byBBCR4d);//CR77
1250 if (pDevice->wCurrentRate <= RATE_11M) { // CCK
1251 // Set the CR33 Bit2 to disable internal Loopback.
1252 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33
1253 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData & 0xFE));//CR33
1256 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154
1257 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData & 0xFE));//CR154
1259 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x0E, &byData);//CR14
1260 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, (BYTE)(byData | 0x80));//CR14
1266 * Description: Set ShortSlotTime mode
1270 * pDevice - Device Structure
1274 * Return Value: none
1278 BBvSetShortSlotTime (PSDevice pDevice)
1282 if (pDevice->bShortSlotTime) {
1283 pDevice->byBBRxConf &= 0xDF;//1101 1111
1285 pDevice->byBBRxConf |= 0x20;//0010 0000
1288 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xE7, &byBBVGA);
1289 if (byBBVGA == pDevice->abyBBVGA[0]) {
1290 pDevice->byBBRxConf |= 0x20;//0010 0000
1293 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);
1298 VOID BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData)
1301 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData);
1303 // patch for 3253B0 Baseband with Cardbus module
1304 if (byData == pDevice->abyBBVGA[0]) {
1305 pDevice->byBBRxConf |= 0x20;//0010 0000
1306 } else if (pDevice->bShortSlotTime) {
1307 pDevice->byBBRxConf &= 0xDF;//1101 1111
1309 pDevice->byBBRxConf |= 0x20;//0010 0000
1311 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10
1316 * Description: Baseband SoftwareReset
1320 * dwIoBase - I/O base address
1324 * Return Value: none
1328 BBvSoftwareReset (PSDevice pDevice)
1330 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40);
1331 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0);
1332 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0x01);
1333 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0);
1337 * Description: BBvSetDeepSleep
1341 * pDevice - Device Structure
1345 * Return Value: none
1349 BBvSetDeepSleep (PSDevice pDevice)
1351 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12
1352 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13
1356 BBvExitDeepSleep (PSDevice pDevice)
1358 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12
1359 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13
1365 s_ulGetLowSQ3(PSDevice pDevice)
1371 ulMaxPacket = pDevice->aulPktNum[RATE_54M];
1372 if ( pDevice->aulPktNum[RATE_54M] != 0 ) {
1373 ulSQ3 = pDevice->aulSQ3Val[RATE_54M] / pDevice->aulPktNum[RATE_54M];
1375 for ( ii=RATE_48M;ii>=RATE_6M;ii-- ) {
1376 if ( pDevice->aulPktNum[ii] > ulMaxPacket ) {
1377 ulMaxPacket = pDevice->aulPktNum[ii];
1378 ulSQ3 = pDevice->aulSQ3Val[ii] / pDevice->aulPktNum[ii];
1389 s_ulGetRatio (PSDevice pDevice)
1396 //This is a thousand-ratio
1397 ulMaxPacket = pDevice->aulPktNum[RATE_54M];
1398 if ( pDevice->aulPktNum[RATE_54M] != 0 ) {
1399 ulPacketNum = pDevice->aulPktNum[RATE_54M];
1400 ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
1401 ulRatio += TOP_RATE_54M;
1403 for ( ii=RATE_48M;ii>=RATE_1M;ii-- ) {
1404 if ( pDevice->aulPktNum[ii] > ulMaxPacket ) {
1406 for ( jj=RATE_54M;jj>=ii;jj--)
1407 ulPacketNum += pDevice->aulPktNum[jj];
1408 ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
1409 ulRatio += TOP_RATE_48M;
1410 ulMaxPacket = pDevice->aulPktNum[ii];
1421 s_vClearSQ3Value (PSDevice pDevice)
1424 pDevice->uDiversityCnt = 0;
1426 for ( ii=RATE_1M;ii<MAX_RATE;ii++) {
1427 pDevice->aulPktNum[ii] = 0;
1428 pDevice->aulSQ3Val[ii] = 0;
1434 * Description: Antenna Diversity
1438 * pDevice - Device Structure
1439 * byRSR - RSR from received packet
1440 * bySQ3 - SQ3 value from received packet
1444 * Return Value: none
1449 BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3)
1452 pDevice->uDiversityCnt++;
1453 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt);
1455 if (byRxRate == 2) {
1456 pDevice->aulPktNum[RATE_1M]++;
1458 else if (byRxRate==4) {
1459 pDevice->aulPktNum[RATE_2M]++;
1461 else if (byRxRate==11) {
1462 pDevice->aulPktNum[RATE_5M]++;
1464 else if (byRxRate==22) {
1465 pDevice->aulPktNum[RATE_11M]++;
1467 else if(byRxRate==12){
1468 pDevice->aulPktNum[RATE_6M]++;
1469 pDevice->aulSQ3Val[RATE_6M] += bySQ3;
1471 else if(byRxRate==18){
1472 pDevice->aulPktNum[RATE_9M]++;
1473 pDevice->aulSQ3Val[RATE_9M] += bySQ3;
1475 else if(byRxRate==24){
1476 pDevice->aulPktNum[RATE_12M]++;
1477 pDevice->aulSQ3Val[RATE_12M] += bySQ3;
1479 else if(byRxRate==36){
1480 pDevice->aulPktNum[RATE_18M]++;
1481 pDevice->aulSQ3Val[RATE_18M] += bySQ3;
1483 else if(byRxRate==48){
1484 pDevice->aulPktNum[RATE_24M]++;
1485 pDevice->aulSQ3Val[RATE_24M] += bySQ3;
1487 else if(byRxRate==72){
1488 pDevice->aulPktNum[RATE_36M]++;
1489 pDevice->aulSQ3Val[RATE_36M] += bySQ3;
1491 else if(byRxRate==96){
1492 pDevice->aulPktNum[RATE_48M]++;
1493 pDevice->aulSQ3Val[RATE_48M] += bySQ3;
1495 else if(byRxRate==108){
1496 pDevice->aulPktNum[RATE_54M]++;
1497 pDevice->aulSQ3Val[RATE_54M] += bySQ3;
1500 if (pDevice->byAntennaState == 0) {
1502 if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) {
1503 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n",(int)pDevice->ulDiversityNValue, (int)pDevice->aulPktNum[RATE_54M]);
1505 pDevice->ulSQ3_State0 = s_ulGetLowSQ3(pDevice);
1506 pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
1507 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, SQ3= [%08x] rate = [%08x]\n",(int)pDevice->ulSQ3_State0,(int)pDevice->ulRatio_State0);
1509 if ( ((pDevice->aulPktNum[RATE_54M] < pDevice->ulDiversityNValue/2) &&
1510 (pDevice->ulSQ3_State0 > pDevice->ulSQ3TH) ) ||
1511 (pDevice->ulSQ3_State0 == 0 ) ) {
1513 if ( pDevice->byTMax == 0 )
1516 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1518 pDevice->byAntennaState = 1;
1520 del_timer(&pDevice->TimerSQ3Tmax3);
1521 del_timer(&pDevice->TimerSQ3Tmax2);
1522 pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
1523 add_timer(&pDevice->TimerSQ3Tmax1);
1526 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1527 add_timer(&pDevice->TimerSQ3Tmax3);
1529 s_vClearSQ3Value(pDevice);
1532 } else { //byAntennaState == 1
1534 if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) {
1536 del_timer(&pDevice->TimerSQ3Tmax1);
1537 pDevice->ulSQ3_State1 = s_ulGetLowSQ3(pDevice);
1538 pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
1539 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n",(int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1);
1541 if ( ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 != 0)) ||
1542 ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 == 0) && (pDevice->ulRatio_State1 < pDevice->ulRatio_State0)) ||
1543 ((pDevice->ulSQ3_State1 != 0) && (pDevice->ulSQ3_State0 != 0) && (pDevice->ulSQ3_State0 < pDevice->ulSQ3_State1))
1546 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1548 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1549 pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
1550 add_timer(&pDevice->TimerSQ3Tmax3);
1551 add_timer(&pDevice->TimerSQ3Tmax2);
1554 pDevice->byAntennaState = 0;
1555 s_vClearSQ3Value(pDevice);
1564 * Timer for SQ3 antenna diversity
1569 * hDeviceContext - Pointer to the adapter
1575 * Return Value: none
1581 IN HANDLE hDeviceContext
1584 PSDevice pDevice = (PSDevice)hDeviceContext;
1586 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack...");
1587 spin_lock_irq(&pDevice->lock);
1589 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1590 pDevice->byAntennaState = 0;
1591 s_vClearSQ3Value(pDevice);
1592 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1593 pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
1594 add_timer(&pDevice->TimerSQ3Tmax3);
1595 add_timer(&pDevice->TimerSQ3Tmax2);
1598 spin_unlock_irq(&pDevice->lock);
1606 * Timer for SQ3 antenna diversity
1611 * hDeviceContext - Pointer to the adapter
1617 * Return Value: none
1622 TimerSQ3Tmax3CallBack (
1623 IN HANDLE hDeviceContext
1626 PSDevice pDevice = (PSDevice)hDeviceContext;
1628 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack...");
1629 spin_lock_irq(&pDevice->lock);
1631 pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
1632 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0 = [%08x]\n",(int)pDevice->ulRatio_State0);
1634 s_vClearSQ3Value(pDevice);
1635 if ( pDevice->byTMax == 0 ) {
1636 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1637 add_timer(&pDevice->TimerSQ3Tmax3);
1638 spin_unlock_irq(&pDevice->lock);
1642 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1643 pDevice->byAntennaState = 1;
1644 del_timer(&pDevice->TimerSQ3Tmax3);
1645 del_timer(&pDevice->TimerSQ3Tmax2);
1646 pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
1647 add_timer(&pDevice->TimerSQ3Tmax1);
1649 spin_unlock_irq(&pDevice->lock);
1654 BBvUpdatePreEDThreshold(
1655 IN PSDevice pDevice,
1660 switch(pDevice->byRFType)
1665 //RobertYu:20060627, update new table
1668 { // need Max sensitivity //RSSI -69, -70,....
1669 if(pDevice->byBBPreEDIndex == 0) break;
1670 pDevice->byBBPreEDIndex = 0;
1671 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1672 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1673 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70, -71,...\n");
1677 if(pDevice->byBBPreEDRSSI <= 45) { // RSSI 0, -1,-2,....-45
1678 if(pDevice->byBBPreEDIndex == 20) break;
1679 pDevice->byBBPreEDIndex = 20;
1680 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1681 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1682 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-45\n");
1683 } else if(pDevice->byBBPreEDRSSI <= 46) { //RSSI -46
1684 if(pDevice->byBBPreEDIndex == 19) break;
1685 pDevice->byBBPreEDIndex = 19;
1686 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x1A); //CR201(0xC9)
1687 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1688 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46\n");
1689 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -47
1690 if(pDevice->byBBPreEDIndex == 18) break;
1691 pDevice->byBBPreEDIndex = 18;
1692 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x15); //CR201(0xC9)
1693 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1694 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -47\n");
1695 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1696 if(pDevice->byBBPreEDIndex == 17) break;
1697 pDevice->byBBPreEDIndex = 17;
1698 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0E); //CR201(0xC9)
1699 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1700 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1701 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1702 if(pDevice->byBBPreEDIndex == 16) break;
1703 pDevice->byBBPreEDIndex = 16;
1704 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x09); //CR201(0xC9)
1705 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1706 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1707 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1708 if(pDevice->byBBPreEDIndex == 15) break;
1709 pDevice->byBBPreEDIndex = 15;
1710 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x06); //CR201(0xC9)
1711 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1712 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1713 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1714 if(pDevice->byBBPreEDIndex == 14) break;
1715 pDevice->byBBPreEDIndex = 14;
1716 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x03); //CR201(0xC9)
1717 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1718 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1719 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1720 if(pDevice->byBBPreEDIndex == 13) break;
1721 pDevice->byBBPreEDIndex = 13;
1722 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1723 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE)
1724 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1725 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1726 if(pDevice->byBBPreEDIndex == 12) break;
1727 pDevice->byBBPreEDIndex = 12;
1728 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1729 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x20); //CR206(0xCE)
1730 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1731 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1732 if(pDevice->byBBPreEDIndex == 11) break;
1733 pDevice->byBBPreEDIndex = 11;
1734 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1735 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE)
1736 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1737 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1738 if(pDevice->byBBPreEDIndex == 10) break;
1739 pDevice->byBBPreEDIndex = 10;
1740 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1741 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x54); //CR206(0xCE)
1742 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1743 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1744 if(pDevice->byBBPreEDIndex == 9) break;
1745 pDevice->byBBPreEDIndex = 9;
1746 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1747 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x18); //CR206(0xCE)
1748 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1749 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1750 if(pDevice->byBBPreEDIndex == 8) break;
1751 pDevice->byBBPreEDIndex = 8;
1752 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1753 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xE3); //CR206(0xCE)
1754 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
1755 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
1756 if(pDevice->byBBPreEDIndex == 7) break;
1757 pDevice->byBBPreEDIndex = 7;
1758 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1759 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB9); //CR206(0xCE)
1760 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
1761 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
1762 if(pDevice->byBBPreEDIndex == 6) break;
1763 pDevice->byBBPreEDIndex = 6;
1764 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1765 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x93); //CR206(0xCE)
1766 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
1767 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
1768 if(pDevice->byBBPreEDIndex == 5) break;
1769 pDevice->byBBPreEDIndex = 5;
1770 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1771 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x79); //CR206(0xCE)
1772 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
1773 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
1774 if(pDevice->byBBPreEDIndex == 4) break;
1775 pDevice->byBBPreEDIndex = 4;
1776 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1777 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x62); //CR206(0xCE)
1778 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
1779 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
1780 if(pDevice->byBBPreEDIndex == 3) break;
1781 pDevice->byBBPreEDIndex = 3;
1782 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1783 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x51); //CR206(0xCE)
1784 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
1785 } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67
1786 if(pDevice->byBBPreEDIndex == 2) break;
1787 pDevice->byBBPreEDIndex = 2;
1788 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1789 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
1790 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n");
1791 } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68
1792 if(pDevice->byBBPreEDIndex == 1) break;
1793 pDevice->byBBPreEDIndex = 1;
1794 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1795 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE)
1796 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n");
1797 } else { //RSSI -69, -70,....
1798 if(pDevice->byBBPreEDIndex == 0) break;
1799 pDevice->byBBPreEDIndex = 0;
1800 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1801 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1802 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,...\n");
1808 //RobertYu:20060627, update new table
1811 { // need Max sensitivity //RSSI -69, -70, ...
1812 if(pDevice->byBBPreEDIndex == 0) break;
1813 pDevice->byBBPreEDIndex = 0;
1814 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1815 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
1816 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n");
1820 if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41
1821 if(pDevice->byBBPreEDIndex == 22) break;
1822 pDevice->byBBPreEDIndex = 22;
1823 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1824 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1825 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1826 } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42
1827 if(pDevice->byBBPreEDIndex == 21) break;
1828 pDevice->byBBPreEDIndex = 21;
1829 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9)
1830 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1831 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n");
1832 } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43
1833 if(pDevice->byBBPreEDIndex == 20) break;
1834 pDevice->byBBPreEDIndex = 20;
1835 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9)
1836 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1837 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n");
1838 } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45
1839 if(pDevice->byBBPreEDIndex == 19) break;
1840 pDevice->byBBPreEDIndex = 19;
1841 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9)
1842 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1843 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n");
1844 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47
1845 if(pDevice->byBBPreEDIndex == 18) break;
1846 pDevice->byBBPreEDIndex = 18;
1847 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9)
1848 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1849 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n");
1850 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1851 if(pDevice->byBBPreEDIndex == 17) break;
1852 pDevice->byBBPreEDIndex = 17;
1853 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9)
1854 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1855 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1856 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1857 if(pDevice->byBBPreEDIndex == 16) break;
1858 pDevice->byBBPreEDIndex = 16;
1859 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9)
1860 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1861 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1862 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1863 if(pDevice->byBBPreEDIndex == 15) break;
1864 pDevice->byBBPreEDIndex = 15;
1865 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9)
1866 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1867 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1868 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1869 if(pDevice->byBBPreEDIndex == 14) break;
1870 pDevice->byBBPreEDIndex = 14;
1871 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1872 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1873 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1874 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1875 if(pDevice->byBBPreEDIndex == 13) break;
1876 pDevice->byBBPreEDIndex = 13;
1877 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1878 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1879 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1880 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1881 if(pDevice->byBBPreEDIndex == 12) break;
1882 pDevice->byBBPreEDIndex = 12;
1883 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1884 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE)
1885 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1886 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1887 if(pDevice->byBBPreEDIndex == 11) break;
1888 pDevice->byBBPreEDIndex = 11;
1889 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1890 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE)
1891 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1892 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1893 if(pDevice->byBBPreEDIndex == 10) break;
1894 pDevice->byBBPreEDIndex = 10;
1895 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1896 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1897 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1898 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1899 if(pDevice->byBBPreEDIndex == 9) break;
1900 pDevice->byBBPreEDIndex = 9;
1901 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1902 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE)
1903 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1904 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1905 if(pDevice->byBBPreEDIndex == 8) break;
1906 pDevice->byBBPreEDIndex = 8;
1907 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1908 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1909 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
1910 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
1911 if(pDevice->byBBPreEDIndex == 7) break;
1912 pDevice->byBBPreEDIndex = 7;
1913 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1914 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE)
1915 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
1916 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
1917 if(pDevice->byBBPreEDIndex == 6) break;
1918 pDevice->byBBPreEDIndex = 6;
1919 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1920 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE)
1921 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
1922 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
1923 if(pDevice->byBBPreEDIndex == 5) break;
1924 pDevice->byBBPreEDIndex = 5;
1925 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1926 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE)
1927 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
1928 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
1929 if(pDevice->byBBPreEDIndex == 4) break;
1930 pDevice->byBBPreEDIndex = 4;
1931 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1932 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE)
1933 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
1934 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
1935 if(pDevice->byBBPreEDIndex == 3) break;
1936 pDevice->byBBPreEDIndex = 3;
1937 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1938 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
1939 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
1940 } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67
1941 if(pDevice->byBBPreEDIndex == 2) break;
1942 pDevice->byBBPreEDIndex = 2;
1943 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1944 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE)
1945 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n");
1946 } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68
1947 if(pDevice->byBBPreEDIndex == 1) break;
1948 pDevice->byBBPreEDIndex = 1;
1949 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1950 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x2D); //CR206(0xCE)
1951 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n");
1952 } else { //RSSI -69, -70, ...
1953 if(pDevice->byBBPreEDIndex == 0) break;
1954 pDevice->byBBPreEDIndex = 0;
1955 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1956 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
1957 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n");
1961 case RF_VT3342A0: //RobertYu:20060627, testing table
1963 { // need Max sensitivity //RSSI -67, -68, ...
1964 if(pDevice->byBBPreEDIndex == 0) break;
1965 pDevice->byBBPreEDIndex = 0;
1966 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1967 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
1968 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n");
1972 if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41
1973 if(pDevice->byBBPreEDIndex == 20) break;
1974 pDevice->byBBPreEDIndex = 20;
1975 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1976 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1977 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1978 } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42
1979 if(pDevice->byBBPreEDIndex == 19) break;
1980 pDevice->byBBPreEDIndex = 19;
1981 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9)
1982 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1983 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n");
1984 } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43
1985 if(pDevice->byBBPreEDIndex == 18) break;
1986 pDevice->byBBPreEDIndex = 18;
1987 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9)
1988 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1989 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n");
1990 } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45
1991 if(pDevice->byBBPreEDIndex == 17) break;
1992 pDevice->byBBPreEDIndex = 17;
1993 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9)
1994 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1995 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n");
1996 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47
1997 if(pDevice->byBBPreEDIndex == 16) break;
1998 pDevice->byBBPreEDIndex = 16;
1999 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9)
2000 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2001 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n");
2002 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
2003 if(pDevice->byBBPreEDIndex == 15) break;
2004 pDevice->byBBPreEDIndex = 15;
2005 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9)
2006 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2007 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
2008 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
2009 if(pDevice->byBBPreEDIndex == 14) break;
2010 pDevice->byBBPreEDIndex = 14;
2011 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9)
2012 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2013 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
2014 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
2015 if(pDevice->byBBPreEDIndex == 13) break;
2016 pDevice->byBBPreEDIndex = 13;
2017 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9)
2018 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
2019 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
2020 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
2021 if(pDevice->byBBPreEDIndex == 12) break;
2022 pDevice->byBBPreEDIndex = 12;
2023 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
2024 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
2025 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
2026 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
2027 if(pDevice->byBBPreEDIndex == 11) break;
2028 pDevice->byBBPreEDIndex = 11;
2029 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
2030 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
2031 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
2032 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
2033 if(pDevice->byBBPreEDIndex == 10) break;
2034 pDevice->byBBPreEDIndex = 10;
2035 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
2036 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE)
2037 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
2038 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
2039 if(pDevice->byBBPreEDIndex == 9) break;
2040 pDevice->byBBPreEDIndex = 9;
2041 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
2042 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE)
2043 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
2044 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
2045 if(pDevice->byBBPreEDIndex == 8) break;
2046 pDevice->byBBPreEDIndex = 8;
2047 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
2048 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
2049 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
2050 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
2051 if(pDevice->byBBPreEDIndex == 7) break;
2052 pDevice->byBBPreEDIndex = 7;
2053 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2054 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE)
2055 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
2056 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
2057 if(pDevice->byBBPreEDIndex == 6) break;
2058 pDevice->byBBPreEDIndex = 6;
2059 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2060 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
2061 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
2062 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
2063 if(pDevice->byBBPreEDIndex == 5) break;
2064 pDevice->byBBPreEDIndex = 5;
2065 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2066 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE)
2067 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
2068 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
2069 if(pDevice->byBBPreEDIndex == 4) break;
2070 pDevice->byBBPreEDIndex = 4;
2071 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2072 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE)
2073 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
2074 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
2075 if(pDevice->byBBPreEDIndex == 3) break;
2076 pDevice->byBBPreEDIndex = 3;
2077 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2078 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE)
2079 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
2080 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
2081 if(pDevice->byBBPreEDIndex == 2) break;
2082 pDevice->byBBPreEDIndex = 2;
2083 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2084 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE)
2085 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
2086 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
2087 if(pDevice->byBBPreEDIndex == 1) break;
2088 pDevice->byBBPreEDIndex = 1;
2089 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2090 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
2091 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
2092 } else { //RSSI -67, -68, ...
2093 if(pDevice->byBBPreEDIndex == 0) break;
2094 pDevice->byBBPreEDIndex = 0;
2095 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2096 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
2097 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n");