FreeCalypso > hg > fc-magnetite
comparison src/cs/layer1/tpu_drivers/source0/tpudrv10.c @ 616:f8e74b692c80
tpudrv10.c: first actual reconstruction attempt
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 06 Oct 2019 02:33:10 +0000 |
parents | 5ca341a26dda |
children |
comparison
equal
deleted
inserted
replaced
615:2bd7c1dcac4b | 616:f8e74b692c80 |
---|---|
1 /* | 1 /* |
2 * The situation with the tpudrv10 RF TPU driver is even worse than with | 2 * The situation with the tpudrv10 RF TPU driver is even worse than with |
3 * tpudrv12: not only are we missing the original tpudrv10.c source, | 3 * tpudrv12: not only are we missing the original tpudrv10.c source, |
4 * but we don't even have a tpudrv10.obj to reconstruct from. | 4 * but we don't even have a tpudrv10.obj to reconstruct from. |
5 * The present reconstruction has been made from the 20020917 fw | |
6 * image that came with our D-Sample board. | |
5 * | 7 * |
6 * We are going to try reconstructing the necessary tpudrv10 bits | 8 * The deep sleep functions haven't been reconstructed yet, |
7 * from the 20020917 fw image sans symbols that came with our D-Sample | 9 * thus the firmware needs to be built with DISABLE_SLEEP=1. |
8 * board, but for now this C file is mostly a placeholder for compilation. | |
9 */ | 10 */ |
10 | 11 |
11 #define TPUDRV10_C | 12 #define TPUDRV10_C |
12 | 13 |
13 #include "board.cfg" | 14 #include "board.cfg" |
61 extern T_L1_CONFIG l1_config; | 62 extern T_L1_CONFIG l1_config; |
62 extern UWORD16 AGC_TABLE[]; | 63 extern UWORD16 AGC_TABLE[]; |
63 extern UWORD16 *TP_Ptr; | 64 extern UWORD16 *TP_Ptr; |
64 | 65 |
65 static UWORD8 rf_index; /* index into rf_path[] */ | 66 static UWORD8 rf_index; /* index into rf_path[] */ |
66 static UWORD16 rf_chip_band; /* from tpudrv12.obj, not in tpudrv61.c */ | |
67 static UWORD8 rfband; /* ditto */ | 67 static UWORD8 rfband; /* ditto */ |
68 static UWORD8 magic2_byte; | 68 static UWORD8 magic2_byte; |
69 static UWORD16 lna_off_flag; | |
70 | |
71 static UWORD8 magic_83be24 = 0x0E; | |
72 static UWORD8 magic_83be25 = 0x01; | |
73 static UWORD8 magic_83be26 = 0x00; | |
69 | 74 |
70 // Internal function prototypes | 75 // Internal function prototypes |
71 void l1dmacro_rx_down (WORD32 t); | 76 void l1dmacro_rx_down (WORD32 t); |
72 | 77 |
73 SYS_UWORD16 Convert_l1_radio_freq(SYS_UWORD16 radio_freq); | 78 SYS_UWORD16 Convert_l1_radio_freq(SYS_UWORD16 radio_freq); |
90 /* Is arfcn in the DCS band (512-885) ? */ | 95 /* Is arfcn in the DCS band (512-885) ? */ |
91 /*------------------------------------------*/ | 96 /*------------------------------------------*/ |
92 #define IS_HIGH_BAND(arfcn) (((arfcn >= 512) && (arfcn <= 885)) ? 1 : 0) | 97 #define IS_HIGH_BAND(arfcn) (((arfcn >= 512) && (arfcn <= 885)) ? 1 : 0) |
93 | 98 |
94 /*------------------------------------------*/ | 99 /*------------------------------------------*/ |
95 /* Send a value to Rita RF */ | 100 /* Send a value to Clara RF */ |
96 /*------------------------------------------*/ | 101 /*------------------------------------------*/ |
97 #define TSP_TO_RF(rf_data)\ | 102 #define TSP_TO_RF_24(rf_data)\ |
103 {\ | |
104 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_1, ((rf_data) >> 16) & 0xFF); \ | |
105 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_2, ((rf_data) >> 8) & 0xFF); \ | |
106 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_3, (rf_data) & 0xFF); \ | |
107 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x17); \ | |
108 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); \ | |
109 } | |
110 | |
111 #define TSP_TO_RF_16(rf_data)\ | |
98 {\ | 112 {\ |
99 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_1, ((rf_data) >> 8) & 0xFF); \ | 113 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_1, ((rf_data) >> 8) & 0xFF); \ |
100 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_2, (rf_data) & 0xFF); \ | 114 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_2, (rf_data) & 0xFF); \ |
101 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x0F); \ | 115 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x0F); \ |
116 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); \ | |
117 } | |
118 | |
119 #define TSP_TO_RF_8(rf_data)\ | |
120 {\ | |
121 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_1, (rf_data) & 0xFF); \ | |
122 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x07); \ | |
102 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); \ | 123 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); \ |
103 } | 124 } |
104 | 125 |
105 /*------------------------------------------*/ | 126 /*------------------------------------------*/ |
106 /* Send a TSP command to ABB */ | 127 /* Send a TSP command to ABB */ |
303 synth_1900, magic1_1900, magic2_rx1900}, | 324 synth_1900, magic1_1900, magic2_rx1900}, |
304 /* non-E GSM */ | 325 /* non-E GSM */ |
305 { BAND_SELECT_GSM, RU_900, RD_900, TU_900, TD_900, TU_REV_900, | 326 { BAND_SELECT_GSM, RU_900, RD_900, TU_900, TD_900, TU_REV_900, |
306 synth_900, magic1_900, magic2_rx900}, | 327 synth_900, magic1_900, magic2_rx900}, |
307 }; | 328 }; |
329 | |
330 static UWORD16 calc_tx_magic(UWORD16 arfcn) | |
331 { | |
332 const struct magic1_s *m1; | |
333 UWORD16 sp6, sp8; | |
334 | |
335 m1 = rf_path[rf_index].tx_magic1; | |
336 while(m1->limit < arfcn) | |
337 m1++; | |
338 sp6 = m1->magic << 1; | |
339 sp8 = sp6 / 13; | |
340 return ((sp8 & 0x1FF) << 5); | |
341 } | |
308 | 342 |
309 static UWORD32 calc_freq_prog(UWORD16 arfcn, UWORD8 downlink) | 343 static UWORD32 calc_freq_prog(UWORD16 arfcn, UWORD8 downlink) |
310 { | 344 { |
311 UWORD32 farfcn; /* sp+0x1C, in 200 kHz units */ | 345 UWORD32 farfcn; /* sp+0x1C, in 200 kHz units */ |
312 const struct synth_s *s; | 346 const struct synth_s *s; |
446 /* Rita and LoCosto versions look totally */ | 480 /* Rita and LoCosto versions look totally */ |
447 /* different, reconstructing from disasm. */ | 481 /* different, reconstructing from disasm. */ |
448 /*------------------------------------------*/ | 482 /*------------------------------------------*/ |
449 WORD32 rf_init(WORD32 t) | 483 WORD32 rf_init(WORD32 t) |
450 { | 484 { |
451 #if 0 | |
452 *TP_Ptr++ = TPU_AT(t); | 485 *TP_Ptr++ = TPU_AT(t); |
453 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, 0x47); | 486 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, 0x47); |
454 t += 5; | 487 *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x01); |
455 *TP_Ptr++ = TPU_AT(t); | 488 *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x00); |
456 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_OFF); | 489 *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x01); |
457 t += 8; | 490 t += 8; |
458 *TP_Ptr++ = TPU_AT(t); | 491 *TP_Ptr++ = TPU_AT(t); |
459 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON); | 492 TSP_TO_RF_16(0x8008); |
460 t += 5; | 493 *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x1F); |
461 *TP_Ptr++ = TPU_AT(t); | |
462 TSP_TO_RF(0x0012); | |
463 t += 7; | 494 t += 7; |
464 *TP_Ptr++ = TPU_AT(t); | 495 *TP_Ptr++ = TPU_AT(t); |
465 *TP_Ptr++ = TPU_AT(t); | 496 *TP_Ptr++ = TPU_AT(t); |
466 *TP_Ptr++ = TPU_AT(t); | 497 *TP_Ptr++ = TPU_AT(t); |
467 *TP_Ptr++ = TPU_AT(t); | 498 *TP_Ptr++ = TPU_AT(t); |
468 *TP_Ptr++ = TPU_AT(t); | 499 *TP_Ptr++ = TPU_AT(t); |
469 *TP_Ptr++ = TPU_AT(t); | 500 *TP_Ptr++ = TPU_AT(t); |
470 TSP_TO_RF(0x003A); | 501 *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x1F); |
471 t += 117; | 502 *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x1E); |
472 *TP_Ptr++ = TPU_AT(t); | 503 *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x1F); |
473 TSP_TO_RF(0xC003); | 504 TSP_TO_RF_16(0x8018); |
474 t += 7; | 505 t += 9; |
475 *TP_Ptr++ = TPU_AT(t); | 506 *TP_Ptr++ = TPU_AT(t); |
476 TSP_TO_RF(0x02FE); | 507 TSP_TO_RF_24(0x140753); |
477 t += 7; | 508 t += 8; |
478 *TP_Ptr++ = TPU_AT(t); | 509 *TP_Ptr++ = TPU_AT(t); |
479 TSP_TO_RF(0x401F); | 510 TSP_TO_RF_24(0x2db084); |
480 t += 7; | 511 t += 8; |
481 *TP_Ptr++ = TPU_AT(t); | 512 *TP_Ptr++ = TPU_AT(t); |
482 TSP_TO_RF(0x043D); | 513 TSP_TO_RF_8((magic_83be26 << 4) | (magic_83be25 << 5) | 0x06); |
483 t += 7; | 514 t += 384; |
484 #endif | 515 *TP_Ptr++ = TPU_AT(t); |
516 TSP_TO_RF_24(((UWORD32) magic_83be24 << 19) | 7); | |
517 t += 8; | |
485 return(t); | 518 return(t); |
486 } | 519 } |
487 | 520 |
488 /*------------------------------------------*/ | 521 /*------------------------------------------*/ |
489 /* rf_init_light */ | 522 /* rf_init_light */ |
517 /* downloads NA counter value */ | 550 /* downloads NA counter value */ |
518 /* t = start time in the current frame */ | 551 /* t = start time in the current frame */ |
519 /*------------------------------------------*/ //change 2 UWORD8 | 552 /*------------------------------------------*/ //change 2 UWORD8 |
520 UWORD32 rf_program(UWORD32 t, SYS_UWORD16 radio_freq, UWORD32 rx) | 553 UWORD32 rf_program(UWORD32 t, SYS_UWORD16 radio_freq, UWORD32 rx) |
521 { | 554 { |
522 UWORD32 rfdiv; | |
523 SYS_UWORD16 arfcn; | 555 SYS_UWORD16 arfcn; |
556 UWORD32 sp0x10, sp0x14; | |
524 | 557 |
525 rfband = Cust_is_band_high(radio_freq); | 558 rfband = Cust_is_band_high(radio_freq); |
526 | 559 |
527 arfcn = Convert_l1_radio_freq(radio_freq); | 560 arfcn = Convert_l1_radio_freq(radio_freq); |
528 #ifdef ARFCN_DEBUG | 561 #ifdef ARFCN_DEBUG |
529 trace_arfcn(arfcn); | 562 trace_arfcn(arfcn); |
530 #endif | 563 #endif |
531 rf_index = arfcn_to_rf_index(arfcn); | 564 rf_index = arfcn_to_rf_index(arfcn); |
532 | 565 |
533 #if 0 | 566 sp0x10 = calc_freq_prog(arfcn, rx); |
534 rfdiv = calc_a_b(arfcn, rx); | 567 if (rx == 1) { |
535 | 568 TSP_TO_RF_24(sp0x10 | magic2_byte | MODE2); |
536 if (rx != 1) { | 569 *TP_Ptr++ = TPU_WAIT(1); |
537 TSP_TO_RF(rfdiv | REG_PLL); | 570 TSP_TO_RF_16(0x8A18 | rf_path[rf_index].rf_chip_band); |
538 *TP_Ptr++ = TPU_FAT(0x1274); | 571 TSP_TO_RF_24(sp0x10 | magic2_byte | MODE2); |
539 TSP_TO_RF(0x043A | rf_chip_band); | |
540 } else { | 572 } else { |
541 TSP_TO_RF(rfdiv | REG_PLL); | 573 sp0x14 = calc_tx_magic(arfcn); |
542 *TP_Ptr++ = TPU_FAT(0x12FD); | 574 TSP_TO_ABB(0x80); |
543 TSP_TO_RF(0x023A | rf_chip_band); | 575 *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x17); |
576 TSP_TO_RF_16(0x0518 | rf_path[rf_index].rf_chip_band); | |
577 TSP_TO_RF_24(sp0x10 | magic2_byte | MODE2); | |
578 *TP_Ptr++ = TPU_FAT(0x1280); | |
579 TSP_TO_ABB(0xC0); | |
580 *TP_Ptr++ = TPU_FAT(0x128B); | |
581 TSP_TO_RF_16(sp0x14 | MODE5); | |
582 *TP_Ptr++ = TPU_FAT(0x12F7); | |
583 TSP_TO_RF_24(0x140973); | |
584 *TP_Ptr++ = TPU_FAT(0x1305); | |
585 TSP_TO_ABB(0x80); | |
544 } | 586 } |
545 #endif | |
546 | 587 |
547 return(t); | 588 return(t); |
548 } | 589 } |
549 | 590 |
550 /**************************************************************************/ | 591 /**************************************************************************/ |
567 /*------------------------------------------*/ | 608 /*------------------------------------------*/ |
568 | 609 |
569 void l1dmacro_agc(SYS_UWORD16 radio_freq, WORD8 gain, UWORD8 lna_off) | 610 void l1dmacro_agc(SYS_UWORD16 radio_freq, WORD8 gain, UWORD8 lna_off) |
570 { | 611 { |
571 int agc_table_index; | 612 int agc_table_index; |
572 UWORD16 rf_data; | 613 |
573 | 614 agc_table_index = gain - 6; |
574 #if 0 | |
575 agc_table_index = gain - 2; | |
576 if (agc_table_index < 0) | 615 if (agc_table_index < 0) |
577 agc_table_index++; | 616 agc_table_index++; |
578 agc_table_index >>= 1; | 617 agc_table_index >>= 1; |
579 if (gain >= 42) | 618 if (agc_table_index >= 27) |
580 agc_table_index = 19; | 619 agc_table_index = 26; |
581 if (gain < 16) | 620 if (agc_table_index < 0) |
582 agc_table_index = 6; | 621 agc_table_index = 0; |
583 *TP_Ptr++ = TPU_FAT(0x1334); | 622 *TP_Ptr++ = TPU_FAT(0x1313); |
584 rf_data = REG_RX; | 623 TSP_TO_RF_16(AGC_TABLE[agc_table_index] << 11 | 0x3B9); |
585 if (!lna_off) | 624 lna_off_flag = (lna_off & 1) << 15; |
586 rf_data |= RF_GAIN; | |
587 rf_data |= AGC_TABLE[agc_table_index] << 11; | |
588 rf_data |= RX_CAL_MODE; | |
589 TSP_TO_RF(rf_data); | |
590 #endif | |
591 } | 625 } |
592 | 626 |
593 /*------------------------------------------*/ | 627 /*------------------------------------------*/ |
594 /* l1dmacro_rx_synth */ | 628 /* l1dmacro_rx_synth */ |
595 /*------------------------------------------*/ | 629 /*------------------------------------------*/ |
633 /* Rita version differs from LoCosto, */ | 667 /* Rita version differs from LoCosto, */ |
634 /* reconstructing from disassembly. */ | 668 /* reconstructing from disassembly. */ |
635 /*------------------------------------------*/ | 669 /*------------------------------------------*/ |
636 void l1dmacro_rx_up (void) | 670 void l1dmacro_rx_up (void) |
637 { | 671 { |
638 #if 0 | 672 *TP_Ptr++ = TPU_FAT(0x1321); |
639 *TP_Ptr++ = TPU_FAT(0x1377); | 673 TSP_TO_RF_16(0x9A18 | rf_path[rf_index].rf_chip_band); |
640 TSP_TO_RF(0x0A3A | rf_chip_band); | 674 *TP_Ptr++ = TPU_FAT(7); |
641 *TP_Ptr++ = TPU_FAT(0x137E); | 675 TSP_TO_RF_16(0x0238 | rf_path[rf_index].rf_chip_band | lna_off_flag); |
676 *TP_Ptr++ = TPU_WAIT(5); | |
642 TSP_TO_ABB(0x10); | 677 TSP_TO_ABB(0x10); |
643 *TP_Ptr++ = TPU_FAT(0x1383); | 678 *TP_Ptr++ = TPU_FAT(0x1B); |
644 TSP_TO_ABB(0x18); | 679 TSP_TO_ABB(0x18); |
645 *TP_Ptr++ = TPU_FAT(58); | 680 *TP_Ptr++ = TPU_FAT(0x36); |
646 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_up | RF_SER_ON); | 681 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_up | 0x09); |
647 *TP_Ptr++ = TPU_FAT(62); | 682 *TP_Ptr++ = TPU_FAT(62); |
648 TSP_TO_ABB(0x14); | 683 TSP_TO_ABB(0x14); |
649 #endif | |
650 } | 684 } |
651 | 685 |
652 /*------------------------------------------*/ | 686 /*------------------------------------------*/ |
653 /* l1pdmacro_rx_down */ | 687 /* l1pdmacro_rx_down */ |
654 /*------------------------------------------*/ | 688 /*------------------------------------------*/ |
657 /* Rita version differs from LoCosto, */ | 691 /* Rita version differs from LoCosto, */ |
658 /* reconstructing from disassembly. */ | 692 /* reconstructing from disassembly. */ |
659 /*------------------------------------------*/ | 693 /*------------------------------------------*/ |
660 void l1dmacro_rx_down (WORD32 t) | 694 void l1dmacro_rx_down (WORD32 t) |
661 { | 695 { |
662 #if 0 | 696 *TP_Ptr++ = TPU_FAT(t - 36); |
663 *TP_Ptr++ = TPU_FAT(t - 37); | 697 TSP_TO_RF_16(0x8018); |
664 TSP_TO_RF(0x003A); | 698 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | 0x09); |
665 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | RF_SER_ON); | |
666 *TP_Ptr++ = TPU_FAT(t - 4); | 699 *TP_Ptr++ = TPU_FAT(t - 4); |
667 TSP_TO_ABB(0x00); | 700 TSP_TO_ABB(0x00); |
668 #endif | |
669 } | 701 } |
670 | 702 |
671 /*------------------------------------------*/ | 703 /*------------------------------------------*/ |
672 /* l1dmacro_tx_up */ | 704 /* l1dmacro_tx_up */ |
673 /*------------------------------------------*/ | 705 /*------------------------------------------*/ |
676 /* Rita version differs from LoCosto, */ | 708 /* Rita version differs from LoCosto, */ |
677 /* reconstructing from disassembly. */ | 709 /* reconstructing from disassembly. */ |
678 /*------------------------------------------*/ | 710 /*------------------------------------------*/ |
679 void l1dmacro_tx_up (void) | 711 void l1dmacro_tx_up (void) |
680 { | 712 { |
681 #if 0 | 713 *TP_Ptr++ = TPU_FAT(0x1309); |
682 if (l1_config.std.id == DCS1800 || | 714 TSP_TO_RF_16(0x0558 | rf_path[rf_index].rf_chip_band); |
683 rfband == MULTI_BAND2 && | 715 *TP_Ptr++ = TPU_FAT(0x133A); |
684 (l1_config.std.id == DUAL || l1_config.std.id == DUALEXT)) { | 716 TSP_TO_RF_24(0x140753); |
685 *TP_Ptr++ = TPU_FAT(0x127E); | |
686 TSP_TO_RF(0x0007); | |
687 *TP_Ptr++ = TPU_FAT(0x1288); | |
688 TSP_TO_RF(0xC00B); | |
689 *TP_Ptr++ = TPU_FAT(0x1292); | |
690 TSP_TO_RF(0x3077); | |
691 } else { | |
692 *TP_Ptr++ = TPU_FAT(0x127E); | |
693 TSP_TO_RF(0xC003); | |
694 } | |
695 *TP_Ptr++ = TPU_FAT(0x12C6); | |
696 TSP_TO_ABB(0x80); | |
697 *TP_Ptr++ = TPU_FAT(0x12E3); | |
698 TSP_TO_RF(0x243A | rf_chip_band); | |
699 *TP_Ptr++ = TPU_FAT(0x1302); | |
700 TSP_TO_ABB(0xC0); | |
701 *TP_Ptr++ = TPU_FAT(0x1352); | |
702 TSP_TO_ABB(0x80); | |
703 *TP_Ptr++ = TPU_FAT(0x1384); | 717 *TP_Ptr++ = TPU_FAT(0x1384); |
704 TSP_TO_ABB(0xA0); | 718 TSP_TO_ABB(0xA0); |
705 *TP_Ptr++ = TPU_FAT(16); | 719 *TP_Ptr++ = TPU_FAT(16); |
706 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_up | RF_SER_ON); | 720 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_up | 0x01); |
707 *TP_Ptr++ = TPU_FAT(21); | 721 *TP_Ptr++ = TPU_FAT(24); |
708 *TP_Ptr++ = TPU_MOVE(TSP_ACTX, 0x0F); | 722 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_up | 0x21); |
709 #endif | |
710 } | 723 } |
711 | 724 |
712 /*-------------------------------------------*/ | 725 /*-------------------------------------------*/ |
713 /* l1dmacro_tx_down */ | 726 /* l1dmacro_tx_down */ |
714 /*-------------------------------------------*/ | 727 /*-------------------------------------------*/ |
717 /* Rita version differs from LoCosto, */ | 730 /* Rita version differs from LoCosto, */ |
718 /* reconstructing from disassembly. */ | 731 /* reconstructing from disassembly. */ |
719 /*-------------------------------------------*/ | 732 /*-------------------------------------------*/ |
720 void l1dmacro_tx_down (WORD32 t, BOOL tx_flag, UWORD8 adc_active) | 733 void l1dmacro_tx_down (WORD32 t, BOOL tx_flag, UWORD8 adc_active) |
721 { | 734 { |
722 #if 0 | |
723 if (adc_active == ACTIVE) | 735 if (adc_active == ACTIVE) |
724 l1dmacro_adc_read_tx(t - 44); | 736 l1dmacro_adc_read_tx(t - 44); |
725 *TP_Ptr++ = TPU_FAT(t - 4); | 737 *TP_Ptr++ = TPU_FAT(t - 4); |
726 TSP_TO_ABB(0x80); | 738 TSP_TO_ABB(0x80); |
739 *TP_Ptr++ = TPU_FAT(t + 13); | |
740 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_down | 0x21); | |
727 *TP_Ptr++ = TPU_FAT(t + 22); | 741 *TP_Ptr++ = TPU_FAT(t + 22); |
728 *TP_Ptr++ = TPU_MOVE(TSP_ACTX, 0x00); | 742 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_down | 0x01); |
729 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_down | RF_SER_ON); | 743 TSP_TO_RF_8(0x18); |
730 *TP_Ptr++ = TPU_FAT(t + 25); | 744 *TP_Ptr++ = TPU_FAT(t + 29); |
731 TSP_TO_RF(0x003A); | |
732 *TP_Ptr++ = TPU_FAT(t + 31); | |
733 TSP_TO_ABB(0x00); | 745 TSP_TO_ABB(0x00); |
734 #endif | 746 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_down | 0x09); |
735 } | 747 } |
736 | 748 |
737 /* | 749 /* |
738 * l1dmacro_rx_nb | 750 * l1dmacro_rx_nb |
739 * | 751 * |
871 void l1dmacro_reset_hw(UWORD32 servingCellOffset) | 883 void l1dmacro_reset_hw(UWORD32 servingCellOffset) |
872 { | 884 { |
873 TPU_Reset(1); // reset TPU only, no TSP reset | 885 TPU_Reset(1); // reset TPU only, no TSP reset |
874 TPU_Reset(0); | 886 TPU_Reset(0); |
875 TP_Ptr = (UWORD16 *) TPU_RAM; | 887 TP_Ptr = (UWORD16 *) TPU_RAM; |
876 | |
877 #if 0 | |
878 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON); | |
879 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON | FEM_OFF); | |
880 #endif | |
881 | 888 |
882 *TP_Ptr++ = TPU_OFFSET(servingCellOffset); | 889 *TP_Ptr++ = TPU_OFFSET(servingCellOffset); |
883 } | 890 } |
884 | 891 |
885 // l1dmacro_RF_sleep | 892 // l1dmacro_RF_sleep |
973 TP_Reset(0); | 980 TP_Reset(0); |
974 | 981 |
975 | 982 |
976 TP_Ptr = (UWORD16 *) TPU_RAM; | 983 TP_Ptr = (UWORD16 *) TPU_RAM; |
977 | 984 |
978 #if 0 | |
979 // Set FEM to inactive state before turning ON the RF Board | |
980 // At this point the RF regulators are still OFF. Thus the | |
981 // FEM command is not inverted yet => Must use the FEM "SLEEP programming" | |
982 *TP_Ptr++ = TPU_MOVE(TSP_ACT, FEM_SLEEP | RF_SER_ON); | |
983 #endif | |
984 | |
985 // TPU_SLEEP | 985 // TPU_SLEEP |
986 l1dmacro_idle(); | 986 l1dmacro_idle(); |
987 | 987 |
988 *TP_Ptr++ = TPU_AT(t); | 988 *TP_Ptr++ = TPU_AT(t); |
989 *TP_Ptr++ = TPU_SYNC(0); | 989 *TP_Ptr++ = TPU_SYNC(0); |
990 | 990 |
991 #if 0 | |
992 /* from disassembly, differs from LoCosto version */ | 991 /* from disassembly, differs from LoCosto version */ |
993 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x20); | 992 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x20); |
994 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06); | 993 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06); |
995 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET3, 0x00); | 994 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET3, 0x00); |
996 #endif | |
997 | 995 |
998 t = 1000; // arbitrary start time | 996 t = 1000; // arbitrary start time |
999 | 997 |
1000 t = rf_init(t); // Initialize RF Board | 998 t = rf_init(t); // Initialize RF Board |
1001 | 999 |
1018 UWORD32 t = 100; // start time for actions // | 1016 UWORD32 t = 100; // start time for actions // |
1019 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; // | 1017 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; // |
1020 *TP_Ptr++ = TPU_AT(t); // | 1018 *TP_Ptr++ = TPU_AT(t); // |
1021 t = 1000; // arbitrary start time // | 1019 t = 1000; // arbitrary start time // |
1022 | 1020 |
1023 t = rf_init_light(t); // Initialize RF Board // | 1021 /* D-Sample 20020917 fw does full rf_init() here */ |
1022 t = rf_init(t); // Initialize RF Board // | |
1024 | 1023 |
1025 *TP_Ptr++ = TPU_AT(t); // | 1024 *TP_Ptr++ = TPU_AT(t); // |
1026 l1dmacro_idle(); // | 1025 l1dmacro_idle(); // |
1027 | 1026 |
1028 return; | 1027 return; |