OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libcpu/] [hppa1.1/] [timer/] [timer.c] - Blame information for rev 617

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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: timer.c,v 1.2 2001-09-27 12:01:21 chris Exp $
16
 */
17
 
18
#include <rtems.h>
19
 
20
volatile rtems_unsigned32 Timer_starting;
21
rtems_boolean Timer_driver_Find_average_overhead;
22
 
23
void 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
 
33
int 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
 
52
rtems_status_code Empty_function( void )
53
{
54
  return RTEMS_SUCCESSFUL;
55
}
56
 
57
void Set_find_average_overhead(
58
  rtems_boolean find_flag
59
)
60
{
61
  Timer_driver_Find_average_overhead = find_flag;
62
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.