source: rtems/c/src/lib/libbsp/arm/lpc24xx/misc/timer.c @ 2c4cae4

4.115
Last change on this file since 2c4cae4 was 2c4cae4, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/09/11 at 11:41:54

2011-02-09 Ralf Corsépius <ralf.corsepius@…>

  • misc/timer.c: Include <rtems/btimer.h>. Fix benchmark_timer_read() definition.
  • Property mode set to 100644
File size: 1.1 KB
Line 
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
19 * http://www.rtems.com/license/LICENSE.
20 */
21
22#include <rtems.h>
23#include <bsh.h>
24#include <rtems/btimer.h>
25#include <rtems/timerdrv.h>
26
27#include <bsp/system-clocks.h>
28
29bool benchmark_timer_find_average_overhead = false;
30
31static uint32_t benchmark_timer_base;
32
33void benchmark_timer_initialize(void)
34{
35  benchmark_timer_base = lpc24xx_timer();
36}
37
38uint32_t benchmark_timer_read(void)
39{
40  uint32_t delta = lpc24xx_timer() - benchmark_timer_base;
41
42  if (benchmark_timer_find_average_overhead) {
43    return delta;
44  } else {
45    /* Value determined by tmck for NCS board */
46    if (delta > 74) {
47      return delta - 74;
48    } else {
49      return 0;
50    }
51  }
52}
53
54void benchmark_timer_disable_subtracting_average_overhead(bool find_average_overhead )
55{
56  benchmark_timer_find_average_overhead = find_average_overhead;
57}
Note: See TracBrowser for help on using the repository browser.