# HG changeset patch # User Mychaela Falconia # Date 1465282087 0 # Node ID c19fb53b730b3360213c587b2eff7f61695868d4 # Parent 5bad5a0bdec2e6ac1ba30465caef37197c0eaf28 dl1_com.c: reconstructed CPU load measurement code in layer_1_sync_HISR_entry() reconstruction of this module can be considered complete at this point diff -r 5bad5a0bdec2 -r c19fb53b730b chipsetsw/layer1/dl1/dl1_com.c --- a/chipsetsw/layer1/dl1/dl1_com.c Tue Jun 07 05:55:03 2016 +0000 +++ b/chipsetsw/layer1/dl1/dl1_com.c Tue Jun 07 06:48:07 2016 +0000 @@ -261,8 +261,46 @@ void layer_1_sync_HISR_entry (void) { - // Call Synchronous Layer1 - hisr(); + /* automatic var for the CPU load measurement code below */ + #if (TRACE_TYPE == 4) + unsigned long cpu; + #endif + + // Call Synchronous Layer1 + hisr(); + + /* + * FreeCalypso: the following code has been reconstructed from + * the disassembly of the TCS211 binary object; it was found to be + * similar to the Trace_L1S_CPU_load() function in l1_trace.c + * which appears to have been only for (TRACE_TYPE == 1) originally. + */ + #if (TRACE_TYPE == 4) + layer_1_sync_end_time = TIMER_RESET_VALUE - TM_ReadTimer(2); + + cpu = (100 * layer_1_sync_end_time) / TICKS_PER_TDMA; + if (cpu > max_cpu) + { + max_cpu=cpu; + fn_max_cpu=l1s.actual_time.fn; + max_cpu_flag = 1; + /* + * TCS211 object has this bogus code here: + + if (some non-understood condition) { + static int i; + i++; // static var never used anywhere + max_cpu_flag = 1; + } + + * Because this bogus code does not change the result, + * I decided not to bother with reconstructing it. + */ + } + + if (((l1s.actual_time.fn%1326) == 0) && (max_cpu_flag == 0)) + max_cpu = 0; + #endif } /* the following stub functions live in the dl1_com module per TCS211 */