[486c329] | 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, 1990, 1991, 1992, 1993, 1994. |
---|
| 13 | * On-Line Applications Research Corporation (OAR). |
---|
| 14 | * All rights assigned to U.S. Government, 1994. |
---|
| 15 | * |
---|
| 16 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 17 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 18 | * notice must appear in all copies of this file and its derivatives. |
---|
| 19 | * |
---|
| 20 | * $Id$ |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | #include <bsp.h> |
---|
| 25 | |
---|
| 26 | rtems_boolean Timer_driver_Find_average_overhead; |
---|
| 27 | |
---|
| 28 | extern rtems_isr Clock_isr(); |
---|
| 29 | |
---|
| 30 | void Timer_initialize( void ) |
---|
| 31 | { |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | /* |
---|
| 35 | * The following controls the behavior of Read_timer(). |
---|
| 36 | * |
---|
| 37 | * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count. |
---|
| 38 | * |
---|
| 39 | * AVG_OVEREHAD is the overhead for starting and stopping the timer. It |
---|
| 40 | * is usually deducted from the number returned. |
---|
| 41 | * |
---|
| 42 | * LEAST_VALID is the lowest number this routine should trust. Numbers |
---|
| 43 | * below this are "noise" and zero is returned. |
---|
| 44 | */ |
---|
| 45 | |
---|
| 46 | #define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */ |
---|
| 47 | /* (Y countdowns) to start/stop the timer. */ |
---|
| 48 | /* This value is in microseconds. */ |
---|
| 49 | #define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ |
---|
| 50 | |
---|
| 51 | /* |
---|
| 52 | * Return timer value in 1/2-microsecond units |
---|
| 53 | */ |
---|
| 54 | int Read_timer( void ) |
---|
| 55 | { |
---|
| 56 | rtems_unsigned32 total; |
---|
| 57 | total = 0; |
---|
| 58 | |
---|
| 59 | if ( Timer_driver_Find_average_overhead == 1 ) |
---|
| 60 | return total; /* in XXX microsecond units */ |
---|
| 61 | |
---|
| 62 | if ( total < LEAST_VALID ) |
---|
| 63 | return 0; /* below timer resolution */ |
---|
| 64 | |
---|
| 65 | return (total - AVG_OVERHEAD); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | /* |
---|
| 70 | * Empty function call used in loops to measure basic cost of looping |
---|
| 71 | * in Timing Test Suite. |
---|
| 72 | */ |
---|
| 73 | |
---|
| 74 | rtems_status_code Empty_function(void) |
---|
| 75 | { |
---|
| 76 | return RTEMS_SUCCESSFUL; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | void Set_find_average_overhead( |
---|
| 80 | rtems_boolean find_flag |
---|
| 81 | ) |
---|
| 82 | { |
---|
| 83 | Timer_driver_Find_average_overhead = find_flag; |
---|
| 84 | } |
---|