File indexing completed on 2025-05-11 08:22:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <bsp.h>
0016 #include <rtems.h>
0017 #include <rtems/btimer.h>
0018 #include <pxa255.h>
0019
0020 uint32_t tstart;
0021 static uint32_t tick_time;
0022 bool benchmark_timer_find_average_overhead;
0023
0024 bool benchmark_timer_is_initialized = false;
0025
0026
0027
0028
0029
0030
0031 void benchmark_timer_initialize(void)
0032 {
0033 tick_time = XSCALE_OS_TIMER_TCR;
0034 }
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #define AVG_OVERHEAD 0
0047
0048
0049 #define LEAST_VALID 1
0050
0051 benchmark_timer_t benchmark_timer_read(void)
0052 {
0053
0054 uint32_t total;
0055 total = XSCALE_OS_TIMER_TCR;
0056 if(total>=tick_time)
0057 total -= tick_time;
0058 else
0059 total += 0xffffffff - tick_time;
0060
0061 if ( benchmark_timer_find_average_overhead == true )
0062 return total;
0063
0064 if ( total < LEAST_VALID )
0065 return 0;
0066
0067 return total;
0068 }
0069
0070 void benchmark_timer_disable_subtracting_average_overhead(
0071 bool find_flag
0072 )
0073 {
0074 benchmark_timer_find_average_overhead = find_flag;
0075 }