1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSImplClassicTimer |
---|
7 | * |
---|
8 | * @brief This header file provides the Timer Manager API. |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) |
---|
13 | * Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR) |
---|
14 | * |
---|
15 | * Redistribution and use in source and binary forms, with or without |
---|
16 | * modification, are permitted provided that the following conditions |
---|
17 | * are met: |
---|
18 | * 1. Redistributions of source code must retain the above copyright |
---|
19 | * notice, this list of conditions and the following disclaimer. |
---|
20 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
21 | * notice, this list of conditions and the following disclaimer in the |
---|
22 | * documentation and/or other materials provided with the distribution. |
---|
23 | * |
---|
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
34 | * POSSIBILITY OF SUCH DAMAGE. |
---|
35 | */ |
---|
36 | |
---|
37 | /* |
---|
38 | * This file is part of the RTEMS quality process and was automatically |
---|
39 | * generated. If you find something that needs to be fixed or |
---|
40 | * worded better please post a report or patch to an RTEMS mailing list |
---|
41 | * or raise a bug report: |
---|
42 | * |
---|
43 | * https://docs.rtems.org/branches/master/user/support/bugs.html |
---|
44 | * |
---|
45 | * For information on updating and regenerating please refer to: |
---|
46 | * |
---|
47 | * https://docs.rtems.org/branches/master/eng/req/howto.html |
---|
48 | */ |
---|
49 | |
---|
50 | /* Generated from spec:/rtems/timer/if/header */ |
---|
51 | |
---|
52 | #ifndef _RTEMS_RTEMS_TIMER_H |
---|
53 | #define _RTEMS_RTEMS_TIMER_H |
---|
54 | |
---|
55 | #include <stddef.h> |
---|
56 | #include <rtems/rtems/attr.h> |
---|
57 | #include <rtems/rtems/status.h> |
---|
58 | #include <rtems/rtems/tasks.h> |
---|
59 | #include <rtems/rtems/types.h> |
---|
60 | #include <rtems/score/watchdogticks.h> |
---|
61 | |
---|
62 | #ifdef __cplusplus |
---|
63 | extern "C" { |
---|
64 | #endif |
---|
65 | |
---|
66 | /* Generated from spec:/rtems/timer/if/group */ |
---|
67 | |
---|
68 | /** |
---|
69 | * @defgroup RTEMSAPIClassicTimer Timer Manager |
---|
70 | * |
---|
71 | * @ingroup RTEMSAPIClassic |
---|
72 | * |
---|
73 | * @brief The Timer Manager provides support for timer facilities. |
---|
74 | */ |
---|
75 | |
---|
76 | /* Generated from spec:/rtems/timer/if/class-bit-not-dormant */ |
---|
77 | |
---|
78 | /** |
---|
79 | * @ingroup RTEMSAPIClassicTimer |
---|
80 | * |
---|
81 | * @brief This timer class bit indicates that the timer is not dormant. |
---|
82 | */ |
---|
83 | #define TIMER_CLASS_BIT_NOT_DORMANT 0x4 |
---|
84 | |
---|
85 | /* Generated from spec:/rtems/timer/if/class-bit-on-task */ |
---|
86 | |
---|
87 | /** |
---|
88 | * @ingroup RTEMSAPIClassicTimer |
---|
89 | * |
---|
90 | * @brief This timer class bit indicates that the timer routine executes in a |
---|
91 | * task context. |
---|
92 | */ |
---|
93 | #define TIMER_CLASS_BIT_ON_TASK 0x2 |
---|
94 | |
---|
95 | /* Generated from spec:/rtems/timer/if/class-bit-time-of-day */ |
---|
96 | |
---|
97 | /** |
---|
98 | * @ingroup RTEMSAPIClassicTimer |
---|
99 | * |
---|
100 | * @brief This timer class bit indicates that the timer uses a time of day. |
---|
101 | */ |
---|
102 | #define TIMER_CLASS_BIT_TIME_OF_DAY 0x1 |
---|
103 | |
---|
104 | /* Generated from spec:/rtems/timer/if/classes */ |
---|
105 | |
---|
106 | /** |
---|
107 | * @ingroup RTEMSAPIClassicTimer |
---|
108 | * |
---|
109 | * @brief The timer class indicates how the timer was most recently fired. |
---|
110 | */ |
---|
111 | typedef enum { |
---|
112 | /** |
---|
113 | * @brief This timer class indicates that the timer was never in use. |
---|
114 | */ |
---|
115 | TIMER_DORMANT, |
---|
116 | |
---|
117 | /** |
---|
118 | * @brief This timer class indicates that the timer is currently in use as an |
---|
119 | * interval timer which will fire in the context of the clock tick ISR. |
---|
120 | */ |
---|
121 | TIMER_INTERVAL = TIMER_CLASS_BIT_NOT_DORMANT, |
---|
122 | |
---|
123 | /** |
---|
124 | * @brief This timer class indicates that the timer is currently in use as an |
---|
125 | * interval timer which will fire in the context of the Timer Server task. |
---|
126 | */ |
---|
127 | TIMER_INTERVAL_ON_TASK = TIMER_CLASS_BIT_NOT_DORMANT | |
---|
128 | TIMER_CLASS_BIT_ON_TASK, |
---|
129 | |
---|
130 | /** |
---|
131 | * @brief This timer class indicates that the timer is currently in use as an |
---|
132 | * time of day timer which will fire in the context of the clock tick ISR. |
---|
133 | */ |
---|
134 | TIMER_TIME_OF_DAY = TIMER_CLASS_BIT_NOT_DORMANT | |
---|
135 | TIMER_CLASS_BIT_TIME_OF_DAY, |
---|
136 | |
---|
137 | /** |
---|
138 | * @brief This timer class indicates that the timer is currently in use as an |
---|
139 | * time of day timer which will fire in the context of the Timer Server task. |
---|
140 | */ |
---|
141 | TIMER_TIME_OF_DAY_ON_TASK = TIMER_CLASS_BIT_NOT_DORMANT | |
---|
142 | TIMER_CLASS_BIT_TIME_OF_DAY | |
---|
143 | TIMER_CLASS_BIT_ON_TASK |
---|
144 | } Timer_Classes; |
---|
145 | |
---|
146 | /* Generated from spec:/rtems/timer/if/information */ |
---|
147 | |
---|
148 | /** |
---|
149 | * @ingroup RTEMSAPIClassicTimer |
---|
150 | * |
---|
151 | * @brief The structure contains information about a timer. |
---|
152 | */ |
---|
153 | typedef struct { |
---|
154 | /** |
---|
155 | * @brief The timer class member indicates how the timer was most recently |
---|
156 | * fired. |
---|
157 | */ |
---|
158 | Timer_Classes the_class; |
---|
159 | |
---|
160 | /** |
---|
161 | * @brief This member indicates the initial requested interval. |
---|
162 | */ |
---|
163 | Watchdog_Interval initial; |
---|
164 | |
---|
165 | /** |
---|
166 | * @brief This member indicates the time the timer was initially scheduled. |
---|
167 | * |
---|
168 | * The time is in clock ticks since the clock driver initialization or the last |
---|
169 | * clock tick counter overflow. |
---|
170 | */ |
---|
171 | Watchdog_Interval start_time; |
---|
172 | |
---|
173 | /** |
---|
174 | * @brief This member indicates the time the timer was scheduled to fire. |
---|
175 | * |
---|
176 | * The time is in clock ticks since the clock driver initialization or the last |
---|
177 | * clock tick counter overflow. |
---|
178 | */ |
---|
179 | Watchdog_Interval stop_time; |
---|
180 | } rtems_timer_information; |
---|
181 | |
---|
182 | /* Generated from spec:/rtems/timer/if/get-information */ |
---|
183 | |
---|
184 | /** |
---|
185 | * @ingroup RTEMSAPIClassicTimer |
---|
186 | * |
---|
187 | * @brief Gets information about the timer. |
---|
188 | * |
---|
189 | * This directive returns information about the timer. |
---|
190 | * |
---|
191 | * This directive will not cause the running task to be preempted. |
---|
192 | * |
---|
193 | * @param id is the timer identifier. |
---|
194 | * |
---|
195 | * @param[out] the_info is the pointer to a timer information variable. The |
---|
196 | * information about the timer will be stored in this variable, in case of a |
---|
197 | * successful operation. |
---|
198 | * |
---|
199 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
200 | * |
---|
201 | * @retval ::RTEMS_INVALID_ADDRESS The ``the_info`` parameter was NULL. |
---|
202 | * |
---|
203 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
204 | * specified by ``id``. |
---|
205 | */ |
---|
206 | rtems_status_code rtems_timer_get_information( |
---|
207 | rtems_id id, |
---|
208 | rtems_timer_information *the_info |
---|
209 | ); |
---|
210 | |
---|
211 | /* Generated from spec:/rtems/timer/if/server-default-priority */ |
---|
212 | |
---|
213 | /** |
---|
214 | * @ingroup RTEMSAPIClassicTimer |
---|
215 | * |
---|
216 | * @brief This constant represents the default value for the task priority of |
---|
217 | * the Timer Server. |
---|
218 | * |
---|
219 | * When given this priority, a special high priority not accessible via the |
---|
220 | * Classic API is used. |
---|
221 | */ |
---|
222 | #define RTEMS_TIMER_SERVER_DEFAULT_PRIORITY ( (rtems_task_priority) -1 ) |
---|
223 | |
---|
224 | /* Generated from spec:/rtems/timer/if/service-routine */ |
---|
225 | |
---|
226 | /** |
---|
227 | * @ingroup RTEMSAPIClassicTimer |
---|
228 | * |
---|
229 | * @brief This type defines the return type of routines which can be fired by |
---|
230 | * directives of the Timer Manager. |
---|
231 | * |
---|
232 | * This type can be used to document timer service routines in the source code. |
---|
233 | */ |
---|
234 | typedef void rtems_timer_service_routine; |
---|
235 | |
---|
236 | /* Generated from spec:/rtems/timer/if/service-routine-entry */ |
---|
237 | |
---|
238 | /** |
---|
239 | * @ingroup RTEMSAPIClassicTimer |
---|
240 | * |
---|
241 | * @brief This type defines the prototype of routines which can be fired by |
---|
242 | * directives of the Timer Manager. |
---|
243 | */ |
---|
244 | typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( rtems_id, void * ); |
---|
245 | |
---|
246 | /* Generated from spec:/rtems/timer/if/create */ |
---|
247 | |
---|
248 | /** |
---|
249 | * @ingroup RTEMSAPIClassicTimer |
---|
250 | * |
---|
251 | * @brief Creates a timer. |
---|
252 | * |
---|
253 | * This directive creates a timer. The assigned object identifier is returned |
---|
254 | * in ``id``. This identifier is used to access the timer with other timer |
---|
255 | * related directives. |
---|
256 | * |
---|
257 | * This directive may cause the calling task to be preempted due to an obtain |
---|
258 | * and release of the object allocator mutex. |
---|
259 | * |
---|
260 | * For control and maintenance of the timer, RTEMS allocates a TMCB from the |
---|
261 | * local TMCB free pool and initializes it. |
---|
262 | * |
---|
263 | * In SMP configurations, the processor of the currently executing thread |
---|
264 | * determines the processor used for the created timer. During the life-time |
---|
265 | * of the timer this processor is used to manage the timer internally. |
---|
266 | * |
---|
267 | * @param name is the name of the timer. |
---|
268 | * |
---|
269 | * @param[out] id is the pointer to an object identifier variable. The |
---|
270 | * identifier of the created timer object will be stored in this variable, in |
---|
271 | * case of a successful operation. |
---|
272 | * |
---|
273 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
274 | * |
---|
275 | * @retval ::RTEMS_INVALID_NAME The timer name was invalid. |
---|
276 | * |
---|
277 | * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. |
---|
278 | * |
---|
279 | * @retval ::RTEMS_TOO_MANY There was no inactive object available to create a |
---|
280 | * new timer. The number of timers available to the application is |
---|
281 | * configured through the #CONFIGURE_MAXIMUM_TIMERS configuration option. |
---|
282 | */ |
---|
283 | rtems_status_code rtems_timer_create( rtems_name name, rtems_id *id ); |
---|
284 | |
---|
285 | /* Generated from spec:/rtems/timer/if/ident */ |
---|
286 | |
---|
287 | /** |
---|
288 | * @ingroup RTEMSAPIClassicTimer |
---|
289 | * |
---|
290 | * @brief Identifies a timer by the object name. |
---|
291 | * |
---|
292 | * This directive obtains the timer identifier associated with the timer name |
---|
293 | * specified in ``name``. |
---|
294 | * |
---|
295 | * If the timer name is not unique, then the timer identifier will match the |
---|
296 | * first timer with that name in the search order. However, this timer |
---|
297 | * identifier is not guaranteed to correspond to the desired timer. The timer |
---|
298 | * identifier is used with other timer related directives to access the timer. |
---|
299 | * |
---|
300 | * The objects are searched from lowest to the highest index. Only the local |
---|
301 | * node is searched. |
---|
302 | * |
---|
303 | * @param name is the object name to look up. |
---|
304 | * |
---|
305 | * @param[out] id is the pointer to an object identifier variable. The object |
---|
306 | * identifier of an object with the specified name will be stored in this |
---|
307 | * variable, in case of a successful operation. |
---|
308 | * |
---|
309 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
310 | * |
---|
311 | * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. |
---|
312 | * |
---|
313 | * @retval ::RTEMS_INVALID_NAME The ``name`` parameter was 0. |
---|
314 | * |
---|
315 | * @retval ::RTEMS_INVALID_NAME There was no object with the specified name on |
---|
316 | * the local node. |
---|
317 | */ |
---|
318 | rtems_status_code rtems_timer_ident( rtems_name name, rtems_id *id ); |
---|
319 | |
---|
320 | /* Generated from spec:/rtems/timer/if/cancel */ |
---|
321 | |
---|
322 | /** |
---|
323 | * @ingroup RTEMSAPIClassicTimer |
---|
324 | * |
---|
325 | * @brief Cancels the timer. |
---|
326 | * |
---|
327 | * This directive cancels the timer specified in the ``id`` parameter. This |
---|
328 | * timer will be reinitiated by the next invocation of rtems_timer_reset(), |
---|
329 | * rtems_timer_fire_after(), or rtems_timer_fire_when() with the same timer |
---|
330 | * identifier. |
---|
331 | * |
---|
332 | * This directive will not cause the running task to be preempted. |
---|
333 | * |
---|
334 | * @param id is the timer identifier. |
---|
335 | * |
---|
336 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
337 | * |
---|
338 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
339 | * specified by ``id``. |
---|
340 | */ |
---|
341 | rtems_status_code rtems_timer_cancel( rtems_id id ); |
---|
342 | |
---|
343 | /* Generated from spec:/rtems/timer/if/delete */ |
---|
344 | |
---|
345 | /** |
---|
346 | * @ingroup RTEMSAPIClassicTimer |
---|
347 | * |
---|
348 | * @brief Deletes the timer. |
---|
349 | * |
---|
350 | * This directive deletes the timer specified by the ``id`` parameter. If the |
---|
351 | * timer is running, it is automatically canceled. |
---|
352 | * |
---|
353 | * This directive may cause the calling task to be preempted due to an obtain |
---|
354 | * and release of the object allocator mutex. |
---|
355 | * |
---|
356 | * The TMCB for the deleted timer is reclaimed by RTEMS. |
---|
357 | * |
---|
358 | * A timer can be deleted by a task other than the task which created the |
---|
359 | * timer. |
---|
360 | * |
---|
361 | * @param id is the timer identifier. |
---|
362 | * |
---|
363 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
364 | * |
---|
365 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
366 | * specified by ``id``. |
---|
367 | */ |
---|
368 | rtems_status_code rtems_timer_delete( rtems_id id ); |
---|
369 | |
---|
370 | /* Generated from spec:/rtems/timer/if/fire-after */ |
---|
371 | |
---|
372 | /** |
---|
373 | * @ingroup RTEMSAPIClassicTimer |
---|
374 | * |
---|
375 | * @brief Fires the timer after the interval. |
---|
376 | * |
---|
377 | * This directive initiates the timer specified by ``id``. If the timer is |
---|
378 | * running, it is automatically canceled before being initiated. The timer is |
---|
379 | * scheduled to fire after an interval of clock ticks has passed specified by |
---|
380 | * ``ticks``. When the timer fires, the timer service routine ``routine`` will |
---|
381 | * be invoked with the argument ``user_data`` in the context of the clock tick |
---|
382 | * ISR. |
---|
383 | * |
---|
384 | * This directive will not cause the running task to be preempted. |
---|
385 | * |
---|
386 | * @param id is the timer identifier. |
---|
387 | * |
---|
388 | * @param ticks is the interval until the routine is fired in clock ticks. |
---|
389 | * |
---|
390 | * @param routine is the routine to schedule. |
---|
391 | * |
---|
392 | * @param user_data is the argument passed to the routine when it is fired. |
---|
393 | * |
---|
394 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
395 | * |
---|
396 | * @retval ::RTEMS_INVALID_NUMBER The ``ticks`` parameter was 0. |
---|
397 | * |
---|
398 | * @retval ::RTEMS_INVALID_ADDRESS The ``routine`` parameter was NULL. |
---|
399 | * |
---|
400 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
401 | * specified by ``id``. |
---|
402 | */ |
---|
403 | rtems_status_code rtems_timer_fire_after( |
---|
404 | rtems_id id, |
---|
405 | rtems_interval ticks, |
---|
406 | rtems_timer_service_routine_entry routine, |
---|
407 | void *user_data |
---|
408 | ); |
---|
409 | |
---|
410 | /* Generated from spec:/rtems/timer/if/fire-when */ |
---|
411 | |
---|
412 | /** |
---|
413 | * @ingroup RTEMSAPIClassicTimer |
---|
414 | * |
---|
415 | * @brief Fires the timer at the time of day. |
---|
416 | * |
---|
417 | * This directive initiates the timer specified by ``id``. If the timer is |
---|
418 | * running, it is automatically canceled before being initiated. The timer is |
---|
419 | * scheduled to fire at the time of day specified by ``wall_time``. When the |
---|
420 | * timer fires, the timer service routine ``routine`` will be invoked with the |
---|
421 | * argument ``user_data`` in the context of the clock tick ISR. |
---|
422 | * |
---|
423 | * This directive will not cause the running task to be preempted. |
---|
424 | * |
---|
425 | * @param id is the timer identifier. |
---|
426 | * |
---|
427 | * @param wall_time is the time of day when the routine is fired. |
---|
428 | * |
---|
429 | * @param routine is the routine to schedule. |
---|
430 | * |
---|
431 | * @param user_data is the argument passed to the routine when it is fired. |
---|
432 | * |
---|
433 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
434 | * |
---|
435 | * @retval ::RTEMS_NOT_DEFINED The system date and time was not set. |
---|
436 | * |
---|
437 | * @retval ::RTEMS_INVALID_ADDRESS The ``routine`` parameter was NULL. |
---|
438 | * |
---|
439 | * @retval ::RTEMS_INVALID_ADDRESS The ``wall_time`` parameter was NULL. |
---|
440 | * |
---|
441 | * @retval ::RTEMS_INVALID_CLOCK The time of day was invalid. |
---|
442 | * |
---|
443 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
444 | * specified by ``id``. |
---|
445 | */ |
---|
446 | rtems_status_code rtems_timer_fire_when( |
---|
447 | rtems_id id, |
---|
448 | rtems_time_of_day *wall_time, |
---|
449 | rtems_timer_service_routine_entry routine, |
---|
450 | void *user_data |
---|
451 | ); |
---|
452 | |
---|
453 | /* Generated from spec:/rtems/timer/if/initiate-server */ |
---|
454 | |
---|
455 | /** |
---|
456 | * @ingroup RTEMSAPIClassicTimer |
---|
457 | * |
---|
458 | * @brief Initiates the Timer Server. |
---|
459 | * |
---|
460 | * This directive initiates the Timer Server task. This task is responsible |
---|
461 | * for executing all timers initiated via the rtems_timer_server_fire_after() |
---|
462 | * or rtems_timer_server_fire_when() directives. |
---|
463 | * |
---|
464 | * This directive may cause the calling task to be preempted due to an obtain |
---|
465 | * and release of the object allocator mutex. |
---|
466 | * |
---|
467 | * The Timer Server task is created using the rtems_task_create() directive and |
---|
468 | * must be accounted for when configuring the system. |
---|
469 | * |
---|
470 | * @param priority is the task priority. |
---|
471 | * |
---|
472 | * @param stack_size is the task stack size in bytes. |
---|
473 | * |
---|
474 | * @param attribute_set is the task attribute set. |
---|
475 | * |
---|
476 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
477 | * |
---|
478 | * @retval ::RTEMS_INCORRECT_STATE The Timer Server was already initiated. |
---|
479 | * |
---|
480 | * @retval ::RTEMS_INVALID_PRIORITY The task priority was invalid. |
---|
481 | * |
---|
482 | * @retval ::RTEMS_TOO_MANY There was no inactive task object available to |
---|
483 | * create the Timer Server task. |
---|
484 | * |
---|
485 | * @retval ::RTEMS_UNSATISFIED There was not enough memory to allocate the task |
---|
486 | * storage area. The task storage area contains the task stack, the |
---|
487 | * thread-local storage, and the floating point context. |
---|
488 | * |
---|
489 | * @retval ::RTEMS_UNSATISFIED One of the task create extensions failed to |
---|
490 | * create the Timer Server task. |
---|
491 | */ |
---|
492 | rtems_status_code rtems_timer_initiate_server( |
---|
493 | rtems_task_priority priority, |
---|
494 | size_t stack_size, |
---|
495 | rtems_attribute attribute_set |
---|
496 | ); |
---|
497 | |
---|
498 | /* Generated from spec:/rtems/timer/if/server-fire-after */ |
---|
499 | |
---|
500 | /** |
---|
501 | * @ingroup RTEMSAPIClassicTimer |
---|
502 | * |
---|
503 | * @brief Fires the timer after the interval using the Timer Server. |
---|
504 | * |
---|
505 | * This directive initiates the timer specified by ``id``. If the timer is |
---|
506 | * running, it is automatically canceled before being initiated. The timer is |
---|
507 | * scheduled to fire after an interval of clock ticks has passed specified by |
---|
508 | * ``ticks``. When the timer fires, the timer service routine ``routine`` will |
---|
509 | * be invoked with the argument ``user_data`` in the context of the Timer |
---|
510 | * Server task. |
---|
511 | * |
---|
512 | * This directive will not cause the running task to be preempted. |
---|
513 | * |
---|
514 | * @param id is the timer identifier. |
---|
515 | * |
---|
516 | * @param ticks is the interval until the routine is fired in clock ticks. |
---|
517 | * |
---|
518 | * @param routine is the routine to schedule. |
---|
519 | * |
---|
520 | * @param user_data is the argument passed to the routine when it is fired. |
---|
521 | * |
---|
522 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
523 | * |
---|
524 | * @retval ::RTEMS_INCORRECT_STATE The Timer Server was not initiated. |
---|
525 | * |
---|
526 | * @retval ::RTEMS_INVALID_NUMBER The ``ticks`` parameter was 0. |
---|
527 | * |
---|
528 | * @retval ::RTEMS_INVALID_ADDRESS The ``routine`` parameter was NULL. |
---|
529 | * |
---|
530 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
531 | * specified by ``id``. |
---|
532 | */ |
---|
533 | rtems_status_code rtems_timer_server_fire_after( |
---|
534 | rtems_id id, |
---|
535 | rtems_interval ticks, |
---|
536 | rtems_timer_service_routine_entry routine, |
---|
537 | void *user_data |
---|
538 | ); |
---|
539 | |
---|
540 | /* Generated from spec:/rtems/timer/if/server-fire-when */ |
---|
541 | |
---|
542 | /** |
---|
543 | * @ingroup RTEMSAPIClassicTimer |
---|
544 | * |
---|
545 | * @brief Fires the timer at the time of day using the Timer Server. |
---|
546 | * |
---|
547 | * This directive initiates the timer specified by ``id``. If the timer is |
---|
548 | * running, it is automatically canceled before being initiated. The timer is |
---|
549 | * scheduled to fire at the time of day specified by ``wall_time``. When the |
---|
550 | * timer fires, the timer service routine ``routine`` will be invoked with the |
---|
551 | * argument ``user_data`` in the context of the Timer Server task. |
---|
552 | * |
---|
553 | * This directive will not cause the running task to be preempted. |
---|
554 | * |
---|
555 | * @param id is the timer identifier. |
---|
556 | * |
---|
557 | * @param wall_time is the time of day when the routine is fired. |
---|
558 | * |
---|
559 | * @param routine is the routine to schedule. |
---|
560 | * |
---|
561 | * @param user_data is the argument passed to the routine when it is fired. |
---|
562 | * |
---|
563 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
564 | * |
---|
565 | * @retval ::RTEMS_INCORRECT_STATE The Timer Server was not initiated. |
---|
566 | * |
---|
567 | * @retval ::RTEMS_NOT_DEFINED The system date and time was not set. |
---|
568 | * |
---|
569 | * @retval ::RTEMS_INVALID_ADDRESS The ``routine`` parameter was NULL. |
---|
570 | * |
---|
571 | * @retval ::RTEMS_INVALID_ADDRESS The ``wall_time`` parameter was NULL. |
---|
572 | * |
---|
573 | * @retval ::RTEMS_INVALID_CLOCK The time of day was invalid. |
---|
574 | * |
---|
575 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
576 | * specified by ``id``. |
---|
577 | */ |
---|
578 | rtems_status_code rtems_timer_server_fire_when( |
---|
579 | rtems_id id, |
---|
580 | rtems_time_of_day *wall_time, |
---|
581 | rtems_timer_service_routine_entry routine, |
---|
582 | void *user_data |
---|
583 | ); |
---|
584 | |
---|
585 | /* Generated from spec:/rtems/timer/if/reset */ |
---|
586 | |
---|
587 | /** |
---|
588 | * @ingroup RTEMSAPIClassicTimer |
---|
589 | * |
---|
590 | * @brief Resets the timer. |
---|
591 | * |
---|
592 | * This directive resets the timer specified by ``id``. This timer must have |
---|
593 | * been previously initiated with either the rtems_timer_fire_after() or |
---|
594 | * rtems_timer_server_fire_after() directive. If active the timer is canceled, |
---|
595 | * after which the timer is reinitiated using the same interval and timer |
---|
596 | * service routine which the original rtems_timer_fire_after() or |
---|
597 | * rtems_timer_server_fire_after() directive used. |
---|
598 | * |
---|
599 | * This directive will not cause the running task to be preempted. |
---|
600 | * |
---|
601 | * If the timer has not been used or the last usage of this timer was by a |
---|
602 | * rtems_timer_fire_when() or rtems_timer_server_fire_when() directive, then |
---|
603 | * the ::RTEMS_NOT_DEFINED error is returned. |
---|
604 | * |
---|
605 | * Restarting a cancelled after timer results in the timer being reinitiated |
---|
606 | * with its previous timer service routine and interval. |
---|
607 | * |
---|
608 | * @param id is the timer identifier. |
---|
609 | * |
---|
610 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
611 | * |
---|
612 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
613 | * specified by ``id``. |
---|
614 | * |
---|
615 | * @retval ::RTEMS_NOT_DEFINED The timer was not of the interval class. |
---|
616 | */ |
---|
617 | rtems_status_code rtems_timer_reset( rtems_id id ); |
---|
618 | |
---|
619 | #ifdef __cplusplus |
---|
620 | } |
---|
621 | #endif |
---|
622 | |
---|
623 | #endif /* _RTEMS_RTEMS_TIMER_H */ |
---|