H A D | mt2063.c | 372 *pAS_Info, InsertNode() 380 if (pAS_Info->freeZones != NULL) { InsertNode() 382 pNode = pAS_Info->freeZones; InsertNode() 383 pAS_Info->freeZones = pNode->next_; InsertNode() 386 pNode = &pAS_Info->MT2063_ExclZones[pAS_Info->nZones]; InsertNode() 394 pNode->next_ = pAS_Info->usedZones; InsertNode() 395 pAS_Info->usedZones = pNode; InsertNode() 398 pAS_Info->nZones++; InsertNode() 403 *pAS_Info, RemoveNode() 417 pNodeToRemove->next_ = pAS_Info->freeZones; RemoveNode() 418 pAS_Info->freeZones = pNodeToRemove; RemoveNode() 421 pAS_Info->nZones--; RemoveNode() 434 static void MT2063_AddExclZone(struct MT2063_AvoidSpursData_t *pAS_Info, MT2063_AddExclZone() argument 437 struct MT2063_ExclZone_t *pNode = pAS_Info->usedZones; MT2063_AddExclZone() 444 if ((f_max > (pAS_Info->f_if1_Center - (pAS_Info->f_if1_bw / 2))) MT2063_AddExclZone() 445 && (f_min < (pAS_Info->f_if1_Center + (pAS_Info->f_if1_bw / 2))) MT2063_AddExclZone() 468 pNode = InsertNode(pAS_Info, pPrev); MT2063_AddExclZone() 479 pNext = RemoveNode(pAS_Info, pNode, pNext); MT2063_AddExclZone() 488 static void MT2063_ResetExclZones(struct MT2063_AvoidSpursData_t *pAS_Info) MT2063_ResetExclZones() argument 494 pAS_Info->nZones = 0; /* this clears the used list */ MT2063_ResetExclZones() 495 pAS_Info->usedZones = NULL; /* reset ptr */ MT2063_ResetExclZones() 496 pAS_Info->freeZones = NULL; /* reset ptr */ MT2063_ResetExclZones() 499 pAS_Info->f_ref * MT2063_ResetExclZones() 500 ((pAS_Info->f_if1_Center - pAS_Info->f_if1_bw / 2 + MT2063_ResetExclZones() 501 pAS_Info->f_in) / pAS_Info->f_ref) - pAS_Info->f_in; MT2063_ResetExclZones() 503 pAS_Info->f_if1_Center + pAS_Info->f_if1_bw / 2 + MT2063_ResetExclZones() 504 pAS_Info->f_LO1_FracN_Avoid) { MT2063_ResetExclZones() 506 MT2063_AddExclZone(pAS_Info, MT2063_ResetExclZones() 507 center - pAS_Info->f_LO1_FracN_Avoid, MT2063_ResetExclZones() 509 MT2063_AddExclZone(pAS_Info, center + 1, MT2063_ResetExclZones() 510 center + pAS_Info->f_LO1_FracN_Avoid); MT2063_ResetExclZones() 511 center += pAS_Info->f_ref; MT2063_ResetExclZones() 515 pAS_Info->f_ref * MT2063_ResetExclZones() 516 ((pAS_Info->f_if1_Center - pAS_Info->f_if1_bw / 2 - MT2063_ResetExclZones() 517 pAS_Info->f_out) / pAS_Info->f_ref) + pAS_Info->f_out; MT2063_ResetExclZones() 519 pAS_Info->f_if1_Center + pAS_Info->f_if1_bw / 2 + MT2063_ResetExclZones() 520 pAS_Info->f_LO2_FracN_Avoid) { MT2063_ResetExclZones() 522 MT2063_AddExclZone(pAS_Info, MT2063_ResetExclZones() 523 center - pAS_Info->f_LO2_FracN_Avoid, MT2063_ResetExclZones() 525 MT2063_AddExclZone(pAS_Info, center + 1, MT2063_ResetExclZones() 526 center + pAS_Info->f_LO2_FracN_Avoid); MT2063_ResetExclZones() 527 center += pAS_Info->f_ref; MT2063_ResetExclZones() 530 if (MT2063_EXCLUDE_US_DECT_FREQUENCIES(pAS_Info->avoidDECT)) { MT2063_ResetExclZones() 532 MT2063_AddExclZone(pAS_Info, 1920836000 - pAS_Info->f_in, 1922236000 - pAS_Info->f_in); /* Ctr = 1921.536 */ MT2063_ResetExclZones() 533 MT2063_AddExclZone(pAS_Info, 1922564000 - pAS_Info->f_in, 1923964000 - pAS_Info->f_in); /* Ctr = 1923.264 */ MT2063_ResetExclZones() 534 MT2063_AddExclZone(pAS_Info, 1924292000 - pAS_Info->f_in, 1925692000 - pAS_Info->f_in); /* Ctr = 1924.992 */ MT2063_ResetExclZones() 535 MT2063_AddExclZone(pAS_Info, 1926020000 - pAS_Info->f_in, 1927420000 - pAS_Info->f_in); /* Ctr = 1926.720 */ MT2063_ResetExclZones() 536 MT2063_AddExclZone(pAS_Info, 1927748000 - pAS_Info->f_in, 1929148000 - pAS_Info->f_in); /* Ctr = 1928.448 */ MT2063_ResetExclZones() 539 if (MT2063_EXCLUDE_EURO_DECT_FREQUENCIES(pAS_Info->avoidDECT)) { MT2063_ResetExclZones() 540 MT2063_AddExclZone(pAS_Info, 1896644000 - pAS_Info->f_in, 1898044000 - pAS_Info->f_in); /* Ctr = 1897.344 */ MT2063_ResetExclZones() 541 MT2063_AddExclZone(pAS_Info, 1894916000 - pAS_Info->f_in, 1896316000 - pAS_Info->f_in); /* Ctr = 1895.616 */ MT2063_ResetExclZones() 542 MT2063_AddExclZone(pAS_Info, 1893188000 - pAS_Info->f_in, 1894588000 - pAS_Info->f_in); /* Ctr = 1893.888 */ MT2063_ResetExclZones() 543 MT2063_AddExclZone(pAS_Info, 1891460000 - pAS_Info->f_in, 1892860000 - pAS_Info->f_in); /* Ctr = 1892.16 */ MT2063_ResetExclZones() 544 MT2063_AddExclZone(pAS_Info, 1889732000 - pAS_Info->f_in, 1891132000 - pAS_Info->f_in); /* Ctr = 1890.432 */ MT2063_ResetExclZones() 545 MT2063_AddExclZone(pAS_Info, 1888004000 - pAS_Info->f_in, 1889404000 - pAS_Info->f_in); /* Ctr = 1888.704 */ MT2063_ResetExclZones() 546 MT2063_AddExclZone(pAS_Info, 1886276000 - pAS_Info->f_in, 1887676000 - pAS_Info->f_in); /* Ctr = 1886.976 */ MT2063_ResetExclZones() 547 MT2063_AddExclZone(pAS_Info, 1884548000 - pAS_Info->f_in, 1885948000 - pAS_Info->f_in); /* Ctr = 1885.248 */ MT2063_ResetExclZones() 548 MT2063_AddExclZone(pAS_Info, 1882820000 - pAS_Info->f_in, 1884220000 - pAS_Info->f_in); /* Ctr = 1883.52 */ MT2063_ResetExclZones() 549 MT2063_AddExclZone(pAS_Info, 1881092000 - pAS_Info->f_in, 1882492000 - pAS_Info->f_in); /* Ctr = 1881.792 */ MT2063_ResetExclZones() 559 static u32 MT2063_ChooseFirstIF(struct MT2063_AvoidSpursData_t *pAS_Info) MT2063_ChooseFirstIF() argument 570 pAS_Info->f_LO1_Step * MT2063_ChooseFirstIF() 571 ((pAS_Info->f_if1_Request + pAS_Info->f_in + MT2063_ChooseFirstIF() 572 pAS_Info->f_LO1_Step / 2) / pAS_Info->f_LO1_Step) - MT2063_ChooseFirstIF() 573 pAS_Info->f_in; MT2063_ChooseFirstIF() 575 (pAS_Info->f_LO1_Step > MT2063_ChooseFirstIF() 576 pAS_Info->f_LO2_Step) ? pAS_Info->f_LO1_Step : pAS_Info-> MT2063_ChooseFirstIF() 585 struct MT2063_ExclZone_t *pNode = pAS_Info->usedZones; MT2063_ChooseFirstIF() 590 if (pAS_Info->nZones == 0) MT2063_ChooseFirstIF() 597 if (pAS_Info->f_if1_Center > f_Desired) MT2063_ChooseFirstIF() 601 ((pAS_Info->f_if1_Center - f_Desired + MT2063_ChooseFirstIF() 607 ((f_Desired - pAS_Info->f_if1_Center + MT2063_ChooseFirstIF() 702 * @pAS_Info: Avoid Spurs information block 708 static u32 IsSpurInBand(struct MT2063_AvoidSpursData_t *pAS_Info, IsSpurInBand() argument 715 const u32 f_LO1 = pAS_Info->f_LO1; IsSpurInBand() 716 const u32 f_LO2 = pAS_Info->f_LO2; IsSpurInBand() 717 const u32 d = pAS_Info->f_out + pAS_Info->f_out_bw / 2; IsSpurInBand() 718 const u32 c = d - pAS_Info->f_out_bw; IsSpurInBand() 719 const u32 f = pAS_Info->f_zif_bw / 2; IsSpurInBand() 720 const u32 f_Scale = (f_LO1 / (UINT_MAX / 2 / pAS_Info->maxH1)) + 1; IsSpurInBand() 746 for (n = n0; n <= pAS_Info->maxH1; ++n) { IsSpurInBand() 751 if (md >= pAS_Info->maxH1) IsSpurInBand() 817 static u32 MT2063_AvoidSpurs(struct MT2063_AvoidSpursData_t *pAS_Info) MT2063_AvoidSpurs() argument 821 pAS_Info->bSpurAvoided = 0; MT2063_AvoidSpurs() 822 pAS_Info->nSpursFound = 0; MT2063_AvoidSpurs() 826 if (pAS_Info->maxH1 == 0) MT2063_AvoidSpurs() 840 pAS_Info->bSpurPresent = IsSpurInBand(pAS_Info, &fm, &fp); MT2063_AvoidSpurs() 841 if (pAS_Info->bSpurPresent) { MT2063_AvoidSpurs() 842 u32 zfIF1 = pAS_Info->f_LO1 - pAS_Info->f_in; /* current attempt at a 1st IF */ MT2063_AvoidSpurs() 843 u32 zfLO1 = pAS_Info->f_LO1; /* current attempt at an LO1 freq */ MT2063_AvoidSpurs() 844 u32 zfLO2 = pAS_Info->f_LO2; /* current attempt at an LO2 freq */ MT2063_AvoidSpurs() 852 pAS_Info->nSpursFound++; MT2063_AvoidSpurs() 855 MT2063_AddExclZone(pAS_Info, zfIF1 - fm, zfIF1 + fp); MT2063_AvoidSpurs() 858 new_IF1 = MT2063_ChooseFirstIF(pAS_Info); MT2063_AvoidSpurs() 861 pAS_Info->f_LO1 += (new_IF1 - zfIF1); MT2063_AvoidSpurs() 862 pAS_Info->f_LO2 += (new_IF1 - zfIF1); MT2063_AvoidSpurs() 864 pAS_Info->f_LO1 -= (zfIF1 - new_IF1); MT2063_AvoidSpurs() 865 pAS_Info->f_LO2 -= (zfIF1 - new_IF1); MT2063_AvoidSpurs() 869 if (zfIF1 > pAS_Info->f_if1_Center) MT2063_AvoidSpurs() 870 delta_IF1 = zfIF1 - pAS_Info->f_if1_Center; MT2063_AvoidSpurs() 872 delta_IF1 = pAS_Info->f_if1_Center - zfIF1; MT2063_AvoidSpurs() 874 pAS_Info->bSpurPresent = IsSpurInBand(pAS_Info, &fm, &fp); MT2063_AvoidSpurs() 879 } while ((2 * delta_IF1 + pAS_Info->f_out_bw <= pAS_Info->f_if1_bw) && pAS_Info->bSpurPresent); MT2063_AvoidSpurs() 886 if (pAS_Info->bSpurPresent == 1) { MT2063_AvoidSpurs() 888 pAS_Info->f_LO1 = zfLO1; MT2063_AvoidSpurs() 889 pAS_Info->f_LO2 = zfLO2; MT2063_AvoidSpurs() 891 pAS_Info->bSpurAvoided = 1; MT2063_AvoidSpurs() 895 ((pAS_Info-> MT2063_AvoidSpurs() 371 InsertNode(struct MT2063_AvoidSpursData_t *pAS_Info, struct MT2063_ExclZone_t *pPrevNode) InsertNode() argument 402 RemoveNode(struct MT2063_AvoidSpursData_t *pAS_Info, struct MT2063_ExclZone_t *pPrevNode, struct MT2063_ExclZone_t *pNodeToRemove) RemoveNode() argument
|