1 | /** |
---|
2 | * @file rtems/btimer.h |
---|
3 | * |
---|
4 | * @brief RTEMS Benchmark Timer API for all Boards |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * COPYRIGHT (c) 2011 Ralf Corsépius Ulm/Germany |
---|
9 | * |
---|
10 | * Derived from libcsupport/include/timerdrv.h: |
---|
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.rtems.org/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | /* |
---|
21 | * All the functions declared as extern after this comment |
---|
22 | * MUST be implemented in each BSP. |
---|
23 | */ |
---|
24 | |
---|
25 | #ifndef _RTEMS_BTIMER_H |
---|
26 | #define _RTEMS_BTIMER_H |
---|
27 | |
---|
28 | #include <stdbool.h> |
---|
29 | #include <stdint.h> |
---|
30 | #include <rtems/rtems/status.h> |
---|
31 | |
---|
32 | #ifdef __cplusplus |
---|
33 | extern "C" { |
---|
34 | #endif |
---|
35 | |
---|
36 | /** |
---|
37 | * @defgroup BenchmarkTimer Benchmark Timer Driver Interface |
---|
38 | * |
---|
39 | * This module defines the interface for the Benchmark Timer Driver. |
---|
40 | * |
---|
41 | * The following methods in this module must be provided by each BSP: |
---|
42 | * |
---|
43 | * - benchmark_timer_initialize |
---|
44 | * - benchmark_timer_read |
---|
45 | * - benchmark_timer_disable_subtracting_average_overhead |
---|
46 | * |
---|
47 | * The units measured are BSP specific but should be at the highest |
---|
48 | * granularity possible. |
---|
49 | * |
---|
50 | * The Benchmark Timer may use the same hardware as the Clock Driver. |
---|
51 | * No RTEMS Timing Tests will use both drivers at the same time. |
---|
52 | */ |
---|
53 | |
---|
54 | /** |
---|
55 | * @brief This type is used to return a Benchmark Timer value. |
---|
56 | * |
---|
57 | * This type is used to contain benchmark times. The units are BSP specific. |
---|
58 | */ |
---|
59 | typedef uint32_t benchmark_timer_t; |
---|
60 | |
---|
61 | /** |
---|
62 | * @brief Initialize the Benchmark Timer |
---|
63 | * |
---|
64 | * This method initializes the benchmark timer and resets it to begin |
---|
65 | * counting. |
---|
66 | */ |
---|
67 | extern void benchmark_timer_initialize( void ); |
---|
68 | |
---|
69 | /** |
---|
70 | * @brief Read the Benchmark Timer |
---|
71 | * |
---|
72 | * This method stops the benchmark timer and returns the number of |
---|
73 | * units that have passed since @a benchmark_timer_initialize was invoked. |
---|
74 | * |
---|
75 | * @return This method returns the number of units with the average overhead |
---|
76 | * removed. If the value is below the minimum trusted value, zero |
---|
77 | * is returned. |
---|
78 | */ |
---|
79 | extern benchmark_timer_t benchmark_timer_read( void ); |
---|
80 | |
---|
81 | /** |
---|
82 | * @brief Benchmark Timer Empty Function |
---|
83 | * |
---|
84 | * This method is used to determine loop overhead. |
---|
85 | */ |
---|
86 | extern rtems_status_code benchmark_timer_empty_function( void ); |
---|
87 | |
---|
88 | /** |
---|
89 | * @brief Disable Average Overhead Removal from the Benchmark Timer |
---|
90 | * |
---|
91 | * This method places the benchmark timer in a "raw" mode where it |
---|
92 | * returns the actual number of units which have passed between |
---|
93 | * calls to @a benchmark_timer_initialize and @a benchmark_timer_read |
---|
94 | * counting. |
---|
95 | * |
---|
96 | * @param[in] find_flag indicates to enable or disable the mode |
---|
97 | */ |
---|
98 | extern void benchmark_timer_disable_subtracting_average_overhead( |
---|
99 | bool find_flag |
---|
100 | ); |
---|
101 | |
---|
102 | /**@}*/ |
---|
103 | |
---|
104 | #ifdef __cplusplus |
---|
105 | } |
---|
106 | #endif |
---|
107 | |
---|
108 | #endif |
---|