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