1 | /* timer.h |
---|
2 | * |
---|
3 | * This include file contains all the constants, structures, and |
---|
4 | * prototypes associated with the Timer Manager. This manager provides |
---|
5 | * facilities to configure, initiate, cancel, and delete timers which will |
---|
6 | * fire at specified intervals of time. |
---|
7 | * |
---|
8 | * Directives provided are: |
---|
9 | * |
---|
10 | * + create a timer |
---|
11 | * + get an ID of a timer |
---|
12 | * + delete a timer |
---|
13 | * + set a timer to fire after a number of ticks have passed |
---|
14 | * + set a timer to fire when a specified date and time has been reached |
---|
15 | * + reset a timer |
---|
16 | * + cancel a time |
---|
17 | * |
---|
18 | * COPYRIGHT (c) 1989-1997. |
---|
19 | * On-Line Applications Research Corporation (OAR). |
---|
20 | * Copyright assigned to U.S. Government, 1994. |
---|
21 | * |
---|
22 | * The license and distribution terms for this file may in |
---|
23 | * the file LICENSE in this distribution or at |
---|
24 | * http://www.OARcorp.com/rtems/license.html. |
---|
25 | * |
---|
26 | * $Id$ |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef __RTEMS_TIMER_h |
---|
30 | #define __RTEMS_TIMER_h |
---|
31 | |
---|
32 | #ifdef __cplusplus |
---|
33 | extern "C" { |
---|
34 | #endif |
---|
35 | |
---|
36 | #include <rtems/score/object.h> |
---|
37 | #include <rtems/score/tod.h> |
---|
38 | #include <rtems/score/watchdog.h> |
---|
39 | |
---|
40 | /* |
---|
41 | * The following enumerated type details the classes to which a timer |
---|
42 | * may belong. |
---|
43 | */ |
---|
44 | |
---|
45 | typedef enum { |
---|
46 | TIMER_INTERVAL, |
---|
47 | TIMER_TIME_OF_DAY, |
---|
48 | TIMER_DORMANT |
---|
49 | } Timer_Classes; |
---|
50 | |
---|
51 | /* |
---|
52 | * The following types define a pointer to a timer service routine. |
---|
53 | */ |
---|
54 | |
---|
55 | typedef void rtems_timer_service_routine; |
---|
56 | |
---|
57 | typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( |
---|
58 | rtems_id, |
---|
59 | void * |
---|
60 | ); |
---|
61 | |
---|
62 | /* |
---|
63 | * The following defines the information control block used to manage |
---|
64 | * this class of objects. |
---|
65 | */ |
---|
66 | |
---|
67 | RTEMS_EXTERN Objects_Information _Timer_Information; |
---|
68 | |
---|
69 | /* |
---|
70 | * The following records define the control block used to manage |
---|
71 | * each timer. |
---|
72 | */ |
---|
73 | |
---|
74 | typedef struct { |
---|
75 | Objects_Control Object; |
---|
76 | Watchdog_Control Ticker; |
---|
77 | Timer_Classes the_class; |
---|
78 | } Timer_Control; |
---|
79 | |
---|
80 | /* |
---|
81 | * _Timer_Manager_initialization |
---|
82 | * |
---|
83 | * DESCRIPTION: |
---|
84 | * |
---|
85 | * This routine performs the initialization necessary for this manager. |
---|
86 | */ |
---|
87 | |
---|
88 | void _Timer_Manager_initialization( |
---|
89 | unsigned32 maximum_timers |
---|
90 | ); |
---|
91 | |
---|
92 | /* |
---|
93 | * rtems_timer_create |
---|
94 | * |
---|
95 | * DESCRIPTION: |
---|
96 | * |
---|
97 | * This routine implements the rtems_timer_create directive. The |
---|
98 | * timer will have the name name. It returns the id of the |
---|
99 | * created timer in ID. |
---|
100 | */ |
---|
101 | |
---|
102 | rtems_status_code rtems_timer_create( |
---|
103 | rtems_name name, |
---|
104 | Objects_Id *id |
---|
105 | ); |
---|
106 | |
---|
107 | /* |
---|
108 | * rtems_timer_ident |
---|
109 | * |
---|
110 | * DESCRIPTION: |
---|
111 | * |
---|
112 | * This routine implements the rtems_timer_ident directive. |
---|
113 | * This directive returns the timer ID associated with name. |
---|
114 | * If more than one timer is named name, then the timer |
---|
115 | * to which the ID belongs is arbitrary. |
---|
116 | */ |
---|
117 | |
---|
118 | rtems_status_code rtems_timer_ident( |
---|
119 | rtems_name name, |
---|
120 | Objects_Id *id |
---|
121 | ); |
---|
122 | |
---|
123 | /* |
---|
124 | * rtems_timer_cancel |
---|
125 | * |
---|
126 | * DESCRIPTION: |
---|
127 | * |
---|
128 | * This routine implements the rtems_timer_cancel directive. It is used |
---|
129 | * to stop the timer associated with ID from firing. |
---|
130 | */ |
---|
131 | |
---|
132 | rtems_status_code rtems_timer_cancel( |
---|
133 | Objects_Id id |
---|
134 | ); |
---|
135 | |
---|
136 | /* |
---|
137 | * rtems_timer_delete |
---|
138 | * |
---|
139 | * DESCRIPTION: |
---|
140 | * |
---|
141 | * This routine implements the rtems_timer_delete directive. The |
---|
142 | * timer indicated by ID is deleted. |
---|
143 | */ |
---|
144 | |
---|
145 | rtems_status_code rtems_timer_delete( |
---|
146 | Objects_Id id |
---|
147 | ); |
---|
148 | |
---|
149 | /* |
---|
150 | * rtems_timer_fire_after |
---|
151 | * |
---|
152 | * DESCRIPTION: |
---|
153 | * |
---|
154 | * This routine implements the rtems_timer_fire_after directive. It |
---|
155 | * initiates the timer associated with ID to fire in ticks clock |
---|
156 | * ticks. When the timer fires, the routine will be invoked. |
---|
157 | */ |
---|
158 | |
---|
159 | rtems_status_code rtems_timer_fire_after( |
---|
160 | Objects_Id id, |
---|
161 | rtems_interval ticks, |
---|
162 | rtems_timer_service_routine_entry routine, |
---|
163 | void *user_data |
---|
164 | ); |
---|
165 | |
---|
166 | /* |
---|
167 | * rtems_timer_fire_when |
---|
168 | * |
---|
169 | * DESCRIPTION: |
---|
170 | * |
---|
171 | * This routine implements the rtems_timer_fire_when directive. It |
---|
172 | * initiates the timer associated with ID to fire at wall_time |
---|
173 | * When the timer fires, the routine will be invoked. |
---|
174 | */ |
---|
175 | |
---|
176 | rtems_status_code rtems_timer_fire_when( |
---|
177 | Objects_Id id, |
---|
178 | rtems_time_of_day *wall_time, |
---|
179 | rtems_timer_service_routine_entry routine, |
---|
180 | void *user_data |
---|
181 | ); |
---|
182 | |
---|
183 | /* |
---|
184 | * rtems_timer_reset |
---|
185 | * |
---|
186 | * DESCRIPTION: |
---|
187 | * |
---|
188 | * This routine implements the rtems_timer_reset directive. It is used |
---|
189 | * to reinitialize the interval timer associated with ID just as if |
---|
190 | * rtems_timer_fire_after were re-invoked with the same arguments that |
---|
191 | * were used to initiate this timer. |
---|
192 | */ |
---|
193 | |
---|
194 | rtems_status_code rtems_timer_reset( |
---|
195 | Objects_Id id |
---|
196 | ); |
---|
197 | |
---|
198 | #ifndef __RTEMS_APPLICATION__ |
---|
199 | #include <rtems/rtems/timer.inl> |
---|
200 | #endif |
---|
201 | |
---|
202 | #ifdef __cplusplus |
---|
203 | } |
---|
204 | #endif |
---|
205 | |
---|
206 | #endif |
---|
207 | /* end of include file */ |
---|