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

4.104.114.84.95
Last change on this file since 5a23ca84 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 17, 1999 at 5:51:34 PM

Updated copyright notice.

  • Property mode set to 100644
File size: 1.4 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-1999.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.OARcorp.com/rtems/license.html.
14 *
15 *  $Id$
16 */
17
18#include <rtems.h>
19
20volatile rtems_unsigned32 Timer_starting;
21rtems_boolean Timer_driver_Find_average_overhead;
22
23void Timer_initialize()
24{
25  Timer_starting = get_itimer();
26  set_eiem(0x80000000);
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.