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
759 void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
760 u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv,
767 u8 byPreambleType = pDevice->byPreambleType;
768 int bCCK = pDevice->bCCK;
770 cbBitCount = cbFrameLength * 8;
775 cbUsCount = cbBitCount;
780 cbUsCount = cbBitCount / 2;
781 if (byPreambleType == 1)
783 else // long preamble
790 cbUsCount = (cbBitCount * 10) / 55;
791 cbTmp = (cbUsCount * 55) / 10;
792 if (cbTmp != cbBitCount)
794 if (byPreambleType == 1)
796 else // long preamble
804 cbUsCount = cbBitCount / 11;
805 cbTmp = cbUsCount * 11;
806 if (cbTmp != cbBitCount) {
808 if ((cbBitCount - cbTmp) <= 3)
811 if (byPreambleType == 1)
813 else // long preamble
818 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
819 *pbyPhySgn = 0x9B; //1001 1011
822 *pbyPhySgn = 0x8B; //1000 1011
827 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
828 *pbyPhySgn = 0x9F; //1001 1111
831 *pbyPhySgn = 0x8F; //1000 1111
836 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
837 *pbyPhySgn = 0x9A; //1001 1010
840 *pbyPhySgn = 0x8A; //1000 1010
845 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
846 *pbyPhySgn = 0x9E; //1001 1110
849 *pbyPhySgn = 0x8E; //1000 1110
854 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
855 *pbyPhySgn = 0x99; //1001 1001
858 *pbyPhySgn = 0x89; //1000 1001
863 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
864 *pbyPhySgn = 0x9D; //1001 1101
867 *pbyPhySgn = 0x8D; //1000 1101
872 if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
873 *pbyPhySgn = 0x98; //1001 1000
876 *pbyPhySgn = 0x88; //1000 1000
881 if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
882 *pbyPhySgn = 0x9C; //1001 1100
885 *pbyPhySgn = 0x8C; //1000 1100
890 if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
891 *pbyPhySgn = 0x9C; //1001 1100
894 *pbyPhySgn = 0x8C; //1000 1100
899 if (byPacketType == PK_TYPE_11B) {
902 *pbyPhySrv = *pbyPhySrv | 0x80;
903 *pwPhyLen = (WORD) cbUsCount;
907 *pwPhyLen = (WORD)cbFrameLength;
913 * Description: Set Antenna mode
917 * pDevice - Device Structure
918 * byAntennaMode - Antenna Mode
925 void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode)
927 switch (byAntennaMode) {
932 pDevice->byBBRxConf &= 0xFC;
935 pDevice->byBBRxConf &= 0xFE;
936 pDevice->byBBRxConf |= 0x02;
941 CONTROLnsRequestOut(pDevice,
942 MESSAGE_TYPE_SET_ANTMD,
943 (WORD) byAntennaMode,
950 * Description: Set Antenna mode
954 * pDevice - Device Structure
955 * byAntennaMode - Antenna Mode
963 int BBbVT3184Init(struct vnt_private *pDevice)
972 ntStatus = CONTROLnsRequestIn(pDevice,
975 MESSAGE_REQUEST_EEPROM,
976 EEP_MAX_CONTEXT_SIZE,
978 if (ntStatus != STATUS_SUCCESS) {
983 // if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04)
987 pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
988 if(pDevice->config_file.ZoneType >= 0) { //read zonetype file ok!
989 if ((pDevice->config_file.ZoneType == 0)&&
990 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] !=0x00)){ //for USA
991 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
992 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
993 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :USA\n");
995 else if((pDevice->config_file.ZoneType == 1)&&
996 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x01)){ //for Japan
997 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
998 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
999 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Japan\n");
1001 else if((pDevice->config_file.ZoneType == 2)&&
1002 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x02)){ //for Europe
1003 pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
1004 pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
1005 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Europe\n");
1008 if(pDevice->config_file.ZoneType !=pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
1009 printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",pDevice->config_file.ZoneType,pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
1011 printk("Read Zonetype file success,use default zonetype setting[%02x]\n",pDevice->config_file.ZoneType);
1015 if ( !pDevice->bZoneRegExist ) {
1016 pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
1018 pDevice->byRFType = pDevice->abyEEPROM[EEP_OFS_RFTYPE];
1020 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Zone Type %x\n", pDevice->byZoneType);
1021 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RF Type %d\n", pDevice->byRFType);
1023 if ((pDevice->byRFType == RF_AL2230) || (pDevice->byRFType == RF_AL2230S)) {
1024 pDevice->byBBRxConf = abyVT3184_AL2230[10];
1025 wLength = sizeof(abyVT3184_AL2230);
1026 pbyAddr = abyVT3184_AL2230;
1027 pbyAgc = abyVT3184_AGC;
1028 wLengthAgc = sizeof(abyVT3184_AGC);
1030 pDevice->abyBBVGA[0] = 0x1C;
1031 pDevice->abyBBVGA[1] = 0x10;
1032 pDevice->abyBBVGA[2] = 0x0;
1033 pDevice->abyBBVGA[3] = 0x0;
1034 pDevice->ldBmThreshold[0] = -70;
1035 pDevice->ldBmThreshold[1] = -48;
1036 pDevice->ldBmThreshold[2] = 0;
1037 pDevice->ldBmThreshold[3] = 0;
1039 else if (pDevice->byRFType == RF_AIROHA7230) {
1040 pDevice->byBBRxConf = abyVT3184_AL2230[10];
1041 wLength = sizeof(abyVT3184_AL2230);
1042 pbyAddr = abyVT3184_AL2230;
1043 pbyAgc = abyVT3184_AGC;
1044 wLengthAgc = sizeof(abyVT3184_AGC);
1046 // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1047 //pbyAddr[0x09] = 0x41;
1048 // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
1049 //pbyAddr[0x0a] = 0x28;
1050 // Select VC1/VC2, CR215 = 0x02->0x06
1051 pbyAddr[0xd7] = 0x06;
1053 pDevice->abyBBVGA[0] = 0x1C;
1054 pDevice->abyBBVGA[1] = 0x10;
1055 pDevice->abyBBVGA[2] = 0x0;
1056 pDevice->abyBBVGA[3] = 0x0;
1057 pDevice->ldBmThreshold[0] = -70;
1058 pDevice->ldBmThreshold[1] = -48;
1059 pDevice->ldBmThreshold[2] = 0;
1060 pDevice->ldBmThreshold[3] = 0;
1062 else if ( (pDevice->byRFType == RF_VT3226) || (pDevice->byRFType == RF_VT3226D0) ) {
1063 pDevice->byBBRxConf = abyVT3184_VT3226D0[10]; //RobertYu:20060515
1064 wLength = sizeof(abyVT3184_VT3226D0); //RobertYu:20060515
1065 pbyAddr = abyVT3184_VT3226D0; //RobertYu:20060515
1066 pbyAgc = abyVT3184_AGC;
1067 wLengthAgc = sizeof(abyVT3184_AGC);
1069 pDevice->abyBBVGA[0] = 0x20; //RobertYu:20060104, reguest by Jack
1070 pDevice->abyBBVGA[1] = 0x10;
1071 pDevice->abyBBVGA[2] = 0x0;
1072 pDevice->abyBBVGA[3] = 0x0;
1073 pDevice->ldBmThreshold[0] = -70;
1074 pDevice->ldBmThreshold[1] = -48;
1075 pDevice->ldBmThreshold[2] = 0;
1076 pDevice->ldBmThreshold[3] = 0;
1077 // Fix VT3226 DFC system timing issue
1078 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
1080 //{{RobertYu:20060609
1081 } else if ( (pDevice->byRFType == RF_VT3342A0) ) {
1082 pDevice->byBBRxConf = abyVT3184_VT3226D0[10];
1083 wLength = sizeof(abyVT3184_VT3226D0);
1084 pbyAddr = abyVT3184_VT3226D0;
1085 pbyAgc = abyVT3184_AGC;
1086 wLengthAgc = sizeof(abyVT3184_AGC);
1088 pDevice->abyBBVGA[0] = 0x20;
1089 pDevice->abyBBVGA[1] = 0x10;
1090 pDevice->abyBBVGA[2] = 0x0;
1091 pDevice->abyBBVGA[3] = 0x0;
1092 pDevice->ldBmThreshold[0] = -70;
1093 pDevice->ldBmThreshold[1] = -48;
1094 pDevice->ldBmThreshold[2] = 0;
1095 pDevice->ldBmThreshold[3] = 0;
1096 // Fix VT3226 DFC system timing issue
1097 MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
1103 memcpy(abyArray, pbyAddr, wLength);
1104 CONTROLnsRequestOut(pDevice,
1107 MESSAGE_REQUEST_BBREG,
1112 memcpy(abyArray, pbyAgc, wLengthAgc);
1113 CONTROLnsRequestOut(pDevice,
1116 MESSAGE_REQUEST_BBAGC,
1122 if ((pDevice->byRFType == RF_VT3226) || //RobertYu:20051116, 20060111 remove VT3226D0
1123 (pDevice->byRFType == RF_VT3342A0) //RobertYu:20060609
1125 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x23);
1126 MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
1128 else if (pDevice->byRFType == RF_VT3226D0)
1130 ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x11);
1131 MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
1135 ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x04,0x7F);
1136 ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01);
1138 RFbRFTableDownload(pDevice);
1139 return true;//ntStatus;
1144 * Description: Turn on BaseBand Loopback mode
1148 * pDevice - Device Structure
1153 * Return Value: none
1156 void BBvLoopbackOn(struct vnt_private *pDevice)
1161 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xC9, &pDevice->byBBCRc9);//CR201
1162 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0);
1163 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x4D, &pDevice->byBBCR4d);//CR77
1164 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, 0x90);
1166 //CR 88 = 0x02(CCK), 0x03(OFDM)
1167 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x88, &pDevice->byBBCR88);//CR136
1169 if (pDevice->wCurrentRate <= RATE_11M) { //CCK
1170 // Enable internal digital loopback: CR33 |= 0000 0001
1171 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33
1172 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData | 0x01));//CR33
1174 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, 0); //CR154
1176 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02);//CR239
1179 // Enable internal digital loopback:CR154 |= 0000 0001
1180 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154
1181 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData | 0x01));//CR154
1183 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, 0); //CR33
1185 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03);//CR239
1189 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, 0);//CR14
1192 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x09, &pDevice->byBBCR09);
1193 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, (BYTE)(pDevice->byBBCR09 & 0xDE));
1197 * Description: Turn off BaseBand Loopback mode
1201 * pDevice - Device Structure
1206 * Return Value: none
1209 void BBvLoopbackOff(struct vnt_private *pDevice)
1213 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, pDevice->byBBCRc9);//CR201
1214 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, pDevice->byBBCR88);//CR136
1215 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, pDevice->byBBCR09);//CR136
1216 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, pDevice->byBBCR4d);//CR77
1218 if (pDevice->wCurrentRate <= RATE_11M) { // CCK
1219 // Set the CR33 Bit2 to disable internal Loopback.
1220 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33
1221 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (BYTE)(byData & 0xFE));//CR33
1223 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154
1224 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (BYTE)(byData & 0xFE));//CR154
1226 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x0E, &byData);//CR14
1227 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, (BYTE)(byData | 0x80));//CR14
1233 * Description: Set ShortSlotTime mode
1237 * pDevice - Device Structure
1241 * Return Value: none
1244 void BBvSetShortSlotTime(struct vnt_private *pDevice)
1248 if (pDevice->bShortSlotTime)
1249 pDevice->byBBRxConf &= 0xDF;//1101 1111
1251 pDevice->byBBRxConf |= 0x20;//0010 0000
1253 ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xE7, &byBBVGA);
1254 if (byBBVGA == pDevice->abyBBVGA[0])
1255 pDevice->byBBRxConf |= 0x20;//0010 0000
1257 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);
1261 void BBvSetVGAGainOffset(struct vnt_private *pDevice, BYTE byData)
1264 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xE7, byData);
1266 // patch for 3253B0 Baseband with Cardbus module
1267 if (pDevice->bShortSlotTime)
1268 pDevice->byBBRxConf &= 0xDF; /* 1101 1111 */
1270 pDevice->byBBRxConf |= 0x20; /* 0010 0000 */
1272 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10
1277 * Description: Baseband SoftwareReset
1281 * dwIoBase - I/O base address
1285 * Return Value: none
1288 void BBvSoftwareReset(struct vnt_private *pDevice)
1290 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40);
1291 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0);
1292 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0x01);
1293 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0);
1297 * Description: BBvSetDeepSleep
1301 * pDevice - Device Structure
1305 * Return Value: none
1308 void BBvSetDeepSleep(struct vnt_private *pDevice)
1310 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);//CR12
1311 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0xB9);//CR13
1314 void BBvExitDeepSleep(struct vnt_private *pDevice)
1316 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0C, 0x00);//CR12
1317 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13
1321 static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice)
1324 unsigned long ulSQ3 = 0;
1325 unsigned long ulMaxPacket;
1327 ulMaxPacket = pDevice->aulPktNum[RATE_54M];
1328 if (pDevice->aulPktNum[RATE_54M] != 0)
1329 ulSQ3 = pDevice->aulSQ3Val[RATE_54M] / pDevice->aulPktNum[RATE_54M];
1331 for (ii = RATE_48M; ii >= RATE_6M; ii--)
1332 if (pDevice->aulPktNum[ii] > ulMaxPacket) {
1333 ulMaxPacket = pDevice->aulPktNum[ii];
1334 ulSQ3 = pDevice->aulSQ3Val[ii] / pDevice->aulPktNum[ii];
1340 static unsigned long s_ulGetRatio(struct vnt_private *pDevice)
1343 unsigned long ulRatio = 0;
1344 unsigned long ulMaxPacket;
1345 unsigned long ulPacketNum;
1347 //This is a thousand-ratio
1348 ulMaxPacket = pDevice->aulPktNum[RATE_54M];
1349 if ( pDevice->aulPktNum[RATE_54M] != 0 ) {
1350 ulPacketNum = pDevice->aulPktNum[RATE_54M];
1351 ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
1352 ulRatio += TOP_RATE_54M;
1354 for (ii = RATE_48M; ii >= RATE_1M; ii--)
1355 if ( pDevice->aulPktNum[ii] > ulMaxPacket ) {
1357 for ( jj=RATE_54M;jj>=ii;jj--)
1358 ulPacketNum += pDevice->aulPktNum[jj];
1359 ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
1360 ulRatio += TOP_RATE_48M;
1361 ulMaxPacket = pDevice->aulPktNum[ii];
1368 static void s_vClearSQ3Value(struct vnt_private *pDevice)
1371 pDevice->uDiversityCnt = 0;
1373 for ( ii=RATE_1M;ii<MAX_RATE;ii++) {
1374 pDevice->aulPktNum[ii] = 0;
1375 pDevice->aulSQ3Val[ii] = 0;
1381 * Description: Antenna Diversity
1385 * pDevice - Device Structure
1386 * byRSR - RSR from received packet
1387 * bySQ3 - SQ3 value from received packet
1391 * Return Value: none
1395 void BBvAntennaDiversity(struct vnt_private *pDevice,
1396 u8 byRxRate, u8 bySQ3)
1399 pDevice->uDiversityCnt++;
1400 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt);
1402 if (byRxRate == 2) {
1403 pDevice->aulPktNum[RATE_1M]++;
1405 else if (byRxRate==4) {
1406 pDevice->aulPktNum[RATE_2M]++;
1408 else if (byRxRate==11) {
1409 pDevice->aulPktNum[RATE_5M]++;
1411 else if (byRxRate==22) {
1412 pDevice->aulPktNum[RATE_11M]++;
1414 else if(byRxRate==12){
1415 pDevice->aulPktNum[RATE_6M]++;
1416 pDevice->aulSQ3Val[RATE_6M] += bySQ3;
1418 else if(byRxRate==18){
1419 pDevice->aulPktNum[RATE_9M]++;
1420 pDevice->aulSQ3Val[RATE_9M] += bySQ3;
1422 else if(byRxRate==24){
1423 pDevice->aulPktNum[RATE_12M]++;
1424 pDevice->aulSQ3Val[RATE_12M] += bySQ3;
1426 else if(byRxRate==36){
1427 pDevice->aulPktNum[RATE_18M]++;
1428 pDevice->aulSQ3Val[RATE_18M] += bySQ3;
1430 else if(byRxRate==48){
1431 pDevice->aulPktNum[RATE_24M]++;
1432 pDevice->aulSQ3Val[RATE_24M] += bySQ3;
1434 else if(byRxRate==72){
1435 pDevice->aulPktNum[RATE_36M]++;
1436 pDevice->aulSQ3Val[RATE_36M] += bySQ3;
1438 else if(byRxRate==96){
1439 pDevice->aulPktNum[RATE_48M]++;
1440 pDevice->aulSQ3Val[RATE_48M] += bySQ3;
1442 else if(byRxRate==108){
1443 pDevice->aulPktNum[RATE_54M]++;
1444 pDevice->aulSQ3Val[RATE_54M] += bySQ3;
1447 if (pDevice->byAntennaState == 0) {
1449 if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) {
1450 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n",(int)pDevice->ulDiversityNValue, (int)pDevice->aulPktNum[RATE_54M]);
1452 pDevice->ulSQ3_State0 = s_ulGetLowSQ3(pDevice);
1453 pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
1454 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, SQ3= [%08x] rate = [%08x]\n",(int)pDevice->ulSQ3_State0,(int)pDevice->ulRatio_State0);
1456 if ( ((pDevice->aulPktNum[RATE_54M] < pDevice->ulDiversityNValue/2) &&
1457 (pDevice->ulSQ3_State0 > pDevice->ulSQ3TH) ) ||
1458 (pDevice->ulSQ3_State0 == 0 ) ) {
1460 if ( pDevice->byTMax == 0 )
1463 bScheduleCommand((void *) pDevice,
1464 WLAN_CMD_CHANGE_ANTENNA,
1467 pDevice->byAntennaState = 1;
1469 del_timer(&pDevice->TimerSQ3Tmax3);
1470 del_timer(&pDevice->TimerSQ3Tmax2);
1471 pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
1472 add_timer(&pDevice->TimerSQ3Tmax1);
1475 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1476 add_timer(&pDevice->TimerSQ3Tmax3);
1478 s_vClearSQ3Value(pDevice);
1481 } else { //byAntennaState == 1
1483 if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) {
1485 del_timer(&pDevice->TimerSQ3Tmax1);
1486 pDevice->ulSQ3_State1 = s_ulGetLowSQ3(pDevice);
1487 pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
1488 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n",(int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1);
1490 if ( ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 != 0)) ||
1491 ((pDevice->ulSQ3_State1 == 0) && (pDevice->ulSQ3_State0 == 0) && (pDevice->ulRatio_State1 < pDevice->ulRatio_State0)) ||
1492 ((pDevice->ulSQ3_State1 != 0) && (pDevice->ulSQ3_State0 != 0) && (pDevice->ulSQ3_State0 < pDevice->ulSQ3_State1))
1495 bScheduleCommand((void *) pDevice,
1496 WLAN_CMD_CHANGE_ANTENNA,
1499 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1500 pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
1501 add_timer(&pDevice->TimerSQ3Tmax3);
1502 add_timer(&pDevice->TimerSQ3Tmax2);
1505 pDevice->byAntennaState = 0;
1506 s_vClearSQ3Value(pDevice);
1515 * Timer for SQ3 antenna diversity
1520 * hDeviceContext - Pointer to the adapter
1526 * Return Value: none
1530 void TimerSQ3CallBack(struct vnt_private *pDevice)
1533 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack...");
1534 spin_lock_irq(&pDevice->lock);
1536 bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1537 pDevice->byAntennaState = 0;
1538 s_vClearSQ3Value(pDevice);
1539 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1540 pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
1541 add_timer(&pDevice->TimerSQ3Tmax3);
1542 add_timer(&pDevice->TimerSQ3Tmax2);
1545 spin_unlock_irq(&pDevice->lock);
1552 * Timer for SQ3 antenna diversity
1557 * hDeviceContext - Pointer to the adapter
1563 * Return Value: none
1567 void TimerSQ3Tmax3CallBack(struct vnt_private *pDevice)
1570 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3Tmax3CallBack...");
1571 spin_lock_irq(&pDevice->lock);
1573 pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
1574 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0 = [%08x]\n",(int)pDevice->ulRatio_State0);
1576 s_vClearSQ3Value(pDevice);
1577 if ( pDevice->byTMax == 0 ) {
1578 pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
1579 add_timer(&pDevice->TimerSQ3Tmax3);
1580 spin_unlock_irq(&pDevice->lock);
1584 bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_ANTENNA, NULL);
1585 pDevice->byAntennaState = 1;
1586 del_timer(&pDevice->TimerSQ3Tmax3);
1587 del_timer(&pDevice->TimerSQ3Tmax2);
1588 pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
1589 add_timer(&pDevice->TimerSQ3Tmax1);
1591 spin_unlock_irq(&pDevice->lock);
1594 void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning)
1598 switch(pDevice->byRFType)
1603 //RobertYu:20060627, update new table
1606 { // need Max sensitivity //RSSI -69, -70,....
1607 if(pDevice->byBBPreEDIndex == 0) break;
1608 pDevice->byBBPreEDIndex = 0;
1609 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1610 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1611 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70, -71,...\n");
1615 if(pDevice->byBBPreEDRSSI <= 45) { // RSSI 0, -1,-2,....-45
1616 if(pDevice->byBBPreEDIndex == 20) break;
1617 pDevice->byBBPreEDIndex = 20;
1618 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1619 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1620 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-45\n");
1621 } else if(pDevice->byBBPreEDRSSI <= 46) { //RSSI -46
1622 if(pDevice->byBBPreEDIndex == 19) break;
1623 pDevice->byBBPreEDIndex = 19;
1624 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x1A); //CR201(0xC9)
1625 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1626 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46\n");
1627 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -47
1628 if(pDevice->byBBPreEDIndex == 18) break;
1629 pDevice->byBBPreEDIndex = 18;
1630 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x15); //CR201(0xC9)
1631 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1632 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -47\n");
1633 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1634 if(pDevice->byBBPreEDIndex == 17) break;
1635 pDevice->byBBPreEDIndex = 17;
1636 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0E); //CR201(0xC9)
1637 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1638 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1639 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1640 if(pDevice->byBBPreEDIndex == 16) break;
1641 pDevice->byBBPreEDIndex = 16;
1642 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x09); //CR201(0xC9)
1643 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1644 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1645 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1646 if(pDevice->byBBPreEDIndex == 15) break;
1647 pDevice->byBBPreEDIndex = 15;
1648 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x06); //CR201(0xC9)
1649 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1650 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1651 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1652 if(pDevice->byBBPreEDIndex == 14) break;
1653 pDevice->byBBPreEDIndex = 14;
1654 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x03); //CR201(0xC9)
1655 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1656 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1657 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1658 if(pDevice->byBBPreEDIndex == 13) break;
1659 pDevice->byBBPreEDIndex = 13;
1660 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1661 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE)
1662 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1663 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1664 if(pDevice->byBBPreEDIndex == 12) break;
1665 pDevice->byBBPreEDIndex = 12;
1666 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1667 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x20); //CR206(0xCE)
1668 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1669 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1670 if(pDevice->byBBPreEDIndex == 11) break;
1671 pDevice->byBBPreEDIndex = 11;
1672 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1673 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xA0); //CR206(0xCE)
1674 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1675 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1676 if(pDevice->byBBPreEDIndex == 10) break;
1677 pDevice->byBBPreEDIndex = 10;
1678 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1679 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x54); //CR206(0xCE)
1680 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1681 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1682 if(pDevice->byBBPreEDIndex == 9) break;
1683 pDevice->byBBPreEDIndex = 9;
1684 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1685 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x18); //CR206(0xCE)
1686 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1687 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1688 if(pDevice->byBBPreEDIndex == 8) break;
1689 pDevice->byBBPreEDIndex = 8;
1690 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1691 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xE3); //CR206(0xCE)
1692 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
1693 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
1694 if(pDevice->byBBPreEDIndex == 7) break;
1695 pDevice->byBBPreEDIndex = 7;
1696 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1697 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB9); //CR206(0xCE)
1698 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
1699 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
1700 if(pDevice->byBBPreEDIndex == 6) break;
1701 pDevice->byBBPreEDIndex = 6;
1702 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1703 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x93); //CR206(0xCE)
1704 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
1705 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
1706 if(pDevice->byBBPreEDIndex == 5) break;
1707 pDevice->byBBPreEDIndex = 5;
1708 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1709 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x79); //CR206(0xCE)
1710 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
1711 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
1712 if(pDevice->byBBPreEDIndex == 4) break;
1713 pDevice->byBBPreEDIndex = 4;
1714 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1715 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x62); //CR206(0xCE)
1716 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
1717 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
1718 if(pDevice->byBBPreEDIndex == 3) break;
1719 pDevice->byBBPreEDIndex = 3;
1720 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1721 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x51); //CR206(0xCE)
1722 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
1723 } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67
1724 if(pDevice->byBBPreEDIndex == 2) break;
1725 pDevice->byBBPreEDIndex = 2;
1726 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1727 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
1728 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n");
1729 } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68
1730 if(pDevice->byBBPreEDIndex == 1) break;
1731 pDevice->byBBPreEDIndex = 1;
1732 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1733 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE)
1734 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n");
1735 } else { //RSSI -69, -70,....
1736 if(pDevice->byBBPreEDIndex == 0) break;
1737 pDevice->byBBPreEDIndex = 0;
1738 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1739 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1740 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,...\n");
1746 //RobertYu:20060627, update new table
1749 { // need Max sensitivity //RSSI -69, -70, ...
1750 if(pDevice->byBBPreEDIndex == 0) break;
1751 pDevice->byBBPreEDIndex = 0;
1752 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1753 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
1754 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n");
1758 if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41
1759 if(pDevice->byBBPreEDIndex == 22) break;
1760 pDevice->byBBPreEDIndex = 22;
1761 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1762 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1763 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1764 } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42
1765 if(pDevice->byBBPreEDIndex == 21) break;
1766 pDevice->byBBPreEDIndex = 21;
1767 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9)
1768 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1769 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n");
1770 } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43
1771 if(pDevice->byBBPreEDIndex == 20) break;
1772 pDevice->byBBPreEDIndex = 20;
1773 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9)
1774 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1775 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n");
1776 } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45
1777 if(pDevice->byBBPreEDIndex == 19) break;
1778 pDevice->byBBPreEDIndex = 19;
1779 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9)
1780 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1781 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n");
1782 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47
1783 if(pDevice->byBBPreEDIndex == 18) break;
1784 pDevice->byBBPreEDIndex = 18;
1785 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9)
1786 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1787 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n");
1788 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1789 if(pDevice->byBBPreEDIndex == 17) break;
1790 pDevice->byBBPreEDIndex = 17;
1791 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9)
1792 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1793 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1794 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1795 if(pDevice->byBBPreEDIndex == 16) break;
1796 pDevice->byBBPreEDIndex = 16;
1797 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9)
1798 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1799 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1800 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1801 if(pDevice->byBBPreEDIndex == 15) break;
1802 pDevice->byBBPreEDIndex = 15;
1803 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9)
1804 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1805 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1806 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1807 if(pDevice->byBBPreEDIndex == 14) break;
1808 pDevice->byBBPreEDIndex = 14;
1809 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1810 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1811 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1812 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1813 if(pDevice->byBBPreEDIndex == 13) break;
1814 pDevice->byBBPreEDIndex = 13;
1815 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1816 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1817 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1818 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1819 if(pDevice->byBBPreEDIndex == 12) break;
1820 pDevice->byBBPreEDIndex = 12;
1821 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1822 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE)
1823 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1824 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1825 if(pDevice->byBBPreEDIndex == 11) break;
1826 pDevice->byBBPreEDIndex = 11;
1827 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1828 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE)
1829 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1830 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1831 if(pDevice->byBBPreEDIndex == 10) break;
1832 pDevice->byBBPreEDIndex = 10;
1833 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1834 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1835 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1836 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1837 if(pDevice->byBBPreEDIndex == 9) break;
1838 pDevice->byBBPreEDIndex = 9;
1839 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1840 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE)
1841 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1842 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1843 if(pDevice->byBBPreEDIndex == 8) break;
1844 pDevice->byBBPreEDIndex = 8;
1845 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1846 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1847 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
1848 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
1849 if(pDevice->byBBPreEDIndex == 7) break;
1850 pDevice->byBBPreEDIndex = 7;
1851 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1852 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE)
1853 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
1854 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
1855 if(pDevice->byBBPreEDIndex == 6) break;
1856 pDevice->byBBPreEDIndex = 6;
1857 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1858 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE)
1859 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
1860 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
1861 if(pDevice->byBBPreEDIndex == 5) break;
1862 pDevice->byBBPreEDIndex = 5;
1863 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1864 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE)
1865 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
1866 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
1867 if(pDevice->byBBPreEDIndex == 4) break;
1868 pDevice->byBBPreEDIndex = 4;
1869 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1870 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE)
1871 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
1872 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
1873 if(pDevice->byBBPreEDIndex == 3) break;
1874 pDevice->byBBPreEDIndex = 3;
1875 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1876 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
1877 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
1878 } else if(pDevice->byBBPreEDRSSI <= 67) { //RSSI -67
1879 if(pDevice->byBBPreEDIndex == 2) break;
1880 pDevice->byBBPreEDIndex = 2;
1881 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1882 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x36); //CR206(0xCE)
1883 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67\n");
1884 } else if(pDevice->byBBPreEDRSSI <= 68) { //RSSI -68
1885 if(pDevice->byBBPreEDIndex == 1) break;
1886 pDevice->byBBPreEDIndex = 1;
1887 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1888 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x2D); //CR206(0xCE)
1889 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -68\n");
1890 } else { //RSSI -69, -70, ...
1891 if(pDevice->byBBPreEDIndex == 0) break;
1892 pDevice->byBBPreEDIndex = 0;
1893 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1894 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
1895 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -69, -70,..\n");
1899 case RF_VT3342A0: //RobertYu:20060627, testing table
1901 { // need Max sensitivity //RSSI -67, -68, ...
1902 if(pDevice->byBBPreEDIndex == 0) break;
1903 pDevice->byBBPreEDIndex = 0;
1904 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1905 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
1906 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n");
1910 if(pDevice->byBBPreEDRSSI <= 41) { // RSSI 0, -1,-2,....-41
1911 if(pDevice->byBBPreEDIndex == 20) break;
1912 pDevice->byBBPreEDIndex = 20;
1913 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0xFF); //CR201(0xC9)
1914 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1915 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI 0, -1,-2,..-41\n");
1916 } else if(pDevice->byBBPreEDRSSI <= 42) { //RSSI -42
1917 if(pDevice->byBBPreEDIndex == 19) break;
1918 pDevice->byBBPreEDIndex = 19;
1919 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x36); //CR201(0xC9)
1920 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1921 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -42\n");
1922 } else if(pDevice->byBBPreEDRSSI <= 43) { //RSSI -43
1923 if(pDevice->byBBPreEDIndex == 18) break;
1924 pDevice->byBBPreEDIndex = 18;
1925 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x26); //CR201(0xC9)
1926 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1927 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -43\n");
1928 } else if(pDevice->byBBPreEDRSSI <= 45) { //RSSI -44, -45
1929 if(pDevice->byBBPreEDIndex == 17) break;
1930 pDevice->byBBPreEDIndex = 17;
1931 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x18); //CR201(0xC9)
1932 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1933 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -44,-45\n");
1934 } else if(pDevice->byBBPreEDRSSI <= 47) { //RSSI -46, -47
1935 if(pDevice->byBBPreEDIndex == 16) break;
1936 pDevice->byBBPreEDIndex = 16;
1937 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x11); //CR201(0xC9)
1938 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1939 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -46,-47\n");
1940 } else if(pDevice->byBBPreEDRSSI <= 49) { //RSSI -48, -49
1941 if(pDevice->byBBPreEDIndex == 15) break;
1942 pDevice->byBBPreEDIndex = 15;
1943 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x0a); //CR201(0xC9)
1944 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1945 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -48,-49\n");
1946 } else if(pDevice->byBBPreEDRSSI <= 51) { //RSSI -50, -51
1947 if(pDevice->byBBPreEDIndex == 14) break;
1948 pDevice->byBBPreEDIndex = 14;
1949 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x07); //CR201(0xC9)
1950 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1951 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -50,-51\n");
1952 } else if(pDevice->byBBPreEDRSSI <= 53) { //RSSI -52, -53
1953 if(pDevice->byBBPreEDIndex == 13) break;
1954 pDevice->byBBPreEDIndex = 13;
1955 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x04); //CR201(0xC9)
1956 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x00); //CR206(0xCE)
1957 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -52,-53\n");
1958 } else if(pDevice->byBBPreEDRSSI <= 55) { //RSSI -54, -55
1959 if(pDevice->byBBPreEDIndex == 12) break;
1960 pDevice->byBBPreEDIndex = 12;
1961 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1962 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1963 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -54,-55\n");
1964 } else if(pDevice->byBBPreEDRSSI <= 56) { //RSSI -56
1965 if(pDevice->byBBPreEDIndex == 11) break;
1966 pDevice->byBBPreEDIndex = 11;
1967 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x02); //CR201(0xC9)
1968 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1969 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -56\n");
1970 } else if(pDevice->byBBPreEDRSSI <= 57) { //RSSI -57
1971 if(pDevice->byBBPreEDIndex == 10) break;
1972 pDevice->byBBPreEDIndex = 10;
1973 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1974 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xB0); //CR206(0xCE)
1975 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -57\n");
1976 } else if(pDevice->byBBPreEDRSSI <= 58) { //RSSI -58
1977 if(pDevice->byBBPreEDIndex == 9) break;
1978 pDevice->byBBPreEDIndex = 9;
1979 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1980 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x70); //CR206(0xCE)
1981 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -58\n");
1982 } else if(pDevice->byBBPreEDRSSI <= 59) { //RSSI -59
1983 if(pDevice->byBBPreEDIndex == 8) break;
1984 pDevice->byBBPreEDIndex = 8;
1985 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x01); //CR201(0xC9)
1986 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
1987 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -59\n");
1988 } else if(pDevice->byBBPreEDRSSI <= 60) { //RSSI -60
1989 if(pDevice->byBBPreEDIndex == 7) break;
1990 pDevice->byBBPreEDIndex = 7;
1991 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1992 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xEA); //CR206(0xCE)
1993 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -60\n");
1994 } else if(pDevice->byBBPreEDRSSI <= 61) { //RSSI -61
1995 if(pDevice->byBBPreEDIndex == 6) break;
1996 pDevice->byBBPreEDIndex = 6;
1997 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
1998 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0xC0); //CR206(0xCE)
1999 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -61\n");
2000 } else if(pDevice->byBBPreEDRSSI <= 62) { //RSSI -62
2001 if(pDevice->byBBPreEDIndex == 5) break;
2002 pDevice->byBBPreEDIndex = 5;
2003 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2004 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x9C); //CR206(0xCE)
2005 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -62\n");
2006 } else if(pDevice->byBBPreEDRSSI <= 63) { //RSSI -63
2007 if(pDevice->byBBPreEDIndex == 4) break;
2008 pDevice->byBBPreEDIndex = 4;
2009 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2010 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x80); //CR206(0xCE)
2011 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -63\n");
2012 } else if(pDevice->byBBPreEDRSSI <= 64) { //RSSI -64
2013 if(pDevice->byBBPreEDIndex == 3) break;
2014 pDevice->byBBPreEDIndex = 3;
2015 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2016 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x68); //CR206(0xCE)
2017 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -64\n");
2018 } else if(pDevice->byBBPreEDRSSI <= 65) { //RSSI -65
2019 if(pDevice->byBBPreEDIndex == 2) break;
2020 pDevice->byBBPreEDIndex = 2;
2021 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2022 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x52); //CR206(0xCE)
2023 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -65\n");
2024 } else if(pDevice->byBBPreEDRSSI <= 66) { //RSSI -66
2025 if(pDevice->byBBPreEDIndex == 1) break;
2026 pDevice->byBBPreEDIndex = 1;
2027 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2028 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x43); //CR206(0xCE)
2029 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -66\n");
2030 } else { //RSSI -67, -68, ...
2031 if(pDevice->byBBPreEDIndex == 0) break;
2032 pDevice->byBBPreEDIndex = 0;
2033 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
2034 ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
2035 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->byBBPreEDRSSI -67, -68,..\n");