Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup RTEMSBSPsARMLPC24XX |
---|
5 | * |
---|
6 | * @brief Benchmark timer support. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2008, 2009 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #include <rtems.h> |
---|
18 | #include <bsp.h> |
---|
19 | #include <rtems/btimer.h> |
---|
20 | |
---|
21 | #include <bsp/system-clocks.h> |
---|
22 | |
---|
23 | bool benchmark_timer_find_average_overhead = false; |
---|
24 | |
---|
25 | static uint32_t benchmark_timer_base; |
---|
26 | |
---|
27 | void benchmark_timer_initialize(void) |
---|
28 | { |
---|
29 | benchmark_timer_base = lpc24xx_timer(); |
---|
30 | } |
---|
31 | |
---|
32 | benchmark_timer_t benchmark_timer_read(void) |
---|
33 | { |
---|
34 | uint32_t delta = lpc24xx_timer() - benchmark_timer_base; |
---|
35 | |
---|
36 | if (benchmark_timer_find_average_overhead) { |
---|
37 | return delta; |
---|
38 | } else { |
---|
39 | /* Value determined by tmck for NCS board */ |
---|
40 | if (delta > 74) { |
---|
41 | return delta - 74; |
---|
42 | } else { |
---|
43 | return 0; |
---|
44 | } |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | void benchmark_timer_disable_subtracting_average_overhead(bool find_average_overhead ) |
---|
49 | { |
---|
50 | benchmark_timer_find_average_overhead = find_average_overhead; |
---|
51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.