4.115
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup raspberrypi |
---|
5 | * |
---|
6 | * @brief Benchmark timer support. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2013 by Alan Cudmore |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * |
---|
15 | * http://www.rtems.com/license/LICENSE |
---|
16 | * |
---|
17 | */ |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | #include <rtems/timerdrv.h> |
---|
21 | #include <bsp/raspberrypi.h> |
---|
22 | |
---|
23 | static bool benchmark_timer_find_average_overhead = false; |
---|
24 | |
---|
25 | static uint64_t benchmark_timer_base; |
---|
26 | |
---|
27 | void benchmark_timer_initialize(void) |
---|
28 | { |
---|
29 | benchmark_timer_base = BCM2835_REG(BCM2835_GPU_TIMER_CLO); |
---|
30 | } |
---|
31 | |
---|
32 | uint32_t benchmark_timer_read(void) |
---|
33 | { |
---|
34 | uint32_t delta = BCM2835_REG(BCM2835_GPU_TIMER_CLO) - benchmark_timer_base; |
---|
35 | |
---|
36 | if (benchmark_timer_find_average_overhead) |
---|
37 | { |
---|
38 | return delta; |
---|
39 | } |
---|
40 | else |
---|
41 | { |
---|
42 | return BCM2835_REG(BCM2835_GPU_TIMER_CLO); |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | void benchmark_timer_disable_subtracting_average_overhead(bool find_average_overhead) |
---|
47 | { |
---|
48 | benchmark_timer_find_average_overhead = find_average_overhead; |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.