[cd67dca] | 1 | /* |
---|
| 2 | * Timer Init |
---|
| 3 | * |
---|
| 4 | * This module implements benchmark stub for simulator. |
---|
| 5 | * |
---|
| 6 | * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia |
---|
| 7 | * Author: Victor V. Vengerov <vvv@oktet.ru> |
---|
| 8 | * |
---|
| 9 | * COPYRIGHT (c) 1989-1998-2001. |
---|
| 10 | * On-Line Applications Research Corporation (OAR). |
---|
| 11 | * |
---|
| 12 | * The license and distribution terms for this file may be |
---|
| 13 | * found in the file LICENSE in this distribution or at |
---|
| 14 | * |
---|
[b5bc659] | 15 | * http://www.rtems.com/license/LICENSE. |
---|
[cd67dca] | 16 | * |
---|
| 17 | * $Id$ |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | #include <rtems.h> |
---|
| 21 | #include <bsp.h> |
---|
| 22 | |
---|
| 23 | rtems_unsigned32 Timer_interrupts; |
---|
| 24 | |
---|
| 25 | rtems_boolean Timer_driver_Find_average_overhead; |
---|
| 26 | |
---|
| 27 | /* External assembler interrupt handler routine */ |
---|
| 28 | extern rtems_isr timerisr(rtems_vector_number vector); |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | /* Timer_initialize -- |
---|
| 32 | * Initialize timer 2 for accurate time measurement. |
---|
| 33 | * |
---|
| 34 | * PARAMETERS: |
---|
| 35 | * none |
---|
| 36 | * |
---|
| 37 | * RETURNS: |
---|
| 38 | * none |
---|
| 39 | */ |
---|
| 40 | void |
---|
| 41 | Timer_initialize(void) |
---|
| 42 | { |
---|
| 43 | return; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | /* |
---|
| 47 | * The following controls the behavior of Read_timer(). |
---|
| 48 | * |
---|
| 49 | * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count. |
---|
| 50 | * |
---|
| 51 | * AVG_OVEREHAD is the overhead for starting and stopping the timer. It |
---|
| 52 | * is usually deducted from the number returned. |
---|
| 53 | * |
---|
| 54 | * LEAST_VALID is the lowest number this routine should trust. Numbers |
---|
| 55 | * below this are "noise" and zero is returned. |
---|
| 56 | */ |
---|
| 57 | |
---|
| 58 | #define AVG_OVERHEAD 0 /* It typically takes 2.0 microseconds */ |
---|
| 59 | /* (Y countdowns) to start/stop the timer. */ |
---|
| 60 | /* This value is in microseconds. */ |
---|
| 61 | #define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ |
---|
| 62 | |
---|
| 63 | /* Read_timer -- |
---|
| 64 | * Read timer value in microsecond units since timer start. |
---|
| 65 | * |
---|
| 66 | * PARAMETERS: |
---|
| 67 | * none |
---|
| 68 | * |
---|
| 69 | * RETURNS: |
---|
| 70 | * number of microseconds since timer has been started |
---|
| 71 | */ |
---|
| 72 | int |
---|
| 73 | Read_timer( void ) |
---|
| 74 | { |
---|
| 75 | return 0; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | /* Empty_function -- |
---|
| 80 | * Empty function call used in loops to measure basic cost of looping |
---|
| 81 | * in Timing Test Suite. |
---|
| 82 | * |
---|
| 83 | * PARAMETERS: |
---|
| 84 | * none |
---|
| 85 | * |
---|
| 86 | * RETURNS: |
---|
| 87 | * RTEMS_SUCCESSFUL |
---|
| 88 | */ |
---|
| 89 | rtems_status_code |
---|
| 90 | Empty_function(void) |
---|
| 91 | { |
---|
| 92 | return RTEMS_SUCCESSFUL; |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | /* Set_find_average_overhead -- |
---|
| 96 | * This routine is invoked by the "Check Timer" (tmck) test in the |
---|
| 97 | * RTEMS Timing Test Suite. It makes the Read_timer routine not |
---|
| 98 | * subtract the overhead required to initialize and read the benchmark |
---|
| 99 | * timer. |
---|
| 100 | * |
---|
| 101 | * PARAMETERS: |
---|
| 102 | * find_flag - boolean flag, TRUE if overhead must not be subtracted. |
---|
| 103 | * |
---|
| 104 | * RETURNS: |
---|
| 105 | * none |
---|
| 106 | */ |
---|
| 107 | void |
---|
| 108 | Set_find_average_overhead(rtems_boolean find_flag) |
---|
| 109 | { |
---|
| 110 | Timer_driver_Find_average_overhead = find_flag; |
---|
| 111 | } |
---|