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 * BBvCalculateParameter - Calculate 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: Calculate 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 BBvCalculateParameter (
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 switch (byAntennaMode) {
940 pDevice->byBBRxConf &= 0xFC;
943 pDevice->byBBRxConf &= 0xFE;
944 pDevice->byBBRxConf |= 0x02;
949 CONTROLnsRequestOut(pDevice,
950 MESSAGE_TYPE_SET_ANTMD,
951 (WORD) byAntennaMode,
958 * Description: Set Antenna mode
962 * pDevice - Device Structure
963 * byAntennaMode - Antenna Mode
971 BOOL BBbVT3184Init(PSDevice pDevice)
980 ntStatus = CONTROLnsRequestIn(pDevice,
983 MESSAGE_REQUEST_EEPROM,
984 EEP_MAX_CONTEXT_SIZE,
986 if (ntStatus != STATUS_SUCCESS) {
991 // if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04)
995 pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
996 if(pDevice->config_file.ZoneType >= 0) { //read zonetype file ok!
997 if ((pDevice->config_file.ZoneType == 0)&&
998 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] !=0x00)){ //for USA
999 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
1000 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
1001 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :USA\n");
1003 else if((pDevice->config_file.ZoneType == 1)&&
1004 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x01)){ //for Japan
1005 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
1006 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
1007 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Japan\n");
1009 else if((pDevice->config_file.ZoneType == 2)&&
1010 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x02)){ //for Europe
1011 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
1012 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
1013 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Europe\n");
1016 if(pDevice->config_file.ZoneType !=pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
1017 printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",pDevice->config_file.ZoneType,pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
1019 printk("Read Zonetype file success,use default zonetype setting[%02x]\n",pDevice->config_file.ZoneType);
1023 if ( !pDevice->bZoneRegExist ) {
1024 pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
1026 pDevice->byRFType = pDevice->abyEEPROM[EEP_OFS_RFTYPE];
1028 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Zone Type %x\n", pDevice->byZoneType);
1029 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RF Type %d\n", pDevice->byRFType);
1031 if ((pDevice->byRFType == RF_AL2230) || (pDevice->byRFType == RF_AL2230S)) {
1032 pDevice->byBBRxConf = abyVT3184_AL2230[10];
1033 wLength = sizeof(abyVT3184_AL2230);
1034 pbyAddr = abyVT3184_AL2230;
1035 pbyAgc = abyVT3184_AGC;
1036 wLengthAgc = sizeof(abyVT3184_AGC);
1038 pDevice->abyBBVGA[0] = 0x1C;
1039 pDevice->abyBBVGA[1] = 0x10;
1040 pDevice->abyBBVGA[2] = 0x0;
1041 pDevice->abyBBVGA[3] = 0x0;
1042 pDevice->ldBmThreshold[0] = -70;
1043 pDevice->ldBmThreshold[1] = -48;
1044 pDevice->ldBmThreshold[2] = 0;
1045 pDevice->ldBmThreshold[3] = 0;
1047 else if (pDevice->byRFType == RF_AIROHA7230) {
1048 pDevice->byBBRxConf = abyVT3184_AL2230[10];
1049 wLength = sizeof(abyVT3184_AL2230);
1050 pbyAddr = abyVT3184_AL2230;
1051 pbyAgc = abyVT3184_AGC;
1052 wLengthAgc = sizeof(abyVT3184_AGC);
1054 // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1055 //pbyAddr[0x09] = 0x41;
1056 // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1057 //pbyAddr[0x0a] = 0x28;
1058 // Select VC1/VC2, CR215 = 0x02->0x06
1059 pbyAddr[0xd7] = 0x06;
1061 pDevice->abyBBVGA[0] = 0x1C;
1062 pDevice->abyBBVGA[1] = 0x10;
1063 pDevice->abyBBVGA[2] = 0x0;
1064 pDevice->abyBBVGA[3] = 0x0;
1065 pDevice->ldBmThreshold[0] = -70;
1066 pDevice->ldBmThreshold[1] = -48;
1067 pDevice->ldBmThreshold[2] = 0;
1068 pDevice->ldBmThreshold[3] = 0;
1070 else if ( (pDevice->byRFType == RF_VT3226) || (pDevice->byRFType == RF_VT3226D0) ) {
1071 pDevice->byBBRxConf = abyVT3184_VT3226D0[10]; //RobertYu:20060515
1072 wLength = sizeof(abyVT3184_VT3226D0); //RobertYu:20060515
1073 pbyAddr = abyVT3184_VT3226D0; //RobertYu:20060515
1074 pbyAgc = abyVT3184_AGC;
1075 wLengthAgc = sizeof(abyVT3184_AGC);
1077 pDevice->abyBBVGA[0] = 0x20; //RobertYu:20060104, reguest by Jack
1078 pDevice->abyBBVGA[1] = 0x10;
1079 pDevice->abyBBVGA[2] = 0x0;
1080 pDevice->abyBBVGA[3] = 0x0;
1081 pDevice->ldBmThreshold[0] = -70;
1082 pDevice->ldBmThreshold[1] = -48;
1083 pDevice->ldBmThreshold[2] = 0;
1084 pDevice->ldBmThreshold[3] = 0;
1085 // Fix VT3226 DFC system timing issue
1086 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
1088 //{{RobertYu:20060609
1089 } else if ( (pDevice->byRFType == RF_VT3342A0) ) {
1090 pDevice->byBBRxConf = abyVT3184_VT3226D0[10];
1091 wLength = sizeof(abyVT3184_VT3226D0);
1092 pbyAddr = abyVT3184_VT3226D0;
1093 pbyAgc = abyVT3184_AGC;
1094 wLengthAgc = sizeof(abyVT3184_AGC);
1096 pDevice->abyBBVGA[0] = 0x20;
1097 pDevice->abyBBVGA[1] = 0x10;
1098 pDevice->abyBBVGA[2] = 0x0;
1099 pDevice->abyBBVGA[3] = 0x0;
1100 pDevice->ldBmThreshold[0] = -70;
1101 pDevice->ldBmThreshold[1] = -48;
1102 pDevice->ldBmThreshold[2] = 0;
1103 pDevice->ldBmThreshold[3] = 0;
1104 // Fix VT3226 DFC system timing issue
1105 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
1111 memcpy(abyArray, pbyAddr, wLength);
1112 CONTROLnsRequestOut(pDevice,
1115 MESSAGE_REQUEST_BBREG,
1120 memcpy(abyArray, pbyAgc, wLengthAgc);
1121 CONTROLnsRequestOut(pDevice,
1124 MESSAGE_REQUEST_BBAGC,
1130 if ((pDevice->byRFType == RF_VT3226) || //RobertYu:20051116, 20060111 remove VT3226D0
1131 (pDevice->byRFType == RF_VT3342A0) //RobertYu:20060609
1133 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x23);
1134 MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
1136 else if (pDevice->byRFType == RF_VT3226D0)
1138 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x11);
1139 MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
1143 ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x04,0x7F);
1144 ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01);
1146 RFbRFTableDownload(pDevice);
1147 return TRUE;//ntStatus;
1152 * Description: Turn on BaseBand Loopback mode
1156 * pDevice - Device Structure
1161 * Return Value: none
1164 void BBvLoopbackOn (PSDevice pDevice)
1169 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xC9, &pDevice->byBBCRc9);//CR201
1170 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0);
1171 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x4D, &pDevice->byBBCR4d);//CR77
1172 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, 0x90);
1174 //CR 88 = 0x02(CCK), 0x03(OFDM)
1175 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x88, &pDevice->byBBCR88);//CR136
1177 if (pDevice->wCurrentRate <= RATE_11M) { //CCK
1178 // Enable internal digital loopback: CR33 |= 0000 0001
1179 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33
1180 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData | 0x01));//CR33
1182 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, 0); //CR154
1184 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02);//CR239
1187 // Enable internal digital loopback:CR154 |= 0000 0001
1188 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154
1189 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData | 0x01));//CR154
1191 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, 0); //CR33
1193 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03);//CR239
1197 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, 0);//CR14
1200 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x09, &pDevice->byBBCR09);
1201 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, (BYTE)(pDevice->byBBCR09 & 0xDE));
1205 * Description: Turn off BaseBand Loopback mode
1209 * pDevice - Device Structure
1214 * Return Value: none
1217 void BBvLoopbackOff (PSDevice pDevice)
1221 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, pDevice->byBBCRc9);//CR201
1222 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, pDevice->byBBCR88);//CR136
1223 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, pDevice->byBBCR09);//CR136
1224 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, pDevice->byBBCR4d);//CR77
1226 if (pDevice->wCurrentRate <= RATE_11M) { // CCK
1227 // Set the CR33 Bit2 to disable internal Loopback.
1228 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33
1229 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData & 0xFE));//CR33
1231 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154
1232 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData & 0xFE));//CR154
1234 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x0E, &byData);//CR14
1235 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, (BYTE)(byData | 0x80));//CR14
1241 * Description: Set ShortSlotTime mode
1245 * pDevice - Device Structure
1249 * Return Value: none
1253 BBvSetShortSlotTime (PSDevice pDevice)
1257 if (pDevice->bShortSlotTime)
1258 pDevice->byBBRxConf &= 0xDF;//1101 1111
1260 pDevice->byBBRxConf |= 0x20;//0010 0000
1262 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xE7, &byBBVGA);
1263 if (byBBVGA == pDevice->abyBBVGA[0])
1264 pDevice->byBBRxConf |= 0x20;//0010 0000
1266 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);
1270 void BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData)
1273 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData);
1275 // patch for 3253B0 Baseband with Cardbus module
1276 if (pDevice->bShortSlotTime)
1277 pDevice->byBBRxConf &= 0xDF; /* 1101 1111 */
1279 pDevice->byBBRxConf |= 0x20; /* 0010 0000 */
1281 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10
1286 * Description: Baseband SoftwareReset
1290 * dwIoBase - I/O base address
1294 * Return Value: none
1298 BBvSoftwareReset (PSDevice pDevice)
1300 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40);
1301 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0);
1302 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0x01);
1303 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0);
1307 * Description: BBvSetDeepSleep
1311 * pDevice - Device Structure
1315 * Return Value: none
1319 BBvSetDeepSleep (PSDevice pDevice)
1321 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12
1322 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13
1326 BBvExitDeepSleep (PSDevice pDevice)
1328 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12
1329 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13
1333 static unsigned long s_ulGetLowSQ3(PSDevice pDevice)
1336 unsigned long ulSQ3 = 0;
1337 unsigned long ulMaxPacket;
1339 ulMaxPacket = pDevice->aulPktNum[RATE_54M];
1340 if (pDevice->aulPktNum[RATE_54M] != 0)
1341 ulSQ3 = pDevice->aulSQ3Val[RATE_54M] / pDevice->aulPktNum[RATE_54M];
1343 for (ii = RATE_48M; ii >= RATE_6M; ii--)
1344 if (pDevice->aulPktNum[ii] > ulMaxPacket) {
1345 ulMaxPacket = pDevice->aulPktNum[ii];
1346 ulSQ3 = pDevice->aulSQ3Val[ii] / pDevice->aulPktNum[ii];
1352 static unsigned long s_ulGetRatio(PSDevice pDevice)
1355 unsigned long ulRatio = 0;
1356 unsigned long ulMaxPacket;
1357 unsigned long ulPacketNum;
1359 //This is a thousand-ratio
1360 ulMaxPacket = pDevice->aulPktNum[RATE_54M];
1361 if ( pDevice->aulPktNum[RATE_54M] != 0 ) {
1362 ulPacketNum = pDevice->aulPktNum[RATE_54M];
1363 ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
1364 ulRatio += TOP_RATE_54M;
1366 for (ii = RATE_48M; ii >= RATE_1M; ii--)
1367 if ( pDevice->aulPktNum[ii] > ulMaxPacket ) {
1369 for ( jj=RATE_54M;jj>=ii;jj--)
1370 ulPacketNum += pDevice->aulPktNum[jj];
1371 ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
1372 ulRatio += TOP_RATE_48M;
1373 ulMaxPacket = pDevice->aulPktNum[ii];
1382 s_vClearSQ3Value (PSDevice pDevice)
1385 pDevice->uDiversityCnt = 0;
1387 for ( ii=RATE_1M;ii<MAX_RATE;ii++) {
1388 pDevice->aulPktNum[ii] = 0;
1389 pDevice->aulSQ3Val[ii] = 0;
1395 * Description: Antenna Diversity
1399 * pDevice - Device Structure
1400 * byRSR - RSR from received packet
1401 * bySQ3 - SQ3 value from received packet
1405 * Return Value: none
1410 BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3)
1413 pDevice->uDiversityCnt++;
1414 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt);
1416 if (byRxRate == 2) {
1417 pDevice->aulPktNum[RATE_1M]++;
1419 else if (byRxRate==4) {
1420 pDevice->aulPktNum[RATE_2M]++;
1422 else if (byRxRate==11) {
1423 pDevice->aulPktNum[RATE_5M]++;
1425 else if (byRxRate==22) {
1426 pDevice->aulPktNum[RATE_11M]++;
1428 else if(byRxRate==12){
1429 pDevice->aulPktNum[RATE_6M]++;
1430 pDevice->aulSQ3Val[RATE_6M] += bySQ3;
1432 else if(byRxRate==18){
1433 pDevice->aulPktNum[RATE_9M]++;
1434 pDevice->aulSQ3Val[RATE_9M] += bySQ3;
1436 else if(byRxRate==24){
1437 pDevice->aulPktNum[RATE_12M]++;
1438 pDevice->aulSQ3Val[RATE_12M] += bySQ3;
1440 else if(byRxRate==36){
1441 pDevice->aulPktNum[RATE_18M]++;
1442 pDevice->aulSQ3Val[RATE_18M] += bySQ3;
1444 else if(byRxRate==48){
1445 pDevice->aulPktNum[RATE_24M]++;
1446 pDevice->aulSQ3Val[RATE_24M] += bySQ3;
1448 else if(byRxRate==72){
1449 pDevice->aulPktNum[RATE_36M]++;
1450 pDevice->aulSQ3Val[RATE_36M] += bySQ3;
1452 else if(byRxRate==96){
1453 pDevice->aulPktNum[RATE_48M]++;
1454 pDevice->aulSQ3Val[RATE_48M] += bySQ3;
1456 else if(byRxRate==108){
1457 pDevice->aulPktNum[RATE_54M]++;
1458 pDevice->aulSQ3Val[RATE_54M] += bySQ3;
1461 if (pDevice->byAntennaState == 0) {
1463 if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) {
1464 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n",(int)pDevice->ulDiversityNValue, (int)pDevice->aulPktNum[RATE_54M]);
1466 pDevice->ulSQ3_State0 = s_ulGetLowSQ3(pDevice);
1467 pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
1468 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, SQ3= [%08x] rate = [%08x]\n",(int)pDevice->ulSQ3_State0,(int)pDevice->ulRatio_State0);
1470 if ( ((pDevice->aulPktNum[RATE_54M] < pDevice->ulDiversityNValue/2) &&
1471 (pDevice->ulSQ3_State0 > pDevice->ulSQ3TH) ) ||
1472 (pDevice->ulSQ3_State0 == 0 ) ) {
1474 if ( pDevice->byTMax == 0 )
1477 bScheduleCommand((void *) pDevice,
1478 WLAN_CMD_CHANGE_ANTENNA,
1481 pDevice->byAntennaState = 1;
1483 del_timer(&pDevice->TimerSQ3Tmax3);
1484 del_timer(&pDevice->TimerSQ3Tmax2);
1485 pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
1486 add_timer(&pDevice->TimerSQ3Tmax1);
1489 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1490 add_timer(&pDevice->TimerSQ3Tmax3);
1492 s_vClearSQ3Value(pDevice);
1495 } else { //byAntennaState == 1
1497 if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) {
1499 del_timer(&pDevice->TimerSQ3Tmax1);
1500 pDevice->ulSQ3_State1 = s_ulGetLowSQ3(pDevice);
1501 pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
1502 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n",(int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1);
1504 if ( ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 != 0)) ||
1505 ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 == 0) && (pDevice->ulRatio_State1 < pDevice->ulRatio_State0)) ||
1506 ((pDevice->ulSQ3_State1 != 0) && (pDevice->ulSQ3_State0 != 0) && (pDevice->ulSQ3_State0 < pDevice->ulSQ3_State1))
1509 bScheduleCommand((void *) pDevice,
1510 WLAN_CMD_CHANGE_ANTENNA,
1513 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1514 pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
1515 add_timer(&pDevice->TimerSQ3Tmax3);
1516 add_timer(&pDevice->TimerSQ3Tmax2);
1519 pDevice->byAntennaState = 0;
1520 s_vClearSQ3Value(pDevice);
1529 * Timer for SQ3 antenna diversity
1534 * hDeviceContext - Pointer to the adapter
1540 * Return Value: none
1544 void TimerSQ3CallBack(void *hDeviceContext)
1546 PSDevice pDevice = (PSDevice)hDeviceContext;
1548 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack...");
1549 spin_lock_irq(&pDevice->lock);
1551 bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1552 pDevice->byAntennaState = 0;
1553 s_vClearSQ3Value(pDevice);
1554 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1555 pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
1556 add_timer(&pDevice->TimerSQ3Tmax3);
1557 add_timer(&pDevice->TimerSQ3Tmax2);
1560 spin_unlock_irq(&pDevice->lock);
1567 * Timer for SQ3 antenna diversity
1572 * hDeviceContext - Pointer to the adapter
1578 * Return Value: none
1582 void TimerSQ3Tmax3CallBack(void *hDeviceContext)
1584 PSDevice pDevice = (PSDevice)hDeviceContext;
1586 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack...");
1587 spin_lock_irq(&pDevice->lock);
1589 pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
1590 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0 = [%08x]\n",(int)pDevice->ulRatio_State0);
1592 s_vClearSQ3Value(pDevice);
1593 if ( pDevice->byTMax == 0 ) {
1594 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1595 add_timer(&pDevice->TimerSQ3Tmax3);
1596 spin_unlock_irq(&pDevice->lock);
1600 bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1601 pDevice->byAntennaState = 1;
1602 del_timer(&pDevice->TimerSQ3Tmax3);
1603 del_timer(&pDevice->TimerSQ3Tmax2);
1604 pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
1605 add_timer(&pDevice->TimerSQ3Tmax1);
1607 spin_unlock_irq(&pDevice->lock);
1611 BBvUpdatePreEDThreshold(
1617 switch(pDevice->byRFType)
1622 //RobertYu:20060627, update new table
1625 { // need Max sensitivity //RSSI -69, -70,....
1626 if(pDevice->byBBPreEDIndex == 0) break;
1627 pDevice->byBBPreEDIndex = 0;
1628 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1629 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1630 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70, -71,...\n");
1634 if(pDevice->byBBPreEDRSSI <= 45) { // RSSI 0, -1,-2,....-45
1635 if(pDevice->byBBPreEDIndex == 20) break;
1636 pDevice->byBBPreEDIndex = 20;
1637 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1638 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1639 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-45\n");
1640 } else if(pDevice->byBBPreEDRSSI <= 46) { //RSSI -46
1641 if(pDevice->byBBPreEDIndex == 19) break;
1642 pDevice->byBBPreEDIndex = 19;
1643 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x1A); //CR201(0xC9)
1644 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1645 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46\n");
1646 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -47
1647 if(pDevice->byBBPreEDIndex == 18) break;
1648 pDevice->byBBPreEDIndex = 18;
1649 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x15); //CR201(0xC9)
1650 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1651 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -47\n");
1652 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1653 if(pDevice->byBBPreEDIndex == 17) break;
1654 pDevice->byBBPreEDIndex = 17;
1655 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0E); //CR201(0xC9)
1656 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1657 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1658 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1659 if(pDevice->byBBPreEDIndex == 16) break;
1660 pDevice->byBBPreEDIndex = 16;
1661 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x09); //CR201(0xC9)
1662 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1663 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1664 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1665 if(pDevice->byBBPreEDIndex == 15) break;
1666 pDevice->byBBPreEDIndex = 15;
1667 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x06); //CR201(0xC9)
1668 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1669 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1670 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1671 if(pDevice->byBBPreEDIndex == 14) break;
1672 pDevice->byBBPreEDIndex = 14;
1673 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x03); //CR201(0xC9)
1674 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1675 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1676 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1677 if(pDevice->byBBPreEDIndex == 13) break;
1678 pDevice->byBBPreEDIndex = 13;
1679 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1680 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE)
1681 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1682 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1683 if(pDevice->byBBPreEDIndex == 12) break;
1684 pDevice->byBBPreEDIndex = 12;
1685 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1686 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x20); //CR206(0xCE)
1687 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1688 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1689 if(pDevice->byBBPreEDIndex == 11) break;
1690 pDevice->byBBPreEDIndex = 11;
1691 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1692 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE)
1693 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1694 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1695 if(pDevice->byBBPreEDIndex == 10) break;
1696 pDevice->byBBPreEDIndex = 10;
1697 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1698 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x54); //CR206(0xCE)
1699 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1700 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1701 if(pDevice->byBBPreEDIndex == 9) break;
1702 pDevice->byBBPreEDIndex = 9;
1703 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1704 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x18); //CR206(0xCE)
1705 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1706 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1707 if(pDevice->byBBPreEDIndex == 8) break;
1708 pDevice->byBBPreEDIndex = 8;
1709 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1710 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xE3); //CR206(0xCE)
1711 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
1712 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
1713 if(pDevice->byBBPreEDIndex == 7) break;
1714 pDevice->byBBPreEDIndex = 7;
1715 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1716 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB9); //CR206(0xCE)
1717 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
1718 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
1719 if(pDevice->byBBPreEDIndex == 6) break;
1720 pDevice->byBBPreEDIndex = 6;
1721 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1722 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x93); //CR206(0xCE)
1723 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
1724 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
1725 if(pDevice->byBBPreEDIndex == 5) break;
1726 pDevice->byBBPreEDIndex = 5;
1727 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1728 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x79); //CR206(0xCE)
1729 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
1730 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
1731 if(pDevice->byBBPreEDIndex == 4) break;
1732 pDevice->byBBPreEDIndex = 4;
1733 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1734 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x62); //CR206(0xCE)
1735 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
1736 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
1737 if(pDevice->byBBPreEDIndex == 3) break;
1738 pDevice->byBBPreEDIndex = 3;
1739 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1740 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x51); //CR206(0xCE)
1741 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
1742 } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67
1743 if(pDevice->byBBPreEDIndex == 2) break;
1744 pDevice->byBBPreEDIndex = 2;
1745 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1746 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
1747 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n");
1748 } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68
1749 if(pDevice->byBBPreEDIndex == 1) break;
1750 pDevice->byBBPreEDIndex = 1;
1751 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1752 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE)
1753 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n");
1754 } else { //RSSI -69, -70,....
1755 if(pDevice->byBBPreEDIndex == 0) break;
1756 pDevice->byBBPreEDIndex = 0;
1757 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1758 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1759 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,...\n");
1765 //RobertYu:20060627, update new table
1768 { // need Max sensitivity //RSSI -69, -70, ...
1769 if(pDevice->byBBPreEDIndex == 0) break;
1770 pDevice->byBBPreEDIndex = 0;
1771 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1772 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
1773 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n");
1777 if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41
1778 if(pDevice->byBBPreEDIndex == 22) break;
1779 pDevice->byBBPreEDIndex = 22;
1780 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1781 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1782 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1783 } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42
1784 if(pDevice->byBBPreEDIndex == 21) break;
1785 pDevice->byBBPreEDIndex = 21;
1786 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9)
1787 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1788 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n");
1789 } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43
1790 if(pDevice->byBBPreEDIndex == 20) break;
1791 pDevice->byBBPreEDIndex = 20;
1792 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9)
1793 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1794 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n");
1795 } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45
1796 if(pDevice->byBBPreEDIndex == 19) break;
1797 pDevice->byBBPreEDIndex = 19;
1798 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9)
1799 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1800 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n");
1801 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47
1802 if(pDevice->byBBPreEDIndex == 18) break;
1803 pDevice->byBBPreEDIndex = 18;
1804 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9)
1805 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1806 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n");
1807 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1808 if(pDevice->byBBPreEDIndex == 17) break;
1809 pDevice->byBBPreEDIndex = 17;
1810 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9)
1811 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1812 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1813 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1814 if(pDevice->byBBPreEDIndex == 16) break;
1815 pDevice->byBBPreEDIndex = 16;
1816 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9)
1817 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1818 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1819 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1820 if(pDevice->byBBPreEDIndex == 15) break;
1821 pDevice->byBBPreEDIndex = 15;
1822 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9)
1823 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1824 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1825 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1826 if(pDevice->byBBPreEDIndex == 14) break;
1827 pDevice->byBBPreEDIndex = 14;
1828 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1829 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1830 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1831 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1832 if(pDevice->byBBPreEDIndex == 13) break;
1833 pDevice->byBBPreEDIndex = 13;
1834 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1835 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1836 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1837 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1838 if(pDevice->byBBPreEDIndex == 12) break;
1839 pDevice->byBBPreEDIndex = 12;
1840 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1841 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE)
1842 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1843 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1844 if(pDevice->byBBPreEDIndex == 11) break;
1845 pDevice->byBBPreEDIndex = 11;
1846 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1847 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE)
1848 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1849 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1850 if(pDevice->byBBPreEDIndex == 10) break;
1851 pDevice->byBBPreEDIndex = 10;
1852 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1853 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1854 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1855 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1856 if(pDevice->byBBPreEDIndex == 9) break;
1857 pDevice->byBBPreEDIndex = 9;
1858 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1859 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE)
1860 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1861 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1862 if(pDevice->byBBPreEDIndex == 8) break;
1863 pDevice->byBBPreEDIndex = 8;
1864 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1865 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1866 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
1867 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
1868 if(pDevice->byBBPreEDIndex == 7) break;
1869 pDevice->byBBPreEDIndex = 7;
1870 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1871 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE)
1872 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
1873 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
1874 if(pDevice->byBBPreEDIndex == 6) break;
1875 pDevice->byBBPreEDIndex = 6;
1876 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1877 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE)
1878 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
1879 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
1880 if(pDevice->byBBPreEDIndex == 5) break;
1881 pDevice->byBBPreEDIndex = 5;
1882 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1883 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE)
1884 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
1885 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
1886 if(pDevice->byBBPreEDIndex == 4) break;
1887 pDevice->byBBPreEDIndex = 4;
1888 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1889 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE)
1890 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
1891 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
1892 if(pDevice->byBBPreEDIndex == 3) break;
1893 pDevice->byBBPreEDIndex = 3;
1894 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1895 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
1896 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
1897 } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67
1898 if(pDevice->byBBPreEDIndex == 2) break;
1899 pDevice->byBBPreEDIndex = 2;
1900 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1901 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE)
1902 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n");
1903 } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68
1904 if(pDevice->byBBPreEDIndex == 1) break;
1905 pDevice->byBBPreEDIndex = 1;
1906 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1907 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x2D); //CR206(0xCE)
1908 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n");
1909 } else { //RSSI -69, -70, ...
1910 if(pDevice->byBBPreEDIndex == 0) break;
1911 pDevice->byBBPreEDIndex = 0;
1912 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1913 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
1914 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n");
1918 case RF_VT3342A0: //RobertYu:20060627, testing table
1920 { // need Max sensitivity //RSSI -67, -68, ...
1921 if(pDevice->byBBPreEDIndex == 0) break;
1922 pDevice->byBBPreEDIndex = 0;
1923 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1924 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
1925 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n");
1929 if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41
1930 if(pDevice->byBBPreEDIndex == 20) break;
1931 pDevice->byBBPreEDIndex = 20;
1932 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1933 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1934 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1935 } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42
1936 if(pDevice->byBBPreEDIndex == 19) break;
1937 pDevice->byBBPreEDIndex = 19;
1938 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9)
1939 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1940 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n");
1941 } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43
1942 if(pDevice->byBBPreEDIndex == 18) break;
1943 pDevice->byBBPreEDIndex = 18;
1944 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9)
1945 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1946 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n");
1947 } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45
1948 if(pDevice->byBBPreEDIndex == 17) break;
1949 pDevice->byBBPreEDIndex = 17;
1950 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9)
1951 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1952 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n");
1953 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47
1954 if(pDevice->byBBPreEDIndex == 16) break;
1955 pDevice->byBBPreEDIndex = 16;
1956 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9)
1957 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1958 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n");
1959 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1960 if(pDevice->byBBPreEDIndex == 15) break;
1961 pDevice->byBBPreEDIndex = 15;
1962 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9)
1963 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1964 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1965 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1966 if(pDevice->byBBPreEDIndex == 14) break;
1967 pDevice->byBBPreEDIndex = 14;
1968 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9)
1969 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1970 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1971 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1972 if(pDevice->byBBPreEDIndex == 13) break;
1973 pDevice->byBBPreEDIndex = 13;
1974 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9)
1975 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1976 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1977 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1978 if(pDevice->byBBPreEDIndex == 12) break;
1979 pDevice->byBBPreEDIndex = 12;
1980 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1981 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1982 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1983 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1984 if(pDevice->byBBPreEDIndex == 11) break;
1985 pDevice->byBBPreEDIndex = 11;
1986 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1987 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1988 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1989 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1990 if(pDevice->byBBPreEDIndex == 10) break;
1991 pDevice->byBBPreEDIndex = 10;
1992 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1993 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE)
1994 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1995 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1996 if(pDevice->byBBPreEDIndex == 9) break;
1997 pDevice->byBBPreEDIndex = 9;
1998 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1999 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE)
2000 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
2001 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
2002 if(pDevice->byBBPreEDIndex == 8) break;
2003 pDevice->byBBPreEDIndex = 8;
2004 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
2005 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
2006 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
2007 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
2008 if(pDevice->byBBPreEDIndex == 7) break;
2009 pDevice->byBBPreEDIndex = 7;
2010 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2011 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE)
2012 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
2013 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
2014 if(pDevice->byBBPreEDIndex == 6) break;
2015 pDevice->byBBPreEDIndex = 6;
2016 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2017 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
2018 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
2019 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
2020 if(pDevice->byBBPreEDIndex == 5) break;
2021 pDevice->byBBPreEDIndex = 5;
2022 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2023 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE)
2024 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
2025 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
2026 if(pDevice->byBBPreEDIndex == 4) break;
2027 pDevice->byBBPreEDIndex = 4;
2028 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2029 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE)
2030 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
2031 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
2032 if(pDevice->byBBPreEDIndex == 3) break;
2033 pDevice->byBBPreEDIndex = 3;
2034 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2035 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE)
2036 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
2037 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
2038 if(pDevice->byBBPreEDIndex == 2) break;
2039 pDevice->byBBPreEDIndex = 2;
2040 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2041 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE)
2042 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
2043 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
2044 if(pDevice->byBBPreEDIndex == 1) break;
2045 pDevice->byBBPreEDIndex = 1;
2046 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2047 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
2048 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
2049 } else { //RSSI -67, -68, ...
2050 if(pDevice->byBBPreEDIndex == 0) break;
2051 pDevice->byBBPreEDIndex = 0;
2052 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2053 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
2054 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n");