comparison L1/cfile/l1_async.c @ 8:b36540edb046

L1/cfile/l1_*.c: initial import from tcs211-l1-reconst
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 05:45:03 +0000
parents 75a11d740a02
children b80f0c5016ee
comparison
equal deleted inserted replaced
7:b7d857ebc9ca 8:b36540edb046
6 * Copyright 2003 (C) Texas Instruments 6 * Copyright 2003 (C) Texas Instruments
7 * 7 *
8 ************* Revision Controle System Header *************/ 8 ************* Revision Controle System Header *************/
9 9
10 //#pragma DUPLICATE_FOR_INTERNAL_RAM_START 10 //#pragma DUPLICATE_FOR_INTERNAL_RAM_START
11 #include "config.h" 11 #include "l1_macro.h"
12 #include "l1_confg.h" 12 #include "l1_confg.h"
13 #include "l1_macro.h"
14 //#pragma DUPLICATE_FOR_INTERNAL_RAM_END 13 //#pragma DUPLICATE_FOR_INTERNAL_RAM_END
15 14
16 #if !((MOVE_IN_INTERNAL_RAM == 1) && (GSM_IDLE_RAM !=0)) // MOVE TO INTERNAL MEM IN CASE GSM_IDLE_RAM enabled 15 #if !((MOVE_IN_INTERNAL_RAM == 1) && (GSM_IDLE_RAM !=0)) // MOVE TO INTERNAL MEM IN CASE GSM_IDLE_RAM enabled
17 //#pragma GSM_IDLE_DUPLICATE_FOR_INTERNAL_RAM_START // KEEP IN EXTERNAL MEM otherwise 16 //#pragma GSM_IDLE_DUPLICATE_FOR_INTERNAL_RAM_START // KEEP IN EXTERNAL MEM otherwise
18 17
86 #include "l1_types.h" 85 #include "l1_types.h"
87 #include "sys_types.h" 86 #include "sys_types.h"
88 #include "l1_const.h" 87 #include "l1_const.h"
89 #include "l1_time.h" 88 #include "l1_time.h"
90 #include "l1_signa.h" 89 #include "l1_signa.h"
91 #include "../../gpf/inc/cust_os.h" 90 #include "cust_os.h"
92 #if TESTMODE 91 #if TESTMODE
93 #include "l1tm_defty.h" 92 #include "l1tm_defty.h"
94 #include "l1tm_signa.h" 93 #include "l1tm_signa.h"
95 #endif 94 #endif
96 #if (AUDIO_TASK == 1) 95 #if (AUDIO_TASK == 1)
115 #if (L1_AAC == 1) 114 #if (L1_AAC == 1)
116 #include "l1aac_defty.h" 115 #include "l1aac_defty.h"
117 #include "l1aac_signa.h" 116 #include "l1aac_signa.h"
118 #endif 117 #endif
119 #if (L1_DYN_DSP_DWNLD == 1) 118 #if (L1_DYN_DSP_DWNLD == 1)
119 #include <stdio.h>
120 #include "l1_dyn_dwl_signa.h" 120 #include "l1_dyn_dwl_signa.h"
121 #endif 121 #endif
122 122
123 #include "l1_defty.h" 123 #include "l1_defty.h"
124 #include "l1_msgty.h" 124 #include "l1_msgty.h"
139 139
140 #if L1_RECOVERY 140 #if L1_RECOVERY
141 #if ((CHIPSET == 12) || (CHIPSET == 15)) 141 #if ((CHIPSET == 12) || (CHIPSET == 15))
142 #include "sys_inth.h" 142 #include "sys_inth.h"
143 #else 143 #else
144 #include "../../bsp/iq.h" 144 #include "iq.h"
145 #include "../../bsp/inth.h" 145 #include "inth.h"
146 #include "../../bsp/mem.h" 146 #include "mem.h"
147 #endif 147 #endif
148
148 #endif 149 #endif
149 150
150 #if (VCXO_ALGO == 1) 151 #if (VCXO_ALGO == 1)
151 #include "l1_ctl.h" 152 #include "l1_ctl.h"
152 #endif 153 #endif
234 // Speech recognition reco process 235 // Speech recognition reco process
235 extern void l1a_mmi_sr_reco_process (xSignalHeaderRec *msg); 236 extern void l1a_mmi_sr_reco_process (xSignalHeaderRec *msg);
236 // Speech recognition update-check process 237 // Speech recognition update-check process
237 extern void l1a_mmi_sr_update_check_process (xSignalHeaderRec *msg); 238 extern void l1a_mmi_sr_update_check_process (xSignalHeaderRec *msg);
238 #endif 239 #endif
239 #if (L1_AEC == 1) 240 #if (AEC)
240 // AEC process
241 extern void l1a_mmi_aec_process (xSignalHeaderRec *msg);
242 #endif
243 #if (L1_AEC == 2)
244 // AEC process 241 // AEC process
245 extern void l1a_mmi_aec_process (xSignalHeaderRec *msg); 242 extern void l1a_mmi_aec_process (xSignalHeaderRec *msg);
246 #endif 243 #endif
247 #if (FIR) 244 #if (FIR)
248 // FIR process 245 // FIR process
614 // Speech recognition reco process 611 // Speech recognition reco process
615 l1a_mmi_sr_reco_process(msg); 612 l1a_mmi_sr_reco_process(msg);
616 // Speech recognition update-check process 613 // Speech recognition update-check process
617 l1a_mmi_sr_update_check_process(msg); 614 l1a_mmi_sr_update_check_process(msg);
618 #endif 615 #endif
619 #if (L1_AEC == 1) 616 #if (AEC)
620 // AEC process
621 l1a_mmi_aec_process(msg);
622 #endif
623 #if (L1_AEC == 2)
624 // AEC process 617 // AEC process
625 l1a_mmi_aec_process(msg); 618 l1a_mmi_aec_process(msg);
626 #endif 619 #endif
627 #if (FIR) 620 #if (FIR)
628 // FIR process 621 // FIR process
685 l1a_mmi_vocoder_cfg_process(msg); 678 l1a_mmi_vocoder_cfg_process(msg);
686 #endif // L1_VOCODER_IF_CHANGE == 1 679 #endif // L1_VOCODER_IF_CHANGE == 1
687 #if(L1_BT_AUDIO ==1) 680 #if(L1_BT_AUDIO ==1)
688 l1a_mmi_bt_process(msg); 681 l1a_mmi_bt_process(msg);
689 #endif // L1_VOCODER_IF_CHANGE == 1 682 #endif // L1_VOCODER_IF_CHANGE == 1
690 /* 683 /*
691 * FreeCalypso change: the following call to l1a_mmi_outen_cfg_process() 684 * FreeCalypso Frankenstein: the following call to
692 * (a function that doesn't exist in the Leonardo objects) has been 685 * l1a_mmi_outen_cfg_process() was totally unconditional
693 * moved inside the #if (AUDIO_TASK == 1) conditional, otherwise 686 * in the LoCosto source we got, but no such function
694 * the link fails - it is definitely an audio function of some kind. 687 * exists in TCS211. To be investigated further when
695 */ 688 * we reach the audio stuff.
696 l1a_mmi_outen_cfg_process(msg); 689 */
690 #if 0
691 l1a_mmi_outen_cfg_process(msg);
692 #endif
697 #endif //AUDIO TASK 693 #endif //AUDIO TASK
698 694
699 // Only processes supported by GSM IDLE in Internal RAM 695 // Only processes supported by GSM IDLE in Internal RAM
700 #if (GSM_IDLE_RAM > 1) 696 #if (GSM_IDLE_RAM > 1)
701 #if L1_GPRS 697 #if L1_GPRS
1843 return; 1839 return;
1844 } 1840 }
1845 1841
1846 // Look for first free location within L1 structure. 1842 // Look for first free location within L1 structure.
1847 while((neigh_number < 6) && (l1a_l1s_com.bcchn.list[neigh_number].status != NSYNC_FREE)) 1843 while((neigh_number < 6) && (l1a_l1s_com.bcchn.list[neigh_number].status != NSYNC_FREE))
1848 {
1849 if(neigh_number != 5 )
1850 neigh_number++; 1844 neigh_number++;
1851 }
1852 1845
1853 1846
1854 // Download neighbour info from request message. 1847 // Download neighbour info from request message.
1855 //---------------------------------------------- 1848 //----------------------------------------------
1856 1849
1861 // Sub the serving cell timeslot number to the Neigh./Serving timing 1854 // Sub the serving cell timeslot number to the Neigh./Serving timing
1862 // difference to format it for L1S use. 1855 // difference to format it for L1S use.
1863 time_alignmt =time_alignmt_mem; 1856 time_alignmt =time_alignmt_mem;
1864 fn_offset =fn_offset_mem; 1857 fn_offset =fn_offset_mem;
1865 l1a_sub_timeslot(&time_alignmt, &fn_offset, l1a_l1s_com.dl_tn); 1858 l1a_sub_timeslot(&time_alignmt, &fn_offset, l1a_l1s_com.dl_tn);
1866 if (neigh_number < 6 )
1867 {
1868 1859
1869 l1a_l1s_com.bcchn.list[neigh_number].radio_freq = ((T_MPHC_NCELL_BCCH_REQ *)(msg->SigP))->radio_freq; 1860 l1a_l1s_com.bcchn.list[neigh_number].radio_freq = ((T_MPHC_NCELL_BCCH_REQ *)(msg->SigP))->radio_freq;
1870 l1a_l1s_com.bcchn.list[neigh_number].fn_offset = fn_offset; 1861 l1a_l1s_com.bcchn.list[neigh_number].fn_offset = fn_offset;
1871 l1a_l1s_com.bcchn.list[neigh_number].time_alignmt = time_alignmt; 1862 l1a_l1s_com.bcchn.list[neigh_number].time_alignmt = time_alignmt;
1872 l1a_l1s_com.bcchn.list[neigh_number].tsc = ((T_MPHC_NCELL_BCCH_REQ *)(msg->SigP))->tsc; 1863 l1a_l1s_com.bcchn.list[neigh_number].tsc = ((T_MPHC_NCELL_BCCH_REQ *)(msg->SigP))->tsc;
1881 l1a_l1s_com.bcchn.list[neigh_number].gprs_priority = TOP_PRIORITY; 1872 l1a_l1s_com.bcchn.list[neigh_number].gprs_priority = TOP_PRIORITY;
1882 #else 1873 #else
1883 l1a_l1s_com.bcchn.list[neigh_number].gprs_priority = NORMAL_PRIORITY; 1874 l1a_l1s_com.bcchn.list[neigh_number].gprs_priority = NORMAL_PRIORITY;
1884 #endif 1875 #endif
1885 1876
1886 }
1887 // Enable L1S activity on this new neighbour task BCCH. 1877 // Enable L1S activity on this new neighbour task BCCH.
1888 if (neigh_number < 6 )//OMAPS00090550
1889 l1a_l1s_com.bcchn.list[neigh_number].status = NSYNC_PENDING; 1878 l1a_l1s_com.bcchn.list[neigh_number].status = NSYNC_PENDING;
1890 1879
1891 l1a_l1s_com.bcchn.current_list_size += 1; 1880 l1a_l1s_com.bcchn.current_list_size += 1;
1892 1881
1893 l1a_l1s_com.l1s_en_task[task] = TASK_ENABLED; 1882 l1a_l1s_com.l1s_en_task[task] = TASK_ENABLED;
1982 j=0; 1971 j=0;
1983 while(!((radio_freq == l1a_l1s_com.bcchn.list[j].radio_freq) && 1972 while(!((radio_freq == l1a_l1s_com.bcchn.list[j].radio_freq) &&
1984 (l1a_l1s_com.bcchn.list[j].status != NSYNC_FREE)) && 1973 (l1a_l1s_com.bcchn.list[j].status != NSYNC_FREE)) &&
1985 (j < 6)) 1974 (j < 6))
1986 { 1975 {
1987 if(j < 5 ) //OMAPS00090550
1988 {
1989 j++; 1976 j++;
1990 }
1991 else
1992 {
1993 j++;
1994 break;
1995 }
1996 } 1977 }
1997 1978
1998 // If found, reset L1 structure for this carrier. 1979 // If found, reset L1 structure for this carrier.
1999 if(j<6) 1980 if(j<6)
2000 { 1981 {
2151 #endif 2132 #endif
2152 }; 2133 };
2153 2134
2154 UWORD8 *state = &l1a.state[I_6MP]; 2135 UWORD8 *state = &l1a.state[I_6MP];
2155 UWORD32 SignalCode = msg->SignalCode; 2136 UWORD32 SignalCode = msg->SignalCode;
2156 static UWORD8 sb_attempt;
2157 2137
2158 2138
2159 #if (L1_12NEIGH == 1) 2139 #if (L1_12NEIGH == 1)
2160 static UWORD8 list_size; 2140 static UWORD8 list_size;
2161 #endif 2141 #endif
3524 /* */ 3504 /* */
3525 /* Reset messages (input): MPHC_STOP_CCCH_REQ */ 3505 /* Reset messages (input): MPHC_STOP_CCCH_REQ */
3526 /* ----------------------- (MPHC_STOP_CCCH_CON) */ 3506 /* ----------------------- (MPHC_STOP_CCCH_CON) */
3527 /* */ 3507 /* */
3528 /*-------------------------------------------------------*/ 3508 /*-------------------------------------------------------*/
3529 //Nina added 3509
3510 /*
3511 * FreeCalypso Frankenstein: the source we got with LoCosto contains
3512 * some logic, apparently designed to increase opportunities for
3513 * deep sleep, marked with "Nina added" comments. This addition by
3514 * Nina showed up on our radar because it makes use of a new member
3515 * in the l1s structure which is not present in the TCS211 version
3516 * of this data structure, which we are not allowed to change while
3517 * deblobbing L1 one module at a time. I am going to turn Nina's
3518 * addition into a conditional compilation option. -- Mychaela
3519 */
3520
3521 #define NINA_ADDED 0
3522
3523 #if NINA_ADDED
3530 INT8 last_page_mode = 2; //REORG; 3524 INT8 last_page_mode = 2; //REORG;
3531 //End Nina added 3525 #endif
3526
3532 void l1a_idle_serving_cell_paging_process(xSignalHeaderRec *msg) 3527 void l1a_idle_serving_cell_paging_process(xSignalHeaderRec *msg)
3533 { 3528 {
3534 enum states 3529 enum states
3535 { 3530 {
3536 RESET = 0, 3531 RESET = 0,
3564 l1a_l1s_com.l1s_en_task[EP] = TASK_DISABLED; // Reset EP task enable flag. 3559 l1a_l1s_com.l1s_en_task[EP] = TASK_DISABLED; // Reset EP task enable flag.
3565 l1a_l1s_com.l1s_en_task[ALLC] = TASK_DISABLED; // Reset ALLC (reorg) task enable flag. 3560 l1a_l1s_com.l1s_en_task[ALLC] = TASK_DISABLED; // Reset ALLC (reorg) task enable flag.
3566 3561
3567 // No Paging => no gauging => no Deep sleep 3562 // No Paging => no gauging => no Deep sleep
3568 //Nina modify to save power, not forbid deep sleep, only force gauging in next paging 3563 //Nina modify to save power, not forbid deep sleep, only force gauging in next paging
3564 #if NINA_ADDED
3569 if(l1s.force_gauging_next_paging_due_to_CCHR == 0) // Force gauging next paging 3565 if(l1s.force_gauging_next_paging_due_to_CCHR == 0) // Force gauging next paging
3566 #endif
3570 l1s.pw_mgr.enough_gaug = FALSE; // forbid Deep sleep 3567 l1s.pw_mgr.enough_gaug = FALSE; // forbid Deep sleep
3571 3568
3572 } 3569 }
3573 break; 3570 break;
3574 3571
3576 { 3573 {
3577 if (SignalCode == MPHC_START_CCCH_REQ) 3574 if (SignalCode == MPHC_START_CCCH_REQ)
3578 { 3575 {
3579 // download page mode from message (msg) 3576 // download page mode from message (msg)
3580 page_mode = ((T_MPHC_START_CCCH_REQ *)(msg->SigP))->page_mode; 3577 page_mode = ((T_MPHC_START_CCCH_REQ *)(msg->SigP))->page_mode;
3581 //Nina added 3578 #if NINA_ADDED
3582 if(((last_page_mode == NORMAL) && (page_mode == EXTENDED)) || 3579 if(((last_page_mode == NORMAL) && (page_mode == EXTENDED)) ||
3583 ((last_page_mode == EXTENDED) && (page_mode == NORMAL))) 3580 ((last_page_mode == EXTENDED) && (page_mode == NORMAL)))
3584 { 3581 {
3585 l1s.force_gauging_next_paging_due_to_CCHR = 1; 3582 l1s.force_gauging_next_paging_due_to_CCHR = 1;
3586 } 3583 }
3587 last_page_mode = page_mode; 3584 last_page_mode = page_mode;
3588 //End Nina added 3585 #endif
3589 3586
3590 if(page_mode == REORG) 3587 if(page_mode == REORG)
3591 // Request to enter the PAGING REORGANIZATION paging mode. 3588 // Request to enter the PAGING REORGANIZATION paging mode.
3592 //-------------------------------------------------------- 3589 //--------------------------------------------------------
3593 // L1 must start the Serving cell paging monitoring in PAGING REORGANIZATION 3590 // L1 must start the Serving cell paging monitoring in PAGING REORGANIZATION
3835 { 3832 {
3836 if(SignalCode == MPHC_START_CCCH_REQ) 3833 if(SignalCode == MPHC_START_CCCH_REQ)
3837 { 3834 {
3838 // download paging mode from msg 3835 // download paging mode from msg
3839 page_mode = ((T_MPHC_START_CCCH_REQ *)(msg->SigP))->page_mode; 3836 page_mode = ((T_MPHC_START_CCCH_REQ *)(msg->SigP))->page_mode;
3840 //Nina added 3837 #if NINA_ADDED
3841 3838
3842 if(((last_page_mode == NORMAL) && (page_mode == EXTENDED)) || 3839 if(((last_page_mode == NORMAL) && (page_mode == EXTENDED)) ||
3843 ((last_page_mode == EXTENDED) && (page_mode == NORMAL))) 3840 ((last_page_mode == EXTENDED) && (page_mode == NORMAL)))
3844 { 3841 {
3845 l1s.force_gauging_next_paging_due_to_CCHR = 1; 3842 l1s.force_gauging_next_paging_due_to_CCHR = 1;
3846 } 3843 }
3847 last_page_mode = page_mode; 3844 last_page_mode = page_mode;
3848 //End Nina added 3845 #endif
3849 if ((page_mode == NORMAL) || (page_mode == REORG)) 3846 if ((page_mode == NORMAL) || (page_mode == REORG))
3850 { 3847 {
3851 // Step in state machine. 3848 // Step in state machine.
3852 *state = RESET; 3849 *state = RESET;
3853 } 3850 }
3971 l1a_l1s_com.l1s_en_task[NP] = TASK_ENABLED; // Set NP task enable flag. 3968 l1a_l1s_com.l1s_en_task[NP] = TASK_ENABLED; // Set NP task enable flag.
3972 l1a_l1s_com.l1s_en_task[EP] = TASK_ENABLED; // Set EP task enable flag also. 3969 l1a_l1s_com.l1s_en_task[EP] = TASK_ENABLED; // Set EP task enable flag also.
3973 3970
3974 // Paging parameters change => perform the gauging on the next paging 3971 // Paging parameters change => perform the gauging on the next paging
3975 //Nina modify to save power, not forbid deep sleep, only force gauging in next paging 3972 //Nina modify to save power, not forbid deep sleep, only force gauging in next paging
3973 #if NINA_ADDED
3976 if(l1s.force_gauging_next_paging_due_to_CCHR == 0) 3974 if(l1s.force_gauging_next_paging_due_to_CCHR == 0)
3975 #endif
3977 l1s.pw_mgr.enough_gaug = FALSE; // forbid Deep sleep until next gauging 3976 l1s.pw_mgr.enough_gaug = FALSE; // forbid Deep sleep until next gauging
3978 //End Nina modify 3977 //End Nina modify
3979 3978
3980 3979
3981 // end of process 3980 // end of process
4131 4130
4132 static WORD16 static_attempt_counter_0; 4131 static WORD16 static_attempt_counter_0;
4133 static WORD16 static_attempt_counter_1; 4132 static WORD16 static_attempt_counter_1;
4134 4133
4135 4134
4136 static UWORD8 static_first_synch_flag = TRUE;
4137 static UWORD8 static_sb_found_flag; 4135 static UWORD8 static_sb_found_flag;
4138 static UWORD8 static_bsic; 4136 static UWORD8 static_bsic;
4139 static UWORD32 static_fn_offset; 4137 static UWORD32 static_fn_offset;
4140 static UWORD32 static_time_alignmt; 4138 static UWORD32 static_time_alignmt;
4141 static UWORD8 static_timing_validity; 4139 static UWORD8 static_timing_validity;
5125 }; 5123 };
5126 5124
5127 UWORD8 *state = &l1a.state[I_SMSCB]; 5125 UWORD8 *state = &l1a.state[I_SMSCB];
5128 UWORD32 SignalCode = msg->SignalCode; 5126 UWORD32 SignalCode = msg->SignalCode;
5129 5127
5130 UWORD32 first_block_0 =0; 5128 UWORD32 first_block_0;
5131 UWORD32 first_block_1= 0; 5129 UWORD32 first_block_1;
5132 BOOL extended_cbch =FALSE; //oamps00090550 5130 BOOL extended_cbch;
5133 T_CBCH_HEAD_SCHEDULE *cbch_schedule_ptr= NULL ; 5131 T_CBCH_HEAD_SCHEDULE *cbch_schedule_ptr;
5134 UWORD8 schedule_length; 5132 UWORD8 schedule_length;
5135 5133
5136 BOOL end_process = 0; 5134 BOOL end_process = 0;
5137 5135
5138 while(!end_process) 5136 while(!end_process)
5444 5442
5445 // End of process. 5443 // End of process.
5446 return; 5444 return;
5447 } 5445 }
5448 } 5446 }
5449 else 5447 #if 0 /* match TCS211 */
5450 if(SignalCode == L1C_DEDIC_DONE) 5448 else
5451 { 5449 if(SignalCode == L1C_DEDIC_DONE)
5450 {
5452 // Stop SMSCB task. 5451 // Stop SMSCB task.
5453 l1a_l1s_com.l1s_en_task[SMSCB] = TASK_DISABLED; 5452 l1a_l1s_com.l1s_en_task[SMSCB] = TASK_DISABLED;
5454 5453
5455 // Set "parameter synchro semaphore for SMSCB task. 5454 // Set "parameter synchro semaphore for SMSCB task.
5456 l1a_l1s_com.task_param[SMSCB] = SEMAPHORE_SET; 5455 l1a_l1s_com.task_param[SMSCB] = SEMAPHORE_SET;
5458 l1a_l1s_com.norm_cbch_schedule.cbch_state = CBCH_INACTIVE; 5457 l1a_l1s_com.norm_cbch_schedule.cbch_state = CBCH_INACTIVE;
5459 l1a_l1s_com.ext_cbch_schedule.cbch_state = CBCH_INACTIVE; 5458 l1a_l1s_com.ext_cbch_schedule.cbch_state = CBCH_INACTIVE;
5460 5459
5461 // Step in state machine. 5460 // Step in state machine.
5462 *state = RESET; 5461 *state = RESET;
5463 5462 }
5464 } 5463 #endif
5465 5464
5466 else 5465 else
5467 // No action in this machine for other messages. 5466 // No action in this machine for other messages.
5468 //---------------------------------------------- 5467 //----------------------------------------------
5469 { 5468 {
5473 } 5472 }
5474 break; 5473 break;
5475 5474
5476 case SET_SCHEDULE: 5475 case SET_SCHEDULE:
5477 { 5476 {
5478 if(cbch_schedule_ptr != NULL)
5479 {
5480 UWORD8 i,j; 5477 UWORD8 i,j;
5481 UWORD8 mf51_offset; 5478 UWORD8 mf51_offset;
5482 5479
5483 // Choose schedule table according to the considered CBCH (normal or extended). 5480 // Choose schedule table according to the considered CBCH (normal or extended).
5484 if(extended_cbch) mf51_offset = 4*51; // Offset to read TB4. 5481 if(extended_cbch) mf51_offset = 4*51; // Offset to read TB4.
5528 // Activate SMSCB task. 5525 // Activate SMSCB task.
5529 l1a_l1s_com.l1s_en_task[SMSCB] = TASK_ENABLED; // Set SMSCB task enable flag. 5526 l1a_l1s_com.l1s_en_task[SMSCB] = TASK_ENABLED; // Set SMSCB task enable flag.
5530 5527
5531 // Step in state machine. 5528 // Step in state machine.
5532 *state = WAIT_RESULT; 5529 *state = WAIT_RESULT;
5533 } 5530
5534 // End of process. 5531 // End of process.
5535 return; 5532 return;
5536 } 5533 }
5537 5534
5538 5535
5559 // Step in state machine. 5556 // Step in state machine.
5560 *state = WAIT_FOR_CHANGE; 5557 *state = WAIT_FOR_CHANGE;
5561 } 5558 }
5562 5559
5563 else 5560 else
5564 if((SignalCode == MPHC_STOP_CBCH_REQ)||(SignalCode == L1C_DEDIC_DONE)) 5561 //if((SignalCode == MPHC_STOP_CBCH_REQ)||(SignalCode == L1C_DEDIC_DONE))
5562 if(SignalCode == MPHC_STOP_CBCH_REQ)
5565 // Request to (may be partially) STOP reading the CBCH. 5563 // Request to (may be partially) STOP reading the CBCH.
5566 //----------------------------------------------------- 5564 //-----------------------------------------------------
5567 { 5565 {
5568 // This process must be reset. 5566 // This process must be reset.
5569 *state = WAIT_FOR_CHANGE; 5567 *state = WAIT_FOR_CHANGE;
5801 /*-------------------------------------------------------*/ 5799 /*-------------------------------------------------------*/
5802 void l1a_dedicated_process(xSignalHeaderRec *msg) 5800 void l1a_dedicated_process(xSignalHeaderRec *msg)
5803 { 5801 {
5804 enum states 5802 enum states
5805 { 5803 {
5806 RESET = 0, 5804 RESET = 0,
5807 WAIT_INIT = 1, 5805 WAIT_INIT = 1,
5808 WAIT_MSG = 2 5806 WAIT_DYN_DWNLD = 2,
5807 WAIT_MSG = 3
5809 }; 5808 };
5810 5809
5811 T_DEDIC_SET *free_set; 5810 T_DEDIC_SET *free_set;
5812 UWORD8 *state = &l1a.state[DEDICATED]; 5811 UWORD8 *state = &l1a.state[DEDICATED];
5813 UWORD32 SignalCode = msg->SignalCode; 5812 UWORD32 SignalCode = msg->SignalCode;
5939 5938
5940 5939
5941 // Set "fset" pointer to the new parameter set. 5940 // Set "fset" pointer to the new parameter set.
5942 l1a_l1s_com.dedic_set.fset = free_set; 5941 l1a_l1s_com.dedic_set.fset = free_set;
5943 5942
5944 // Give new msg code to L1S. 5943 /*
5945 l1a_l1s_com.dedic_set.SignalCode = MPHC_IMMED_ASSIGN_REQ; 5944 * FreeCalypso: the following logic related to dynamic DSP
5946 5945 * patching has been reconstructed from our only available
5947 #if (TRACE_TYPE==5) && FLOWCHART 5946 * binary object version.
5948 trace_flowchart_dedic(l1a_l1s_com.dedic_set.SignalCode); 5947 */
5949 #endif 5948 #if (L1_DYN_DSP_DWNLD == 1)
5950 5949 if (l1a.dyn_dwnld.semaphore_vect[DEDI_STATE_MACHINE]==GREEN)
5951 // Set confirmation message name. 5950 #endif
5952 l1a.confirm_SignalCode = MPHC_IMMED_ASSIGN_CON; 5951 {
5953 5952 // Give new msg code to L1S.
5954 // step in state machine. 5953 l1a_l1s_com.dedic_set.SignalCode = MPHC_IMMED_ASSIGN_REQ;
5955 *state = WAIT_MSG; 5954
5955 #if (TRACE_TYPE==5) && FLOWCHART
5956 trace_flowchart_dedic(l1a_l1s_com.dedic_set.SignalCode);
5957 #endif
5958
5959 // Set confirmation message name.
5960 l1a.confirm_SignalCode = MPHC_IMMED_ASSIGN_CON;
5961
5962 // step in state machine.
5963 *state = WAIT_MSG;
5964 }
5965 #if (L1_DYN_DSP_DWNLD == 1)
5966 else
5967 {
5968 *state = WAIT_DYN_DWNLD;
5969 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5))
5970 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD))
5971 {
5972 char str[30];
5973 sprintf(str,"DEDI SM blocked by DYN DWNLD\r\n");
5974 #if(CODE_VERSION == SIMULATION)
5975 trace_fct_simu_dyn_dwnld(str);
5976 #else
5977 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT);
5978 #endif
5979 }
5980 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4)
5981 }
5982 #endif
5956 } 5983 }
5957 break; 5984 break;
5958 5985
5959 case MPHC_CHANNEL_ASSIGN_REQ: 5986 case MPHC_CHANNEL_ASSIGN_REQ:
5960 // Channel assignement message. 5987 // Channel assignement message.
6204 free_set->cell_desc.time_alignmt = time_alignmt; 6231 free_set->cell_desc.time_alignmt = time_alignmt;
6205 free_set->cell_desc.fn_offset = fn_offset; 6232 free_set->cell_desc.fn_offset = fn_offset;
6206 free_set->cell_desc.meas.acc = 0; 6233 free_set->cell_desc.meas.acc = 0;
6207 free_set->cell_desc.meas.nbr_meas = 0; 6234 free_set->cell_desc.meas.nbr_meas = 0;
6208 6235
6236 #if 0 /* FreeCalypso TCS211 reconstruction */
6209 #if (L1_FF_MULTIBAND == 0) // TBD 6237 #if (L1_FF_MULTIBAND == 0) // TBD
6210 free_set->cell_desc.traffic_meas_beacon = l1a_l1s_com.last_input_level[radio_freq - l1_config.std.radio_freq_index_offset]; 6238 free_set->cell_desc.traffic_meas_beacon = l1a_l1s_com.last_input_level[radio_freq - l1_config.std.radio_freq_index_offset];
6211 free_set->cell_desc.traffic_meas = l1a_l1s_com.last_input_level[radio_freq - l1_config.std.radio_freq_index_offset]; 6239 free_set->cell_desc.traffic_meas = l1a_l1s_com.last_input_level[radio_freq - l1_config.std.radio_freq_index_offset];
6212 6240
6213 #else // L1_FF_MULTIBAND = 1 below 6241 #else // L1_FF_MULTIBAND = 1 below
6216 l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq); 6244 l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq);
6217 free_set->cell_desc.traffic_meas_beacon = l1a_l1s_com.last_input_level[operative_radio_freq]; 6245 free_set->cell_desc.traffic_meas_beacon = l1a_l1s_com.last_input_level[operative_radio_freq];
6218 free_set->cell_desc.traffic_meas = l1a_l1s_com.last_input_level[operative_radio_freq]; 6246 free_set->cell_desc.traffic_meas = l1a_l1s_com.last_input_level[operative_radio_freq];
6219 6247
6220 #endif // #if (L1_FF_MULTIBAND == 1) else 6248 #endif // #if (L1_FF_MULTIBAND == 1) else
6249 #endif
6221 6250
6222 // Download the message content. 6251 // Download the message content.
6223 free_set->chan1.desc = ((T_MPHC_SYNC_HO_REQ *)(msg->SigP))->handover_command.channel_desc_1; 6252 free_set->chan1.desc = ((T_MPHC_SYNC_HO_REQ *)(msg->SigP))->handover_command.channel_desc_1;
6224 free_set->chan1.desc_bef_sti = ((T_MPHC_SYNC_HO_REQ *)(msg->SigP))->handover_command.channel_desc_1_bef_sti; 6253 free_set->chan1.desc_bef_sti = ((T_MPHC_SYNC_HO_REQ *)(msg->SigP))->handover_command.channel_desc_1_bef_sti;
6225 free_set->chan1.mode = ((T_MPHC_SYNC_HO_REQ *)(msg->SigP))->handover_command.channel_mode_1; 6254 free_set->chan1.mode = ((T_MPHC_SYNC_HO_REQ *)(msg->SigP))->handover_command.channel_mode_1;
6599 // end of process. 6628 // end of process.
6600 end_process = 1; 6629 end_process = 1;
6601 } 6630 }
6602 break; 6631 break;
6603 6632
6633 /*
6634 * FreeCalypso: the following logic related to dynamic DSP
6635 * patching has been reconstructed from our only available
6636 * binary object version.
6637 */
6638 #if (L1_DYN_DSP_DWNLD == 1)
6639 case WAIT_DYN_DWNLD:
6640 {
6641 if((SignalCode==API_L1_DYN_DWNLD_FINISHED) && (l1a.dyn_dwnld.semaphore_vect[DEDI_STATE_MACHINE] == GREEN))
6642 {
6643 /* replicate the code that would have executed originally */
6644
6645 // Give new msg code to L1S.
6646 l1a_l1s_com.dedic_set.SignalCode = MPHC_IMMED_ASSIGN_REQ;
6647
6648 #if (TRACE_TYPE==5) && FLOWCHART
6649 trace_flowchart_dedic(l1a_l1s_com.dedic_set.SignalCode);
6650 #endif
6651
6652 // Set confirmation message name.
6653 l1a.confirm_SignalCode = MPHC_IMMED_ASSIGN_CON;
6654
6655 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5))
6656 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD))
6657 {
6658 char str[30];
6659 sprintf(str,"DEDI SM un-blocked\r\n");
6660 #if(CODE_VERSION == SIMULATION)
6661 trace_fct_simu_dyn_dwnld(str);
6662 #else
6663 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT);
6664 #endif
6665 }
6666 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4)
6667
6668 // step in state machine.
6669 *state = WAIT_MSG;
6670 }
6671 // End process
6672 end_process = 1;
6673 }
6674 break;
6675 #endif
6676
6604 case WAIT_MSG: 6677 case WAIT_MSG:
6605 { 6678 {
6606 switch(SignalCode) 6679 switch(SignalCode)
6607 // switch on input message. 6680 // switch on input message.
6608 //------------------------------- 6681 //-------------------------------
6762 // 1 | 1 Acouustic devices 6835 // 1 | 1 Acouustic devices
6763 // 1 | 0 speech encoder 6836 // 1 | 0 speech encoder
6764 // 0 | 1 speech decoder 6837 // 0 | 1 speech decoder
6765 // 0 | 0 no test 6838 // 0 | 0 no test
6766 6839
6767 #if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3) || (ANALOG == 11)) 6840 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (ANLG_FAM == 11))
6768 vbctl3 = ( (l1s_dsp_com.dsp_ndb_ptr ->d_dai_onoff & 0xE7FF) | 6841 vbctl3 = ( (l1s_dsp_com.dsp_ndb_ptr ->d_dai_onoff & 0xE7FF) |
6769 (dai_vbctl3[((T_OML1_START_DAI_TEST_REQ *)(msg->SigP))->tested_device] << 11) ); 6842 (dai_vbctl3[((T_OML1_START_DAI_TEST_REQ *)(msg->SigP))->tested_device] << 11) );
6770 l1s_dsp_com.dsp_ndb_ptr ->d_dai_onoff = vbctl3 | TRUE; 6843 l1s_dsp_com.dsp_ndb_ptr ->d_dai_onoff = vbctl3 | TRUE;
6771 #endif 6844 #endif
6772 6845
6791 UWORD32 vbctl3; 6864 UWORD32 vbctl3;
6792 6865
6793 // DAI test is stopped "on fly". 6866 // DAI test is stopped "on fly".
6794 l1a_l1s_com.dedic_set.aset->dai_mode = 0; 6867 l1a_l1s_com.dedic_set.aset->dai_mode = 0;
6795 6868
6796 #if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3)) 6869 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
6797 // program vbctl3 6870 // program vbctl3
6798 vbctl3 = (l1s_dsp_com.dsp_ndb_ptr ->d_dai_onoff & 0xE7FF); 6871 vbctl3 = (l1s_dsp_com.dsp_ndb_ptr ->d_dai_onoff & 0xE7FF);
6799 l1s_dsp_com.dsp_ndb_ptr ->d_dai_onoff = vbctl3 | TRUE; 6872 l1s_dsp_com.dsp_ndb_ptr ->d_dai_onoff = vbctl3 | TRUE;
6800 #endif 6873 #endif
6801 6874
7880 }; 7953 };
7881 7954
7882 UWORD8 *state = &l1a.state[DEDIC_6]; 7955 UWORD8 *state = &l1a.state[DEDIC_6];
7883 UWORD32 SignalCode = msg->SignalCode; 7956 UWORD32 SignalCode = msg->SignalCode;
7884 7957
7885 // use only in packet transfer mode
7886 // these variables memorize this SBCNF parameters.
7887 static UWORD32 time_alignmt_mem;
7888 static UWORD32 fn_offset_mem;
7889 //#if !L1_R99 7958 //#if !L1_R99
7890 static UWORD8 nb_fb_attempt; 7959 static UWORD8 nb_fb_attempt;
7891 //#endif 7960 //#endif
7892 7961
7893 // For EOTD purpose we need of flag to identify 1st/last SB Serving Cell 7962 // For EOTD purpose we need of flag to identify 1st/last SB Serving Cell
7979 8048
7980 8049
7981 case NSYNC_CONFIG: 8050 case NSYNC_CONFIG:
7982 { 8051 {
7983 UWORD8 neigh_id = l1a_l1s_com.nsync.first_in_list; 8052 UWORD8 neigh_id = l1a_l1s_com.nsync.first_in_list;
7984 UWORD32 time_alignmt =0; //omaps00090550 8053 UWORD32 time_alignmt;
7985 UWORD32 fn_offset=0; //omaps00090550; 8054 UWORD32 fn_offset;
7986 8055
7987 // Request to acquire FB/SB or to confirm FB or SB from one ncell. 8056 // Request to acquire FB/SB or to confirm FB or SB from one ncell.
7988 //---------------------------------------------------------------- 8057 //----------------------------------------------------------------
7989 // Abort if there is no room for a new neighbour synchro request. 8058 // Abort if there is no room for a new neighbour synchro request.
7990 if(l1a_l1s_com.nsync.current_list_size >= NBR_NEIGHBOURS) 8059 if(l1a_l1s_com.nsync.current_list_size >= NBR_NEIGHBOURS)
8266 } 8335 }
8267 } 8336 }
8268 8337
8269 // disable all tasks 8338 // disable all tasks
8270 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED; 8339 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
8340 l1a_l1s_com.l1s_en_task[FB51] = TASK_DISABLED;
8341 l1a_l1s_com.l1s_en_task[FB26] = TASK_DISABLED;
8342 l1a_l1s_com.l1s_en_task[SB51] = TASK_DISABLED;
8343 l1a_l1s_com.l1s_en_task[SB26] = TASK_DISABLED;
8344 l1a_l1s_com.l1s_en_task[SBCNF26] = TASK_DISABLED;
8345 l1a_l1s_com.l1s_en_task[SBCNF51] = TASK_DISABLED;
8271 8346
8272 // Set semaphores for all neighbor relative task. 8347 // Set semaphores for all neighbor relative task.
8273 l1a_l1s_com.task_param[NSYNC]= SEMAPHORE_SET; // Set NSYNC task semaphore. 8348 l1a_l1s_com.task_param[NSYNC]= SEMAPHORE_SET; // Set NSYNC task semaphore.
8274 l1a_l1s_com.task_param[FB51] = SEMAPHORE_SET; // Set FB51 task semaphore. 8349 l1a_l1s_com.task_param[FB51] = SEMAPHORE_SET; // Set FB51 task semaphore.
8275 l1a_l1s_com.task_param[FB26] = SEMAPHORE_SET; // Set FB26 task semaphore. 8350 l1a_l1s_com.task_param[FB26] = SEMAPHORE_SET; // Set FB26 task semaphore.
8898 l1a_l1s_com.nsync.eotd_meas_session = FALSE; 8973 l1a_l1s_com.nsync.eotd_meas_session = FALSE;
8899 #endif 8974 #endif
8900 8975
8901 // Disable neighbor sync. tasks. 8976 // Disable neighbor sync. tasks.
8902 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED; 8977 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
8978 l1a_l1s_com.l1s_en_task[FB51] = TASK_DISABLED;
8979 l1a_l1s_com.l1s_en_task[FB26] = TASK_DISABLED;
8980 l1a_l1s_com.l1s_en_task[SB51] = TASK_DISABLED;
8981 l1a_l1s_com.l1s_en_task[SB26] = TASK_DISABLED;
8982 l1a_l1s_com.l1s_en_task[SBCNF26] = TASK_DISABLED;
8983 l1a_l1s_com.l1s_en_task[SBCNF51] = TASK_DISABLED;
8903 8984
8904 if(array_size != NBR_NEIGHBOURS) 8985 if(array_size != NBR_NEIGHBOURS)
8905 { 8986 {
8906 // Stop some of the Neighb. synchro. 8987 // Stop some of the Neighb. synchro.
8907 for(i=0;i<array_size;i++) 8988 for(i=0;i<array_size;i++)
8920 // If found, reset L1 structure for this carrier. 9001 // If found, reset L1 structure for this carrier.
8921 if(j<NBR_NEIGHBOURS) 9002 if(j<NBR_NEIGHBOURS)
8922 { 9003 {
8923 l1a_l1s_com.nsync.list[j].status = NSYNC_FREE; 9004 l1a_l1s_com.nsync.list[j].status = NSYNC_FREE;
8924 l1a_l1s_com.nsync.current_list_size --; 9005 l1a_l1s_com.nsync.current_list_size --;
8925 if (l1a_l1s_com.nsync.list[l1a_l1s_com.nsync.active_fb_id].radio_freq == radio_freq) 9006 #if 0 /* FreeCalypso: match TCS211 object */
8926 l1a_l1s_com.l1s_en_task[FB26] = TASK_DISABLED; 9007 if (l1a_l1s_com.nsync.list[l1a_l1s_com.nsync.active_fb_id].radio_freq == radio_freq)
9008 l1a_l1s_com.l1s_en_task[FB26] = TASK_DISABLED;
9009 #endif
8927 } 9010 }
8928 } 9011 }
8929 } 9012 }
8930 else 9013 else
8931 { 9014 {
8998 ((l1a.confirm_SignalCode == MPHC_SYNC_HO_CON) || 9081 ((l1a.confirm_SignalCode == MPHC_SYNC_HO_CON) ||
8999 (l1a.confirm_SignalCode == MPHC_PRE_SYNC_HO_CON) || 9082 (l1a.confirm_SignalCode == MPHC_PRE_SYNC_HO_CON) ||
9000 (l1a.confirm_SignalCode == MPHC_ASYNC_HO_CON) || 9083 (l1a.confirm_SignalCode == MPHC_ASYNC_HO_CON) ||
9001 (l1a.confirm_SignalCode == MPHC_HANDOVER_FAIL_CON)) ) 9084 (l1a.confirm_SignalCode == MPHC_HANDOVER_FAIL_CON)) )
9002 { 9085 {
9086 #if 0 /* LoCosto L1 code, doesn't match TCS211 */
9003 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED; 9087 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
9004 l1a_l1s_com.l1s_en_task[FB51] = TASK_DISABLED; 9088 l1a_l1s_com.l1s_en_task[FB51] = TASK_DISABLED;
9005 l1a_l1s_com.l1s_en_task[FB26] = TASK_DISABLED; 9089 l1a_l1s_com.l1s_en_task[FB26] = TASK_DISABLED;
9006 l1a_l1s_com.l1s_en_task[SB51] = TASK_DISABLED; 9090 l1a_l1s_com.l1s_en_task[SB51] = TASK_DISABLED;
9007 l1a_l1s_com.l1s_en_task[SB26] = TASK_DISABLED; 9091 l1a_l1s_com.l1s_en_task[SB26] = TASK_DISABLED;
9055 *state = SELECT_BEST_NSYNC; 9139 *state = SELECT_BEST_NSYNC;
9056 9140
9057 // Enable neighbour sync task. 9141 // Enable neighbour sync task.
9058 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_ENABLED; 9142 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_ENABLED;
9059 } // if 9143 } // if
9144 #else
9145 /* code from TSM30 version, matches TCS211 object */
9146 #if (L1_EOTD ==1)
9147 // FN and time reference are WRONG for remaining neigbours....
9148 // --> abort all.
9149 l1a_l1s_com.nsync.eotd_meas_session = FALSE;
9150 #endif
9151 // Step in state machine.
9152 *state = STOP_NSYNC;
9153 break;
9154 #endif
9060 } // if 9155 } // if
9061 9156
9062 else 9157 else
9063 { 9158 {
9064 // Channel changes : Restart all neighbors 9159 // Channel changes : Restart all neighbors
9389 } 9484 }
9390 break; 9485 break;
9391 9486
9392 case WAIT_INIT: 9487 case WAIT_INIT:
9393 { 9488 {
9489 #if 0 /* FreeCalypso: match TCS211 object */
9490
9394 #if (OP_SAP == 0) 9491 #if (OP_SAP == 0)
9395 if (SignalCode == MPHC_UPDATE_BA_LIST) 9492 if (SignalCode == MPHC_UPDATE_BA_LIST)
9396 #else 9493 #else
9397 if (SignalCode == MPHC_UPDATE_BA_LIST_REQ) 9494 if (SignalCode == MPHC_UPDATE_BA_LIST_REQ)
9398 #endif /* if (OP_SAP == 0) */ 9495 #endif /* if (OP_SAP == 0) */
9445 9542
9446 // step in state machine. 9543 // step in state machine.
9447 *state = WAIT_RESULT; 9544 *state = WAIT_RESULT;
9448 } 9545 }
9449 else 9546 else
9547 #endif /* FreeCalypso TCS211 reconstruction */
9450 9548
9451 if(SignalCode == L1C_DEDIC_DONE) 9549 if(SignalCode == L1C_DEDIC_DONE)
9452 // We enter DEDICATED mode. 9550 // We enter DEDICATED mode.
9453 //------------------------- 9551 //-------------------------
9454 { 9552 {
9553 #if 0 /* FreeCalypso: match TCS211 object */
9455 #if (CODE_VERSION == NOT_SIMULATION) 9554 #if (CODE_VERSION == NOT_SIMULATION)
9456 if (l1a_l1s_com.ba_list.nbr_carrier == 0) 9555 if (l1a_l1s_com.ba_list.nbr_carrier == 0)
9457 return; 9556 return;
9557 #endif
9458 #endif 9558 #endif
9459 9559
9460 // Set parameter synchro semaphore for D_BAMS task. 9560 // Set parameter synchro semaphore for D_BAMS task.
9461 l1a_l1s_com.meas_param |= D_BAMS_MEAS; 9561 l1a_l1s_com.meas_param |= D_BAMS_MEAS;
9462 9562