source: rtems/c/src/lib/libcpu/hppa1.1/timer/timer.c @ 11290355

4.104.114.84.95
Last change on this file since 11290355 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*  timer.c
2 *
3 *  This file manages the interval timer on the PA-RISC.
4 *
5 *  NOTE: It is important that the timer start/stop overhead be
6 *        determined when porting or modifying this code.
7 *
8 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
9 *  On-Line Applications Research Corporation (OAR).
10 *  All rights assigned to U.S. Government, 1994.
11 *
12 *  This material may be reproduced by or for the U.S. Government pursuant
13 *  to the copyright license under the clause at DFARS 252.227-7013.  This
14 *  notice must appear in all copies of this file and its derivatives.
15 *
16 *  $Id$
17 */
18
19#include <rtems.h>
20
21volatile rtems_unsigned32 Timer_starting;
22rtems_boolean Timer_driver_Find_average_overhead;
23
24void Timer_initialize()
25{
26  Timer_starting = get_itimer();
27}
28
29#define AVG_OVERHEAD      0  /* It typically takes 3.0 microseconds */
30                             /* (6 countdowns) to start/stop the timer. */
31#define LEAST_VALID       1  /* Don't trust a value lower than this */
32
33int Read_timer()
34{
35  rtems_unsigned32 clicks;
36  rtems_unsigned32 total;
37
38  clicks = get_itimer();
39
40  total = clicks - Timer_starting;
41
42  if ( Timer_driver_Find_average_overhead == 1 )
43    return total;          /* in XXX microsecond units */
44
45  else {
46    if ( total < LEAST_VALID )
47      return 0;            /* below timer resolution */
48    return (total - AVG_OVERHEAD);
49  }
50}
51
52rtems_status_code Empty_function( void )
53{
54  return RTEMS_SUCCESSFUL;
55}
56
57void Set_find_average_overhead(
58  rtems_boolean find_flag
59)
60{
61  Timer_driver_Find_average_overhead = find_flag;
62}
Note: See TracBrowser for help on using the repository browser.