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

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