source: rtems/c/src/lib/libbsp/m68k/mrm332/timer/timer.c @ c080c343

4.115
Last change on this file since c080c343 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

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

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-1999.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#include <bsp.h>
11#include <rtems/btimer.h>
12
13bool benchmark_timer_find_average_overhead;
14
15extern rtems_isr Clock_isr(void);
16
17void benchmark_timer_initialize( void )
18{
19}
20
21/*
22 *  The following controls the behavior of benchmark_timer_read().
23 *
24 *  FIND_AVG_OVERHEAD *  instructs the routine to return the "raw" count.
25 *
26 *  AVG_OVEREHAD is the overhead for starting and stopping the timer.  It
27 *  is usually deducted from the number returned.
28 *
29 *  LEAST_VALID is the lowest number this routine should trust.  Numbers
30 *  below this are "noise" and zero is returned.
31 */
32
33#define AVG_OVERHEAD      0  /* It typically takes X.X microseconds */
34                             /* (Y countdowns) to start/stop the timer. */
35                             /* This value is in microseconds. */
36#define LEAST_VALID       1  /* Don't trust a clicks value lower than this */
37
38/*
39 * Return timer value in 1/2-microsecond units
40 */
41uint32_t benchmark_timer_read( void )
42{
43  uint32_t         total;
44  total = 0;
45
46  if ( benchmark_timer_find_average_overhead == true )
47    return total;          /* in XXX microsecond units */
48
49  if ( total < LEAST_VALID )
50    return 0;            /* below timer resolution */
51
52  return (total - AVG_OVERHEAD);
53}
54
55void benchmark_timer_disable_subtracting_average_overhead(
56  bool find_flag
57)
58{
59  benchmark_timer_find_average_overhead = find_flag;
60}
Note: See TracBrowser for help on using the repository browser.