source: rtems/c/src/lib/libbsp/arm/raspberrypi/misc/timer.c @ 8fbe2e6

4.11
Last change on this file since 8fbe2e6 was 8fbe2e6, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2014 at 1:59:49 PM

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
23static bool benchmark_timer_find_average_overhead = false;
24
25static uint64_t benchmark_timer_base;
26
27void benchmark_timer_initialize(void)
28{
29  benchmark_timer_base = BCM2835_REG(BCM2835_GPU_TIMER_CLO);
30}
31
32benchmark_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
46void 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.