comparison L1/cfile/l1_sync.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 #define L1_SYNC_C 17 #define L1_SYNC_C
128 #if (L1_MIDI == 1) 127 #if (L1_MIDI == 1)
129 #include "l1midi_defty.h" 128 #include "l1midi_defty.h"
130 #endif 129 #endif
131 130
132 #include "l1_defty.h" 131 #include "l1_defty.h"
133 #include "../../gpf/inc/cust_os.h" 132 #include "cust_os.h"
134 #include "l1_msgty.h" 133 #include "l1_msgty.h"
135 #include "l1_varex.h" 134 #include "l1_varex.h"
136 #include "l1_proto.h" 135 #include "l1_proto.h"
137 #include "l1_mftab.h" 136 #include "l1_mftab.h"
138 #include "l1_tabs.h" 137 #include "l1_tabs.h"
141 140
142 #if L2_L3_SIMUL 141 #if L2_L3_SIMUL
143 #include "hw_debug.h" 142 #include "hw_debug.h"
144 #endif // L2_L3 SIMUL 143 #endif // L2_L3 SIMUL
145 144
146 #include "../../bsp/ulpd.h" 145 #include "ulpd.h"
147 #include "../../bsp/mem.h" 146 #include "mem.h"
148 #include "../../bsp/inth.h" 147 #include "inth.h"
149 #include "../../bsp/iq.h" 148 #include "iq.h"
150 149
151 #if L1_GPRS 150 #if L1_GPRS
152 #include "l1p_cons.h" 151 #include "l1p_cons.h"
153 #include "l1p_msgt.h" 152 #include "l1p_msgt.h"
154 #include "l1p_deft.h" 153 #include "l1p_deft.h"
161 #endif // NO SIMULATION 160 #endif // NO SIMULATION
162 161
163 #if(RF_FAM == 61) 162 #if(RF_FAM == 61)
164 #include "l1_rf61.h" 163 #include "l1_rf61.h"
165 #endif 164 #endif
166 #if (CODE_VERSION!= SIMULATION) 165
167 #include "l1_pwmgr.h" 166 #define W_A_DSP_PR20037 1 /* FreeCalypso */
168 #endif //NOT SIMULATION
169 167
170 #if (GSM_IDLE_RAM != 0) 168 #if (GSM_IDLE_RAM != 0)
171 #if (OP_L1_STANDALONE == 1) 169 #if (OP_L1_STANDALONE == 1)
172 #include "csmi_simul.h" 170 #include "csmi_simul.h"
173 #else 171 #else
181 179
182 #if (OP_L1_STANDALONE != 1) && (WCP_PROF == 1) 180 #if (OP_L1_STANDALONE != 1) && (WCP_PROF == 1)
183 #include "prf/prf_api.h" 181 #include "prf/prf_api.h"
184 #endif 182 #endif
185 183
186 184 #if 0 /* FreeCalypso TCS211 reconstruction */
187 //Enhanced RSSI -OMAPS00075410 185 //Enhanced RSSI -OMAPS00075410
188 #define TOTAL_NO_OF_BITS_IDLE_MEAS 625 186 #define TOTAL_NO_OF_BITS_IDLE_MEAS 625
189 extern UWORD32 qual_acc_idle1[2]; 187 extern UWORD32 qual_acc_idle1[2];
188 #endif
190 189
191 #if (RF_FAM == 61) 190 #if (RF_FAM == 61)
192 #include "tpudrv61.h" 191 #include "tpudrv61.h"
193 #endif 192 #endif
194 193
228 extern void l1s_audio_manager (void); 227 extern void l1s_audio_manager (void);
229 #endif 228 #endif
230 /*-------------------------------------------------------*/ 229 /*-------------------------------------------------------*/
231 /* Prototypes of external functions used in this file. */ 230 /* Prototypes of external functions used in this file. */
232 /*-------------------------------------------------------*/ 231 /*-------------------------------------------------------*/
233 void l1ddsp_meas_read (UWORD8 nbmeas, UWORD16 *pm); 232 void l1ddsp_meas_read (UWORD8 nbmeas, UWORD8 *pm);
234 233
235 #if L1_GPRS 234 #if L1_GPRS
236 void l1ps_transfer_mode_manager (void); 235 void l1ps_transfer_mode_manager (void);
237 void l1ps_reset_db_mcu_to_dsp (T_DB_MCU_TO_DSP_GPRS *page_ptr); 236 void l1ps_reset_db_mcu_to_dsp (T_DB_MCU_TO_DSP_GPRS *page_ptr);
238 void l1pddsp_meas_ctrl (UWORD8 nbmeas, UWORD8 pm_pos); 237 void l1pddsp_meas_ctrl (UWORD8 nbmeas, UWORD8 pm_pos);
239 void l1pddsp_meas_read (UWORD8 nbmeas, UWORD16 *pm_read); 238 void l1pddsp_meas_read (UWORD8 nbmeas, UWORD8 *pm_read);
240 void l1ps_meas_manager (void); 239 void l1ps_meas_manager (void);
241 void l1ps_transfer_meas_manager (void); 240 void l1ps_transfer_meas_manager (void);
242 void l1ps_macs_rlc_downlink_call (void); 241 void l1ps_macs_rlc_downlink_call (void);
243 #endif 242 #endif
244
245 UWORD8 calc_num_pm_to_report(void);
246 void update_num_pm_fp_table_for_rach(UWORD8 nbmeas,UWORD8 *p);
247 void update_num_pm_table_for_rach(UWORD8 nbmeas,UWORD8 *p);
248 243
249 #if (TRACE_TYPE==7) // CPU_LOAD 244 #if (TRACE_TYPE==7) // CPU_LOAD
250 extern void l1_cpu_load_start(void); 245 extern void l1_cpu_load_start(void);
251 extern void l1_cpu_load_stop(void); 246 extern void l1_cpu_load_stop(void);
252 extern void l1_cpu_load_interm(void); 247 extern void l1_cpu_load_interm(void);
360 /*-------------------------------------------------------*/ 355 /*-------------------------------------------------------*/
361 356
362 extern unsigned short layer_1_sync_end_time; 357 extern unsigned short layer_1_sync_end_time;
363 void hisr(void) 358 void hisr(void)
364 { 359 {
365 #if (TRACE_TYPE == 4) && (TI_NUC_MONITOR != 1) && (WCP_PROF == 0) 360 /*
366 if(trace_info.current_config->l1_dyn_trace & 1<<L1_DYN_TRACE_L1S_CPU_LOAD) 361 * FreeCalypso TCS211 reconstruction: the LoCosto version
367 { 362 * of this function had a whole bunch of junk here
368 TM_ResetTimer (2, TIMER_RESET_VALUE, 0, 0); 363 * which we have removed in order to match the TCS211
369 TM_StartTimer (2); 364 * binary object.
370 } 365 */
371 #endif
372
373 #if (GSM_IDLE_RAM_DEBUG == 1)
374 (*( volatile unsigned short* )(0xFFFE4802)) |= (1 << 2); // GPIO-2=1
375 #endif
376
377 /*
378 * FreeCalypso change: the conditioned-out GPIO twiddling below appears in
379 * the LoCosto version of this L1 code without any conditionals around it.
380 * Checking the disassembly of the Leonardo binary object confirms that
381 * NO GPIO muck takes places in that version. Needless to say, I am
382 * disabling it for FreeCalypso - we don't want to wreak havoc on some
383 * target that uses GPIO 0 for something else.
384 */
385 #if 0
386 // Configure GPIO0 pin as output - Reset Bit 0 i.e. set Bit 0 to 0
387 (*( volatile unsigned short* )(0xFFFE4804)) &= (~(1 << 0)); // GPIO-2=1
388 // write 1 in GPIO pin 0
389 (*( volatile unsigned short* )(0xFFFE4802)) |= (1 << 0); // GPIO-2=1
390 #endif
391 366
392 // stop the gauging.This function must be called at the 367 // stop the gauging.This function must be called at the
393 // begining of the HISR in order to have the IT_GAUGING 368 // begining of the HISR in order to have the IT_GAUGING
394 // executed before the Deep sleep decision. 369 // executed before the Deep sleep decision.
395 // GOAL: reduce the wake up time by 1 frame 370 // GOAL: reduce the wake up time by 1 frame
398 // check if an IT DSP stills pending => it means a CPU load error in the MCU 373 // check if an IT DSP stills pending => it means a CPU load error in the MCU
399 #if (TRACE_TYPE==1) || (TRACE_TYPE==4) 374 #if (TRACE_TYPE==1) || (TRACE_TYPE==4)
400 if (TPU_check_IT_DSP()==TRUE) 375 if (TPU_check_IT_DSP()==TRUE)
401 { 376 {
402 #if (GSM_IDLE_RAM == 0) 377 #if (GSM_IDLE_RAM == 0)
403 l1_trace_IT_DSP_error(IT_DSP_ERROR_CPU_OVERLOAD); 378 l1_trace_IT_DSP_error();
404 #else 379 #else
405 l1_trace_IT_DSP_error_intram(); 380 l1_trace_IT_DSP_error_intram();
406 #endif 381 #endif
407 } 382 }
408 #endif 383 #endif
469 /* Call layer 1 synchronous part. */ 444 /* Call layer 1 synchronous part. */
470 /******************************************************/ 445 /******************************************************/
471 446
472 l1s_synch(); 447 l1s_synch();
473 448
449 /*
450 * The following double invokation of l1s_synch()
451 * is NOT present in the TCS211 version.
452 */
453 #if 0
474 if(l1s.pw_mgr.sleep_performed == CLOCK_STOP && 454 if(l1s.pw_mgr.sleep_performed == CLOCK_STOP &&
475 (l1s.pw_mgr.wakeup_type == WAKEUP_FOR_L1_TASK || 455 (l1s.pw_mgr.wakeup_type == WAKEUP_FOR_L1_TASK ||
476 l1s.pw_mgr.wakeup_type == WAKEUP_ASYNCHRONOUS_ULPD_0 || 456 l1s.pw_mgr.wakeup_type == WAKEUP_ASYNCHRONOUS_ULPD_0 ||
477 l1s.pw_mgr.wakeup_type == WAKEUP_FOR_OS_TASK || 457 l1s.pw_mgr.wakeup_type == WAKEUP_FOR_OS_TASK ||
478 l1s.pw_mgr.wakeup_type == WAKEUP_FOR_HW_TIMER_TASK || 458 l1s.pw_mgr.wakeup_type == WAKEUP_FOR_HW_TIMER_TASK ||
479 l1s.pw_mgr.wakeup_type == WAKEUP_FOR_GAUGING_TASK)) 459 l1s.pw_mgr.wakeup_type == WAKEUP_FOR_GAUGING_TASK))
480 { 460 {
481 l1s_synch(); 461 l1s_synch();
482 } 462 }
463 #endif
483 464
484 // Be careful:in case of asynchronous wake-up after sleep 465 // Be careful:in case of asynchronous wake-up after sleep
485 // an IT_TDMA may be unmasked and executed just after l1s_sleep_manager(); 466 // an IT_TDMA may be unmasked and executed just after l1s_sleep_manager();
486 // In order to avoid issues with the execution of hisr() inside hisr() 467 // In order to avoid issues with the execution of hisr() inside hisr()
487 // do not add code here after !!! 468 // do not add code here after !!!
497 l1_trace_cpu_load(cpu_load); 478 l1_trace_cpu_load(cpu_load);
498 } 479 }
499 #endif 480 #endif
500 481
501 482
502 #if (TRACE_TYPE == 1) || (TRACE_TYPE == 4) 483 /* used to be #if (TRACE_TYPE == 1) || (TRACE_TYPE == 4) in LoCosto */
484 #if (TRACE_TYPE == 1) /* TSM30 code has it this way */
503 // CPU load for TRACE_TYPE == 1 and 4 only 485 // CPU load for TRACE_TYPE == 1 and 4 only
504 if((trace_info.current_config->l1_dyn_trace & 1<<L1_DYN_TRACE_L1S_CPU_LOAD) && 486 if((trace_info.current_config->l1_dyn_trace & 1<<L1_DYN_TRACE_L1S_CPU_LOAD) &&
505 (trace_info.sleep_performed == FALSE)) 487 (trace_info.sleep_performed == FALSE))
506 { 488 {
507 Trace_L1S_CPU_load(); 489 Trace_L1S_CPU_load();
521 /******************************************************/ 503 /******************************************************/
522 504
523 #if (TRACE_TYPE==7) // CPU_LOAD 505 #if (TRACE_TYPE==7) // CPU_LOAD
524 l1_cpu_load_stop(); 506 l1_cpu_load_stop();
525 #endif 507 #endif
526
527 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4)) && (DSP >= 38)
528 // DSP CPU load for TRACE_TYPE == 1 and 4 only
529 if(trace_info.current_config->l1_dyn_trace & 1<<L1_DYN_TRACE_DSP_CPU_LOAD)
530 {
531 // DSP CPU load measurement
532 l1_dsp_cpu_load_read();
533 }
534 #endif
535
536 #if 0
537 // write 0 in GPIO pin 0
538 (*( volatile unsigned short* )(0xFFFE4802)) &= (~(1 << 0)); // GPIO-2=1
539 #endif
540 508
541 } 509 }
542 510
543 #endif // NO SIMULATION 511 #endif // NO SIMULATION
544 //#pragma GSM_IDLE_DUPLICATE_FOR_INTERNAL_RAM_END 512 //#pragma GSM_IDLE_DUPLICATE_FOR_INTERNAL_RAM_END
563 // - Neighbor cells measurement manager. 531 // - Neighbor cells measurement manager.
564 // - End manager. 532 // - End manager.
565 533
566 void l1s_synch() 534 void l1s_synch()
567 { 535 {
568
569 #if(L1_RF_KBD_FIX == 1)
570 static int prev_correction_ratio = 0; //omaps00090550
571
572 // Ratio Computation - Rounding Up to the Higher Integer if applicable
573
574 if (l1s.total_kbd_on_time !=0)
575 l1s.correction_ratio = ((FRAME_DURATION+((l1s.total_kbd_on_time-1)/2))/l1s.total_kbd_on_time);
576
577
578 // Fix to change the Debounce Time value to 16 ms during Initial FB search
579 if ((l1a_l1s_com.mode == CS_MODE0)||(l1a_l1s_com.mode == CS_MODE))
580 {
581 l1s.correction_ratio = 4;
582 kpd_timer_modify(l1s.correction_ratio, l1s.actual_time.fn_mod42432);
583
584 #if (TRACE_TYPE == 1) || (TRACE_TYPE == 4)
585 l1_trace_correction_ratio(l1s.correction_ratio);
586 #endif
587 prev_correction_ratio=4;
588 }
589 else
590 {
591 if(prev_correction_ratio != l1s.correction_ratio)
592 {
593 kpd_timer_modify(l1s.correction_ratio, l1s.actual_time.fn_mod42432);
594
595 #if (TRACE_TYPE == 1) || (TRACE_TYPE == 4)
596 l1_trace_correction_ratio(l1s.correction_ratio);
597 #endif
598 prev_correction_ratio = l1s.correction_ratio;
599 }
600 else
601 {
602 kpd_state_probe(l1s.actual_time.fn_mod42432);
603 }
604 }
605 l1s.total_kbd_on_time = FRAME_DURATION;
606 #endif
607
608 #if (CODE_VERSION==SIMULATION) 536 #if (CODE_VERSION==SIMULATION)
609 // increment time counter used for debug and by L3 scenario... 537 // increment time counter used for debug and by L3 scenario...
610 l1s.debug_time ++; 538 l1s.debug_time ++;
611 539
612 /***************************************************/ 540 /***************************************************/
636 // Decrement time to next L1S task. 564 // Decrement time to next L1S task.
637 if(l1a_l1s_com.time_to_next_l1s_task > 0 && 565 if(l1a_l1s_com.time_to_next_l1s_task > 0 &&
638 l1a_l1s_com.time_to_next_l1s_task < MAX_FN) 566 l1a_l1s_com.time_to_next_l1s_task < MAX_FN)
639 l1a_l1s_com.time_to_next_l1s_task--; 567 l1a_l1s_com.time_to_next_l1s_task--;
640 #endif 568 #endif
641 l1s.tcr_prog_done=0; 569 /* l1s.tcr_prog_done=0; */
642 #if (FF_L1_FAST_DECODING == 1) 570 #if (FF_L1_FAST_DECODING == 1)
643 /* If a fast decoding IT is expected AND a deferred control is scheduled */ 571 /* If a fast decoding IT is expected AND a deferred control is scheduled */
644 /* then it means that a fast decoding IT is still awaited from previous */ 572 /* then it means that a fast decoding IT is still awaited from previous */
645 /* TDMA. */ 573 /* TDMA. */
646 if ( 574 if (
651 l1_trace_IT_DSP_error(IT_DSP_ERROR_FAST_DECODING); 579 l1_trace_IT_DSP_error(IT_DSP_ERROR_FAST_DECODING);
652 } 580 }
653 #endif /* #if (FF_L1_FAST_DECODING == 1) */ 581 #endif /* #if (FF_L1_FAST_DECODING == 1) */
654 582
655 #if L1_GPRS 583 #if L1_GPRS
656 l1s.tcr_prog_done=0; 584 /* l1s.tcr_prog_done=0; */
657 // Increment TOA period counter used in packet tranfer mode 585 // Increment TOA period counter used in packet tranfer mode
658 if (l1a_l1s_com.mode == PACKET_TRANSFER_MODE) 586 if (l1a_l1s_com.mode == PACKET_TRANSFER_MODE)
659 { 587 {
660 // TOA update period in packet transfer mode = 4*78 frames 588 // TOA update period in packet transfer mode = 4*78 frames
661 // At least one block needs to be transmitted by the BTS every 78 frames 589 // At least one block needs to be transmitted by the BTS every 78 frames
749 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 677 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
750 678
751 { 679 {
752 BOOL l1s_task_allowed = TRUE; 680 BOOL l1s_task_allowed = TRUE;
753 681
682 /*
683 * FreeCalypso TCS211 reconstruction: the following code
684 * fails to compile because the wakeup_time structure member
685 * is not present in TCS211 headers. Let's try omitting it
686 * so we can get a successful compile and start diffing the
687 * compilation results.
688 */
689 #if 0
690
754 /* This is not required in Locosto after merge of deep-sleep 691 /* This is not required in Locosto after merge of deep-sleep
755 * initialization and control frame */ 692 * initialization and control frame */
756 #if (CHIPSET != 15) 693 #if (CHIPSET != 15)
757 // SETUP_AFC_AND_RF+1 frames shall pass since last wakeup 694 // SETUP_AFC_AND_RF+1 frames shall pass since last wakeup
758 // from deep sleep before scheduling any tasks due to RF wakeup. 695 // from deep sleep before scheduling any tasks due to RF wakeup.
775 l1s_task_allowed = TRUE; 712 l1s_task_allowed = TRUE;
776 } 713 }
777 #else 714 #else
778 l1s.pw_mgr.sleep_performed = DO_NOT_SLEEP; // In case l1s is executed, initialize sleep performed in order to avoid reentry in part above 42432 frames later 715 l1s.pw_mgr.sleep_performed = DO_NOT_SLEEP; // In case l1s is executed, initialize sleep performed in order to avoid reentry in part above 42432 frames later
779 l1s_task_allowed = TRUE; 716 l1s_task_allowed = TRUE;
717 #endif
780 #endif 718 #endif
781 719
782 if (l1s_task_allowed == TRUE) 720 if (l1s_task_allowed == TRUE)
783 { 721 {
784 // Reset L1A activity flag. 722 // Reset L1A activity flag.
1136 if ( l1s.pw_mgr.mode_authorized >= BIG_SLEEP ) 1074 if ( l1s.pw_mgr.mode_authorized >= BIG_SLEEP )
1137 { 1075 {
1138 l1s_sleep_manager(); 1076 l1s_sleep_manager();
1139 } 1077 }
1140 } 1078 }
1141 #if (CODE_VERSION!= SIMULATION) 1079 #if 0 /* FreeCalypso TCS211 reconstruction */
1142 else{ 1080 else{
1143 l1_trace_fail_sleep(FAIL_SLEEP_L1SYNCH,0,0); 1081 l1_trace_fail_sleep(FAIL_SLEEP_L1SYNCH,0,0);
1144 } 1082 }
1145 #endif 1083 #endif
1146 } 1084 }
1229 /* task is installed. */ 1167 /* task is installed. */
1230 /* */ 1168 /* */
1231 /*-------------------------------------------------------*/ 1169 /*-------------------------------------------------------*/
1232 void l1s_task_scheduler_process() 1170 void l1s_task_scheduler_process()
1233 { 1171 {
1234 WORD32 pending_task = NO_NEW_TASK; 1172 WORD32 pending_task;
1173
1235 // Call routine: SCHEDULE_TASKS. 1174 // Call routine: SCHEDULE_TASKS.
1236 l1s_schedule_tasks(&pending_task); 1175 l1s_schedule_tasks(&pending_task);
1237 1176
1238 // Call routine: MERGE_MANAGER (contains LOAD_MFTAB). 1177 // Call routine: MERGE_MANAGER (contains LOAD_MFTAB).
1239 l1s_merge_manager(pending_task); 1178 l1s_merge_manager(pending_task);
1343 if ((l1a_l1s_com.l1s_en_meas & FSMS_MEAS) == 0) // avoid conflict with the Measurement campaign 1282 if ((l1a_l1s_com.l1s_en_meas & FSMS_MEAS) == 0) // avoid conflict with the Measurement campaign
1344 //-------------------------------- 1283 //--------------------------------
1345 // ADC task is ENABLED in CS_MODE0. 1284 // ADC task is ENABLED in CS_MODE0.
1346 //-------------------------------- 1285 //--------------------------------
1347 { 1286 {
1348 UWORD32 time_to_adc = 0 ; //omaps00090550 1287 UWORD32 time_to_adc;
1349 1288
1350 if (l1a_l1s_com.adc_mode & ADC_NEXT_CS_MODE0) 1289 if (l1a_l1s_com.adc_mode & ADC_NEXT_CS_MODE0)
1351 { 1290 {
1352 time_to_adc = 0; // ADC performed in the current frame 1291 time_to_adc = 0; // ADC performed in the current frame
1353 } 1292 }
1512 time_to_nbcchs += modulus_times_51; 1451 time_to_nbcchs += modulus_times_51;
1513 else 1452 else
1514 if(time_to_nbcchs >= modulus_times_51) 1453 if(time_to_nbcchs >= modulus_times_51)
1515 time_to_nbcchs -= modulus_times_51; 1454 time_to_nbcchs -= modulus_times_51;
1516 1455
1517 if(time_to_nbcchs < (WORD32)min_time_to_nbcchs) 1456 if(time_to_nbcchs < min_time_to_nbcchs)
1518 min_time_to_nbcchs = time_to_nbcchs; 1457 min_time_to_nbcchs = time_to_nbcchs;
1519 } 1458 }
1520 1459
1521 // Save scheduling result. 1460 // Save scheduling result.
1522 l1s.task_status[NBCCHS].time_to_exec = min_time_to_nbcchs; 1461 l1s.task_status[NBCCHS].time_to_exec = min_time_to_nbcchs;
1674 // Still some CBCH blocks to read from TB1/2/3/5/6/7, get next one. 1613 // Still some CBCH blocks to read from TB1/2/3/5/6/7, get next one.
1675 time_to_smscb_info = l1a_l1s_com.cbch_info_req.start_fn[l1a_l1s_com.cbch_info_req.next] + 1614 time_to_smscb_info = l1a_l1s_com.cbch_info_req.start_fn[l1a_l1s_com.cbch_info_req.next] +
1676 MAX_FN - 1615 MAX_FN -
1677 l1s.actual_time.fn; 1616 l1s.actual_time.fn;
1678 1617
1679 if(time_to_smscb_info >= (WORD32)MAX_FN) time_to_smscb_info -= MAX_FN; 1618 if(time_to_smscb_info >= MAX_FN) time_to_smscb_info -= MAX_FN;
1680 1619
1681 // Check if passing 1 schedule position. 1620 // Check if passing 1 schedule position.
1682 if(time_to_smscb_info == 0) 1621 if(time_to_smscb_info == 0)
1683 l1a_l1s_com.cbch_info_req.next++; 1622 l1a_l1s_com.cbch_info_req.next++;
1684 } 1623 }
1699 // Still some scheduled CBCH to read, get next one. 1638 // Still some scheduled CBCH to read, get next one.
1700 time_to_norm_smscb = l1a_l1s_com.norm_cbch_schedule.first_block[l1a_l1s_com.norm_cbch_schedule.next] + 1639 time_to_norm_smscb = l1a_l1s_com.norm_cbch_schedule.first_block[l1a_l1s_com.norm_cbch_schedule.next] +
1701 MAX_FN - 1640 MAX_FN -
1702 l1s.actual_time.fn; 1641 l1s.actual_time.fn;
1703 1642
1704 if(time_to_norm_smscb >= (WORD32)MAX_FN) time_to_norm_smscb -= MAX_FN; 1643 if(time_to_norm_smscb >= MAX_FN) time_to_norm_smscb -= MAX_FN;
1705 1644
1706 // Check if passing 1 schedule position. 1645 // Check if passing 1 schedule position.
1707 if(time_to_norm_smscb == 0) 1646 if(time_to_norm_smscb == 0)
1708 l1a_l1s_com.norm_cbch_schedule.next++; 1647 l1a_l1s_com.norm_cbch_schedule.next++;
1709 } 1648 }
1723 { 1662 {
1724 time_to_norm_smscb = l1a_l1s_com.norm_cbch_schedule.start_continuous_fn + 1663 time_to_norm_smscb = l1a_l1s_com.norm_cbch_schedule.start_continuous_fn +
1725 MAX_FN - 1664 MAX_FN -
1726 l1s.actual_time.fn; 1665 l1s.actual_time.fn;
1727 1666
1728 if(time_to_norm_smscb >= (WORD32)MAX_FN) time_to_norm_smscb -= MAX_FN; 1667 if(time_to_norm_smscb >= MAX_FN) time_to_norm_smscb -= MAX_FN;
1729 1668
1730 // Check for "CBCH continuous reading" starting frame number. 1669 // Check for "CBCH continuous reading" starting frame number.
1731 if(time_to_norm_smscb == 0) 1670 if(time_to_norm_smscb == 0)
1732 l1a_l1s_com.norm_cbch_schedule.start_continuous_fn = -1; 1671 l1a_l1s_com.norm_cbch_schedule.start_continuous_fn = -1;
1733 } 1672 }
1763 // Still some scheduled CBCH to read, get next one. 1702 // Still some scheduled CBCH to read, get next one.
1764 time_to_ext_smscb = l1a_l1s_com.ext_cbch_schedule.first_block[l1a_l1s_com.ext_cbch_schedule.next] + 1703 time_to_ext_smscb = l1a_l1s_com.ext_cbch_schedule.first_block[l1a_l1s_com.ext_cbch_schedule.next] +
1765 MAX_FN - 1704 MAX_FN -
1766 l1s.actual_time.fn; 1705 l1s.actual_time.fn;
1767 1706
1768 if(time_to_ext_smscb >= (WORD32)MAX_FN) time_to_ext_smscb -= MAX_FN; 1707 if(time_to_ext_smscb >= MAX_FN) time_to_ext_smscb -= MAX_FN;
1769 1708
1770 // Check if passing 1 schedule position. 1709 // Check if passing 1 schedule position.
1771 if(time_to_ext_smscb == 0) 1710 if(time_to_ext_smscb == 0)
1772 l1a_l1s_com.ext_cbch_schedule.next++; // passing 1 schedule position. 1711 l1a_l1s_com.ext_cbch_schedule.next++; // passing 1 schedule position.
1773 } 1712 }
1787 { 1726 {
1788 time_to_ext_smscb = l1a_l1s_com.ext_cbch_schedule.start_continuous_fn + 1727 time_to_ext_smscb = l1a_l1s_com.ext_cbch_schedule.start_continuous_fn +
1789 MAX_FN - 1728 MAX_FN -
1790 l1s.actual_time.fn; 1729 l1s.actual_time.fn;
1791 1730
1792 if(time_to_ext_smscb >= (WORD32 )MAX_FN) time_to_ext_smscb -= MAX_FN; 1731 if(time_to_ext_smscb >= MAX_FN) time_to_ext_smscb -= MAX_FN;
1793 1732
1794 // Check for "CBCH continuous reading" starting frame number. 1733 // Check for "CBCH continuous reading" starting frame number.
1795 if(time_to_ext_smscb == 0) 1734 if(time_to_ext_smscb == 0)
1796 l1a_l1s_com.ext_cbch_schedule.start_continuous_fn = -1; 1735 l1a_l1s_com.ext_cbch_schedule.start_continuous_fn = -1;
1797 } 1736 }
1818 if(time_to_norm_smscb < time_to_ext_smscb) 1757 if(time_to_norm_smscb < time_to_ext_smscb)
1819 min_time_to_smscb = time_to_norm_smscb; 1758 min_time_to_smscb = time_to_norm_smscb;
1820 else 1759 else
1821 min_time_to_smscb = time_to_ext_smscb; 1760 min_time_to_smscb = time_to_ext_smscb;
1822 1761
1823 if(time_to_smscb_info <(WORD32) min_time_to_smscb) 1762 if(time_to_smscb_info < min_time_to_smscb)
1824 min_time_to_smscb = time_to_smscb_info; 1763 min_time_to_smscb = time_to_smscb_info;
1825 1764
1826 // Save scheduling result. 1765 // Save scheduling result.
1827 l1s.task_status[SMSCB].time_to_exec = min_time_to_smscb; 1766 l1s.task_status[SMSCB].time_to_exec = min_time_to_smscb;
1828 1767
1968 time_to_bcchn -= 8*51; 1907 time_to_bcchn -= 8*51;
1969 1908
1970 // memorize the next BCCHN according to its priority 1909 // memorize the next BCCHN according to its priority
1971 // (TOP_PRIORITY or HIGH_PRIORITY or NORMAL_PRIORITY ) 1910 // (TOP_PRIORITY or HIGH_PRIORITY or NORMAL_PRIORITY )
1972 bcchn_priority = l1a_l1s_com.bcchn.list[i].gprs_priority ; 1911 bcchn_priority = l1a_l1s_com.bcchn.list[i].gprs_priority ;
1973 if(time_to_bcchn <(WORD32 ) min_time_to_bcchn[bcchn_priority]) 1912 if(time_to_bcchn < min_time_to_bcchn[bcchn_priority])
1974 { 1913 {
1975 min_time_to_bcchn[bcchn_priority] = time_to_bcchn; 1914 min_time_to_bcchn[bcchn_priority] = time_to_bcchn;
1976 1915
1977 // Save Neighbour number 1916 // Save Neighbour number
1978 best_neigh_id[bcchn_priority] = i; 1917 best_neigh_id[bcchn_priority] = i;
2035 time_to_bcchn -= 8*51; 1974 time_to_bcchn -= 8*51;
2036 1975
2037 // memorize the next BCCHN according to its priority 1976 // memorize the next BCCHN according to its priority
2038 // (TOP_PRIORITY or HIGH_PRIORITY or NORMAL_PRIORITY ) 1977 // (TOP_PRIORITY or HIGH_PRIORITY or NORMAL_PRIORITY )
2039 bcchn_priority = l1a_l1s_com.bcchn.list[i].gprs_priority; 1978 bcchn_priority = l1a_l1s_com.bcchn.list[i].gprs_priority;
2040 if(time_to_bcchn < (WORD32)min_time_to_bcchn[bcchn_priority]) 1979 if(time_to_bcchn < min_time_to_bcchn[bcchn_priority])
2041 { 1980 {
2042 min_time_to_bcchn[bcchn_priority] = time_to_bcchn; 1981 min_time_to_bcchn[bcchn_priority] = time_to_bcchn;
2043 1982
2044 // Save Neighbour number 1983 // Save Neighbour number
2045 best_neigh_id[bcchn_priority] = i; 1984 best_neigh_id[bcchn_priority] = i;
2281 2220
2282 // PEP is scheduled for the 1st time. If first PPCH block is a PEP and not PNP 2221 // PEP is scheduled for the 1st time. If first PPCH block is a PEP and not PNP
2283 // then PEP scheduling has to be computed with "m_for_pep = m_index - 1" 2222 // then PEP scheduling has to be computed with "m_for_pep = m_index - 1"
2284 if(l1a_l1s_com.task_param[PEP] == SEMAPHORE_SET) 2223 if(l1a_l1s_com.task_param[PEP] == SEMAPHORE_SET)
2285 { 2224 {
2286 UWORD16 u16Temp;
2287 // PAGING GROUP computation: 2225 // PAGING GROUP computation:
2288 2226
2289 u16Temp = (l1pa_l1ps_com.pccch.pg_offset + (((m_for_pep) * l1pa_l1ps_com.pccch.pg_blks_avail) 2227 paging_group = (l1pa_l1ps_com.pccch.pg_offset + (((UWORD32)(m_for_pep) * (UWORD32)l1pa_l1ps_com.pccch.pg_blks_avail)
2290 / l1pa_l1ps_com.pccch.split_pg_value)) % l1pa_l1ps_com.pccch.pg_blks_avail; 2228 / (UWORD32)l1pa_l1ps_com.pccch.split_pg_value)) % l1pa_l1ps_com.pccch.pg_blks_avail;
2291
2292 paging_group = u16Temp;
2293 2229
2294 // Computation of the MF52 for MS Packet Extented Paging 2230 // Computation of the MF52 for MS Packet Extented Paging
2295 mf52_for_ms_epg = ((paging_group + 3) / l1pa_l1ps_com.pccch.nb_ppch_per_mf52) % 64; 2231 mf52_for_ms_epg = ((paging_group + 3) / l1pa_l1ps_com.pccch.nb_ppch_per_mf52) % 64;
2296 2232
2297 // Paging Block Index computation 2233 // Paging Block Index computation
2424 time_to_pbcchs = PbcchS.offset_array[i] - fn_mod_ps1_period; 2360 time_to_pbcchs = PbcchS.offset_array[i] - fn_mod_ps1_period;
2425 if(time_to_pbcchs < 0) 2361 if(time_to_pbcchs < 0)
2426 time_to_pbcchs += psi_period; 2362 time_to_pbcchs += psi_period;
2427 2363
2428 // Save Min time to next PBCCHS block. 2364 // Save Min time to next PBCCHS block.
2429 if(time_to_pbcchs < (WORD16)min_time_to_pbcchs) 2365 if(time_to_pbcchs < min_time_to_pbcchs)
2430 { 2366 {
2431 min_time_to_pbcchs = time_to_pbcchs; 2367 min_time_to_pbcchs = time_to_pbcchs;
2432 psi_index = i; 2368 psi_index = i;
2433 } 2369 }
2434 } 2370 }
3314 { 3250 {
3315 #define MF51 1 3251 #define MF51 1
3316 #define MF26 2 3252 #define MF26 2
3317 3253
3318 UWORD8 channel = 255; 3254 UWORD8 channel = 255;
3319 UWORD8 start_time =0; //omaps00090550 3255 UWORD8 start_time;
3320 UWORD8 fn_in_report_mod51 = l1s.next_time.fn_in_report % 51; 3256 UWORD8 fn_in_report_mod51 = l1s.next_time.fn_in_report % 51;
3321 T_CHANNEL_DESCRIPTION *desc_ptr= NULL; 3257 T_CHANNEL_DESCRIPTION *desc_ptr;
3322 T_SDCCH_DESC *sdcch_desc = NULL;//OMAPS00090550 3258 T_SDCCH_DESC *sdcch_desc;
3323 3259
3324 if(l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED) 3260 if(l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED)
3325 //--------------------------------------------- 3261 //---------------------------------------------
3326 // Dedicated mode tasks are enabled. 3262 // Dedicated mode tasks are enabled.
3327 //--------------------------------------------- 3263 //---------------------------------------------
3613 } 3549 }
3614 3550
3615 } // End of "if / current_status" 3551 } // End of "if / current_status"
3616 } // End of "if / NSYNC" 3552 } // End of "if / NSYNC"
3617 3553
3618 if((l1a_l1s_com.l1s_en_task[DDL] == TASK_ENABLED) && (sdcch_desc != NULL)) 3554 if (l1a_l1s_com.l1s_en_task[DDL] == TASK_ENABLED)
3619 //------------------------- 3555 //-------------------------
3620 // SDCCH DL task is ENABLED. 3556 // SDCCH DL task is ENABLED.
3621 //------------------------- 3557 //-------------------------
3622 { 3558 {
3623 UWORD32 time_to_ddl; 3559 UWORD32 time_to_ddl;
3629 3565
3630 // Save scheduling result. 3566 // Save scheduling result.
3631 l1s.task_status[DDL].time_to_exec = time_to_ddl; 3567 l1s.task_status[DDL].time_to_exec = time_to_ddl;
3632 } 3568 }
3633 3569
3634 if((l1a_l1s_com.l1s_en_task[DUL] == TASK_ENABLED) && (sdcch_desc != NULL)) 3570 if (l1a_l1s_com.l1s_en_task[DUL] == TASK_ENABLED)
3635 //------------------------- 3571 //-------------------------
3636 // SDCCH DUL task is ENABLED. 3572 // SDCCH DUL task is ENABLED.
3637 //------------------------- 3573 //-------------------------
3638 { 3574 {
3639 UWORD32 time_to_dul; 3575 UWORD32 time_to_dul;
3645 3581
3646 // Save scheduling result. 3582 // Save scheduling result.
3647 l1s.task_status[DUL].time_to_exec = time_to_dul; 3583 l1s.task_status[DUL].time_to_exec = time_to_dul;
3648 } 3584 }
3649 3585
3650 if((l1a_l1s_com.l1s_en_task[ADL] == TASK_ENABLED) && (sdcch_desc != NULL)) 3586 if (l1a_l1s_com.l1s_en_task[ADL] == TASK_ENABLED)
3651 //---------------------------------- 3587 //----------------------------------
3652 // SACCH DL (SDCCH) task is ENABLED. 3588 // SACCH DL (SDCCH) task is ENABLED.
3653 //---------------------------------- 3589 //----------------------------------
3654 { 3590 {
3655 UWORD32 time_to_adl; 3591 UWORD32 time_to_adl;
3661 3597
3662 // Save scheduling result. 3598 // Save scheduling result.
3663 l1s.task_status[ADL].time_to_exec = time_to_adl; 3599 l1s.task_status[ADL].time_to_exec = time_to_adl;
3664 } 3600 }
3665 3601
3666 if((l1a_l1s_com.l1s_en_task[AUL] == TASK_ENABLED) && (sdcch_desc != NULL)) 3602 if (l1a_l1s_com.l1s_en_task[AUL] == TASK_ENABLED)
3667 //---------------------------------- 3603 //----------------------------------
3668 // SACCH UL (SDCCH) task is ENABLED. 3604 // SACCH UL (SDCCH) task is ENABLED.
3669 //---------------------------------- 3605 //----------------------------------
3670 { 3606 {
3671 UWORD32 time_to_aul; 3607 UWORD32 time_to_aul;
3698 if (l1a_l1s_com.l1s_en_task[NSYNC] == TASK_ENABLED) 3634 if (l1a_l1s_com.l1s_en_task[NSYNC] == TASK_ENABLED)
3699 //----------------------------------------------------------- 3635 //-----------------------------------------------------------
3700 // Neigbour Cell Synchro task enabled for DEDIC TCH or PACKET 3636 // Neigbour Cell Synchro task enabled for DEDIC TCH or PACKET
3701 //----------------------------------------------------------- 3637 //-----------------------------------------------------------
3702 { 3638 {
3703 T_CHANNEL_DESCRIPTION *desc_ptr = NULL; //OMAPS00090550 3639 T_CHANNEL_DESCRIPTION *desc_ptr;
3704 3640
3705 if (l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED) 3641 if (l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED)
3706 { 3642 {
3707 desc_ptr = l1a_l1s_com.dedic_set.aset->achan_ptr->desc_ptr; 3643 desc_ptr = l1a_l1s_com.dedic_set.aset->achan_ptr->desc_ptr;
3708 } 3644 }
3760 { 3696 {
3761 case 0: // No valid info is supplied: search FB with no a priori info. 3697 case 0: // No valid info is supplied: search FB with no a priori info.
3762 { 3698 {
3763 UWORD32 min_time_to_fb = MAX_FN; 3699 UWORD32 min_time_to_fb = MAX_FN;
3764 3700
3765 if((l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED) && (desc_ptr != NULL)) 3701 if (l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED)
3766 //--------------------------------------------- 3702 //---------------------------------------------
3767 // Dedicated mode tasks are enabled. 3703 // Dedicated mode tasks are enabled.
3768 //--------------------------------------------- 3704 //---------------------------------------------
3769 { 3705 {
3770 // Rem: this task is used in dedicated/TCH_H/F 3706 // Rem: this task is used in dedicated/TCH_H/F
3817 #endif 3753 #endif
3818 { 3754 {
3819 BOOL check_fbcnf26 = 0; 3755 BOOL check_fbcnf26 = 0;
3820 UWORD32 min_time_to_fbconf = MAX_FN; 3756 UWORD32 min_time_to_fbconf = MAX_FN;
3821 3757
3822 if((l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED) && (desc_ptr != NULL)) 3758 if (l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED)
3823 //--------------------------------------------- 3759 //---------------------------------------------
3824 // Dedicated mode tasks are enabled. 3760 // Dedicated mode tasks are enabled.
3825 //--------------------------------------------- 3761 //---------------------------------------------
3826 { 3762 {
3827 UWORD8 normalised_fn_mod26; 3763 UWORD8 normalised_fn_mod26;
3985 case 2: // Accurate timing is supplied SBCONF: confirm SB. 3921 case 2: // Accurate timing is supplied SBCONF: confirm SB.
3986 { 3922 {
3987 BOOL check_sbcnf26 = 0; 3923 BOOL check_sbcnf26 = 0;
3988 UWORD32 min_time_to_sbconf = MAX_FN; 3924 UWORD32 min_time_to_sbconf = MAX_FN;
3989 3925
3990 if((l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED) && (desc_ptr != NULL)) 3926 if (l1a_l1s_com.l1s_en_task[DEDIC] == TASK_ENABLED)
3991 //--------------------------------------------- 3927 //---------------------------------------------
3992 // Dedicated mode tasks are enabled. 3928 // Dedicated mode tasks are enabled.
3993 //--------------------------------------------- 3929 //---------------------------------------------
3994 { 3930 {
3995 UWORD8 normalised_fn_mod26; 3931 UWORD8 normalised_fn_mod26;
4693 if(l1a_l1s_com.l1s_en_task[ITMEAS] == TASK_ENABLED) 4629 if(l1a_l1s_com.l1s_en_task[ITMEAS] == TASK_ENABLED)
4694 //------------------------- 4630 //-------------------------
4695 // ITMEAS task is ENABLED. 4631 // ITMEAS task is ENABLED.
4696 //------------------------- 4632 //-------------------------
4697 { 4633 {
4698 UWORD8 time_to_itmeas =0 ; //omaps00090550 4634 UWORD8 time_to_itmeas;
4699 4635
4700 // time to ITMEAS processing 4636 // time to ITMEAS processing
4701 // ITMEAS must be scheduled 2 frames in advance (C W W R scheme) 4637 // ITMEAS must be scheduled 2 frames in advance (C W W R scheme)
4702 // --> use of 'next_plus_time' 4638 // --> use of 'next_plus_time'
4703 switch(l1pa_l1ps_com.itmeas.position) 4639 switch(l1pa_l1ps_com.itmeas.position)
4851 (l1s.task_status[PBCCHN_TRAN].current_status == INACTIVE) && 4787 (l1s.task_status[PBCCHN_TRAN].current_status == INACTIVE) &&
4852 (l1s.task_status[PDTCH].current_status == INACTIVE) && 4788 (l1s.task_status[PDTCH].current_status == INACTIVE) &&
4853 (l1s.task_status[SMSCB].current_status == INACTIVE) && 4789 (l1s.task_status[SMSCB].current_status == INACTIVE) &&
4854 (((l1a_l1s_com.mode != PACKET_TRANSFER_MODE) || 4790 (((l1a_l1s_com.mode != PACKET_TRANSFER_MODE) ||
4855 ((l1s.task_status[NBCCHS].current_status == INACTIVE) && 4791 ((l1s.task_status[NBCCHS].current_status == INACTIVE) &&
4856 (l1s.task_status[EBCCHS].current_status == INACTIVE) && 4792 (l1s.task_status[EBCCHS].current_status == INACTIVE)
4857 (l1s.task_status[PNP].current_status == INACTIVE) && 4793 #if 0 /* FreeCalypso TCS211 reconstruction */
4858 (l1s.task_status[PEP].current_status == INACTIVE) && 4794 && (l1s.task_status[PNP].current_status == INACTIVE)
4859 (l1s.task_status[NP].current_status == INACTIVE) && 4795 && (l1s.task_status[PEP].current_status == INACTIVE)
4860 (l1s.task_status[EP].current_status == INACTIVE))))) 4796 && (l1s.task_status[NP].current_status == INACTIVE)
4797 && (l1s.task_status[EP].current_status == INACTIVE)
4798 #endif
4799 ))))
4861 4800
4862 #else 4801 #else
4863 if (l1s.task_status[SMSCB].current_status == INACTIVE) 4802 if (l1s.task_status[SMSCB].current_status == INACTIVE)
4864 #endif 4803 #endif
4865 { 4804 {
5290 /* L1C_RXLEV_PERIODIC_DONE is built and sent to L1A. */ 5229 /* L1C_RXLEV_PERIODIC_DONE is built and sent to L1A. */
5291 /* */ 5230 /* */
5292 /*-------------------------------------------------------*/ 5231 /*-------------------------------------------------------*/
5293 void l1s_meas_manager(void) 5232 void l1s_meas_manager(void)
5294 { 5233 {
5295 static static_s_rxlev_cntr = 0; 5234 /* static static_s_rxlev_cntr = 0; */
5296 UWORD32 i; 5235 UWORD32 i;
5297 UWORD8 IL_for_rxlev; 5236 UWORD8 IL_for_rxlev;
5298 UWORD8 adc_active = INACTIVE; 5237 UWORD8 adc_active = INACTIVE;
5299 5238
5300 static xSignalHeaderRec *pch_msg = NULL; 5239 static xSignalHeaderRec *pch_msg = NULL;
5425 // Call Cell Selection measurement management function or Idle PLMN permitted function 5364 // Call Cell Selection measurement management function or Idle PLMN permitted function
5426 // if meas. task still enabled. 5365 // if meas. task still enabled.
5427 if((l1a_l1s_com.l1s_en_meas & FSMS_MEAS) && !(l1a_l1s_com.meas_param & FSMS_MEAS)) 5366 if((l1a_l1s_com.l1s_en_meas & FSMS_MEAS) && !(l1a_l1s_com.meas_param & FSMS_MEAS))
5428 { 5367 {
5429 #if L1_GPRS 5368 #if L1_GPRS
5430 UWORD16 pm_read[NB_MEAS_MAX_GPRS]={0}; //omaps00090550 5369 UWORD8 pm_read[NB_MEAS_MAX_GPRS];
5431 #else 5370 #else
5432 UWORD16 pm_read[NB_MEAS_MAX]; 5371 UWORD8 pm_read[NB_MEAS_MAX];
5433 #endif 5372 #endif
5434 5373
5435 UWORD8 nbmeas, max_nbmeas; 5374 UWORD8 nbmeas, max_nbmeas;
5436 5375
5437 // When FULL LIST measurement task is enabled L1S is executed every frame. 5376 // When FULL LIST measurement task is enabled L1S is executed every frame.
5501 #if (TRACE_TYPE!=0) && (TRACE_TYPE!=5) 5440 #if (TRACE_TYPE!=0) && (TRACE_TYPE!=5)
5502 trace_fct(CST_READ_FULL_LIST_MEAS, (UWORD32)(-1));//OMAPS00090550 5441 trace_fct(CST_READ_FULL_LIST_MEAS, (UWORD32)(-1));//OMAPS00090550
5503 #endif 5442 #endif
5504 5443
5505 l1_check_pm_error(pm_read[i], FULL_LIST_MEAS_ID); 5444 l1_check_pm_error(pm_read[i], FULL_LIST_MEAS_ID);
5506 pm_read[i] = (pm_read[i] >> 5);
5507 5445
5508 #if (TRACE_TYPE==3) 5446 #if (TRACE_TYPE==3)
5509 stats_samples_pm(pm_read[i]); 5447 stats_samples_pm(pm_read[i]);
5510 #endif 5448 #endif
5511 5449
5953 5891
5954 /* pch_msg != NULL added below due to the fast pagin feature + power reduction feature 5892 /* pch_msg != NULL added below due to the fast pagin feature + power reduction feature
5955 * as the measurement can end in potentially 2 TDMA frames itself and an IBA_R message 5893 * as the measurement can end in potentially 2 TDMA frames itself and an IBA_R message
5956 * when comes in certail TDMA frames of paging task, both static ctrl index and static 5894 * when comes in certail TDMA frames of paging task, both static ctrl index and static
5957 * read index will be zero */ 5895 * read index will be zero */
5958 if((static_ctrl_index != 0) || (static_read_index != 0) || (pch_msg != NULL)) 5896 /* FreeCalypso TCS211 reconstruction: above change reverted */
5897 if((static_ctrl_index != 0) || (static_read_index != 0))
5959 { 5898 {
5960 5899
5961 // Paging process has been interrupted by a L3 message 5900 // Paging process has been interrupted by a L3 message
5962 // Deallocate memory for the received message if msg not forwarded to L3. 5901 // Deallocate memory for the received message if msg not forwarded to L3.
5963 // ---------------------------------------------------------------------- 5902 // ----------------------------------------------------------------------
5989 5928
5990 // variables introduced to cope with RACH sent on one frame of the paging block 5929 // variables introduced to cope with RACH sent on one frame of the paging block
5991 static UWORD8 static_nbmeas_to_report = 8; 5930 static UWORD8 static_nbmeas_to_report = 8;
5992 static UWORD8 static_nbmeas_ctrl_d = 0; 5931 static UWORD8 static_nbmeas_ctrl_d = 0;
5993 static UWORD8 static_nbmeas_ctrl_dd = 0; 5932 static UWORD8 static_nbmeas_ctrl_dd = 0;
5933
5934 #if 0 /* FreeCalypso TCS211 reconstruction */
5994 static UWORD8 num_pm[4]={0,0,0,0}; 5935 static UWORD8 num_pm[4]={0,0,0,0};
5995 #if (FF_L1_FAST_DECODING == 1) 5936 #if (FF_L1_FAST_DECODING == 1)
5996 static UWORD8 num_pm_fp[2]={0,0}; 5937 static UWORD8 num_pm_fp[2]={0,0};
5997 #endif 5938 #endif
5998 static UWORD8 num_pm_frames = 0; /* number of frames over which measurement is scheduled */ 5939 static UWORD8 num_pm_frames = 0; /* number of frames over which measurement is scheduled */
5940 #endif
5999 5941
6000 UWORD8 nbmeas_ctrl = 0; 5942 UWORD8 nbmeas_ctrl = 0;
6001 #if (FF_L1_FAST_DECODING == 1) 5943 #if (FF_L1_FAST_DECODING == 1)
6002 BOOL schedule_measures = FALSE; 5944 BOOL schedule_measures = FALSE;
6003 BOOL fast_decoding = l1s_check_fast_decoding_authorized(NP); 5945 BOOL fast_decoding = l1s_check_fast_decoding_authorized(NP);
6023 #if (TRACE_TYPE!=0) && (TRACE_TYPE!=5) 5965 #if (TRACE_TYPE!=0) && (TRACE_TYPE!=5)
6024 trace_fct(CST_READ_I_BA_MEAS, (UWORD32)(-1));//OMAPS00090550 5966 trace_fct(CST_READ_I_BA_MEAS, (UWORD32)(-1));//OMAPS00090550
6025 #endif 5967 #endif
6026 5968
6027 // Read power measurement result from DSP. 5969 // Read power measurement result from DSP.
6028 pm = (l1s_dsp_com.dsp_db_r_ptr->a_pm[i] & 0xffff); 5970 pm = (l1s_dsp_com.dsp_db_r_ptr->a_pm[i] & 0xffff) >> 5;
6029 l1_check_pm_error(pm, I_BA_MEAS_ID); 5971 l1_check_pm_error(pm, I_BA_MEAS_ID);
6030 pm = pm >> 5;
6031 5972
6032 #if (TRACE_TYPE==3) 5973 #if (TRACE_TYPE==3)
6033 stats_samples_pm(pm); 5974 stats_samples_pm(pm);
6034 #endif 5975 #endif
6035 5976
6043 #if (TRACE_TYPE == 1) || (TRACE_TYPE == 4) 5984 #if (TRACE_TYPE == 1) || (TRACE_TYPE == 4)
6044 RTTL1_FILL_MON_MEAS(pm, IL_for_rxlev, I_BA_MEAS_ID, radio_freq_read) 5985 RTTL1_FILL_MON_MEAS(pm, IL_for_rxlev, I_BA_MEAS_ID, radio_freq_read)
6045 #endif 5986 #endif
6046 5987
6047 5988
6048 #if (GSM_IDLE_RAM != 1) 5989 #if 0 /* FreeCalypso TCS211 reconstruction */
6049 5990 //Check if the message is not empty, else allocate memory
6050 //Check if the message is not empty, else allocate memory 5991 if (pch_msg == NULL)
6051 if (pch_msg == NULL)
6052 { 5992 {
6053 pch_msg = os_alloc_sig(sizeof(T_L1C_RXLEV_PERIODIC_DONE)); 5993 pch_msg = os_alloc_sig(sizeof(T_L1C_RXLEV_PERIODIC_DONE));
6054 DEBUGMSG(status,NU_ALLOC_ERR) 5994 DEBUGMSG(status,NU_ALLOC_ERR)
6055 pch_msg->SignalCode = L1C_RXLEV_PERIODIC_DONE; 5995 pch_msg->SignalCode = L1C_RXLEV_PERIODIC_DONE;
6056 } 5996 }
6057 // Fill reporting message. 5997 #endif
6058 5998
6059 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))-> 5999 // Fill reporting message.
6060 A[static_read_index].radio_freq_no = radio_freq_read; 6000 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->
6061 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))-> 6001 A[static_read_index].radio_freq_no = radio_freq_read;
6062 A[static_read_index].rxlev = l1s_encode_rxlev(IL_for_rxlev); 6002 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->
6063 #elif (GSM_IDLE_RAM == 1) // In this case the msg is not allocated yet -> save into internal variable 6003 A[static_read_index].rxlev = l1s_encode_rxlev(IL_for_rxlev);
6064 // Fill reporting message.
6065 l1s.A[static_read_index].radio_freq_no = radio_freq_read;
6066 l1s.A[static_read_index].rxlev = l1s_encode_rxlev(IL_for_rxlev);
6067 #endif
6068 6004
6069 // Increment the number of neighbor meas read. 6005 // Increment the number of neighbor meas read.
6070 static_read_index ++; 6006 static_read_index ++;
6071 6007
6072 // Increment "l1s.next_to_read" field for next measurement... 6008 // Increment "l1s.next_to_read" field for next measurement...
6077 6013
6078 // Serving cell measurements... 6014 // Serving cell measurements...
6079 // Accumulate the new measurement with the partial result. 6015 // Accumulate the new measurement with the partial result.
6080 // Compensate AGC for current measurement value. 6016 // Compensate AGC for current measurement value.
6081 l1a_l1s_com.Scell_info.meas.acc += l1a_l1s_com.Scell_IL_for_rxlev; 6017 l1a_l1s_com.Scell_info.meas.acc += l1a_l1s_com.Scell_IL_for_rxlev;
6082 static_s_rxlev_cntr++; 6018 /* static_s_rxlev_cntr++; */
6083 6019
6084 // ********** 6020 // **********
6085 // Reporting 6021 // Reporting
6086 // ********** 6022 // **********
6087 if (static_read_index==static_nbmeas_to_report) 6023 if (static_read_index==static_nbmeas_to_report)
6119 // ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->s_rxlev = l1s_encode_rxlev(l1a_l1s_com.Scell_info.meas.acc/4); 6055 // ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->s_rxlev = l1s_encode_rxlev(l1a_l1s_com.Scell_info.meas.acc/4);
6120 //#else /* #if (FF_L1_FAST_DECODING == 1) */ 6056 //#else /* #if (FF_L1_FAST_DECODING == 1) */
6121 // ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->s_rxlev = l1s_encode_rxlev(l1a_l1s_com.Scell_info.meas.acc/4); 6057 // ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->s_rxlev = l1s_encode_rxlev(l1a_l1s_com.Scell_info.meas.acc/4);
6122 //#endif /* #if (FF_L1_FAST_DECODING == 1) #else */ 6058 //#endif /* #if (FF_L1_FAST_DECODING == 1) #else */
6123 6059
6124 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->s_rxlev = l1s_encode_rxlev(l1a_l1s_com.Scell_info.meas.acc/(static_s_rxlev_cntr)); 6060 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->s_rxlev = l1s_encode_rxlev(l1a_l1s_com.Scell_info.meas.acc/4);
6125 // Fill "nbr_of_carriers" field, it is 7 when a RACH coincides with paging block, 8 otherwise. 6061 // Fill "nbr_of_carriers" field, it is 7 when a RACH coincides with paging block, 8 otherwise.
6126 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->nbr_of_carriers = static_nbmeas_to_report; 6062 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->nbr_of_carriers = static_nbmeas_to_report;
6127 6063
6128 // Fill BA identifier field. 6064 // Fill BA identifier field.
6129 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->ba_id = l1a_l1s_com.ba_list.ba_id; 6065 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->ba_id = l1a_l1s_com.ba_list.ba_id;
6130 // Enhanced RSSI 6066 // Enhanced RSSI
6131 6067
6068 #if 0 /* FreeCalypso TCS211 reconstruction */
6132 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->qual_acc_idle =qual_acc_idle1[0] ; 6069 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->qual_acc_idle =qual_acc_idle1[0] ;
6133 6070
6134 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->qual_nbr_meas_idle =qual_acc_idle1[1]* TOTAL_NO_OF_BITS_IDLE_MEAS; 6071 ((T_L1C_RXLEV_PERIODIC_DONE*)(pch_msg->SigP))->qual_nbr_meas_idle =qual_acc_idle1[1]* TOTAL_NO_OF_BITS_IDLE_MEAS;
6072 #endif
6135 6073
6136 // send L1C_RXLEV_PERIODIC_IND message... 6074 // send L1C_RXLEV_PERIODIC_IND message...
6137 os_send_sig(pch_msg, L1C1_QUEUE); 6075 os_send_sig(pch_msg, L1C1_QUEUE);
6138 DEBUGMSG(status,NU_SEND_QUEUE_ERR) 6076 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
6139 6077
6078 #if 0 /* FreeCalypso TCS211 reconstruction */
6140 // Reseting the value 6079 // Reseting the value
6141 qual_acc_idle1[0]= 0; 6080 qual_acc_idle1[0]= 0;
6142 qual_acc_idle1[1] =0; 6081 qual_acc_idle1[1] =0;
6082 #endif
6143 6083
6144 // Reset pointer for debugg. 6084 // Reset pointer for debugg.
6145 pch_msg = NULL; 6085 pch_msg = NULL;
6146 static_s_rxlev_cntr = 0; 6086 /* static_s_rxlev_cntr = 0; */
6147 } 6087 }
6148 6088
6149 }// end of READ 6089 }// end of READ
6150 6090
6151 // ********** 6091 // **********
6158 if (pch_msg == NULL) 6098 if (pch_msg == NULL)
6159 { 6099 {
6160 pch_msg = os_alloc_sig(sizeof(T_L1C_RXLEV_PERIODIC_DONE)); 6100 pch_msg = os_alloc_sig(sizeof(T_L1C_RXLEV_PERIODIC_DONE));
6161 DEBUGMSG(status,NU_ALLOC_ERR) 6101 DEBUGMSG(status,NU_ALLOC_ERR)
6162 pch_msg->SignalCode = L1C_RXLEV_PERIODIC_DONE; 6102 pch_msg->SignalCode = L1C_RXLEV_PERIODIC_DONE;
6163 static_s_rxlev_cntr = 0; 6103 /* static_s_rxlev_cntr = 0; */
6164 } 6104 }
6165 #endif 6105 #endif
6166 // Reset accumalator for serving measurements. 6106 // Reset accumalator for serving measurements.
6167 l1a_l1s_com.Scell_info.meas.acc = 0; 6107 l1a_l1s_com.Scell_info.meas.acc = 0;
6168 6108
6171 6111
6172 // Save first BA index to be measured in this new session. 6112 // Save first BA index to be measured in this new session.
6173 l1a_l1s_com.ba_list.first_index = l1a_l1s_com.ba_list.next_to_ctrl; 6113 l1a_l1s_com.ba_list.first_index = l1a_l1s_com.ba_list.next_to_ctrl;
6174 6114
6175 // Reset static variables for control of nbmeas per frame 6115 // Reset static variables for control of nbmeas per frame
6176 static_nbmeas_to_report = calc_num_pm_to_report(); 6116 static_nbmeas_to_report = 8;
6177 static_nbmeas_ctrl_d = 0; 6117 static_nbmeas_ctrl_d = 0;
6178 static_nbmeas_ctrl_dd = 0; 6118 static_nbmeas_ctrl_dd = 0;
6179
6180 switch(static_nbmeas_to_report)
6181 {
6182 case 1: num_pm[0]=1;
6183 num_pm[1]=0;
6184 num_pm[2]=0;
6185 num_pm[3]=0;
6186 num_pm_frames = 1;
6187 break;
6188 case 2: num_pm[0]=1;
6189 num_pm[1]=1;
6190 num_pm[2]=0;
6191 num_pm[3]=0;
6192 num_pm_frames = 2;
6193 break;
6194 case 3: num_pm[0]=1;
6195 num_pm[1]=1;
6196 num_pm[2]=1;
6197 num_pm[3]=0;
6198 num_pm_frames = 3;
6199 break;
6200 case 4: num_pm[0]=1;
6201 num_pm[1]=1;
6202 num_pm[2]=1;
6203 num_pm[3]=1;
6204 num_pm_frames = 4;
6205 break;
6206 case 5: num_pm[0]=2;
6207 num_pm[1]=1;
6208 num_pm[2]=1;
6209 num_pm[3]=1;
6210 num_pm_frames = 4;
6211 break;
6212 case 6: num_pm[0]=2;
6213 num_pm[1]=2;
6214 num_pm[2]=1;
6215 num_pm[3]=1;
6216 num_pm_frames = 4;
6217 break;
6218 case 7: num_pm[0]=2;
6219 num_pm[1]=2;
6220 num_pm[2]=2;
6221 num_pm[3]=1;
6222 num_pm_frames = 4;
6223 break;
6224 }
6225 #if (FF_L1_FAST_DECODING == 1)
6226 switch(static_nbmeas_to_report)
6227 {
6228 case 1: num_pm_fp[0]=1;
6229 num_pm_fp[1]=0;
6230 num_pm_frames = 1;
6231 break;
6232 case 2: num_pm_fp[0]=1;
6233 num_pm_fp[1]=1;
6234 num_pm_frames = 2;
6235 break;
6236 case 3: num_pm_fp[0]=2;
6237 num_pm_fp[1]=1;
6238 num_pm_frames = 2;
6239 break;
6240 case 4: num_pm_fp[0]=3;
6241 num_pm_fp[1]=1;
6242 num_pm_frames = 2;
6243 break;
6244 case 5: num_pm_fp[0]=4;
6245 num_pm_fp[1]=1;
6246 num_pm_frames = 2;
6247 break;
6248 case 6: num_pm_fp[0]=4;
6249 num_pm_fp[1]=2;
6250 num_pm_frames = 2;
6251 break;
6252 case 7: num_pm_fp[0]=4;
6253 num_pm_fp[1]=3;
6254 num_pm_frames = 2;
6255 break;
6256 }
6257 #endif
6258
6259
6260 } 6119 }
6261 6120
6262 // A PCH burst has been controled, we must make the control of 1 or 2 new measurements. 6121 // A PCH burst has been controled, we must make the control of 1 or 2 new measurements.
6263 #if (FF_L1_FAST_DECODING == 1) 6122 if ((static_ctrl_index == (l1a_l1s_com.ba_list.np_ctrl-1)*2) ||
6264 schedule_measures = FALSE; 6123 (static_ctrl_index == (l1a_l1s_com.ba_list.np_ctrl-1)*2 - 1))
6265
6266 if ( (fast_decoding == TRUE)
6267 &&
6268 ( (l1a_l1s_com.ba_list.np_ctrl == 1) ||
6269 (l1a_l1s_com.ba_list.np_ctrl == 2) )
6270 )
6271 {
6272 /* Fast decoding enabled, current NP control on bursts 1 or 2 */
6273 #if (GSM_IDLE_RAM!=1)
6274 if (pch_msg != NULL)
6275 #endif
6276 {
6277
6278 schedule_measures = TRUE;
6279 }
6280 }
6281 else
6282 if ( (fast_decoding == FALSE)
6283 &&
6284 ( (num_pm[l1a_l1s_com.ba_list.np_ctrl-1]!=0) && ((l1a_l1s_com.ba_list.np_ctrl >=1) && (l1a_l1s_com.ba_list.np_ctrl<=4)))
6285 )
6286 {
6287 /* Fast decoding disabled, use legacy condition to schedule up to
6288 2 power measurements */
6289 #if (GSM_IDLE_RAM!=1)
6290 if (pch_msg != NULL)
6291 #endif
6292 {
6293
6294 schedule_measures = TRUE;
6295 }
6296 }
6297
6298 if (schedule_measures == TRUE)
6299 #else /* #if (FF_L1_FAST_DECODING == 1) */
6300 #if (GSM_IDLE_RAM!=1)
6301 if ((num_pm[l1a_l1s_com.ba_list.np_ctrl-1]!=0) && (pch_msg != NULL) && ((l1a_l1s_com.ba_list.np_ctrl >=1) && (l1a_l1s_com.ba_list.np_ctrl<=4)))
6302 #else
6303 if( (num_pm[l1a_l1s_com.ba_list.np_ctrl-1]!=0) && ((l1a_l1s_com.ba_list.np_ctrl >=1) && (l1a_l1s_com.ba_list.np_ctrl<=4)))
6304 #endif
6305 #endif /* #if (FF_L1_FAST_DECODING == 1) #else*/
6306 { 6124 {
6307 UWORD16 radio_freq_ctrl; 6125 UWORD16 radio_freq_ctrl;
6308 UWORD8 ba_index_ctrl; 6126 UWORD8 ba_index_ctrl;
6309 6127
6310 // check whether RACH has been controlled in the same frame 6128 // check whether RACH has been controlled in the same frame
6311 // if YES only one PW measurement will be controlled and the number of meas to report is decremented by 1 6129 // if YES only one PW measurement will be controlled and the number of meas to report is decremented by 1
6312 if (l1s.tpu_win >= (3 * BP_SPLIT + l1_config.params.tx_ra_load_split + l1_config.params.rx_synth_load_split)) 6130 if (l1s.tpu_win >= (3 * BP_SPLIT + l1_config.params.tx_ra_load_split + l1_config.params.rx_synth_load_split))
6313 { 6131 {
6132 static_nbmeas_to_report--;
6314 nbmeas_ctrl = 1; 6133 nbmeas_ctrl = 1;
6315 #if (FF_L1_FAST_DECODING == 1)
6316 if (fast_decoding == TRUE)
6317 {
6318 if(static_nbmeas_to_report > 5)
6319 static_nbmeas_to_report = 5;
6320
6321 if(l1a_l1s_com.ba_list.np_ctrl == 1)
6322 {
6323 update_num_pm_fp_table_for_rach(static_nbmeas_to_report,num_pm_fp);
6324 }
6325 }
6326 else
6327 {
6328
6329 update_num_pm_table_for_rach(static_nbmeas_to_report,num_pm);
6330
6331 }
6332 #else
6333
6334 update_num_pm_table_for_rach(static_nbmeas_to_report,num_pm);
6335
6336 #endif
6337 } 6134 }
6338 else 6135 else
6339 { 6136 {
6340 #if (FF_L1_FAST_DECODING == 1) 6137 nbmeas_ctrl = 2;
6341 if (fast_decoding)
6342 {
6343 nbmeas_ctrl = num_pm_fp[l1a_l1s_com.ba_list.np_ctrl-1];
6344 }
6345 else
6346 {
6347 nbmeas_ctrl = num_pm[l1a_l1s_com.ba_list.np_ctrl-1];
6348 }
6349 #else /* #if (FF_L1_FAST_DECODING == 1) */
6350 nbmeas_ctrl = num_pm[l1a_l1s_com.ba_list.np_ctrl-1];
6351 #endif /* #if (FF_L1_FAST_DECODING == 1) #else */
6352 } /* end else no RACH */ 6138 } /* end else no RACH */
6353 6139
6354 for(i=0; i<nbmeas_ctrl; i++) 6140 for(i=0; i<nbmeas_ctrl; i++)
6355 { 6141 {
6356 UWORD8 lna_off; 6142 UWORD8 lna_off;
6362 ba_index_ctrl = l1a_l1s_com.ba_list.next_to_ctrl; 6148 ba_index_ctrl = l1a_l1s_com.ba_list.next_to_ctrl;
6363 radio_freq_ctrl = l1a_l1s_com.ba_list.A[ba_index_ctrl].radio_freq; 6149 radio_freq_ctrl = l1a_l1s_com.ba_list.A[ba_index_ctrl].radio_freq;
6364 6150
6365 #if (L1_FF_MULTIBAND == 0) 6151 #if (L1_FF_MULTIBAND == 0)
6366 6152
6153 // Get AGC according to the last known IL.
6154 agc = Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level >> 1, PWR_ID);
6367 lna_off = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off; 6155 lna_off = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off;
6368 // Get AGC according to the last known IL.
6369 agc = Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level >> 1, PWR_ID,lna_off);
6370 6156
6371 // Memorize the IL used for AGC setting. 6157 // Memorize the IL used for AGC setting.
6372 l1a_l1s_com.ba_list.used_il[i] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level; 6158 l1a_l1s_com.ba_list.used_il[i] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level;
6373 l1a_l1s_com.ba_list.used_lna[i] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off; 6159 l1a_l1s_com.ba_list.used_lna[i] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off;
6374 6160
6378 l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq_ctrl); 6164 l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq_ctrl);
6379 6165
6380 lna_off = l1a_l1s_com.last_input_level[operative_radio_freq].lna_off; 6166 lna_off = l1a_l1s_com.last_input_level[operative_radio_freq].lna_off;
6381 // Get AGC according to the last known IL. 6167 // Get AGC according to the last known IL.
6382 agc = 6168 agc =
6383 Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[operative_radio_freq].input_level >> 1, PWR_ID,lna_off); 6169 Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[operative_radio_freq].input_level >> 1, PWR_ID);
6384 6170
6385 // Memorize the IL used for AGC setting. 6171 // Memorize the IL used for AGC setting.
6386 l1a_l1s_com.ba_list.used_il[i] = 6172 l1a_l1s_com.ba_list.used_il[i] =
6387 l1a_l1s_com.last_input_level[operative_radio_freq].input_level; 6173 l1a_l1s_com.last_input_level[operative_radio_freq].input_level;
6388 l1a_l1s_com.ba_list.used_lna[i] = 6174 l1a_l1s_com.ba_list.used_lna[i] =
6544 #if (TRACE_TYPE!=0) && (TRACE_TYPE!=5) 6330 #if (TRACE_TYPE!=0) && (TRACE_TYPE!=5)
6545 trace_fct(CST_READ_D_BA_MEAS, (UWORD32)(-1));//OMAPS00090550 6331 trace_fct(CST_READ_D_BA_MEAS, (UWORD32)(-1));//OMAPS00090550
6546 #endif 6332 #endif
6547 6333
6548 // Read power measurement result from DSP. 6334 // Read power measurement result from DSP.
6549 pm = (l1s_dsp_com.dsp_db_r_ptr->a_pm[0] & 0xffff); 6335 pm = (l1s_dsp_com.dsp_db_r_ptr->a_pm[0] & 0xffff) >> 5;
6550 l1_check_pm_error(pm, D_BA_MEAS_ID); 6336 l1_check_pm_error(pm, D_BA_MEAS_ID);
6551 pm = pm >> 5;
6552 6337
6553 #if (TRACE_TYPE==3) 6338 #if (TRACE_TYPE==3)
6554 stats_samples_pm(pm); 6339 stats_samples_pm(pm);
6555 #endif 6340 #endif
6556 6341
6599 ba_index_ctrl = l1a_l1s_com.ba_list.next_to_ctrl; 6384 ba_index_ctrl = l1a_l1s_com.ba_list.next_to_ctrl;
6600 radio_freq_ctrl = l1a_l1s_com.ba_list.A[ba_index_ctrl].radio_freq; 6385 radio_freq_ctrl = l1a_l1s_com.ba_list.A[ba_index_ctrl].radio_freq;
6601 6386
6602 #if (L1_FF_MULTIBAND == 0) 6387 #if (L1_FF_MULTIBAND == 0)
6603 6388
6389 agc = Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level >> 1, PWR_ID);
6604 lna_off = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off; 6390 lna_off = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off;
6605 agc = Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level >> 1, PWR_ID, lna_off);
6606 6391
6607 6392
6608 // Store IL used for current CTRL in order to be able to build IL from pm 6393 // Store IL used for current CTRL in order to be able to build IL from pm
6609 // in READ phase. 6394 // in READ phase.
6610 l1a_l1s_com.ba_list.used_il[0] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level; 6395 l1a_l1s_com.ba_list.used_il[0] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level;
6616 l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq_ctrl); 6401 l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq_ctrl);
6617 6402
6618 lna_off = 6403 lna_off =
6619 l1a_l1s_com.last_input_level[operative_radio_freq].lna_off; 6404 l1a_l1s_com.last_input_level[operative_radio_freq].lna_off;
6620 agc = 6405 agc =
6621 Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[operative_radio_freq].input_level >> 1, PWR_ID, lna_off); 6406 Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[operative_radio_freq].input_level >> 1, PWR_ID);
6622 6407
6623 6408
6624 // Store IL used for current CTRL in order to be able to build IL from pm 6409 // Store IL used for current CTRL in order to be able to build IL from pm
6625 // in READ phase. 6410 // in READ phase.
6626 l1a_l1s_com.ba_list.used_il[0] = 6411 l1a_l1s_com.ba_list.used_il[0] =
6719 ba_index_ctrl = l1a_l1s_com.ba_list.next_to_ctrl; 6504 ba_index_ctrl = l1a_l1s_com.ba_list.next_to_ctrl;
6720 radio_freq_ctrl = l1a_l1s_com.ba_list.A[ba_index_ctrl].radio_freq; 6505 radio_freq_ctrl = l1a_l1s_com.ba_list.A[ba_index_ctrl].radio_freq;
6721 6506
6722 #if (L1_FF_MULTIBAND == 0) 6507 #if (L1_FF_MULTIBAND == 0)
6723 6508
6509 agc = Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level >> 1, PWR_ID);
6724 lna_off = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off; 6510 lna_off = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off;
6725 agc = Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level >> 1, PWR_ID,lna_off);
6726 6511
6727 // Store IL used for current CTRL in order to be able to build IL from pm 6512 // Store IL used for current CTRL in order to be able to build IL from pm
6728 // in READ phase. 6513 // in READ phase.
6729 l1a_l1s_com.ba_list.used_il[0] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level; 6514 l1a_l1s_com.ba_list.used_il[0] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].input_level;
6730 l1a_l1s_com.ba_list.used_lna[0] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off; 6515 l1a_l1s_com.ba_list.used_lna[0] = l1a_l1s_com.last_input_level[radio_freq_ctrl - l1_config.std.radio_freq_index_offset].lna_off;
6734 operative_radio_freq = 6519 operative_radio_freq =
6735 l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq_ctrl); 6520 l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq_ctrl);
6736 lna_off = 6521 lna_off =
6737 l1a_l1s_com.last_input_level[operative_radio_freq].lna_off; 6522 l1a_l1s_com.last_input_level[operative_radio_freq].lna_off;
6738 agc = 6523 agc =
6739 Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[operative_radio_freq].input_level >> 1, PWR_ID,lna_off); 6524 Cust_get_agc_from_IL(radio_freq_ctrl, l1a_l1s_com.last_input_level[operative_radio_freq].input_level >> 1, PWR_ID);
6740 6525
6741 // Store IL used for current CTRL in order to be able to build IL from pm 6526 // Store IL used for current CTRL in order to be able to build IL from pm
6742 // in READ phase. 6527 // in READ phase.
6743 l1a_l1s_com.ba_list.used_il[0] = 6528 l1a_l1s_com.ba_list.used_il[0] =
6744 l1a_l1s_com.last_input_level[operative_radio_freq].input_level; 6529 l1a_l1s_com.last_input_level[operative_radio_freq].input_level;
7389 || ( (l1a_l1s_com.dedic_set.SignalCode == MPHC_ASYNC_HO_REQ) && (process_assign_now == TRUE) ) 7174 || ( (l1a_l1s_com.dedic_set.SignalCode == MPHC_ASYNC_HO_REQ) && (process_assign_now == TRUE) )
7390 || ( l1a_l1s_com.dedic_set.SignalCode == MPHC_HANDOVER_FAIL_REQ) 7175 || ( l1a_l1s_com.dedic_set.SignalCode == MPHC_HANDOVER_FAIL_REQ)
7391 || ( l1a_l1s_com.dedic_set.SignalCode == MPHC_CHANGE_FREQUENCY) ) 7176 || ( l1a_l1s_com.dedic_set.SignalCode == MPHC_CHANGE_FREQUENCY) )
7392 // A new channel is given in fset... 7177 // A new channel is given in fset...
7393 { 7178 {
7394 // Reset DTX AMR status 7179 #if 0 /* FreeCalypso TCS211 reconstruction */
7395 #if (AMR == 1) 7180 // Reset DTX AMR status
7396 l1s.dtx_amr_dl_on=FALSE; 7181 #if (AMR == 1)
7397 #endif 7182 l1s.dtx_amr_dl_on=FALSE;
7183 #endif
7184 #endif
7398 // When a Dedicated mode request is pending, L1S must be ran every frame 7185 // When a Dedicated mode request is pending, L1S must be ran every frame
7399 // to be able to cope with STI. 7186 // to be able to cope with STI.
7400 l1a_l1s_com.time_to_next_l1s_task = 0; 7187 l1a_l1s_com.time_to_next_l1s_task = 0;
7401 7188
7402 // Set the default channel/description. 7189 // Set the default channel/description.
7518 (new_channel_type != TCH_H)) 7305 (new_channel_type != TCH_H))
7519 { 7306 {
7520 l1a_l1s_com.dedic_set.stop_tch = TRUE; 7307 l1a_l1s_com.dedic_set.stop_tch = TRUE;
7521 7308
7522 /* 7309 /*
7523 * FreeCalypso change: this module was failing to compile without 7310 * FreeCalypso TCS211 reconstruction: the following code
7524 * AUDIO_TASK enabled because of the following code; 7311 * appears to be a LoCosto-ism, so let's take it out.
7525 * conditional has been added.
7526 */ 7312 */
7527 #if AUDIO_TASK 7313 #if 0
7528 // If audio enabling was forced by L1S because of a HO failure, do not force it anymore. 7314 // If audio enabling was forced by L1S because of a HO failure, do not force it anymore.
7529 // Restore it in the state required by the MMI if the feature is compiled. 7315 // Restore it in the state required by the MMI if the feature is compiled.
7530 if (l1a_l1s_com.audio_forced_by_l1s == TRUE) 7316 if (l1a_l1s_com.audio_forced_by_l1s == TRUE)
7531 { 7317 {
7532 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) 7318 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1)
7631 7417
7632 #if (L1_AMR_NSYNC == 1) 7418 #if (L1_AMR_NSYNC == 1)
7633 // AMR NSYNC bit: set to 0 by load_amr_param, set to 1 if HO from AMR cell to AMR cell, reset by DSP 7419 // AMR NSYNC bit: set to 0 by load_amr_param, set to 1 if HO from AMR cell to AMR cell, reset by DSP
7634 if ( (current_channel_mode == TCH_AFS_MODE) || (current_channel_mode == TCH_AHS_MODE) ) 7420 if ( (current_channel_mode == TCH_AFS_MODE) || (current_channel_mode == TCH_AHS_MODE) )
7635 { 7421 {
7636 #if (FF_L1_TCH_VOCODER_CONTROL == 1) 7422 #if (FF_L1_TCH_VOCODER_CONTROL == 1)
7637 if(l1a_l1s_com.dedic_set.vocoder_on == TRUE) 7423 if(l1a_l1s_com.dedic_set.vocoder_on == TRUE)
7638 { 7424 {
7639 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[NSYNC_INDEX] |= (1 << NSYNC_SHIFT); 7425 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[NSYNC_INDEX] |= (1 << NSYNC_SHIFT);
7640 } 7426 }
7641 #else 7427 #else
7642 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[NSYNC_INDEX] |= (1 << NSYNC_SHIFT); 7428 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[NSYNC_INDEX] |= (1 << NSYNC_SHIFT);
7643 #endif 7429 #endif
7644 } 7430 }
7645 #endif 7431 #endif
7646 7432
7647 // Set the flag to tell to DSP that a new AMR config is ready in the API memory 7433 // Set the flag to tell to DSP that a new AMR config is ready in the API memory
7648 l1a_l1s_com.dedic_set.sync_amr = TRUE; 7434 l1a_l1s_com.dedic_set.sync_amr = TRUE;
7814 else 7600 else
7815 if(l1a_l1s_com.dedic_set.SignalCode == MPHC_STOP_DEDICATED_REQ) 7601 if(l1a_l1s_com.dedic_set.SignalCode == MPHC_STOP_DEDICATED_REQ)
7816 // All channel must be aborted... 7602 // All channel must be aborted...
7817 { 7603 {
7818 // Perform the functions below if there is active dedicated set. 7604 // Perform the functions below if there is active dedicated set.
7819 // This check is to take care of race condition which can happen 7605 // This check is to take care of race condition which can happen
7820 // if MPHC_STOP_DEDICATED_REQ is receivedm before MPHC_HANDOVER_FAIL_REQ 7606 // if MPHC_STOP_DEDICATED_REQ is receivedm before MPHC_HANDOVER_FAIL_REQ
7821 if (l1a_l1s_com.dedic_set.aset!=NULL) 7607 #if 0 /* FreeCalypso TCS211 reconstruction */
7822 { 7608 if (l1a_l1s_com.dedic_set.aset!=NULL)
7823 7609 {
7824 // Stop TCH/F and TCH/H (stop Omega) (used in SYNCHRO task). 7610 #endif
7825 UWORD8 channel_type = l1a_l1s_com.dedic_set.aset->chan1.desc.channel_type; 7611
7826 if((channel_type == TCH_F) || (channel_type == TCH_H)) 7612 // Stop TCH/F and TCH/H (stop Omega) (used in SYNCHRO task).
7827 { 7613 UWORD8 channel_type = l1a_l1s_com.dedic_set.aset->chan1.desc.channel_type;
7828 l1a_l1s_com.dedic_set.stop_tch = TRUE; 7614 if((channel_type == TCH_F) || (channel_type == TCH_H))
7829 7615 {
7830 /* FreeCalypso change: same situation as earlier in this function */ 7616 l1a_l1s_com.dedic_set.stop_tch = TRUE;
7831 #if AUDIO_TASK 7617
7832 // If audio enabling was forced by L1S because of a HO failure, do not force it anymore. 7618 /* FreeCalypso change: same situation as earlier in this function */
7833 // Restore it in the state required by the MMI if the feature is compiled. 7619 #if 0
7834 if (l1a_l1s_com.audio_forced_by_l1s == TRUE) 7620 // If audio enabling was forced by L1S because of a HO failure, do not force it anymore.
7835 { 7621 // Restore it in the state required by the MMI if the feature is compiled.
7836 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) 7622 if (l1a_l1s_com.audio_forced_by_l1s == TRUE)
7837 if (l1a_l1s_com.audio_onoff_task.parameters.onoff_value == FALSE)
7838 { 7623 {
7839 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP;
7840 }
7841 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF
7842 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP;
7843 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF
7844 l1a_l1s_com.audio_forced_by_l1s = FALSE;
7845 }
7846 #endif
7847
7848 #if (AMR == 1)
7849 // Reset DTX AMR status
7850 l1s.dtx_amr_dl_on=FALSE;
7851 #endif
7852
7853 }
7854
7855 // Clear ciphering setting in MCU-DSP com.
7856 l1ddsp_load_ciph_param(0, &(l1a_l1s_com.dedic_set.aset->ciph_key));
7857
7858 // Reset the global dedicated enable flag.
7859 l1a_l1s_com.l1s_en_task[DEDIC] = TASK_DISABLED;
7860 l1a_l1s_com.l1s_en_task[DDL] = TASK_DISABLED;
7861 l1a_l1s_com.l1s_en_task[DUL] = TASK_DISABLED;
7862 l1a_l1s_com.l1s_en_task[ADL] = TASK_DISABLED;
7863 l1a_l1s_com.l1s_en_task[AUL] = TASK_DISABLED;
7864 l1a_l1s_com.l1s_en_task[TCHTH] = TASK_DISABLED;
7865 l1a_l1s_com.l1s_en_task[TCHD] = TASK_DISABLED;
7866 l1a_l1s_com.l1s_en_task[TCHTF] = TASK_DISABLED;
7867 l1a_l1s_com.l1s_en_task[TCHA] = TASK_DISABLED;
7868
7869
7870 // Reset active dedicated set.
7871 l1a_l1s_com.dedic_set.aset = NULL;
7872
7873 }
7874 else
7875 {
7876 /* FreeCalypso change: same AUDIO_TASK situation as earlier */
7877 #if AUDIO_TASK
7878 if (l1a_l1s_com.audio_forced_by_l1s == TRUE)
7879 {
7880 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) 7624 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1)
7881 if (l1a_l1s_com.audio_onoff_task.parameters.onoff_value == FALSE) 7625 if (l1a_l1s_com.audio_onoff_task.parameters.onoff_value == FALSE)
7882 { 7626 {
7883 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; 7627 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP;
7884 } 7628 }
7885 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF 7629 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF
7886 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; 7630 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP;
7887 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF 7631 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF
7888 l1a_l1s_com.audio_forced_by_l1s = FALSE; 7632 l1a_l1s_com.audio_forced_by_l1s = FALSE;
7889 } 7633 }
7890 #endif 7634 #endif
7891 #if (AMR == 1) 7635
7892 // Reset DTX AMR status 7636 #if (AMR == 1)
7893 l1s.dtx_amr_dl_on=FALSE; 7637 // Reset DTX AMR status
7894 #endif 7638 l1s.dtx_amr_dl_on=FALSE;
7895 } 7639 #endif
7896 7640
7897 // Clear d_ra_conf => default value 7641 }
7898 l1s_dsp_com.dsp_ndb_ptr->d_ra_conf = 0; 7642
7899 7643 // Clear d_ra_conf => default value
7900 // Reset input msg. 7644 l1s_dsp_com.dsp_ndb_ptr->d_ra_conf = 0;
7901 l1a_l1s_com.dedic_set.SignalCode = NULL; 7645
7902 #if ((REL99 == 1) && (FF_BHO == 1)) 7646 // Clear ciphering setting in MCU-DSP com.
7903 // this is required in BHO as you need to retain the previous channel info. 7647 l1ddsp_load_ciph_param(0, &(l1a_l1s_com.dedic_set.aset->ciph_key));
7904 //This is checked in HO_REQ to L1S.....In normal handover this does not happen 7648
7905 if(l1a_l1s_com.dedic_set.handover_type == NORMAL_HANDOVER) 7649 // Reset the global dedicated enable flag.
7906 { 7650 l1a_l1s_com.l1s_en_task[DEDIC] = TASK_DISABLED;
7651 l1a_l1s_com.l1s_en_task[DDL] = TASK_DISABLED;
7652 l1a_l1s_com.l1s_en_task[DUL] = TASK_DISABLED;
7653 l1a_l1s_com.l1s_en_task[ADL] = TASK_DISABLED;
7654 l1a_l1s_com.l1s_en_task[AUL] = TASK_DISABLED;
7655 l1a_l1s_com.l1s_en_task[TCHTH] = TASK_DISABLED;
7656 l1a_l1s_com.l1s_en_task[TCHD] = TASK_DISABLED;
7657 l1a_l1s_com.l1s_en_task[TCHTF] = TASK_DISABLED;
7658 l1a_l1s_com.l1s_en_task[TCHA] = TASK_DISABLED;
7659
7660 #if 0 /* FreeCalypso TCS211 reconstruction */
7661 }
7662 else
7663 {
7664 /* FreeCalypso change: same AUDIO_TASK situation as earlier */
7665 #if 0
7666 if (l1a_l1s_com.audio_forced_by_l1s == TRUE)
7667 {
7668 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1)
7669 if (l1a_l1s_com.audio_onoff_task.parameters.onoff_value == FALSE)
7670 {
7671 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP;
7672 }
7673 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF
7674 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP;
7675 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF
7676 l1a_l1s_com.audio_forced_by_l1s = FALSE;
7677 }
7678 #endif
7679 #if (AMR == 1)
7680 // Reset DTX AMR status
7681 l1s.dtx_amr_dl_on=FALSE;
7682 #endif
7683
7684 // Clear d_ra_conf => default value
7685 l1s_dsp_com.dsp_ndb_ptr->d_ra_conf = 0;
7686 }
7687 #endif /* FreeCalypso TCS211 reconstruction */
7688
7689 // Reset input msg.
7690 l1a_l1s_com.dedic_set.SignalCode = NULL;
7691 #if ((REL99 == 1) && (FF_BHO == 1))
7692 // this is required in BHO as you need to retain the previous channel info.
7693 //This is checked in HO_REQ to L1S.....In normal handover this does not happen
7694 if(l1a_l1s_com.dedic_set.handover_type == NORMAL_HANDOVER)
7695 {
7696 // Reset active dedicated set.
7697 l1a_l1s_com.dedic_set.aset = NULL;
7698 }
7699 #else
7907 // Reset active dedicated set. 7700 // Reset active dedicated set.
7908 l1a_l1s_com.dedic_set.aset = NULL; 7701 l1a_l1s_com.dedic_set.aset = NULL;
7909 } 7702 #endif
7910 #else
7911 // Reset active dedicated set.
7912 l1a_l1s_com.dedic_set.aset = NULL;
7913 #endif
7914 7703
7915 // SYNCHRO task and its associated parameters (tn_difference, dl_tn and 7704 // SYNCHRO task and its associated parameters (tn_difference, dl_tn and
7916 // dsp_scheduler_mode) are not Enabled/Updated if we are in the specific case: 7705 // dsp_scheduler_mode) are not Enabled/Updated if we are in the specific case:
7917 // L1A is touching SYNCHRO parameters and leave L1A to go in HISR (L1S) 7706 // L1A is touching SYNCHRO parameters and leave L1A to go in HISR (L1S)
7918 // in middle of the update (cf. BUG1339) 7707 // in middle of the update (cf. BUG1339)
8193 l1a_l1s_com.dedic_set.stop_tch = TRUE; 7982 l1a_l1s_com.dedic_set.stop_tch = TRUE;
8194 7983
8195 /* 7984 /*
8196 * FreeCalypso change: same AUDIO_TASK conditional issue as earlier. 7985 * FreeCalypso change: same AUDIO_TASK conditional issue as earlier.
8197 */ 7986 */
8198 #if AUDIO_TASK 7987 #if 0
8199 // CQ: Force the Audio ON to avoid having the DSP reseting the VDLON and producing a pop noise 7988 // CQ: Force the Audio ON to avoid having the DSP reseting the VDLON and producing a pop noise
8200 // on single ended outputs. 7989 // on single ended outputs.
8201 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_ON_START; 7990 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_ON_START;
8202 l1s.l1_audio_it_com = TRUE; 7991 l1s.l1_audio_it_com = TRUE;
8203 l1a_l1s_com.audio_forced_by_l1s = TRUE; 7992 l1a_l1s_com.audio_forced_by_l1s = TRUE;
8204 #endif 7993 #endif
8205 } 7994 }
7995
7996 /*
7997 * FreeCalypso: the following code has been reconstructed from the
7998 * TCS211 binary object; it appears neither in the LoCosto nor
7999 * in the TSM30 source.
8000 */
8001 #if (AEC)
8002 if((l1s.aec.aec_control & 0x0002) || (l1s.aec.aec_control & 0x0004)) {
8003 l1s.aec.aec_control = l1a_l1s_com.aec_task.parameters.aec_control
8004 | 0x0001;
8005 l1s_dsp_com.dsp_ndb_ptr->d_aec_ctrl = l1s.aec.aec_control;
8006 }
8007 #endif
8206 8008
8207 // Clear ciphering setting in MCU-DSP com. 8009 // Clear ciphering setting in MCU-DSP com.
8208 l1ddsp_load_ciph_param(0, &(l1a_l1s_com.dedic_set.aset->ciph_key)); 8010 l1ddsp_load_ciph_param(0, &(l1a_l1s_com.dedic_set.aset->ciph_key));
8209 8011
8210 // Reset the global dedicated enable flag. 8012 // Reset the global dedicated enable flag.
8535 #endif /* FF_L1_FAST_DECODING */ 8337 #endif /* FF_L1_FAST_DECODING */
8536 8338
8537 //#pragma DUPLICATE_FOR_INTERNAL_RAM_END 8339 //#pragma DUPLICATE_FOR_INTERNAL_RAM_END
8538 #endif // MOVE_IN_INTERNAL_RAM 8340 #endif // MOVE_IN_INTERNAL_RAM
8539 8341
8540
8541 /* Added temporirly for RF_KEypad build */
8542 #if (L1_RF_KBD_FIX == 1)
8543
8544 #if(OP_L1_STANDALONE == 1)
8545
8546 /* Modify the KPD timer values */
8547 void kpd_timer_modify(UWORD8 ratio,UWORD32 frameNumber)
8548 {
8549 UWORD32 debounce_time, long_key_time, timeout_time, temp_count, local_ratio;
8550 WORD32 ptv_value;
8551 UWORD16 keypad_state;
8552
8553 keypad_state = ((*(volatile UINT16*) KBR_STATE_MACHINE_STATUS) & 0x0f);
8554
8555 debounce_time = (*(volatile UINT16*) KBR_DEBOUNCING_TIME) & 0x3f;
8556 local_ratio = KPD_DEBOUNCING_TIME / debounce_time;
8557
8558 if( keypad_state == 2 || keypad_state == 3 || keypad_state == 4)
8559 {
8560 ptv_value = KPD_CLOCK_DIVIDER;
8561
8562 if( ratio > 1)
8563 {
8564 if( ratio % 2)
8565 {
8566 ratio += 1;
8567 }
8568 if( !ratio )
8569 ratio = 2;
8570
8571 for(temp_count = 0; ratio > 1 && temp_count < 7; temp_count++)
8572 {
8573 ratio /= 2;
8574 }
8575
8576 ptv_value -= temp_count;
8577 }
8578
8579 if( local_ratio > 1)
8580 {
8581 if( ratio % 2)
8582 {
8583 ratio += 1;
8584 }
8585 if( !ratio )
8586 ratio = 2;
8587
8588 for(temp_count = 0; ratio > 1 && temp_count < 7; temp_count++)
8589 {
8590 ratio /= 2;
8591 }
8592
8593 ptv_value += temp_count;
8594 }
8595
8596 if( ptv_value < 0)
8597 ptv_value = 0;
8598
8599 /* Change the PTV value */
8600 SetGroupBits16(*(volatile unsigned short *)(KBR_CTRL_REG), 2, 3, ptv_value);
8601 }
8602 else
8603 {
8604
8605 debounce_time = ((*(volatile UINT16*) KBR_DEBOUNCING_TIME) & 0x3f) * local_ratio;
8606 long_key_time = ((*(volatile UINT16*)KBR_LONG_KEY_TIME) & 0xfff) * local_ratio;
8607 timeout_time = (*(volatile UINT16*) KBR_TIME_OUT) * local_ratio;
8608 // kpd_env_ctrl_blk->long_time *= local_ratio;
8609 // kpd_env_ctrl_blk->repeat_time *= local_ratio;
8610 ptv_value = ((*(volatile UINT16*) KBR_CTRL_REG) & 0x1c) >> 2;
8611
8612 if( ptv_value != KPD_CLOCK_DIVIDER)
8613 {
8614 /* Change the PTV value */
8615 SetGroupBits16(*(volatile unsigned short *)(KBR_CTRL_REG), 2, 3, KPD_CLOCK_DIVIDER);
8616 }
8617
8618 if( ratio > 0 )
8619 {
8620 (*(volatile UINT16*) KBR_DEBOUNCING_TIME) = debounce_time / ratio;
8621 (*(volatile UINT16*) KBR_LONG_KEY_TIME) = long_key_time / ratio;
8622 (*(volatile UINT16*)KBR_TIME_OUT) = timeout_time / ratio;
8623 // kpd_env_ctrl_blk->long_time /= ratio;
8624 // kpd_env_ctrl_blk->repeat_time /= ratio;
8625 }
8626 }
8627
8628 }
8629
8630
8631 void kpd_state_probe(UWORD32 frameNumber)
8632 {
8633 // not used in stand alone
8634 }
8635
8636 #endif
8637
8638 #endif/* #if (L1_RF_KBD_FIX == 1) */
8639
8640 /* Added temporirly for RF_KEypad build */
8641
8642
8643
8644 //This function calculates and returns the number of PM to scheduled during page block monitor
8645 UWORD8 calc_num_pm_to_report()
8646 {
8647 UWORD8 time_for_balist_meas;
8648 UWORD8 num_pms_drx;
8649
8650 time_for_balist_meas = ((((((5*l1a_l1s_com.ba_list.nbr_carrier)+6)/7)*l1a_l1s_com.bs_pa_mfrms /4)+1) > 5)?(((((5*l1a_l1s_com.ba_list.nbr_carrier)+6)/7)*l1a_l1s_com.bs_pa_mfrms /4)+1):5;
8651
8652 if(time_for_balist_meas == 5)
8653 {
8654 num_pms_drx = ((5*l1a_l1s_com.ba_list.nbr_carrier*l1a_l1s_com.bs_pa_mfrms*51*577*8)/(time_for_balist_meas*1000*1000))+1;
8655 }
8656 else
8657 {
8658 num_pms_drx = ((5*l1a_l1s_com.ba_list.nbr_carrier*28*51*577*8)/(((5*l1a_l1s_com.ba_list.nbr_carrier)+6)*1000*1000))+1;
8659 }
8660
8661 return(num_pms_drx);
8662 }
8663
8664
8665
8666 void update_num_pm_fp_table_for_rach(UWORD8 nbmeas,UWORD8 *p)
8667 {
8668
8669 switch(nbmeas)
8670 {
8671 case 1:
8672 case 2: break;
8673 case 3: p[0]=1;
8674 p[1]=2;
8675 break;
8676 case 4: p[0]=1;
8677 p[1]=3;
8678 break;
8679 case 5: p[0]=1;
8680 p[1]=4;
8681 break;
8682 case 6: p[0]=1;
8683 p[1]=4;
8684 break;
8685 case 7: p[0]=1;
8686 p[1]=4;
8687 break;
8688 }
8689
8690 }
8691
8692
8693
8694 void update_num_pm_table_for_rach(UWORD8 nbmeas,UWORD8 *p)
8695 {
8696 switch(nbmeas)
8697 {
8698 case 1:
8699 case 2:
8700 case 3:
8701 case 4: break;
8702 case 5: if(l1a_l1s_com.ba_list.np_ctrl == 1)
8703 {
8704 p[0]=1;
8705 p[1]=2;
8706 p[2]=1;
8707 p[3]=1;
8708 }
8709 else if(l1a_l1s_com.ba_list.np_ctrl == 2)
8710 {
8711 p[0]=2;
8712 p[1]=1;
8713 p[2]=1;
8714 p[3]=1;
8715 }
8716 else if(l1a_l1s_com.ba_list.np_ctrl == 3)
8717 {
8718 p[0]=2;
8719 p[1]=1;
8720 p[2]=1;
8721 p[3]=1;
8722 }
8723 break;
8724 case 6: if(l1a_l1s_com.ba_list.np_ctrl == 1)
8725 {
8726 p[0]=1;
8727 p[1]=2;
8728 p[2]=2;
8729 p[3]=1;
8730 }
8731 else if(l1a_l1s_com.ba_list.np_ctrl == 2)
8732 {
8733 p[0]=2;
8734 p[1]=1;
8735 p[2]=2;
8736 p[3]=1;
8737 }
8738 else if(l1a_l1s_com.ba_list.np_ctrl == 3)
8739 {
8740 p[0]=2;
8741 p[1]=2;
8742 p[2]=1;
8743 p[3]=1;
8744 }
8745 break;
8746 case 7: if(l1a_l1s_com.ba_list.np_ctrl == 1)
8747 {
8748 p[0]=1;
8749 p[1]=2;
8750 p[2]=2;
8751 p[3]=2;
8752 }
8753 else if(l1a_l1s_com.ba_list.np_ctrl == 2)
8754 {
8755 p[0]=2;
8756 p[1]=1;
8757 p[2]=2;
8758 p[3]=2;
8759 }
8760 else if(l1a_l1s_com.ba_list.np_ctrl == 3)
8761 {
8762 p[0]=2;
8763 p[1]=2;
8764 p[2]=1;
8765 p[3]=2;
8766 }
8767 break;
8768 }
8769 }