source: rtems/bsps/arm/lpc24xx/start/timer.c @ ba619b7f

Last change on this file since ba619b7f was ba619b7f, checked in by Joel Sherrill <joel@…>, on 03/01/22 at 21:38:20

bsps/arm/: Scripted embedded brains header file clean up

Updates #4625.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSBSPsARMLPC24XX
5 *
6 * @brief Benchmark timer support.
7 */
8
9/*
10 * Copyright (c) 2008, 2009 embedded brains GmbH.  All rights reserved.
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.org/license/LICENSE.
15 */
16
17#include <rtems.h>
18#include <bsp.h>
19#include <rtems/btimer.h>
20
21#include <bsp/system-clocks.h>
22
23bool benchmark_timer_find_average_overhead = false;
24
25static uint32_t benchmark_timer_base;
26
27void benchmark_timer_initialize(void)
28{
29  benchmark_timer_base = lpc24xx_timer();
30}
31
32benchmark_timer_t benchmark_timer_read(void)
33{
34  uint32_t delta = lpc24xx_timer() - benchmark_timer_base;
35
36  if (benchmark_timer_find_average_overhead) {
37    return delta;
38  } else {
39    /* Value determined by tmck for NCS board */
40    if (delta > 74) {
41      return delta - 74;
42    } else {
43      return 0;
44    }
45  }
46}
47
48void benchmark_timer_disable_subtracting_average_overhead(bool find_average_overhead )
49{
50  benchmark_timer_find_average_overhead = find_average_overhead;
51}
Note: See TracBrowser for help on using the repository browser.