FreeCalypso > hg > tcs211-l1-reconst
changeset 167:c19fb53b730b
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
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 07 Jun 2016 06:48:07 +0000 |
parents | 5bad5a0bdec2 |
children | b69d183cac75 |
files | chipsetsw/layer1/dl1/dl1_com.c |
diffstat | 1 files changed, 40 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 */