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