FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/L1/cfile/l1_sync.c @ 568:ae24e49c41a9
L1: l1_sync.c compiles for XIP
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 10 Aug 2014 17:52:59 +0000 |
parents | 96a96ec34139 |
children | 9df89f93d311 |
comparison
equal
deleted
inserted
replaced
567:528fa901ae79 | 568:ae24e49c41a9 |
---|---|
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" | |
12 #include "l1_confg.h" | |
11 #include "l1_macro.h" | 13 #include "l1_macro.h" |
12 #include "l1_confg.h" | |
13 //#pragma DUPLICATE_FOR_INTERNAL_RAM_END | 14 //#pragma DUPLICATE_FOR_INTERNAL_RAM_END |
14 | 15 |
15 #if !((MOVE_IN_INTERNAL_RAM == 1) && (GSM_IDLE_RAM !=0)) // MOVE TO INTERNAL MEM IN CASE GSM_IDLE_RAM enabled | 16 #if !((MOVE_IN_INTERNAL_RAM == 1) && (GSM_IDLE_RAM !=0)) // MOVE TO INTERNAL MEM IN CASE GSM_IDLE_RAM enabled |
16 //#pragma GSM_IDLE_DUPLICATE_FOR_INTERNAL_RAM_START // KEEP IN EXTERNAL MEM otherwise | 17 //#pragma GSM_IDLE_DUPLICATE_FOR_INTERNAL_RAM_START // KEEP IN EXTERNAL MEM otherwise |
17 #define L1_SYNC_C | 18 #define L1_SYNC_C |
127 #if (L1_MIDI == 1) | 128 #if (L1_MIDI == 1) |
128 #include "l1midi_defty.h" | 129 #include "l1midi_defty.h" |
129 #endif | 130 #endif |
130 | 131 |
131 #include "l1_defty.h" | 132 #include "l1_defty.h" |
132 #include "cust_os.h" | 133 #include "../../gpf/inc/cust_os.h" |
133 #include "l1_msgty.h" | 134 #include "l1_msgty.h" |
134 #include "l1_varex.h" | 135 #include "l1_varex.h" |
135 #include "l1_proto.h" | 136 #include "l1_proto.h" |
136 #include "l1_mftab.h" | 137 #include "l1_mftab.h" |
137 #include "l1_tabs.h" | 138 #include "l1_tabs.h" |
140 | 141 |
141 #if L2_L3_SIMUL | 142 #if L2_L3_SIMUL |
142 #include "hw_debug.h" | 143 #include "hw_debug.h" |
143 #endif // L2_L3 SIMUL | 144 #endif // L2_L3 SIMUL |
144 | 145 |
145 #include "ulpd.h" | 146 #include "../../bsp/ulpd.h" |
146 #include "mem.h" | 147 #include "../../bsp/mem.h" |
147 #include "inth.h" | 148 #include "../../bsp/inth.h" |
148 #include "iq.h" | 149 #include "../../bsp/iq.h" |
149 | 150 |
150 #if L1_GPRS | 151 #if L1_GPRS |
151 #include "l1p_cons.h" | 152 #include "l1p_cons.h" |
152 #include "l1p_msgt.h" | 153 #include "l1p_msgt.h" |
153 #include "l1p_deft.h" | 154 #include "l1p_deft.h" |
172 #else | 173 #else |
173 #include "csmi/sleep.h" | 174 #include "csmi/sleep.h" |
174 #endif | 175 #endif |
175 #endif | 176 #endif |
176 | 177 |
177 #include "sys_conf.h" | 178 #if (CHIPSET >= 12) |
179 #include "sys_conf.h" | |
180 #endif | |
178 | 181 |
179 #if (OP_L1_STANDALONE != 1) && (WCP_PROF == 1) | 182 #if (OP_L1_STANDALONE != 1) && (WCP_PROF == 1) |
180 #include "prf/prf_api.h" | 183 #include "prf/prf_api.h" |
181 #endif | 184 #endif |
182 | 185 |
183 | 186 |
184 //Enhanced RSSI -OMAPS00075410 | 187 //Enhanced RSSI -OMAPS00075410 |
185 #define TOTAL_NO_OF_BITS_IDLE_MEAS 625 | 188 #define TOTAL_NO_OF_BITS_IDLE_MEAS 625 |
186 extern UWORD32 qual_acc_idle1[2]; | 189 extern UWORD32 qual_acc_idle1[2]; |
187 | 190 |
188 #include "tpudrv61.h" | 191 #if (RF_FAM == 61) |
192 #include "tpudrv61.h" | |
193 #endif | |
194 | |
189 #if W_A_DSP1 | 195 #if W_A_DSP1 |
190 UWORD8 old_sacch_DSP_bug = FALSE; | 196 UWORD8 old_sacch_DSP_bug = FALSE; |
191 #endif | 197 #endif |
192 | 198 |
193 #if (TRACE_TYPE == 6) | 199 #if (TRACE_TYPE == 6) |
366 | 372 |
367 #if (GSM_IDLE_RAM_DEBUG == 1) | 373 #if (GSM_IDLE_RAM_DEBUG == 1) |
368 (*( volatile unsigned short* )(0xFFFE4802)) |= (1 << 2); // GPIO-2=1 | 374 (*( volatile unsigned short* )(0xFFFE4802)) |= (1 << 2); // GPIO-2=1 |
369 #endif | 375 #endif |
370 | 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 | |
371 // Configure GPIO0 pin as output - Reset Bit 0 i.e. set Bit 0 to 0 | 386 // Configure GPIO0 pin as output - Reset Bit 0 i.e. set Bit 0 to 0 |
372 (*( volatile unsigned short* )(0xFFFE4804)) &= (~(1 << 0)); // GPIO-2=1 | 387 (*( volatile unsigned short* )(0xFFFE4804)) &= (~(1 << 0)); // GPIO-2=1 |
373 // write 1 in GPIO pin 0 | 388 // write 1 in GPIO pin 0 |
374 (*( volatile unsigned short* )(0xFFFE4802)) |= (1 << 0); // GPIO-2=1 | 389 (*( volatile unsigned short* )(0xFFFE4802)) |= (1 << 0); // GPIO-2=1 |
375 | 390 #endif |
376 | 391 |
377 // stop the gauging.This function must be called at the | 392 // stop the gauging.This function must be called at the |
378 // begining of the HISR in order to have the IT_GAUGING | 393 // begining of the HISR in order to have the IT_GAUGING |
379 // executed before the Deep sleep decision. | 394 // executed before the Deep sleep decision. |
380 // GOAL: reduce the wake up time by 1 frame | 395 // GOAL: reduce the wake up time by 1 frame |
516 // DSP CPU load measurement | 531 // DSP CPU load measurement |
517 l1_dsp_cpu_load_read(); | 532 l1_dsp_cpu_load_read(); |
518 } | 533 } |
519 #endif | 534 #endif |
520 | 535 |
536 #if 0 | |
521 // write 0 in GPIO pin 0 | 537 // write 0 in GPIO pin 0 |
522 (*( volatile unsigned short* )(0xFFFE4802)) &= (~(1 << 0)); // GPIO-2=1 | 538 (*( volatile unsigned short* )(0xFFFE4802)) &= (~(1 << 0)); // GPIO-2=1 |
523 | 539 #endif |
524 | 540 |
525 } | 541 } |
526 | 542 |
527 #endif // NO SIMULATION | 543 #endif // NO SIMULATION |
528 //#pragma GSM_IDLE_DUPLICATE_FOR_INTERNAL_RAM_END | 544 //#pragma GSM_IDLE_DUPLICATE_FOR_INTERNAL_RAM_END |
6059 | 6075 |
6060 // Serving cell measurements... | 6076 // Serving cell measurements... |
6061 // Accumulate the new measurement with the partial result. | 6077 // Accumulate the new measurement with the partial result. |
6062 // Compensate AGC for current measurement value. | 6078 // Compensate AGC for current measurement value. |
6063 l1a_l1s_com.Scell_info.meas.acc += l1a_l1s_com.Scell_IL_for_rxlev; | 6079 l1a_l1s_com.Scell_info.meas.acc += l1a_l1s_com.Scell_IL_for_rxlev; |
6064 static_s_rxlev_cntr++; | 6080 static_s_rxlev_cntr++; |
6065 | 6081 |
6066 // ********** | 6082 // ********** |
6067 // Reporting | 6083 // Reporting |
6068 // ********** | 6084 // ********** |
6069 if (static_read_index==static_nbmeas_to_report) | 6085 if (static_read_index==static_nbmeas_to_report) |
6123 qual_acc_idle1[0]= 0; | 6139 qual_acc_idle1[0]= 0; |
6124 qual_acc_idle1[1] =0; | 6140 qual_acc_idle1[1] =0; |
6125 | 6141 |
6126 // Reset pointer for debugg. | 6142 // Reset pointer for debugg. |
6127 pch_msg = NULL; | 6143 pch_msg = NULL; |
6128 static_s_rxlev_cntr = 0; | 6144 static_s_rxlev_cntr = 0; |
6129 } | 6145 } |
6130 | 6146 |
6131 }// end of READ | 6147 }// end of READ |
6132 | 6148 |
6133 // ********** | 6149 // ********** |
7499 (new_channel_type != TCH_F) && | 7515 (new_channel_type != TCH_F) && |
7500 (new_channel_type != TCH_H)) | 7516 (new_channel_type != TCH_H)) |
7501 { | 7517 { |
7502 l1a_l1s_com.dedic_set.stop_tch = TRUE; | 7518 l1a_l1s_com.dedic_set.stop_tch = TRUE; |
7503 | 7519 |
7520 /* | |
7521 * FreeCalypso change: this module was failing to compile without | |
7522 * AUDIO_TASK enabled because of the following code; | |
7523 * conditional has been added. | |
7524 */ | |
7525 #if AUDIO_TASK | |
7504 // If audio enabling was forced by L1S because of a HO failure, do not force it anymore. | 7526 // If audio enabling was forced by L1S because of a HO failure, do not force it anymore. |
7505 // Restore it in the state required by the MMI if the feature is compiled. | 7527 // Restore it in the state required by the MMI if the feature is compiled. |
7506 if (l1a_l1s_com.audio_forced_by_l1s == TRUE) | 7528 if (l1a_l1s_com.audio_forced_by_l1s == TRUE) |
7507 { | 7529 { |
7508 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) | 7530 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) |
7513 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF | 7535 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF |
7514 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; | 7536 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; |
7515 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF | 7537 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF |
7516 l1a_l1s_com.audio_forced_by_l1s = FALSE; | 7538 l1a_l1s_com.audio_forced_by_l1s = FALSE; |
7517 } | 7539 } |
7540 #endif | |
7518 } | 7541 } |
7519 | 7542 |
7520 // The new channel becomes the ACTIVE one. | 7543 // The new channel becomes the ACTIVE one. |
7521 l1a_l1s_com.dedic_set.aset = l1a_l1s_com.dedic_set.fset; | 7544 l1a_l1s_com.dedic_set.aset = l1a_l1s_com.dedic_set.fset; |
7522 | 7545 |
7800 UWORD8 channel_type = l1a_l1s_com.dedic_set.aset->chan1.desc.channel_type; | 7823 UWORD8 channel_type = l1a_l1s_com.dedic_set.aset->chan1.desc.channel_type; |
7801 if((channel_type == TCH_F) || (channel_type == TCH_H)) | 7824 if((channel_type == TCH_F) || (channel_type == TCH_H)) |
7802 { | 7825 { |
7803 l1a_l1s_com.dedic_set.stop_tch = TRUE; | 7826 l1a_l1s_com.dedic_set.stop_tch = TRUE; |
7804 | 7827 |
7828 /* FreeCalypso change: same situation as earlier in this function */ | |
7829 #if AUDIO_TASK | |
7805 // If audio enabling was forced by L1S because of a HO failure, do not force it anymore. | 7830 // If audio enabling was forced by L1S because of a HO failure, do not force it anymore. |
7806 // Restore it in the state required by the MMI if the feature is compiled. | 7831 // Restore it in the state required by the MMI if the feature is compiled. |
7807 if (l1a_l1s_com.audio_forced_by_l1s == TRUE) | 7832 if (l1a_l1s_com.audio_forced_by_l1s == TRUE) |
7808 { | 7833 { |
7809 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) | 7834 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) |
7814 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF | 7839 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF |
7815 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; | 7840 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; |
7816 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF | 7841 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF |
7817 l1a_l1s_com.audio_forced_by_l1s = FALSE; | 7842 l1a_l1s_com.audio_forced_by_l1s = FALSE; |
7818 } | 7843 } |
7844 #endif | |
7819 | 7845 |
7820 #if (AMR == 1) | 7846 #if (AMR == 1) |
7821 // Reset DTX AMR status | 7847 // Reset DTX AMR status |
7822 l1s.dtx_amr_dl_on=FALSE; | 7848 l1s.dtx_amr_dl_on=FALSE; |
7823 #endif | 7849 #endif |
7837 l1a_l1s_com.l1s_en_task[TCHD] = TASK_DISABLED; | 7863 l1a_l1s_com.l1s_en_task[TCHD] = TASK_DISABLED; |
7838 l1a_l1s_com.l1s_en_task[TCHTF] = TASK_DISABLED; | 7864 l1a_l1s_com.l1s_en_task[TCHTF] = TASK_DISABLED; |
7839 l1a_l1s_com.l1s_en_task[TCHA] = TASK_DISABLED; | 7865 l1a_l1s_com.l1s_en_task[TCHA] = TASK_DISABLED; |
7840 | 7866 |
7841 | 7867 |
7842 // Reset active dedicated set. | 7868 // Reset active dedicated set. |
7843 l1a_l1s_com.dedic_set.aset = NULL; | 7869 l1a_l1s_com.dedic_set.aset = NULL; |
7844 | 7870 |
7845 } | 7871 } |
7846 else | 7872 else |
7847 { | 7873 { |
7848 if (l1a_l1s_com.audio_forced_by_l1s == TRUE) | 7874 /* FreeCalypso change: same AUDIO_TASK situation as earlier */ |
7849 { | 7875 #if AUDIO_TASK |
7850 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) | 7876 if (l1a_l1s_com.audio_forced_by_l1s == TRUE) |
7851 if (l1a_l1s_com.audio_onoff_task.parameters.onoff_value == FALSE) | 7877 { |
7852 { | 7878 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) |
7853 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; | 7879 if (l1a_l1s_com.audio_onoff_task.parameters.onoff_value == FALSE) |
7854 } | 7880 { |
7855 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF | 7881 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; |
7856 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; | 7882 } |
7857 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF | 7883 #else // L1_EXTERNAL_AUDIO_VOICE_ONOFF |
7858 l1a_l1s_com.audio_forced_by_l1s = FALSE; | 7884 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_OFF_STOP; |
7859 } | 7885 #endif // L1_EXTERNAL_AUDIO_VOICE_ONOFF |
7860 #if (AMR == 1) | 7886 l1a_l1s_com.audio_forced_by_l1s = FALSE; |
7861 // Reset DTX AMR status | 7887 } |
7862 l1s.dtx_amr_dl_on=FALSE; | 7888 #endif |
7863 #endif | 7889 #if (AMR == 1) |
7864 | 7890 // Reset DTX AMR status |
7865 } | 7891 l1s.dtx_amr_dl_on=FALSE; |
7866 | 7892 #endif |
7867 // Clear d_ra_conf => default value | 7893 } |
7868 l1s_dsp_com.dsp_ndb_ptr->d_ra_conf = 0; | 7894 |
7869 | 7895 // Clear d_ra_conf => default value |
7870 // Reset input msg. | 7896 l1s_dsp_com.dsp_ndb_ptr->d_ra_conf = 0; |
7871 l1a_l1s_com.dedic_set.SignalCode = NULL; | 7897 |
7898 // Reset input msg. | |
7899 l1a_l1s_com.dedic_set.SignalCode = NULL; | |
7872 #if ((REL99 == 1) && (FF_BHO == 1)) | 7900 #if ((REL99 == 1) && (FF_BHO == 1)) |
7873 // this is required in BHO as you need to retain the previous channel info. | 7901 // this is required in BHO as you need to retain the previous channel info. |
7874 //This is checked in HO_REQ to L1S.....In normal handover this does not happen | 7902 //This is checked in HO_REQ to L1S.....In normal handover this does not happen |
7875 if(l1a_l1s_com.dedic_set.handover_type == NORMAL_HANDOVER) | 7903 if(l1a_l1s_com.dedic_set.handover_type == NORMAL_HANDOVER) |
7876 { | 7904 { |
8160 // Stop TCH/F and TCH/H (stop Omega) (used in SYNCHRO task) | 8188 // Stop TCH/F and TCH/H (stop Omega) (used in SYNCHRO task) |
8161 if((channel_type == TCH_F) || (channel_type == TCH_H)) | 8189 if((channel_type == TCH_F) || (channel_type == TCH_H)) |
8162 { | 8190 { |
8163 l1a_l1s_com.dedic_set.stop_tch = TRUE; | 8191 l1a_l1s_com.dedic_set.stop_tch = TRUE; |
8164 | 8192 |
8193 /* | |
8194 * FreeCalypso change: same AUDIO_TASK conditional issue as earlier. | |
8195 */ | |
8196 #if AUDIO_TASK | |
8165 // CQ: Force the Audio ON to avoid having the DSP reseting the VDLON and producing a pop noise | 8197 // CQ: Force the Audio ON to avoid having the DSP reseting the VDLON and producing a pop noise |
8166 // on single ended outputs. | 8198 // on single ended outputs. |
8167 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_ON_START; | 8199 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init |= (API) B_AUDIO_ON_START; |
8168 l1s.l1_audio_it_com = TRUE; | 8200 l1s.l1_audio_it_com = TRUE; |
8169 l1a_l1s_com.audio_forced_by_l1s = TRUE; | 8201 l1a_l1s_com.audio_forced_by_l1s = TRUE; |
8202 #endif | |
8170 } | 8203 } |
8171 | 8204 |
8172 // Clear ciphering setting in MCU-DSP com. | 8205 // Clear ciphering setting in MCU-DSP com. |
8173 l1ddsp_load_ciph_param(0, &(l1a_l1s_com.dedic_set.aset->ciph_key)); | 8206 l1ddsp_load_ciph_param(0, &(l1a_l1s_com.dedic_set.aset->ciph_key)); |
8174 | 8207 |