source: rtems/c/src/lib/libbsp/m68k/efi332/timer/timer.c @ 98e4ebf

4.104.114.84.95
Last change on this file since 98e4ebf was 98e4ebf, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 8, 1997 at 3:45:54 PM

Fixed typo in the pointer to the license terms.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*  Timer_init()
2 *
3 *  This routine initializes a timer in efi68k's DP8570A TCP
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  NOTE: It is important that the timer start/stop overhead be
10 *        determined when porting or modifying this code.
11 *
12 *  COPYRIGHT (c) 1989-1997.
13 *  On-Line Applications Research Corporation (OAR).
14 *  Copyright assigned to U.S. Government, 1994.
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.OARcorp.com/rtems/license.html.
19 *
20 *  $Id$
21 */
22
23
24#include <bsp.h>
25
26rtems_boolean Timer_driver_Find_average_overhead;
27
28extern rtems_isr Clock_isr();
29
30void Timer_initialize( void )
31{
32}
33
34/*
35 *  The following controls the behavior of Read_timer().
36 *
37 *  FIND_AVG_OVERHEAD *  instructs the routine to return the "raw" count.
38 *
39 *  AVG_OVEREHAD is the overhead for starting and stopping the timer.  It
40 *  is usually deducted from the number returned.
41 *
42 *  LEAST_VALID is the lowest number this routine should trust.  Numbers
43 *  below this are "noise" and zero is returned.
44 */
45
46#define AVG_OVERHEAD      0  /* It typically takes X.X microseconds */
47                             /* (Y countdowns) to start/stop the timer. */
48                             /* This value is in microseconds. */
49#define LEAST_VALID       1  /* Don't trust a clicks value lower than this */
50
51/*
52 * Return timer value in 1/2-microsecond units
53 */
54int Read_timer( void )
55{
56  rtems_unsigned32 total;
57  total = 0;
58
59  if ( Timer_driver_Find_average_overhead == 1 )
60    return total;          /* in XXX microsecond units */
61
62  if ( total < LEAST_VALID )
63    return 0;            /* below timer resolution */
64
65  return (total - AVG_OVERHEAD);
66}
67
68
69/*
70 *  Empty function call used in loops to measure basic cost of looping
71 *  in Timing Test Suite.
72 */
73
74rtems_status_code Empty_function(void)
75{
76    return RTEMS_SUCCESSFUL;
77}
78
79void Set_find_average_overhead(
80  rtems_boolean find_flag
81)
82{
83  Timer_driver_Find_average_overhead = find_flag;
84}
Note: See TracBrowser for help on using the repository browser.