4.104.114.84.95
Last change
on this file since 1587af6 was
98e4ebf5,
checked in by Joel Sherrill <joel.sherrill@…>, on 10/08/97 at 15:45:54
|
Fixed typo in the pointer to the license terms.
|
-
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-1997. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * Copyright assigned to U.S. Government, 1994. |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.OARcorp.com/rtems/license.html. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | |
---|
21 | volatile rtems_unsigned32 Timer_starting; |
---|
22 | rtems_boolean Timer_driver_Find_average_overhead; |
---|
23 | |
---|
24 | void Timer_initialize() |
---|
25 | { |
---|
26 | Timer_starting = get_itimer(); |
---|
27 | set_eiem(0x80000000); |
---|
28 | } |
---|
29 | |
---|
30 | #define AVG_OVERHEAD 0 /* It typically takes 3.0 microseconds */ |
---|
31 | /* (6 countdowns) to start/stop the timer. */ |
---|
32 | #define LEAST_VALID 1 /* Don't trust a value lower than this */ |
---|
33 | |
---|
34 | int Read_timer() |
---|
35 | { |
---|
36 | rtems_unsigned32 clicks; |
---|
37 | rtems_unsigned32 total; |
---|
38 | |
---|
39 | clicks = get_itimer(); |
---|
40 | |
---|
41 | total = clicks - Timer_starting; |
---|
42 | |
---|
43 | if ( Timer_driver_Find_average_overhead == 1 ) |
---|
44 | return total; /* in XXX microsecond units */ |
---|
45 | |
---|
46 | else { |
---|
47 | if ( total < LEAST_VALID ) |
---|
48 | return 0; /* below timer resolution */ |
---|
49 | return (total - AVG_OVERHEAD); |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | rtems_status_code Empty_function( void ) |
---|
54 | { |
---|
55 | return RTEMS_SUCCESSFUL; |
---|
56 | } |
---|
57 | |
---|
58 | void Set_find_average_overhead( |
---|
59 | rtems_boolean find_flag |
---|
60 | ) |
---|
61 | { |
---|
62 | Timer_driver_Find_average_overhead = find_flag; |
---|
63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.