4.115
Last change
on this file since 8fbe2e6 was
8fbe2e6,
checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/14 at 13:59:49
|
Use correct prototype of benchmark_timer_read()
This change starts with removing the effectively empty file
timerdrv.h. The prototypes for benchmark_timer_XXX() were in
btimer.h which was not universally used. Thus every use of
timerdrv.h had to be changed to btimer.h. Then the prototypes
for benchmark_timer_read() had to be adjusted to return
benchmark_timer_t rather than int or uint32_t.
I took this opportunity to also correct the file headers to
separate the copyright from the file description comments which
is needed to ensure the copyright isn't propagated into Doxygen
output.
|
-
Property mode set to
100644
|
File size:
991 bytes
|
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.org/license/LICENSE |
---|
16 | * |
---|
17 | */ |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | #include <rtems/btimer.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 | benchmark_timer_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.