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

4.11
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 984 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/timerdrv.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
32uint32_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.