FreeCalypso > hg > freecalypso-citrine
comparison L1/cfile/l1_isr_glue.c @ 11:bf52986ae7f2
L1/cfile/l1_isr_glue.c: applying changes discovered in TCS211 L1 reconstruction
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 06:37:40 +0000 |
parents | 75a11d740a02 |
children |
comparison
equal
deleted
inserted
replaced
10:9ffe74065152 | 11:bf52986ae7f2 |
---|---|
155 | 155 |
156 status = NU_Create_HISR (&layer_1_sync_HISR, | 156 status = NU_Create_HISR (&layer_1_sync_HISR, |
157 "L1_HISR", | 157 "L1_HISR", |
158 layer_1_sync_HISR_entry, | 158 layer_1_sync_HISR_entry, |
159 #if (OP_L1_STANDALONE == 0) | 159 #if (OP_L1_STANDALONE == 0) |
160 1, | 160 0, |
161 layer_1_sync_stack, | 161 layer_1_sync_stack, |
162 LAYER_1_SYNC_STACK_SIZE); | 162 LAYER_1_SYNC_STACK_SIZE); |
163 #else | 163 #else |
164 1, | 164 0, |
165 layer_1_sync_stack, | 165 layer_1_sync_stack, |
166 sizeof(layer_1_sync_stack)); | 166 sizeof(layer_1_sync_stack)); |
167 #endif | 167 #endif |
168 | 168 |
169 #if (L1_EXT_AUDIO_MGT) | 169 #if (L1_EXT_AUDIO_MGT) |
170 // Create HISR for Ext MIDI activity | 170 // Create HISR for Ext MIDI activity |
171 //================================== | 171 //================================== |
172 status += NU_Create_HISR(&EXT_AUDIO_MGT_hisr, | 172 status += NU_Create_HISR(&EXT_AUDIO_MGT_hisr, |
173 "H_EXT_AUDIO_MGT", | 173 "H_EXT_AUDIO_MGT", |
174 Cust_ext_audio_mgt_hisr, | 174 Cust_ext_audio_mgt_hisr, |
175 2, | 175 1, |
176 ext_audio_mgt_hisr_stack, | 176 ext_audio_mgt_hisr_stack, |
177 sizeof(ext_audio_mgt_hisr_stack)); | 177 sizeof(ext_audio_mgt_hisr_stack)); |
178 #endif | 178 #endif |
179 | 179 |
180 #if ( (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_AAC == 1) || (L1_DYN_DSP_DWNLD == 1) ) // equivalent to an API_HISR flag | 180 #if ( (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_AAC == 1) || (L1_DYN_DSP_DWNLD == 1) ) // equivalent to an API_HISR flag |
181 status += NU_Create_HISR(&apiHISR, | 181 status += NU_Create_HISR(&apiHISR, |
182 "API_HISR", | 182 "API_HISR", |
183 api_hisr, | 183 api_hisr, |
184 2, | 184 1, |
185 API_HISR_stack, | 185 API_HISR_stack, |
186 sizeof(API_HISR_stack)); | 186 sizeof(API_HISR_stack)); |
187 #endif // (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_AAC == 1) || (L1_DYN_DSP_DWNLD == 1) | 187 #endif // (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_AAC == 1) || (L1_DYN_DSP_DWNLD == 1) |
188 | 188 |
189 #if (FF_L1_IT_DSP_USF == 1) || (FF_L1_IT_DSP_DTX == 1) // equivalent to an API_MODEM_HISR flag | 189 #if (FF_L1_IT_DSP_USF == 1) || (FF_L1_IT_DSP_DTX == 1) // equivalent to an API_MODEM_HISR flag |
192 // to be known before the next block starts. | 192 // to be known before the next block starts. |
193 //======================================================== | 193 //======================================================== |
194 status += NU_Create_HISR(&api_modemHISR, | 194 status += NU_Create_HISR(&api_modemHISR, |
195 "MODEM", | 195 "MODEM", |
196 api_modem_hisr, | 196 api_modem_hisr, |
197 1, | 197 0, |
198 API_MODEM_HISR_stack, | 198 API_MODEM_HISR_stack, |
199 sizeof(API_MODEM_HISR_stack)); | 199 sizeof(API_MODEM_HISR_stack)); |
200 #endif | 200 #endif |
201 | 201 |
202 assert (status == 0); | 202 assert (status == 0); |
203 } | 203 } |
204 | 204 |
205 /* | 205 /* |
206 * The versions of TP_FrameIntHandler() and layer_1_sync_HISR_entry() | 206 * The versions of TP_FrameIntHandler() and layer_1_sync_HISR_entry() |
207 * in the Leonardo dl1_com.obj module contain CPU load measurement | 207 * in the TCS211 dl1_com.obj module contain CPU load measurement |
208 * code, but in the LoCosto version of L1 which we are using this | 208 * code. TI changed things for LoCosto, so we have to revert their |
209 * functionality has been moved into L1S proper, i.e., inside the | 209 * changes and restore the TCS211 way. |
210 * hisr() function. | 210 */ |
211 */ | 211 |
212 #if (TRACE_TYPE == 4) | |
213 #define TIMER_RESET_VALUE (0xFFFF) | |
214 #define TICKS_PER_TDMA (1875) | |
215 #endif | |
212 | 216 |
213 /*-------------------------------------------------------*/ | 217 /*-------------------------------------------------------*/ |
214 /* TP_FrameIntHandler() Low Interrupt service routine */ | 218 /* TP_FrameIntHandler() Low Interrupt service routine */ |
215 /*-------------------------------------------------------*/ | 219 /*-------------------------------------------------------*/ |
216 /* Parameters : */ | 220 /* Parameters : */ |
239 l1_cpu_load_start(); | 243 l1_cpu_load_start(); |
240 #endif | 244 #endif |
241 | 245 |
242 #else | 246 #else |
243 | 247 |
244 #if (TRACE_TYPE == 4) && (TI_NUC_MONITOR != 1) && (WCP_PROF == 1) | 248 #if (TRACE_TYPE == 4) && (TI_NUC_MONITOR != 1) |
245 TM_ResetTimer (2, TIMER_RESET_VALUE, 1, 0); | 249 TM_ResetTimer (2, TIMER_RESET_VALUE, 1, 0); |
246 TM_StartTimer (2); | 250 TM_StartTimer (2); |
247 #endif | 251 #endif |
248 | 252 |
249 #if (TI_NUC_MONITOR == 1) | 253 #if (TI_NUC_MONITOR == 1) |
275 * HISR associated to layer 1 sync. | 279 * HISR associated to layer 1 sync. |
276 */ | 280 */ |
277 | 281 |
278 void layer_1_sync_HISR_entry (void) | 282 void layer_1_sync_HISR_entry (void) |
279 { | 283 { |
280 // Call Synchronous Layer1 | 284 /* automatic var for the CPU load measurement code below */ |
281 hisr(); | 285 #if (TRACE_TYPE == 4) |
286 unsigned long cpu; | |
287 #endif | |
288 | |
289 // Call Synchronous Layer1 | |
290 hisr(); | |
291 | |
292 /* | |
293 * FreeCalypso: the following code has been reconstructed from | |
294 * the disassembly of the TCS211 binary object; it was found to be | |
295 * similar to the Trace_L1S_CPU_load() function in l1_trace.c | |
296 * which appears to have been only for (TRACE_TYPE == 1) originally. | |
297 */ | |
298 #if (TRACE_TYPE == 4) | |
299 layer_1_sync_end_time = TIMER_RESET_VALUE - TM_ReadTimer(2); | |
300 | |
301 cpu = (100 * layer_1_sync_end_time) / TICKS_PER_TDMA; | |
302 if (cpu > max_cpu) | |
303 { | |
304 max_cpu=cpu; | |
305 fn_max_cpu=l1s.actual_time.fn; | |
306 max_cpu_flag = 1; | |
307 /* | |
308 * TCS211 object has this bogus code here: | |
309 | |
310 if (some non-understood condition) { | |
311 static int i; | |
312 i++; // static var never used anywhere | |
313 max_cpu_flag = 1; | |
314 } | |
315 | |
316 * Because this bogus code does not change the result, | |
317 * I decided not to bother with reconstructing it. | |
318 */ | |
319 } | |
320 | |
321 if (((l1s.actual_time.fn%1326) == 0) && (max_cpu_flag == 0)) | |
322 max_cpu = 0; | |
323 #endif | |
282 } | 324 } |