FreeCalypso > hg > fc-magnetite
comparison src/cs/layer1/tpu_drivers/source0/tpudrv10.c @ 406:d926a8986755
tpudrv10.c placeholder: all meat disabled in order to compile
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 18 Jan 2018 04:29:50 +0000 |
parents | 35638332aff5 |
children | ee49b250774f |
comparison
equal
deleted
inserted
replaced
405:909fe8b92b26 | 406:d926a8986755 |
---|---|
165 UWORD8 tx_up; | 165 UWORD8 tx_up; |
166 UWORD8 tx_down; | 166 UWORD8 tx_down; |
167 struct synth_s *synth; | 167 struct synth_s *synth; |
168 }; | 168 }; |
169 | 169 |
170 #if 0 | |
170 const struct synth_s synth_900[] = | 171 const struct synth_s synth_900[] = |
171 { | 172 { |
172 { 0, 124, BAND_SELECT_GSM, {{ 890, 1}, { 935, 2}}},// gsm 0 - 124 | 173 { 0, 124, BAND_SELECT_GSM, {{ 890, 1}, { 935, 2}}},// gsm 0 - 124 |
173 {974, 1023, BAND_SELECT_GSM, {{ 880, 1}, { 925, 2}}},// egsm 975 - 1023 | 174 {974, 1023, BAND_SELECT_GSM, {{ 880, 1}, { 925, 2}}},// egsm 975 - 1023 |
174 }; | 175 }; |
221 n = farfcn * s->tx_rx[downlink].ou; | 222 n = farfcn * s->tx_rx[downlink].ou; |
222 | 223 |
223 /* magic A & B encoding for Rita */ | 224 /* magic A & B encoding for Rita */ |
224 return((n - 4096) << 3); | 225 return((n - 4096) << 3); |
225 } | 226 } |
227 #endif | |
226 | 228 |
227 /*------------------------------------------*/ | 229 /*------------------------------------------*/ |
228 /* Convert_l1_radio_freq */ | 230 /* Convert_l1_radio_freq */ |
229 /*------------------------------------------*/ | 231 /*------------------------------------------*/ |
230 /* conversion of l1 radio_freq to */ | 232 /* conversion of l1 radio_freq to */ |
318 /* Rita and LoCosto versions look totally */ | 320 /* Rita and LoCosto versions look totally */ |
319 /* different, reconstructing from disasm. */ | 321 /* different, reconstructing from disasm. */ |
320 /*------------------------------------------*/ | 322 /*------------------------------------------*/ |
321 WORD32 rf_init(WORD32 t) | 323 WORD32 rf_init(WORD32 t) |
322 { | 324 { |
325 #if 0 | |
323 *TP_Ptr++ = TPU_AT(t); | 326 *TP_Ptr++ = TPU_AT(t); |
324 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, 0x47); | 327 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, 0x47); |
325 t += 5; | 328 t += 5; |
326 *TP_Ptr++ = TPU_AT(t); | 329 *TP_Ptr++ = TPU_AT(t); |
327 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_OFF); | 330 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_OFF); |
350 TSP_TO_RF(0x401F); | 353 TSP_TO_RF(0x401F); |
351 t += 7; | 354 t += 7; |
352 *TP_Ptr++ = TPU_AT(t); | 355 *TP_Ptr++ = TPU_AT(t); |
353 TSP_TO_RF(0x043D); | 356 TSP_TO_RF(0x043D); |
354 t += 7; | 357 t += 7; |
358 #endif | |
355 return(t); | 359 return(t); |
356 } | 360 } |
357 | 361 |
358 /*------------------------------------------*/ | 362 /*------------------------------------------*/ |
359 /* rf_init_light */ | 363 /* rf_init_light */ |
398 #ifdef ARFCN_DEBUG | 402 #ifdef ARFCN_DEBUG |
399 trace_arfcn(arfcn); | 403 trace_arfcn(arfcn); |
400 #endif | 404 #endif |
401 rf_index = arfcn_to_rf_index(arfcn); | 405 rf_index = arfcn_to_rf_index(arfcn); |
402 | 406 |
407 #if 0 | |
403 rfdiv = calc_a_b(arfcn, rx); | 408 rfdiv = calc_a_b(arfcn, rx); |
404 | 409 |
405 if (rx != 1) { | 410 if (rx != 1) { |
406 TSP_TO_RF(rfdiv | REG_PLL); | 411 TSP_TO_RF(rfdiv | REG_PLL); |
407 *TP_Ptr++ = TPU_FAT(0x1274); | 412 *TP_Ptr++ = TPU_FAT(0x1274); |
409 } else { | 414 } else { |
410 TSP_TO_RF(rfdiv | REG_PLL); | 415 TSP_TO_RF(rfdiv | REG_PLL); |
411 *TP_Ptr++ = TPU_FAT(0x12FD); | 416 *TP_Ptr++ = TPU_FAT(0x12FD); |
412 TSP_TO_RF(0x023A | rf_chip_band); | 417 TSP_TO_RF(0x023A | rf_chip_band); |
413 } | 418 } |
419 #endif | |
414 | 420 |
415 return(t); | 421 return(t); |
416 } | 422 } |
417 | 423 |
418 /**************************************************************************/ | 424 /**************************************************************************/ |
437 void l1dmacro_agc(SYS_UWORD16 radio_freq, WORD8 gain, UWORD8 lna_off) | 443 void l1dmacro_agc(SYS_UWORD16 radio_freq, WORD8 gain, UWORD8 lna_off) |
438 { | 444 { |
439 int agc_table_index; | 445 int agc_table_index; |
440 UWORD16 rf_data; | 446 UWORD16 rf_data; |
441 | 447 |
448 #if 0 | |
442 agc_table_index = gain - 2; | 449 agc_table_index = gain - 2; |
443 if (agc_table_index < 0) | 450 if (agc_table_index < 0) |
444 agc_table_index++; | 451 agc_table_index++; |
445 agc_table_index >>= 1; | 452 agc_table_index >>= 1; |
446 if (gain >= 42) | 453 if (gain >= 42) |
452 if (!lna_off) | 459 if (!lna_off) |
453 rf_data |= RF_GAIN; | 460 rf_data |= RF_GAIN; |
454 rf_data |= AGC_TABLE[agc_table_index] << 11; | 461 rf_data |= AGC_TABLE[agc_table_index] << 11; |
455 rf_data |= RX_CAL_MODE; | 462 rf_data |= RX_CAL_MODE; |
456 TSP_TO_RF(rf_data); | 463 TSP_TO_RF(rf_data); |
464 #endif | |
457 } | 465 } |
458 | 466 |
459 /*------------------------------------------*/ | 467 /*------------------------------------------*/ |
460 /* l1dmacro_rx_synth */ | 468 /* l1dmacro_rx_synth */ |
461 /*------------------------------------------*/ | 469 /*------------------------------------------*/ |
499 /* Rita version differs from LoCosto, */ | 507 /* Rita version differs from LoCosto, */ |
500 /* reconstructing from disassembly. */ | 508 /* reconstructing from disassembly. */ |
501 /*------------------------------------------*/ | 509 /*------------------------------------------*/ |
502 void l1dmacro_rx_up (void) | 510 void l1dmacro_rx_up (void) |
503 { | 511 { |
512 #if 0 | |
504 *TP_Ptr++ = TPU_FAT(0x1377); | 513 *TP_Ptr++ = TPU_FAT(0x1377); |
505 TSP_TO_RF(0x0A3A | rf_chip_band); | 514 TSP_TO_RF(0x0A3A | rf_chip_band); |
506 *TP_Ptr++ = TPU_FAT(0x137E); | 515 *TP_Ptr++ = TPU_FAT(0x137E); |
507 TSP_TO_ABB(0x10); | 516 TSP_TO_ABB(0x10); |
508 *TP_Ptr++ = TPU_FAT(0x1383); | 517 *TP_Ptr++ = TPU_FAT(0x1383); |
509 TSP_TO_ABB(0x18); | 518 TSP_TO_ABB(0x18); |
510 *TP_Ptr++ = TPU_FAT(58); | 519 *TP_Ptr++ = TPU_FAT(58); |
511 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_up | RF_SER_ON); | 520 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_up | RF_SER_ON); |
512 *TP_Ptr++ = TPU_FAT(62); | 521 *TP_Ptr++ = TPU_FAT(62); |
513 TSP_TO_ABB(0x14); | 522 TSP_TO_ABB(0x14); |
523 #endif | |
514 } | 524 } |
515 | 525 |
516 /*------------------------------------------*/ | 526 /*------------------------------------------*/ |
517 /* l1pdmacro_rx_down */ | 527 /* l1pdmacro_rx_down */ |
518 /*------------------------------------------*/ | 528 /*------------------------------------------*/ |
521 /* Rita version differs from LoCosto, */ | 531 /* Rita version differs from LoCosto, */ |
522 /* reconstructing from disassembly. */ | 532 /* reconstructing from disassembly. */ |
523 /*------------------------------------------*/ | 533 /*------------------------------------------*/ |
524 void l1dmacro_rx_down (WORD32 t) | 534 void l1dmacro_rx_down (WORD32 t) |
525 { | 535 { |
536 #if 0 | |
526 *TP_Ptr++ = TPU_FAT(t - 37); | 537 *TP_Ptr++ = TPU_FAT(t - 37); |
527 TSP_TO_RF(0x003A); | 538 TSP_TO_RF(0x003A); |
528 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | RF_SER_ON); | 539 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | RF_SER_ON); |
529 *TP_Ptr++ = TPU_FAT(t - 4); | 540 *TP_Ptr++ = TPU_FAT(t - 4); |
530 TSP_TO_ABB(0x00); | 541 TSP_TO_ABB(0x00); |
542 #endif | |
531 } | 543 } |
532 | 544 |
533 /*------------------------------------------*/ | 545 /*------------------------------------------*/ |
534 /* l1dmacro_tx_up */ | 546 /* l1dmacro_tx_up */ |
535 /*------------------------------------------*/ | 547 /*------------------------------------------*/ |
538 /* Rita version differs from LoCosto, */ | 550 /* Rita version differs from LoCosto, */ |
539 /* reconstructing from disassembly. */ | 551 /* reconstructing from disassembly. */ |
540 /*------------------------------------------*/ | 552 /*------------------------------------------*/ |
541 void l1dmacro_tx_up (void) | 553 void l1dmacro_tx_up (void) |
542 { | 554 { |
555 #if 0 | |
543 if (l1_config.std.id == DCS1800 || | 556 if (l1_config.std.id == DCS1800 || |
544 rfband == MULTI_BAND2 && | 557 rfband == MULTI_BAND2 && |
545 (l1_config.std.id == DUAL || l1_config.std.id == DUALEXT)) { | 558 (l1_config.std.id == DUAL || l1_config.std.id == DUALEXT)) { |
546 *TP_Ptr++ = TPU_FAT(0x127E); | 559 *TP_Ptr++ = TPU_FAT(0x127E); |
547 TSP_TO_RF(0x0007); | 560 TSP_TO_RF(0x0007); |
565 TSP_TO_ABB(0xA0); | 578 TSP_TO_ABB(0xA0); |
566 *TP_Ptr++ = TPU_FAT(16); | 579 *TP_Ptr++ = TPU_FAT(16); |
567 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_up | RF_SER_ON); | 580 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_up | RF_SER_ON); |
568 *TP_Ptr++ = TPU_FAT(21); | 581 *TP_Ptr++ = TPU_FAT(21); |
569 *TP_Ptr++ = TPU_MOVE(TSP_ACTX, 0x0F); | 582 *TP_Ptr++ = TPU_MOVE(TSP_ACTX, 0x0F); |
583 #endif | |
570 } | 584 } |
571 | 585 |
572 /*-------------------------------------------*/ | 586 /*-------------------------------------------*/ |
573 /* l1dmacro_tx_down */ | 587 /* l1dmacro_tx_down */ |
574 /*-------------------------------------------*/ | 588 /*-------------------------------------------*/ |
577 /* Rita version differs from LoCosto, */ | 591 /* Rita version differs from LoCosto, */ |
578 /* reconstructing from disassembly. */ | 592 /* reconstructing from disassembly. */ |
579 /*-------------------------------------------*/ | 593 /*-------------------------------------------*/ |
580 void l1dmacro_tx_down (WORD32 t, BOOL tx_flag, UWORD8 adc_active) | 594 void l1dmacro_tx_down (WORD32 t, BOOL tx_flag, UWORD8 adc_active) |
581 { | 595 { |
596 #if 0 | |
582 if (adc_active == ACTIVE) | 597 if (adc_active == ACTIVE) |
583 l1dmacro_adc_read_tx(t - 44); | 598 l1dmacro_adc_read_tx(t - 44); |
584 *TP_Ptr++ = TPU_FAT(t - 4); | 599 *TP_Ptr++ = TPU_FAT(t - 4); |
585 TSP_TO_ABB(0x80); | 600 TSP_TO_ABB(0x80); |
586 *TP_Ptr++ = TPU_FAT(t + 22); | 601 *TP_Ptr++ = TPU_FAT(t + 22); |
588 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_down | RF_SER_ON); | 603 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_down | RF_SER_ON); |
589 *TP_Ptr++ = TPU_FAT(t + 25); | 604 *TP_Ptr++ = TPU_FAT(t + 25); |
590 TSP_TO_RF(0x003A); | 605 TSP_TO_RF(0x003A); |
591 *TP_Ptr++ = TPU_FAT(t + 31); | 606 *TP_Ptr++ = TPU_FAT(t + 31); |
592 TSP_TO_ABB(0x00); | 607 TSP_TO_ABB(0x00); |
608 #endif | |
593 } | 609 } |
594 | 610 |
595 /* | 611 /* |
596 * l1dmacro_rx_nb | 612 * l1dmacro_rx_nb |
597 * | 613 * |
730 { | 746 { |
731 TPU_Reset(1); // reset TPU only, no TSP reset | 747 TPU_Reset(1); // reset TPU only, no TSP reset |
732 TPU_Reset(0); | 748 TPU_Reset(0); |
733 TP_Ptr = (UWORD16 *) TPU_RAM; | 749 TP_Ptr = (UWORD16 *) TPU_RAM; |
734 | 750 |
751 #if 0 | |
735 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON); | 752 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON); |
736 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON | FEM_OFF); | 753 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON | FEM_OFF); |
754 #endif | |
737 | 755 |
738 *TP_Ptr++ = TPU_OFFSET(servingCellOffset); | 756 *TP_Ptr++ = TPU_OFFSET(servingCellOffset); |
739 } | 757 } |
740 | 758 |
741 // l1dmacro_RF_sleep | 759 // l1dmacro_RF_sleep |
743 | 761 |
744 | 762 |
745 /* Rita version differs from LoCosto, reconstructing from disassembly */ | 763 /* Rita version differs from LoCosto, reconstructing from disassembly */ |
746 void l1dmacro_RF_sleep (void) | 764 void l1dmacro_RF_sleep (void) |
747 { | 765 { |
766 #if 0 | |
748 TSP_TO_RF(0x0002); | 767 TSP_TO_RF(0x0002); |
749 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON); | 768 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON); |
750 *TP_Ptr++ = TPU_WAIT(1); | 769 *TP_Ptr++ = TPU_WAIT(1); |
751 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x21); | 770 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x21); |
752 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x02); | 771 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x02); |
753 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x01); | 772 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x01); |
754 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); | 773 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); |
755 *TP_Ptr++ = TPU_WAIT(100); | 774 *TP_Ptr++ = TPU_WAIT(100); |
775 #endif | |
756 /* code from tpudrv61.c follows, same for Rita and LoCosto */ | 776 /* code from tpudrv61.c follows, same for Rita and LoCosto */ |
757 *TP_Ptr++ = TPU_SLEEP; | 777 *TP_Ptr++ = TPU_SLEEP; |
758 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; | 778 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; |
759 TP_Enable(1); | 779 TP_Enable(1); |
760 #if 0 /* present in LoCosto but not in TCS211 */ | 780 #if 0 /* present in LoCosto but not in TCS211 */ |
767 | 787 |
768 /* Rita version differs from LoCosto, reconstructing from disassembly */ | 788 /* Rita version differs from LoCosto, reconstructing from disassembly */ |
769 void l1dmacro_RF_wakeup (void) | 789 void l1dmacro_RF_wakeup (void) |
770 { | 790 { |
771 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; | 791 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; |
792 #if 0 | |
772 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x01); | 793 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x01); |
773 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06); | 794 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06); |
774 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x01); | 795 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x01); |
775 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); | 796 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); |
776 *TP_Ptr++ = TPU_WAIT(100); | 797 *TP_Ptr++ = TPU_WAIT(100); |
796 TSP_TO_RF(0x401F); | 817 TSP_TO_RF(0x401F); |
797 *TP_Ptr++ = TPU_WAIT(7); | 818 *TP_Ptr++ = TPU_WAIT(7); |
798 TSP_TO_RF(0x043D); | 819 TSP_TO_RF(0x043D); |
799 *TP_Ptr++ = TPU_WAIT(7); | 820 *TP_Ptr++ = TPU_WAIT(7); |
800 *TP_Ptr++ = TPU_WAIT(117); | 821 *TP_Ptr++ = TPU_WAIT(117); |
822 #endif | |
801 /* code from tpudrv61.c follows, same for Rita and LoCosto */ | 823 /* code from tpudrv61.c follows, same for Rita and LoCosto */ |
802 *TP_Ptr++ = TPU_SLEEP; | 824 *TP_Ptr++ = TPU_SLEEP; |
803 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; | 825 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; |
804 TP_Enable(1); | 826 TP_Enable(1); |
805 #if 0 /* present in LoCosto but not in TCS211 */ | 827 #if 0 /* present in LoCosto but not in TCS211 */ |
825 TP_Reset(0); | 847 TP_Reset(0); |
826 | 848 |
827 | 849 |
828 TP_Ptr = (UWORD16 *) TPU_RAM; | 850 TP_Ptr = (UWORD16 *) TPU_RAM; |
829 | 851 |
852 #if 0 | |
830 // Set FEM to inactive state before turning ON the RF Board | 853 // Set FEM to inactive state before turning ON the RF Board |
831 // At this point the RF regulators are still OFF. Thus the | 854 // At this point the RF regulators are still OFF. Thus the |
832 // FEM command is not inverted yet => Must use the FEM "SLEEP programming" | 855 // FEM command is not inverted yet => Must use the FEM "SLEEP programming" |
833 *TP_Ptr++ = TPU_MOVE(TSP_ACT, FEM_SLEEP | RF_SER_ON); | 856 *TP_Ptr++ = TPU_MOVE(TSP_ACT, FEM_SLEEP | RF_SER_ON); |
857 #endif | |
834 | 858 |
835 // TPU_SLEEP | 859 // TPU_SLEEP |
836 l1dmacro_idle(); | 860 l1dmacro_idle(); |
837 | 861 |
838 *TP_Ptr++ = TPU_AT(t); | 862 *TP_Ptr++ = TPU_AT(t); |
839 *TP_Ptr++ = TPU_SYNC(0); | 863 *TP_Ptr++ = TPU_SYNC(0); |
840 | 864 |
865 #if 0 | |
841 /* from disassembly, differs from LoCosto version */ | 866 /* from disassembly, differs from LoCosto version */ |
842 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x20); | 867 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x20); |
843 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06); | 868 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06); |
844 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET3, 0x00); | 869 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET3, 0x00); |
870 #endif | |
845 | 871 |
846 t = 1000; // arbitrary start time | 872 t = 1000; // arbitrary start time |
847 | 873 |
848 t = rf_init(t); // Initialize RF Board | 874 t = rf_init(t); // Initialize RF Board |
849 | 875 |