1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-2002. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Timer Manager |
---|
10 | |
---|
11 | @cindex timers |
---|
12 | |
---|
13 | @section Introduction |
---|
14 | |
---|
15 | The timer manager provides support for timer |
---|
16 | facilities. The directives provided by the timer manager are: |
---|
17 | |
---|
18 | @itemize @bullet |
---|
19 | @item @code{@value{DIRPREFIX}timer_create} - Create a timer |
---|
20 | @item @code{@value{DIRPREFIX}timer_ident} - Get ID of a timer |
---|
21 | @item @code{@value{DIRPREFIX}timer_cancel} - Cancel a timer |
---|
22 | @item @code{@value{DIRPREFIX}timer_delete} - Delete a timer |
---|
23 | @item @code{@value{DIRPREFIX}timer_fire_after} - Fire timer after interval |
---|
24 | @item @code{@value{DIRPREFIX}timer_fire_when} - Fire timer when specified |
---|
25 | @item @code{@value{DIRPREFIX}timer_initiate_server} - Initiate server for task-based timers |
---|
26 | @item @code{@value{DIRPREFIX}timer_server_fire_after} - Fire task-based timer after interval |
---|
27 | @item @code{@value{DIRPREFIX}timer_server_fire_when} - Fire task-based timer when specified |
---|
28 | @item @code{@value{DIRPREFIX}timer_reset} - Reset an interval timer |
---|
29 | @end itemize |
---|
30 | |
---|
31 | |
---|
32 | @section Background |
---|
33 | |
---|
34 | @subsection Required Support |
---|
35 | |
---|
36 | A clock tick is required to support the functionality provided by this manager. |
---|
37 | |
---|
38 | @subsection Timers |
---|
39 | |
---|
40 | A timer is an RTEMS object which allows the |
---|
41 | application to schedule operations to occur at specific times in |
---|
42 | the future. User supplied timer service routines are invoked by |
---|
43 | either the @code{@value{DIRPREFIX}clock_tick} directive or |
---|
44 | a special Timer Server task when the timer fires. Timer service |
---|
45 | routines may perform any operations or directives which normally |
---|
46 | would be performed by the application code which invoked the |
---|
47 | @code{@value{DIRPREFIX}clock_tick} directive. |
---|
48 | |
---|
49 | The timer can be used to implement watchdog routines |
---|
50 | which only fire to denote that an application error has |
---|
51 | occurred. The timer is reset at specific points in the |
---|
52 | application to insure that the watchdog does not fire. Thus, if |
---|
53 | the application does not reset the watchdog timer, then the |
---|
54 | timer service routine will fire to indicate that the application |
---|
55 | has failed to reach a reset point. This use of a timer is |
---|
56 | sometimes referred to as a "keep alive" or a "deadman" timer. |
---|
57 | |
---|
58 | @subsection Timer Server |
---|
59 | |
---|
60 | The Timer Server task is responsible for executing the timer |
---|
61 | service routines associated with all task-based timers. |
---|
62 | This task executes at a priority higher than any RTEMS application |
---|
63 | task and thus can be viewed logically as the lowest priority interrupt. |
---|
64 | |
---|
65 | By providing a mechanism where timer service routines execute |
---|
66 | in task rather than interrupt space, the application is |
---|
67 | allowed a bit more flexibility in what operations a timer |
---|
68 | service routine can perform. For example, the Timer Server |
---|
69 | can be configured to have a floating point context in which case |
---|
70 | it would be save to perform floating point operations |
---|
71 | from a task-based timer. Most of the time, executing floating |
---|
72 | point instructions from an interrupt service routine |
---|
73 | is not considered safe. |
---|
74 | |
---|
75 | The Timer Server is designed to remain blocked until a |
---|
76 | task-based timer fires. This reduces the execution overhead |
---|
77 | of the Timer Server. |
---|
78 | |
---|
79 | @subsection Timer Service Routines |
---|
80 | |
---|
81 | The timer service routine should adhere to @value{LANGUAGE} calling |
---|
82 | conventions and have a prototype similar to the following: |
---|
83 | |
---|
84 | @ifset is-C |
---|
85 | @findex rtems_timer_service_routine |
---|
86 | @example |
---|
87 | rtems_timer_service_routine user_routine( |
---|
88 | rtems_id timer_id, |
---|
89 | void *user_data |
---|
90 | ); |
---|
91 | @end example |
---|
92 | @end ifset |
---|
93 | |
---|
94 | @ifset is-Ada |
---|
95 | @example |
---|
96 | procedure User_Routine( |
---|
97 | Timer_ID : in RTEMS.ID; |
---|
98 | User_Data : in System.Address |
---|
99 | ); |
---|
100 | @end example |
---|
101 | @end ifset |
---|
102 | |
---|
103 | Where the timer_id parameter is the RTEMS object ID |
---|
104 | of the timer which is being fired and user_data is a pointer to |
---|
105 | user-defined information which may be utilized by the timer |
---|
106 | service routine. The argument user_data may be NULL. |
---|
107 | |
---|
108 | @section Operations |
---|
109 | |
---|
110 | @subsection Creating a Timer |
---|
111 | |
---|
112 | The @code{@value{DIRPREFIX}timer_create} directive creates a timer by |
---|
113 | allocating a Timer Control Block (TMCB), assigning the timer a |
---|
114 | user-specified name, and assigning it a timer ID. Newly created |
---|
115 | timers do not have a timer service routine associated with them |
---|
116 | and are not active. |
---|
117 | |
---|
118 | @subsection Obtaining Timer IDs |
---|
119 | |
---|
120 | When a timer is created, RTEMS generates a unique |
---|
121 | timer ID and assigns it to the created timer until it is |
---|
122 | deleted. The timer ID may be obtained by either of two methods. |
---|
123 | First, as the result of an invocation of the |
---|
124 | @code{@value{DIRPREFIX}timer_create} |
---|
125 | directive, the timer ID is stored in a user provided location. |
---|
126 | Second, the timer ID may be obtained later using the |
---|
127 | @code{@value{DIRPREFIX}timer_ident} directive. The timer ID |
---|
128 | is used by other directives to manipulate this timer. |
---|
129 | |
---|
130 | @subsection Initiating an Interval Timer |
---|
131 | |
---|
132 | The @code{@value{DIRPREFIX}timer_fire_after} |
---|
133 | and @code{@value{DIRPREFIX}timer_server_fire_after} |
---|
134 | directives initiate a timer to fire a user provided |
---|
135 | timer service routine after the specified |
---|
136 | number of clock ticks have elapsed. When the interval has |
---|
137 | elapsed, the timer service routine will be invoked from the |
---|
138 | @code{@value{DIRPREFIX}clock_tick} directive if it was initiated |
---|
139 | by the @code{@value{DIRPREFIX}timer_fire_after} directive |
---|
140 | and from the Timer Server task if initiated by the |
---|
141 | @code{@value{DIRPREFIX}timer_server_fire_after} directive. |
---|
142 | |
---|
143 | @subsection Initiating a Time of Day Timer |
---|
144 | |
---|
145 | The @code{@value{DIRPREFIX}timer_fire_when} |
---|
146 | and @code{@value{DIRPREFIX}timer_server_fire_when} |
---|
147 | directive initiate a timer to |
---|
148 | fire a user provided timer service routine when the specified |
---|
149 | time of day has been reached. When the interval has elapsed, |
---|
150 | the timer service routine will be invoked from the |
---|
151 | @code{@value{DIRPREFIX}clock_tick} directive |
---|
152 | by the @code{@value{DIRPREFIX}timer_fire_when} directive |
---|
153 | and from the Timer Server task if initiated by the |
---|
154 | @code{@value{DIRPREFIX}timer_server_fire_when} directive. |
---|
155 | |
---|
156 | @subsection Canceling a Timer |
---|
157 | |
---|
158 | The @code{@value{DIRPREFIX}timer_cancel} directive is used to halt the |
---|
159 | specified timer. Once canceled, the timer service routine will |
---|
160 | not fire unless the timer is reinitiated. The timer can be |
---|
161 | reinitiated using the @code{@value{DIRPREFIX}timer_reset}, |
---|
162 | @code{@value{DIRPREFIX}timer_fire_after}, and |
---|
163 | @code{@value{DIRPREFIX}timer_fire_when} directives. |
---|
164 | |
---|
165 | @subsection Resetting a Timer |
---|
166 | |
---|
167 | The @code{@value{DIRPREFIX}timer_reset} directive is used to restore an |
---|
168 | interval timer initiated by a previous invocation of |
---|
169 | @code{@value{DIRPREFIX}timer_fire_after} or |
---|
170 | @code{@value{DIRPREFIX}timer_server_fire_after} to |
---|
171 | its original interval length. If the |
---|
172 | timer has not been used or the last usage of this timer |
---|
173 | was by the @code{@value{DIRPREFIX}timer_fire_when} |
---|
174 | or @code{@value{DIRPREFIX}timer_server_fire_when} |
---|
175 | directive, then an error is returned. The timer service routine |
---|
176 | is not changed or fired by this directive. |
---|
177 | |
---|
178 | @subsection Initiating the Timer Server |
---|
179 | |
---|
180 | The @code{@value{DIRPREFIX}timer_initiate_server} directive is used to |
---|
181 | allocate and start the execution of the Timer Server task. The |
---|
182 | application can specify both the stack size and attributes of the |
---|
183 | Timer Server. The Timer Server executes at a priority higher than |
---|
184 | any application task and thus the user can expect to be preempted |
---|
185 | as the result of executing the @code{@value{DIRPREFIX}timer_initiate_server} |
---|
186 | directive. |
---|
187 | |
---|
188 | @subsection Deleting a Timer |
---|
189 | |
---|
190 | The @code{@value{DIRPREFIX}timer_delete} directive is used to delete a timer. |
---|
191 | If the timer is running and has not expired, the timer is |
---|
192 | automatically canceled. The timer's control block is returned |
---|
193 | to the TMCB free list when it is deleted. A timer can be |
---|
194 | deleted by a task other than the task which created the timer. |
---|
195 | Any subsequent references to the timer's name and ID are invalid. |
---|
196 | |
---|
197 | @section Directives |
---|
198 | |
---|
199 | This section details the timer manager's directives. |
---|
200 | A subsection is dedicated to each of this manager's directives |
---|
201 | and describes the calling sequence, related constants, usage, |
---|
202 | and status codes. |
---|
203 | |
---|
204 | @c |
---|
205 | @c |
---|
206 | @c |
---|
207 | @page |
---|
208 | @subsection TIMER_CREATE - Create a timer |
---|
209 | |
---|
210 | @cindex create a timer |
---|
211 | |
---|
212 | @subheading CALLING SEQUENCE: |
---|
213 | |
---|
214 | @ifset is-C |
---|
215 | @findex rtems_timer_create |
---|
216 | @example |
---|
217 | rtems_status_code rtems_timer_create( |
---|
218 | rtems_name name, |
---|
219 | rtems_id *id |
---|
220 | ); |
---|
221 | @end example |
---|
222 | @end ifset |
---|
223 | |
---|
224 | @ifset is-Ada |
---|
225 | @example |
---|
226 | procedure Timer_Create ( |
---|
227 | Name : in RTEMS.Name; |
---|
228 | ID : out RTEMS.ID; |
---|
229 | Result : out RTEMS.Status_Codes |
---|
230 | ); |
---|
231 | @end example |
---|
232 | @end ifset |
---|
233 | |
---|
234 | @subheading DIRECTIVE STATUS CODES: |
---|
235 | @code{@value{RPREFIX}SUCCESSFUL} - timer created successfully@* |
---|
236 | @code{@value{RPREFIX}INVALID_NAME} - invalid timer name@* |
---|
237 | @code{@value{RPREFIX}TOO_MANY} - too many timers created |
---|
238 | |
---|
239 | @subheading DESCRIPTION: |
---|
240 | |
---|
241 | This directive creates a timer. The assigned timer |
---|
242 | id is returned in id. This id is used to access the timer with |
---|
243 | other timer manager directives. For control and maintenance of |
---|
244 | the timer, RTEMS allocates a TMCB from the local TMCB free pool |
---|
245 | and initializes it. |
---|
246 | |
---|
247 | @subheading NOTES: |
---|
248 | |
---|
249 | This directive will not cause the calling task to be |
---|
250 | preempted. |
---|
251 | |
---|
252 | @c |
---|
253 | @c |
---|
254 | @c |
---|
255 | @page |
---|
256 | @subsection TIMER_IDENT - Get ID of a timer |
---|
257 | |
---|
258 | @cindex obtain the ID of a timer |
---|
259 | |
---|
260 | @subheading CALLING SEQUENCE: |
---|
261 | |
---|
262 | @ifset is-C |
---|
263 | @findex rtems_timer_ident |
---|
264 | @example |
---|
265 | rtems_status_code rtems_timer_ident( |
---|
266 | rtems_name name, |
---|
267 | rtems_id *id |
---|
268 | ); |
---|
269 | @end example |
---|
270 | @end ifset |
---|
271 | |
---|
272 | @ifset is-Ada |
---|
273 | @example |
---|
274 | procedure Timer_Ident ( |
---|
275 | Name : in RTEMS.Name; |
---|
276 | ID : out RTEMS.ID; |
---|
277 | Result : out RTEMS.Status_Codes |
---|
278 | ); |
---|
279 | @end example |
---|
280 | @end ifset |
---|
281 | |
---|
282 | @subheading DIRECTIVE STATUS CODES: |
---|
283 | @code{@value{RPREFIX}SUCCESSFUL} - timer identified successfully@* |
---|
284 | @code{@value{RPREFIX}INVALID_NAME} - timer name not found |
---|
285 | |
---|
286 | @subheading DESCRIPTION: |
---|
287 | |
---|
288 | This directive obtains the timer id associated with |
---|
289 | the timer name to be acquired. If the timer name is not unique, |
---|
290 | then the timer id will match one of the timers with that name. |
---|
291 | However, this timer id is not guaranteed to correspond to the |
---|
292 | desired timer. The timer id is used to access this timer in |
---|
293 | other timer related directives. |
---|
294 | |
---|
295 | @subheading NOTES: |
---|
296 | |
---|
297 | This directive will not cause the running task to be |
---|
298 | preempted. |
---|
299 | |
---|
300 | @c |
---|
301 | @c |
---|
302 | @c |
---|
303 | @page |
---|
304 | @subsection TIMER_CANCEL - Cancel a timer |
---|
305 | |
---|
306 | @cindex cancel a timer |
---|
307 | |
---|
308 | @subheading CALLING SEQUENCE: |
---|
309 | |
---|
310 | @ifset is-C |
---|
311 | @findex rtems_timer_cancel |
---|
312 | @example |
---|
313 | rtems_status_code rtems_timer_cancel( |
---|
314 | rtems_id id |
---|
315 | ); |
---|
316 | @end example |
---|
317 | @end ifset |
---|
318 | |
---|
319 | @ifset is-Ada |
---|
320 | @example |
---|
321 | procedure Timer_Cancel ( |
---|
322 | ID : in RTEMS.ID; |
---|
323 | Result : out RTEMS.Status_Codes |
---|
324 | ); |
---|
325 | @end example |
---|
326 | @end ifset |
---|
327 | |
---|
328 | @subheading DIRECTIVE STATUS CODES: |
---|
329 | @code{@value{RPREFIX}SUCCESSFUL} - timer canceled successfully@* |
---|
330 | @code{@value{RPREFIX}INVALID_ID} - invalid timer id |
---|
331 | |
---|
332 | @subheading DESCRIPTION: |
---|
333 | |
---|
334 | This directive cancels the timer id. This timer will |
---|
335 | be reinitiated by the next invocation of @code{@value{DIRPREFIX}timer_reset}, |
---|
336 | @code{@value{DIRPREFIX}timer_fire_after}, or |
---|
337 | @code{@value{DIRPREFIX}timer_fire_when} with this id. |
---|
338 | |
---|
339 | @subheading NOTES: |
---|
340 | |
---|
341 | This directive will not cause the running task to be preempted. |
---|
342 | |
---|
343 | @c |
---|
344 | @c |
---|
345 | @c |
---|
346 | @page |
---|
347 | @subsection TIMER_DELETE - Delete a timer |
---|
348 | |
---|
349 | @cindex delete a timer |
---|
350 | |
---|
351 | @subheading CALLING SEQUENCE: |
---|
352 | |
---|
353 | @ifset is-C |
---|
354 | @findex rtems_timer_delete |
---|
355 | @example |
---|
356 | rtems_status_code rtems_timer_delete( |
---|
357 | rtems_id id |
---|
358 | ); |
---|
359 | @end example |
---|
360 | @end ifset |
---|
361 | |
---|
362 | @ifset is-Ada |
---|
363 | @example |
---|
364 | procedure Timer_Delete ( |
---|
365 | ID : in RTEMS.ID; |
---|
366 | Result : out RTEMS.Status_Codes |
---|
367 | ); |
---|
368 | @end example |
---|
369 | @end ifset |
---|
370 | |
---|
371 | @subheading DIRECTIVE STATUS CODES: |
---|
372 | @code{@value{RPREFIX}SUCCESSFUL} - timer deleted successfully@* |
---|
373 | @code{@value{RPREFIX}INVALID_ID} - invalid timer id |
---|
374 | |
---|
375 | @subheading DESCRIPTION: |
---|
376 | |
---|
377 | This directive deletes the timer specified by id. If |
---|
378 | the timer is running, it is automatically canceled. The TMCB |
---|
379 | for the deleted timer is reclaimed by RTEMS. |
---|
380 | |
---|
381 | @subheading NOTES: |
---|
382 | |
---|
383 | This directive will not cause the running task to be |
---|
384 | preempted. |
---|
385 | |
---|
386 | A timer can be deleted by a task other than the task |
---|
387 | which created the timer. |
---|
388 | |
---|
389 | @c |
---|
390 | @c |
---|
391 | @c |
---|
392 | @page |
---|
393 | @subsection TIMER_FIRE_AFTER - Fire timer after interval |
---|
394 | |
---|
395 | @cindex fire a timer after an interval |
---|
396 | |
---|
397 | @subheading CALLING SEQUENCE: |
---|
398 | |
---|
399 | @ifset is-C |
---|
400 | @findex rtems_timer_fire_after |
---|
401 | @example |
---|
402 | rtems_status_code rtems_timer_fire_after( |
---|
403 | rtems_id id, |
---|
404 | rtems_interval ticks, |
---|
405 | rtems_timer_service_routine_entry routine, |
---|
406 | void *user_data |
---|
407 | ); |
---|
408 | @end example |
---|
409 | @end ifset |
---|
410 | |
---|
411 | @ifset is-Ada |
---|
412 | @example |
---|
413 | procedure Timer_Fire_After ( |
---|
414 | ID : in RTEMS.ID; |
---|
415 | Ticks : in RTEMS.Interval; |
---|
416 | Routine : in RTEMS.Timer_Service_Routine; |
---|
417 | User_Data : in RTEMS.Address; |
---|
418 | Result : out RTEMS.Status_Codes |
---|
419 | ); |
---|
420 | @end example |
---|
421 | @end ifset |
---|
422 | |
---|
423 | @subheading DIRECTIVE STATUS CODES: |
---|
424 | @code{@value{RPREFIX}SUCCESSFUL} - timer initiated successfully@* |
---|
425 | @code{@value{RPREFIX}INVALID_ID} - invalid timer id@* |
---|
426 | @code{@value{RPREFIX}INVALID_NUMBER} - invalid interval |
---|
427 | |
---|
428 | @subheading DESCRIPTION: |
---|
429 | |
---|
430 | This directive initiates the timer specified by id. |
---|
431 | If the timer is running, it is automatically canceled before |
---|
432 | being initiated. The timer is scheduled to fire after an |
---|
433 | interval ticks clock ticks has passed. When the timer fires, |
---|
434 | the timer service routine routine will be invoked with the |
---|
435 | argument user_data. |
---|
436 | |
---|
437 | @subheading NOTES: |
---|
438 | |
---|
439 | This directive will not cause the running task to be |
---|
440 | preempted. |
---|
441 | |
---|
442 | @c |
---|
443 | @c |
---|
444 | @c |
---|
445 | @page |
---|
446 | @subsection TIMER_FIRE_WHEN - Fire timer when specified |
---|
447 | |
---|
448 | @cindex fire a timer at wall time |
---|
449 | |
---|
450 | @subheading CALLING SEQUENCE: |
---|
451 | |
---|
452 | @ifset is-C |
---|
453 | @findex rtems_timer_fire_when |
---|
454 | @example |
---|
455 | rtems_status_code rtems_timer_fire_when( |
---|
456 | rtems_id id, |
---|
457 | rtems_time_of_day *wall_time, |
---|
458 | rtems_timer_service_routine_entry routine, |
---|
459 | void *user_data |
---|
460 | ); |
---|
461 | @end example |
---|
462 | @end ifset |
---|
463 | |
---|
464 | @ifset is-Ada |
---|
465 | @example |
---|
466 | procedure Timer_Fire_When ( |
---|
467 | ID : in RTEMS.ID; |
---|
468 | Wall_Time : in RTEMS.Time_Of_Day; |
---|
469 | Routine : in RTEMS.Timer_Service_Routine; |
---|
470 | User_Data : in RTEMS.Address; |
---|
471 | Result : out RTEMS.Status_Codes |
---|
472 | ); |
---|
473 | @end example |
---|
474 | @end ifset |
---|
475 | |
---|
476 | @subheading DIRECTIVE STATUS CODES: |
---|
477 | @code{@value{RPREFIX}SUCCESSFUL} - timer initiated successfully@* |
---|
478 | @code{@value{RPREFIX}INVALID_ID} - invalid timer id@* |
---|
479 | @code{@value{RPREFIX}NOT_DEFINED} - system date and time is not set@* |
---|
480 | @code{@value{RPREFIX}INVALID_CLOCK} - invalid time of day |
---|
481 | |
---|
482 | @subheading DESCRIPTION: |
---|
483 | |
---|
484 | This directive initiates the timer specified by id. |
---|
485 | If the timer is running, it is automatically canceled before |
---|
486 | being initiated. The timer is scheduled to fire at the time of |
---|
487 | day specified by wall_time. When the timer fires, the timer |
---|
488 | service routine routine will be invoked with the argument |
---|
489 | user_data. |
---|
490 | |
---|
491 | @subheading NOTES: |
---|
492 | |
---|
493 | This directive will not cause the running task to be |
---|
494 | preempted. |
---|
495 | |
---|
496 | @c |
---|
497 | @c |
---|
498 | @c |
---|
499 | @page |
---|
500 | @subsection TIMER_INITIATE_SERVER - Initiate server for task-based timers |
---|
501 | |
---|
502 | @cindex initiate the Timer Server |
---|
503 | |
---|
504 | @subheading CALLING SEQUENCE: |
---|
505 | |
---|
506 | @ifset is-C |
---|
507 | @findex rtems_timer_initiate_server |
---|
508 | @example |
---|
509 | rtems_status_code rtems_timer_initiate_server( |
---|
510 | unsigned32 stack_size, |
---|
511 | rtems_attribute attribute_set |
---|
512 | ) |
---|
513 | ); |
---|
514 | @end example |
---|
515 | @end ifset |
---|
516 | |
---|
517 | @ifset is-Ada |
---|
518 | @example |
---|
519 | procedure Timer_Initiate_Server ( |
---|
520 | Stack_Size : in RTEMS.Unsigned32; |
---|
521 | Attribute_Set : in RTEMS.Attribute; |
---|
522 | Result : out RTEMS.Status_Codes |
---|
523 | ); |
---|
524 | @end example |
---|
525 | @end ifset |
---|
526 | |
---|
527 | @subheading DIRECTIVE STATUS CODES: |
---|
528 | @code{@value{RPREFIX}SUCCESSFUL} - Timer Server initiated successfully@* |
---|
529 | @code{@value{RPREFIX}TOO_MANY} - too many tasks created |
---|
530 | |
---|
531 | @subheading DESCRIPTION: |
---|
532 | |
---|
533 | This directive initiates the Timer Server task. This task |
---|
534 | is responsible for executing all timers initiated via the |
---|
535 | @code{@value{DIRPREFIX}timer_server_fire_after} or |
---|
536 | @code{@value{DIRPREFIX}timer_server_fire_when} directives. |
---|
537 | |
---|
538 | @subheading NOTES: |
---|
539 | |
---|
540 | This directive could cause the calling task to be preempted. |
---|
541 | |
---|
542 | The Timer Server task is created using the |
---|
543 | @code{@value{DIRPREFIX}task_create} service and must be accounted |
---|
544 | for when configuring the system. |
---|
545 | |
---|
546 | Even through this directive invokes the @code{@value{DIRPREFIX}task_create} |
---|
547 | and @code{@value{DIRPREFIX}task_start} directives, it should only fail |
---|
548 | due to resource allocation problems. |
---|
549 | |
---|
550 | @c |
---|
551 | @c |
---|
552 | @c |
---|
553 | @page |
---|
554 | @subsection TIMER_SERVER_FIRE_AFTER - Fire task-based timer after interval |
---|
555 | |
---|
556 | @cindex fire task-based a timer after an interval |
---|
557 | |
---|
558 | @subheading CALLING SEQUENCE: |
---|
559 | |
---|
560 | @ifset is-C |
---|
561 | @findex rtems_timer_server_fire_after |
---|
562 | @example |
---|
563 | rtems_status_code rtems_timer_server_fire_after( |
---|
564 | rtems_id id, |
---|
565 | rtems_interval ticks, |
---|
566 | rtems_timer_service_routine_entry routine, |
---|
567 | void *user_data |
---|
568 | ); |
---|
569 | @end example |
---|
570 | @end ifset |
---|
571 | |
---|
572 | @ifset is-Ada |
---|
573 | @example |
---|
574 | procedure Timer_Fire_Server_After ( |
---|
575 | ID : in RTEMS.ID; |
---|
576 | Ticks : in RTEMS.Interval; |
---|
577 | Routine : in RTEMS.Timer_Service_Routine; |
---|
578 | User_Data : in RTEMS.Address; |
---|
579 | Result : out RTEMS.Status_Codes |
---|
580 | ); |
---|
581 | @end example |
---|
582 | @end ifset |
---|
583 | |
---|
584 | @subheading DIRECTIVE STATUS CODES: |
---|
585 | @code{@value{RPREFIX}SUCCESSFUL} - timer initiated successfully@* |
---|
586 | @code{@value{RPREFIX}INVALID_ID} - invalid timer id@* |
---|
587 | @code{@value{RPREFIX}INVALID_NUMBER} - invalid interval@* |
---|
588 | @code{@value{RPREFIX}INCORRECT_STATE} - Timer Server not initiated |
---|
589 | |
---|
590 | @subheading DESCRIPTION: |
---|
591 | |
---|
592 | This directive initiates the timer specified by id and specifies |
---|
593 | that when it fires it will be executed by the Timer Server. |
---|
594 | |
---|
595 | If the timer is running, it is automatically canceled before |
---|
596 | being initiated. The timer is scheduled to fire after an |
---|
597 | interval ticks clock ticks has passed. When the timer fires, |
---|
598 | the timer service routine routine will be invoked with the |
---|
599 | argument user_data. |
---|
600 | |
---|
601 | @subheading NOTES: |
---|
602 | |
---|
603 | This directive will not cause the running task to be |
---|
604 | preempted. |
---|
605 | |
---|
606 | @c |
---|
607 | @c |
---|
608 | @c |
---|
609 | @page |
---|
610 | @subsection TIMER_SERVER_FIRE_WHEN - Fire task-based timer when specified |
---|
611 | |
---|
612 | @cindex fire a task-based timer at wall time |
---|
613 | |
---|
614 | @subheading CALLING SEQUENCE: |
---|
615 | |
---|
616 | @ifset is-C |
---|
617 | @findex rtems_timer_server_fire_when |
---|
618 | @example |
---|
619 | rtems_status_code rtems_timer_server_fire_when( |
---|
620 | rtems_id id, |
---|
621 | rtems_time_of_day *wall_time, |
---|
622 | rtems_timer_service_routine_entry routine, |
---|
623 | void *user_data |
---|
624 | ); |
---|
625 | @end example |
---|
626 | @end ifset |
---|
627 | |
---|
628 | @ifset is-Ada |
---|
629 | @example |
---|
630 | procedure Timer_Fire_Server_When ( |
---|
631 | ID : in RTEMS.ID; |
---|
632 | Wall_Time : in RTEMS.Time_Of_Day; |
---|
633 | Routine : in RTEMS.Timer_Service_Routine; |
---|
634 | User_Data : in RTEMS.Address; |
---|
635 | Result : out RTEMS.Status_Codes |
---|
636 | ); |
---|
637 | @end example |
---|
638 | @end ifset |
---|
639 | |
---|
640 | @subheading DIRECTIVE STATUS CODES: |
---|
641 | @code{@value{RPREFIX}SUCCESSFUL} - timer initiated successfully@* |
---|
642 | @code{@value{RPREFIX}INVALID_ID} - invalid timer id@* |
---|
643 | @code{@value{RPREFIX}NOT_DEFINED} - system date and time is not set@* |
---|
644 | @code{@value{RPREFIX}INVALID_CLOCK} - invalid time of day@* |
---|
645 | @code{@value{RPREFIX}INCORRECT_STATE} - Timer Server not initiated |
---|
646 | |
---|
647 | @subheading DESCRIPTION: |
---|
648 | |
---|
649 | This directive initiates the timer specified by id and specifies |
---|
650 | that when it fires it will be executed by the Timer Server. |
---|
651 | |
---|
652 | If the timer is running, it is automatically canceled before |
---|
653 | being initiated. The timer is scheduled to fire at the time of |
---|
654 | day specified by wall_time. When the timer fires, the timer |
---|
655 | service routine routine will be invoked with the argument |
---|
656 | user_data. |
---|
657 | |
---|
658 | @subheading NOTES: |
---|
659 | |
---|
660 | This directive will not cause the running task to be |
---|
661 | preempted. |
---|
662 | |
---|
663 | @c |
---|
664 | @c |
---|
665 | @c |
---|
666 | @page |
---|
667 | @subsection TIMER_RESET - Reset an interval timer |
---|
668 | |
---|
669 | @cindex reset a timer |
---|
670 | |
---|
671 | @subheading CALLING SEQUENCE: |
---|
672 | |
---|
673 | @ifset is-C |
---|
674 | @findex rtems_timer_reset |
---|
675 | @example |
---|
676 | rtems_status_code rtems_timer_reset( |
---|
677 | rtems_id id |
---|
678 | ); |
---|
679 | @end example |
---|
680 | @end ifset |
---|
681 | |
---|
682 | @ifset is-Ada |
---|
683 | @example |
---|
684 | procedure Timer_Reset ( |
---|
685 | ID : in RTEMS.ID; |
---|
686 | Result : out RTEMS.Status_Codes |
---|
687 | ); |
---|
688 | @end example |
---|
689 | @end ifset |
---|
690 | |
---|
691 | @subheading DIRECTIVE STATUS CODES: |
---|
692 | @code{@value{RPREFIX}SUCCESSFUL} - timer reset successfully@* |
---|
693 | @code{@value{RPREFIX}INVALID_ID} - invalid timer id@* |
---|
694 | @code{@value{RPREFIX}NOT_DEFINED} - attempted to reset a when or newly created timer |
---|
695 | |
---|
696 | @subheading DESCRIPTION: |
---|
697 | |
---|
698 | This directive resets the timer associated with id. |
---|
699 | This timer must have been previously initiated with either the |
---|
700 | @code{@value{DIRPREFIX}timer_fire_after} or |
---|
701 | @code{@value{DIRPREFIX}timer_server_fire_after} |
---|
702 | directive. If active the timer is canceled, |
---|
703 | after which the timer is reinitiated using the same interval and |
---|
704 | timer service routine which the original |
---|
705 | @code{@value{DIRPREFIX}timer_fire_after} |
---|
706 | @code{@value{DIRPREFIX}timer_server_fire_after} |
---|
707 | directive used. |
---|
708 | |
---|
709 | @subheading NOTES: |
---|
710 | |
---|
711 | If the timer has not been used or the last usage of this timer |
---|
712 | was by a @code{@value{DIRPREFIX}timer_fire_when} or |
---|
713 | @code{@value{DIRPREFIX}timer_server_fire_when} |
---|
714 | directive, then the @code{@value{RPREFIX}NOT_DEFINED} error is |
---|
715 | returned. |
---|
716 | |
---|
717 | Restarting a cancelled after timer results in the timer being |
---|
718 | reinitiated with its previous timer service routine and interval. |
---|
719 | |
---|
720 | This directive will not cause the running task to be preempted. |
---|
721 | |
---|