comparison L1/cfile/l1_func.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
7 * 7 *
8 ************* Revision Controle System Header *************/ 8 ************* Revision Controle System Header *************/
9 9
10 #define L1_FUNC_C 10 #define L1_FUNC_C
11 11
12 #include "config.h" 12 #include "l1_macro.h"
13 #include "l1_confg.h" 13 #include "l1_confg.h"
14 #include "l1_macro.h"
15 14
16 #if (CODE_VERSION == SIMULATION) 15 #if (CODE_VERSION == SIMULATION)
17 #include <string.h> 16 #include <string.h>
18 #include "l1_types.h" 17 #include "l1_types.h"
19 #include "sys_types.h" 18 #include "sys_types.h"
102 //ADDED FOR AAC 101 //ADDED FOR AAC
103 #if (L1_AAC == 1) 102 #if (L1_AAC == 1)
104 #include "l1aac_defty.h" 103 #include "l1aac_defty.h"
105 #endif 104 #endif
106 #include "l1_defty.h" 105 #include "l1_defty.h"
107 #include "../../gpf/inc/cust_os.h" 106 #include "cust_os.h"
108 #include "l1_msgty.h" 107 #include "l1_msgty.h"
109 #include "l1_varex.h" 108 #include "l1_varex.h"
110 #include "l1_proto.h" 109 #include "l1_proto.h"
111 #include "l1_mftab.h" 110 #include "l1_mftab.h"
112 #include "l1_tabs.h" 111 #include "l1_tabs.h"
113 #include "l1_ver.h" 112 #include "l1_ver.h"
114 #include "tpudrv.h" 113 #include "tpudrv.h"
115 114
116 #include "../../bsp/mem.h" 115 #include "mem.h"
117 #include "../../bsp/inth.h" 116 #include "inth.h"
118 #include "../../bsp/clkm.h" 117 #include "clkm.h"
119 #include "../../bsp/rhea_arm.h" 118 #include "rhea_arm.h"
120 #include "../../bsp/dma.h" 119 #include "dma.h"
121 #include "../../bsp/ulpd.h" 120 #include "ulpd.h"
122 #include "../dsp/leadapi.h" 121 #include "leadapi.h"
123 122
124 #if (OP_L1_STANDALONE) 123 #if (OP_L1_STANDALONE)
125 #if (CHIPSET == 4) || (CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || \ 124 #if (CHIPSET == 4) || (CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || \
126 (CHIPSET == 11) || (CHIPSET == 12) || (CHIPSET == 15) 125 (CHIPSET == 11) || (CHIPSET == 12) || (CHIPSET == 15)
127 #include "dynamic_clock.h" 126 #include "dynamic_clock.h"
148 147
149 #if (CODE_VERSION != SIMULATION) 148 #if (CODE_VERSION != SIMULATION)
150 149
151 /* DSP patch */ 150 /* DSP patch */
152 #if (DWNLD == NO_DWNLD) 151 #if (DWNLD == NO_DWNLD)
153 const UWORD8 patch_array[1] = {0}; 152 const UWORD8 patch_array[1];
154 const UWORD8 DspCode_array[1] = {0}; 153 const UWORD8 DspCode_array[1] ;
155 const UWORD8 DspData_array[1] = {0}; 154 const UWORD8 DspData_array[1];
156 #elif (DWNLD == PATCH_DWNLD) 155 #elif (DWNLD == PATCH_DWNLD)
157 extern const UWORD8 patch_array[] ; 156 extern const UWORD8 patch_array[] ;
158 const UWORD8 DspCode_array[1] = {0}; 157 const UWORD8 DspCode_array[1] ;
159 const UWORD8 DspData_array[1] = {0}; 158 const UWORD8 DspData_array[1];
160 #elif (DWNLD == DSP_DWNLD) 159 #elif (DWNLD == DSP_DWNLD)
161 const UWORD8 patch_array[1] = {0}; 160 const UWORD8 patch_array[1] ;
162 extern const UWORD8 DspCode_array[] ; 161 extern const UWORD8 DspCode_array[] ;
163 extern const UWORD8 DspData_array[]; 162 extern const UWORD8 DspData_array[];
164 #else 163 #else
165 extern const UWORD8 patch_array[] ; 164 extern const UWORD8 patch_array[] ;
166 extern const UWORD8 DspCode_array[] ; 165 extern const UWORD8 DspCode_array[] ;
167 extern const UWORD8 DspData_array[]; 166 extern const UWORD8 DspData_array[];
168 #endif 167 #endif
169 168
170 extern const UWORD8 bootCode[] ; 169 extern const UWORD8 bootCode[] ;
170 /* DSP patch */
171
172 #if ( FF_REPEATED_DL_FACCH == 1 )
171 UWORD32 fn_prev; // Added as a debug stage.. 173 UWORD32 fn_prev; // Added as a debug stage..
172 /* DSP patch */ 174 #endif
173
174 175
175 /*-------------------------------------------------------*/ 176 /*-------------------------------------------------------*/
176 /* Prototypes of internal functions used in this file. */ 177 /* Prototypes of internal functions used in this file. */
177 /*-------------------------------------------------------*/ 178 /*-------------------------------------------------------*/
178 void l1s_init_voice_blocks (void); 179 void l1s_init_voice_blocks (void);
203 /* is not running yet) : */ 204 /* is not running yet) : */
204 /* ==> check string size < 256 !!!!!! */ 205 /* ==> check string size < 256 !!!!!! */
205 /*-------------------------------------------------------*/ 206 /*-------------------------------------------------------*/
206 void dsp_power_on(void) 207 void dsp_power_on(void)
207 { 208 {
208 UWORD16 dsp_start_address =0 ;//omaps00090550 209 UWORD16 dsp_start_address;
209 UWORD16 param_size; 210 UWORD16 param_size;
210 #if IDS 211 #if IDS
211 UWORD16 param_size2; 212 UWORD16 param_size2;
212 #endif 213 #endif
213 214
1105 { 1106 {
1106 IncMod(time->t2, 1, 26); // increment T2 % 26. 1107 IncMod(time->t2, 1, 26); // increment T2 % 26.
1107 IncMod(time->t3, 1, 51); // increment T3 % 51. 1108 IncMod(time->t3, 1, 51); // increment T3 % 51.
1108 IncMod(time->fn_mod42432, 1, 42432); // increment FN % 42432. 1109 IncMod(time->fn_mod42432, 1, 42432); // increment FN % 42432.
1109 IncMod(time->fn_mod13, 1, 13); // increment FN % 13. 1110 IncMod(time->fn_mod13, 1, 13); // increment FN % 13.
1110 IncMod(time->fn_mod13_mod4, 1, 4); // increment (FN % 13) % 4.
1111 if(time->fn_mod13 == 0)
1112 time->fn_mod13_mod4 = 0;
1113 1111
1114 if(time->t3 == 0) 1112 if(time->t3 == 0)
1115 // new FN is a multiple of 51. 1113 // new FN is a multiple of 51.
1116 { 1114 {
1117 // Increment TC ((FN/51) % 8). 1115 // Increment TC ((FN/51) % 8).
1122 } 1120 }
1123 1121
1124 #if (L1_GPRS) 1122 #if (L1_GPRS)
1125 IncMod(time->fn_mod52, 1, 52); // increment FN % 52. 1123 IncMod(time->fn_mod52, 1, 52); // increment FN % 52.
1126 IncMod(time->fn_mod104, 1, 104); // increment FN % 104. 1124 IncMod(time->fn_mod104, 1, 104); // increment FN % 104.
1125
1126 IncMod(time->fn_mod13_mod4, 1, 4); // increment (FN % 13) % 4.
1127 if(time->fn_mod13 == 0)
1128 time->fn_mod13_mod4 = 0;
1127 1129
1128 if((time->fn_mod13 == 0) || (time->fn_mod13 == 4) || (time->fn_mod13 == 8)) 1130 if((time->fn_mod13 == 0) || (time->fn_mod13 == 4) || (time->fn_mod13 == 8))
1129 IncMod(time->block_id, 1, MAX_BLOCK_ID); 1131 IncMod(time->block_id, 1, MAX_BLOCK_ID);
1130 #endif 1132 #endif
1131 1133
1139 time->t3 = time->fn % 51; // T3 = FN % 51. 1141 time->t3 = time->fn % 51; // T3 = FN % 51.
1140 time->t1 = time->fn / (26L*51L); // T1 = FN div 26*51 1142 time->t1 = time->fn / (26L*51L); // T1 = FN div 26*51
1141 time->tc = (time->fn / 51) % 8; // TC = (FN div 51) % 8 1143 time->tc = (time->fn / 51) % 8; // TC = (FN div 51) % 8
1142 time->fn_mod42432 = time->fn % 42432; // FN%42432. 1144 time->fn_mod42432 = time->fn % 42432; // FN%42432.
1143 time->fn_mod13 = time->fn % 13; // FN % 13. 1145 time->fn_mod13 = time->fn % 13; // FN % 13.
1144 time->fn_mod13_mod4 = time->fn_mod13 % 4; // FN % 13 % 4.
1145 1146
1146 #if (L1_GPRS) 1147 #if (L1_GPRS)
1147 time->fn_mod104 = time->fn % 104; // FN % 104. 1148 time->fn_mod104 = time->fn % 104; // FN % 104.
1148 1149
1149 if(time->fn_mod104 >= 52) // FN % 52. 1150 if(time->fn_mod104 >= 52) // FN % 52.
1150 time->fn_mod52 = time->fn_mod104 - 52; 1151 time->fn_mod52 = time->fn_mod104 - 52;
1151 else 1152 else
1152 time->fn_mod52 = time->fn_mod104; 1153 time->fn_mod52 = time->fn_mod104;
1154
1155 time->fn_mod13_mod4 = time->fn_mod13 % 4; // FN % 13 % 4.
1153 1156
1154 time->block_id = ((3 * (time->fn / 13)) + (time->fn_mod13 / 4)); 1157 time->block_id = ((3 * (time->fn / 13)) + (time->fn_mod13 / 4));
1155 #endif 1158 #endif
1156 1159
1157 } 1160 }
1318 /* Functionality : */ 1321 /* Functionality : */
1319 /*-------------------------------------------------------*/ 1322 /*-------------------------------------------------------*/
1320 UWORD32 l1s_swap_iq_dl(UWORD16 radio_freq, UWORD8 task) 1323 UWORD32 l1s_swap_iq_dl(UWORD16 radio_freq, UWORD8 task)
1321 { 1324 {
1322 UWORD8 swap_iq; 1325 UWORD8 swap_iq;
1323 UWORD32 task_tab= 0; //omaps00090550 1326 UWORD32 task_tab;
1324 1327
1325 #if (L1_FF_MULTIBAND == 0) 1328 #if (L1_FF_MULTIBAND == 0)
1326 if(((l1_config.std.id == DUAL) || (l1_config.std.id == DUALEXT) || (l1_config.std.id == DUAL_US)) && 1329 if(((l1_config.std.id == DUAL) || (l1_config.std.id == DUALEXT) || (l1_config.std.id == DUAL_US)) &&
1327 (radio_freq >= l1_config.std.first_radio_freq_band2)) 1330 (radio_freq >= l1_config.std.first_radio_freq_band2))
1328 { 1331 {
1364 /* Functionality : */ 1367 /* Functionality : */
1365 /*-------------------------------------------------------*/ 1368 /*-------------------------------------------------------*/
1366 UWORD32 l1s_swap_iq_ul(UWORD16 radio_freq, UWORD8 task) 1369 UWORD32 l1s_swap_iq_ul(UWORD16 radio_freq, UWORD8 task)
1367 { 1370 {
1368 UWORD8 swap_iq; 1371 UWORD8 swap_iq;
1369 UWORD32 task_tab = 0; //omaps00090550 1372 UWORD32 task_tab;
1370 1373
1371 #if (L1_FF_MULTIBAND == 0) 1374 #if (L1_FF_MULTIBAND == 0)
1372 1375
1373 if(((l1_config.std.id == DUAL) || (l1_config.std.id == DUALEXT) || (l1_config.std.id == DUAL_US)) && 1376 if(((l1_config.std.id == DUAL) || (l1_config.std.id == DUALEXT) || (l1_config.std.id == DUAL_US)) &&
1374 (radio_freq >= l1_config.std.first_radio_freq_band2)) 1377 (radio_freq >= l1_config.std.first_radio_freq_band2))
1722 } 1725 }
1723 1726
1724 #endif // AMR 1727 #endif // AMR
1725 1728
1726 1729
1727 1730 /*
1731 * FreeCalypso TCS211 reconstruction: the following l1_memcpy_16bit()
1732 * function has been moved to l1_dyn_dwl_func.c.
1733 */
1734
1735 #if 0
1728 /*--------------------------------------------------------*/ 1736 /*--------------------------------------------------------*/
1729 /* l1_memcpy_16bit() */ 1737 /* l1_memcpy_16bit() */
1730 /*--------------------------------------------------------*/ 1738 /*--------------------------------------------------------*/
1731 /* */ 1739 /* */
1732 /* Description: */ 1740 /* Description: */
1778 *cdst++ = *csrc++; 1786 *cdst++ = *csrc++;
1779 } 1787 }
1780 } 1788 }
1781 return; 1789 return;
1782 } 1790 }
1783 1791 #endif
1792
1793 #if (FF_L1_FAST_DECODING == 1)
1784 /*-----------------------------------------------------------------*/ 1794 /*-----------------------------------------------------------------*/
1785 /* l1s_restore_synchro */ 1795 /* l1s_restore_synchro */
1786 /*-----------------------------------------------------------------*/ 1796 /*-----------------------------------------------------------------*/
1787 /* Description: */ 1797 /* Description: */
1788 /* ------------ */ 1798 /* ------------ */
1832 #if (TRACE_TYPE == 1) || (TRACE_TYPE == 4) 1842 #if (TRACE_TYPE == 1) || (TRACE_TYPE == 4)
1833 trace_fct(CST_L1S_ADJUST_TIME, (UWORD32)(-1)); 1843 trace_fct(CST_L1S_ADJUST_TIME, (UWORD32)(-1));
1834 #endif 1844 #endif
1835 } 1845 }
1836 1846
1837 #if (FF_L1_FAST_DECODING == 1)
1838 BOOL l1s_check_deferred_control(UWORD8 task, UWORD8 burst_id) 1847 BOOL l1s_check_deferred_control(UWORD8 task, UWORD8 burst_id)
1839 { 1848 {
1840 /* Control activities are performed only if: 1849 /* Control activities are performed only if:
1841 - Fast decoding is not authorized 1850 - Fast decoding is not authorized
1842 - Fast decoding authorized, control running inside the fast HISR context and not first burst 1851 - Fast decoding authorized, control running inside the fast HISR context and not first burst
2310 return(l1_config.pwr_mngt); 2319 return(l1_config.pwr_mngt);
2311 } 2320 }
2312 2321
2313 #endif 2322 #endif
2314 2323
2324 #if (L1_FF_MULTIBAND == 1)
2315 void l1_multiband_error_handler(UWORD16 radio_freq) 2325 void l1_multiband_error_handler(UWORD16 radio_freq)
2316 { 2326 {
2317 while(1); 2327 while(1);
2318 } 2328 }
2319 2329 #endif
2320