source:
rtems/c/src/lib/libbsp/m68k/mrm332/timer/timer.c
@
66387986
Last change on this file since 66387986 was 332484b5, checked in by Joel Sherrill <joel.sherrill@…>, on 05/25/01 at 16:28:46 | |
---|---|
|
|
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-1999. |
13 | * On-Line Applications Research Corporation (OAR). |
14 | * |
15 | * The license and distribution terms for this file may be |
16 | * found in the file LICENSE in this distribution or at |
17 | * http://www.OARcorp.com/rtems/license.html. |
18 | * |
19 | * $Id$ |
20 | */ |
21 | |
22 | |
23 | #include <bsp.h> |
24 | |
25 | rtems_boolean Timer_driver_Find_average_overhead; |
26 | |
27 | extern rtems_isr Clock_isr(); |
28 | |
29 | void Timer_initialize( void ) |
30 | { |
31 | } |
32 | |
33 | /* |
34 | * The following controls the behavior of Read_timer(). |
35 | * |
36 | * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count. |
37 | * |
38 | * AVG_OVEREHAD is the overhead for starting and stopping the timer. It |
39 | * is usually deducted from the number returned. |
40 | * |
41 | * LEAST_VALID is the lowest number this routine should trust. Numbers |
42 | * below this are "noise" and zero is returned. |
43 | */ |
44 | |
45 | #define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */ |
46 | /* (Y countdowns) to start/stop the timer. */ |
47 | /* This value is in microseconds. */ |
48 | #define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ |
49 | |
50 | /* |
51 | * Return timer value in 1/2-microsecond units |
52 | */ |
53 | int Read_timer( void ) |
54 | { |
55 | rtems_unsigned32 total; |
56 | total = 0; |
57 | |
58 | if ( Timer_driver_Find_average_overhead == 1 ) |
59 | return total; /* in XXX microsecond units */ |
60 | |
61 | if ( total < LEAST_VALID ) |
62 | return 0; /* below timer resolution */ |
63 | |
64 | return (total - AVG_OVERHEAD); |
65 | } |
66 | |
67 | |
68 | /* |
69 | * Empty function call used in loops to measure basic cost of looping |
70 | * in Timing Test Suite. |
71 | */ |
72 | |
73 | rtems_status_code Empty_function(void) |
74 | { |
75 | return RTEMS_SUCCESSFUL; |
76 | } |
77 | |
78 | void Set_find_average_overhead( |
79 | rtems_boolean find_flag |
80 | ) |
81 | { |
82 | Timer_driver_Find_average_overhead = find_flag; |
83 | } |
Note: See TracBrowser
for help on using the repository browser.