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, 2021 embedded brains GmbH & Co. KG |
---|
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://www.rtems.org/bugs.html |
---|
44 | * |
---|
45 | * For information on updating and regenerating please refer to the How-To |
---|
46 | * section in the Software Requirements Engineering chapter of the |
---|
47 | * RTEMS Software Engineering manual. The manual is provided as a part of |
---|
48 | * a release. For development sources please refer to the online |
---|
49 | * documentation at: |
---|
50 | * |
---|
51 | * https://docs.rtems.org |
---|
52 | */ |
---|
53 | |
---|
54 | /* Generated from spec:/rtems/timer/if/header */ |
---|
55 | |
---|
56 | #ifndef _RTEMS_RTEMS_TIMER_H |
---|
57 | #define _RTEMS_RTEMS_TIMER_H |
---|
58 | |
---|
59 | #include <stddef.h> |
---|
60 | #include <rtems/rtems/attr.h> |
---|
61 | #include <rtems/rtems/status.h> |
---|
62 | #include <rtems/rtems/types.h> |
---|
63 | #include <rtems/score/watchdogticks.h> |
---|
64 | |
---|
65 | #ifdef __cplusplus |
---|
66 | extern "C" { |
---|
67 | #endif |
---|
68 | |
---|
69 | /* Generated from spec:/rtems/timer/if/group */ |
---|
70 | |
---|
71 | /** |
---|
72 | * @defgroup RTEMSAPIClassicTimer Timer Manager |
---|
73 | * |
---|
74 | * @ingroup RTEMSAPIClassic |
---|
75 | * |
---|
76 | * @brief The Timer Manager provides support for timer facilities. |
---|
77 | */ |
---|
78 | |
---|
79 | /* Generated from spec:/rtems/timer/if/class-bit-not-dormant */ |
---|
80 | |
---|
81 | /** |
---|
82 | * @ingroup RTEMSAPIClassicTimer |
---|
83 | * |
---|
84 | * @brief This timer class bit indicates that the timer is not dormant. |
---|
85 | */ |
---|
86 | #define TIMER_CLASS_BIT_NOT_DORMANT 0x4 |
---|
87 | |
---|
88 | /* Generated from spec:/rtems/timer/if/class-bit-on-task */ |
---|
89 | |
---|
90 | /** |
---|
91 | * @ingroup RTEMSAPIClassicTimer |
---|
92 | * |
---|
93 | * @brief This timer class bit indicates that the timer routine executes in a |
---|
94 | * task context. |
---|
95 | */ |
---|
96 | #define TIMER_CLASS_BIT_ON_TASK 0x2 |
---|
97 | |
---|
98 | /* Generated from spec:/rtems/timer/if/class-bit-time-of-day */ |
---|
99 | |
---|
100 | /** |
---|
101 | * @ingroup RTEMSAPIClassicTimer |
---|
102 | * |
---|
103 | * @brief This timer class bit indicates that the timer uses a time of day. |
---|
104 | */ |
---|
105 | #define TIMER_CLASS_BIT_TIME_OF_DAY 0x1 |
---|
106 | |
---|
107 | /* Generated from spec:/rtems/timer/if/classes */ |
---|
108 | |
---|
109 | /** |
---|
110 | * @ingroup RTEMSAPIClassicTimer |
---|
111 | * |
---|
112 | * @brief The timer class indicates how the timer was most recently fired. |
---|
113 | */ |
---|
114 | typedef enum { |
---|
115 | /** |
---|
116 | * @brief This timer class indicates that the timer was never in use. |
---|
117 | */ |
---|
118 | TIMER_DORMANT, |
---|
119 | |
---|
120 | /** |
---|
121 | * @brief This timer class indicates that the timer is currently in use as an |
---|
122 | * interval timer which will fire in the context of the clock tick ISR. |
---|
123 | */ |
---|
124 | TIMER_INTERVAL = TIMER_CLASS_BIT_NOT_DORMANT, |
---|
125 | |
---|
126 | /** |
---|
127 | * @brief This timer class indicates that the timer is currently in use as an |
---|
128 | * interval timer which will fire in the context of the Timer Server task. |
---|
129 | */ |
---|
130 | TIMER_INTERVAL_ON_TASK = TIMER_CLASS_BIT_NOT_DORMANT | |
---|
131 | TIMER_CLASS_BIT_ON_TASK, |
---|
132 | |
---|
133 | /** |
---|
134 | * @brief This timer class indicates that the timer is currently in use as an |
---|
135 | * time of day timer which will fire in the context of the clock tick ISR. |
---|
136 | */ |
---|
137 | TIMER_TIME_OF_DAY = TIMER_CLASS_BIT_NOT_DORMANT | |
---|
138 | TIMER_CLASS_BIT_TIME_OF_DAY, |
---|
139 | |
---|
140 | /** |
---|
141 | * @brief This timer class indicates that the timer is currently in use as an |
---|
142 | * time of day timer which will fire in the context of the Timer Server task. |
---|
143 | */ |
---|
144 | TIMER_TIME_OF_DAY_ON_TASK = TIMER_CLASS_BIT_NOT_DORMANT | |
---|
145 | TIMER_CLASS_BIT_TIME_OF_DAY | |
---|
146 | TIMER_CLASS_BIT_ON_TASK |
---|
147 | } Timer_Classes; |
---|
148 | |
---|
149 | /* Generated from spec:/rtems/timer/if/information */ |
---|
150 | |
---|
151 | /** |
---|
152 | * @ingroup RTEMSAPIClassicTimer |
---|
153 | * |
---|
154 | * @brief The structure contains information about a timer. |
---|
155 | */ |
---|
156 | typedef struct { |
---|
157 | /** |
---|
158 | * @brief The timer class member indicates how the timer was most recently |
---|
159 | * fired. |
---|
160 | */ |
---|
161 | Timer_Classes the_class; |
---|
162 | |
---|
163 | /** |
---|
164 | * @brief This member indicates the initial requested interval. |
---|
165 | */ |
---|
166 | Watchdog_Interval initial; |
---|
167 | |
---|
168 | /** |
---|
169 | * @brief This member indicates the time the timer was initially scheduled. |
---|
170 | * |
---|
171 | * The time is in clock ticks since the clock driver initialization or the last |
---|
172 | * clock tick counter overflow. |
---|
173 | */ |
---|
174 | Watchdog_Interval start_time; |
---|
175 | |
---|
176 | /** |
---|
177 | * @brief This member indicates the time the timer was scheduled to fire. |
---|
178 | * |
---|
179 | * The time is in clock ticks since the clock driver initialization or the last |
---|
180 | * clock tick counter overflow. |
---|
181 | */ |
---|
182 | Watchdog_Interval stop_time; |
---|
183 | } rtems_timer_information; |
---|
184 | |
---|
185 | /* Generated from spec:/rtems/timer/if/get-information */ |
---|
186 | |
---|
187 | /** |
---|
188 | * @ingroup RTEMSAPIClassicTimer |
---|
189 | * |
---|
190 | * @brief Gets information about the timer. |
---|
191 | * |
---|
192 | * @param id is the timer identifier. |
---|
193 | * |
---|
194 | * @param[out] the_info is the pointer to an rtems_timer_information object. |
---|
195 | * When the directive call is successful, the information about the timer |
---|
196 | * will be stored in this object. |
---|
197 | * |
---|
198 | * This directive returns information about the timer. |
---|
199 | * |
---|
200 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
201 | * |
---|
202 | * @retval ::RTEMS_INVALID_ADDRESS The ``the_info`` parameter was NULL. |
---|
203 | * |
---|
204 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
205 | * specified by ``id``. |
---|
206 | * |
---|
207 | * @par Constraints |
---|
208 | * @parblock |
---|
209 | * The following constraints apply to this directive: |
---|
210 | * |
---|
211 | * * The directive may be called from within interrupt context. |
---|
212 | * |
---|
213 | * * The directive may be called from within device driver initialization |
---|
214 | * context. |
---|
215 | * |
---|
216 | * * The directive may be called from within task context. |
---|
217 | * |
---|
218 | * * The directive will not cause the calling task to be preempted. |
---|
219 | * @endparblock |
---|
220 | */ |
---|
221 | rtems_status_code rtems_timer_get_information( |
---|
222 | rtems_id id, |
---|
223 | rtems_timer_information *the_info |
---|
224 | ); |
---|
225 | |
---|
226 | /* Generated from spec:/rtems/timer/if/server-default-priority */ |
---|
227 | |
---|
228 | /** |
---|
229 | * @ingroup RTEMSAPIClassicTimer |
---|
230 | * |
---|
231 | * @brief This constant represents the default value for the task priority of |
---|
232 | * the Timer Server. |
---|
233 | * |
---|
234 | * When given this priority, a special high priority not accessible via the |
---|
235 | * Classic API is used. |
---|
236 | */ |
---|
237 | #define RTEMS_TIMER_SERVER_DEFAULT_PRIORITY ( (rtems_task_priority) -1 ) |
---|
238 | |
---|
239 | /* Generated from spec:/rtems/timer/if/service-routine */ |
---|
240 | |
---|
241 | /** |
---|
242 | * @ingroup RTEMSAPIClassicTimer |
---|
243 | * |
---|
244 | * @brief This type defines the return type of routines which can be fired by |
---|
245 | * directives of the Timer Manager. |
---|
246 | * |
---|
247 | * This type can be used to document timer service routines in the source code. |
---|
248 | */ |
---|
249 | typedef void rtems_timer_service_routine; |
---|
250 | |
---|
251 | /* Generated from spec:/rtems/timer/if/service-routine-entry */ |
---|
252 | |
---|
253 | /** |
---|
254 | * @ingroup RTEMSAPIClassicTimer |
---|
255 | * |
---|
256 | * @brief This type defines the prototype of routines which can be fired by |
---|
257 | * directives of the Timer Manager. |
---|
258 | */ |
---|
259 | typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( rtems_id, void * ); |
---|
260 | |
---|
261 | /* Generated from spec:/rtems/timer/if/create */ |
---|
262 | |
---|
263 | /** |
---|
264 | * @ingroup RTEMSAPIClassicTimer |
---|
265 | * |
---|
266 | * @brief Creates a timer. |
---|
267 | * |
---|
268 | * @param name is the object name of the timer. |
---|
269 | * |
---|
270 | * @param[out] id is the pointer to an ::rtems_id object. When the directive |
---|
271 | * call is successful, the identifier of the created timer will be stored in |
---|
272 | * this object. |
---|
273 | * |
---|
274 | * This directive creates a timer which resides on the local node. The timer |
---|
275 | * has the user-defined object name specified in ``name``. The assigned object |
---|
276 | * identifier is returned in ``id``. This identifier is used to access the |
---|
277 | * timer with other timer related directives. |
---|
278 | * |
---|
279 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
280 | * |
---|
281 | * @retval ::RTEMS_INVALID_NAME The ``name`` parameter was invalid. |
---|
282 | * |
---|
283 | * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. |
---|
284 | * |
---|
285 | * @retval ::RTEMS_TOO_MANY There was no inactive object available to create a |
---|
286 | * timer. The number of timers available to the application is configured |
---|
287 | * through the @ref CONFIGURE_MAXIMUM_TIMERS application configuration |
---|
288 | * option. |
---|
289 | * |
---|
290 | * @par Notes |
---|
291 | * @parblock |
---|
292 | * The processor used to maintain the timer is the processor of the calling |
---|
293 | * task at some point during the timer creation. |
---|
294 | * |
---|
295 | * For control and maintenance of the timer, RTEMS allocates a TMCB from the |
---|
296 | * local TMCB free pool and initializes it. |
---|
297 | * @endparblock |
---|
298 | * |
---|
299 | * @par Constraints |
---|
300 | * @parblock |
---|
301 | * The following constraints apply to this directive: |
---|
302 | * |
---|
303 | * * The directive may be called from within device driver initialization |
---|
304 | * context. |
---|
305 | * |
---|
306 | * * The directive may be called from within task context. |
---|
307 | * |
---|
308 | * * The directive may obtain and release the object allocator mutex. This may |
---|
309 | * cause the calling task to be preempted. |
---|
310 | * |
---|
311 | * * The number of timers available to the application is configured through |
---|
312 | * the @ref CONFIGURE_MAXIMUM_TIMERS application configuration option. |
---|
313 | * |
---|
314 | * * Where the object class corresponding to the directive is configured to use |
---|
315 | * unlimited objects, the directive may allocate memory from the RTEMS |
---|
316 | * Workspace. |
---|
317 | * @endparblock |
---|
318 | */ |
---|
319 | rtems_status_code rtems_timer_create( rtems_name name, rtems_id *id ); |
---|
320 | |
---|
321 | /* Generated from spec:/rtems/timer/if/ident */ |
---|
322 | |
---|
323 | /** |
---|
324 | * @ingroup RTEMSAPIClassicTimer |
---|
325 | * |
---|
326 | * @brief Identifies a timer by the object name. |
---|
327 | * |
---|
328 | * @param name is the object name to look up. |
---|
329 | * |
---|
330 | * @param[out] id is the pointer to an ::rtems_id object. When the directive |
---|
331 | * call is successful, the object identifier of an object with the specified |
---|
332 | * name will be stored in this object. |
---|
333 | * |
---|
334 | * This directive obtains a timer identifier associated with the timer name |
---|
335 | * specified in ``name``. |
---|
336 | * |
---|
337 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
338 | * |
---|
339 | * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. |
---|
340 | * |
---|
341 | * @retval ::RTEMS_INVALID_NAME The ``name`` parameter was 0. |
---|
342 | * |
---|
343 | * @retval ::RTEMS_INVALID_NAME There was no object with the specified name on |
---|
344 | * the local node. |
---|
345 | * |
---|
346 | * @par Notes |
---|
347 | * @parblock |
---|
348 | * If the timer name is not unique, then the timer identifier will match the |
---|
349 | * first timer with that name in the search order. However, this timer |
---|
350 | * identifier is not guaranteed to correspond to the desired timer. |
---|
351 | * |
---|
352 | * The objects are searched from lowest to the highest index. Only the local |
---|
353 | * node is searched. |
---|
354 | * |
---|
355 | * The timer identifier is used with other timer related directives to access |
---|
356 | * the timer. |
---|
357 | * @endparblock |
---|
358 | * |
---|
359 | * @par Constraints |
---|
360 | * @parblock |
---|
361 | * The following constraints apply to this directive: |
---|
362 | * |
---|
363 | * * The directive may be called from within any runtime context. |
---|
364 | * |
---|
365 | * * The directive will not cause the calling task to be preempted. |
---|
366 | * @endparblock |
---|
367 | */ |
---|
368 | rtems_status_code rtems_timer_ident( rtems_name name, rtems_id *id ); |
---|
369 | |
---|
370 | /* Generated from spec:/rtems/timer/if/cancel */ |
---|
371 | |
---|
372 | /** |
---|
373 | * @ingroup RTEMSAPIClassicTimer |
---|
374 | * |
---|
375 | * @brief Cancels the timer. |
---|
376 | * |
---|
377 | * @param id is the timer identifier. |
---|
378 | * |
---|
379 | * This directive cancels the timer specified by ``id``. This timer will be |
---|
380 | * reinitiated by the next invocation of rtems_timer_reset(), |
---|
381 | * rtems_timer_fire_after(), rtems_timer_fire_when(), |
---|
382 | * rtems_timer_server_fire_after(), or rtems_timer_server_fire_when() with the |
---|
383 | * same timer identifier. |
---|
384 | * |
---|
385 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
386 | * |
---|
387 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
388 | * specified by ``id``. |
---|
389 | * |
---|
390 | * @par Constraints |
---|
391 | * @parblock |
---|
392 | * The following constraints apply to this directive: |
---|
393 | * |
---|
394 | * * The directive may be called from within interrupt context. |
---|
395 | * |
---|
396 | * * The directive may be called from within device driver initialization |
---|
397 | * context. |
---|
398 | * |
---|
399 | * * The directive may be called from within task context. |
---|
400 | * |
---|
401 | * * The directive will not cause the calling task to be preempted. |
---|
402 | * @endparblock |
---|
403 | */ |
---|
404 | rtems_status_code rtems_timer_cancel( rtems_id id ); |
---|
405 | |
---|
406 | /* Generated from spec:/rtems/timer/if/delete */ |
---|
407 | |
---|
408 | /** |
---|
409 | * @ingroup RTEMSAPIClassicTimer |
---|
410 | * |
---|
411 | * @brief Deletes the timer. |
---|
412 | * |
---|
413 | * @param id is the timer identifier. |
---|
414 | * |
---|
415 | * This directive deletes the timer specified by ``id``. If the timer is |
---|
416 | * running, it is automatically canceled. |
---|
417 | * |
---|
418 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
419 | * |
---|
420 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
421 | * specified by ``id``. |
---|
422 | * |
---|
423 | * @par Notes |
---|
424 | * The TMCB for the deleted timer is reclaimed by RTEMS. |
---|
425 | * |
---|
426 | * @par Constraints |
---|
427 | * @parblock |
---|
428 | * The following constraints apply to this directive: |
---|
429 | * |
---|
430 | * * The directive may be called from within device driver initialization |
---|
431 | * context. |
---|
432 | * |
---|
433 | * * The directive may be called from within task context. |
---|
434 | * |
---|
435 | * * The directive may obtain and release the object allocator mutex. This may |
---|
436 | * cause the calling task to be preempted. |
---|
437 | * |
---|
438 | * * The calling task does not have to be the task that created the object. |
---|
439 | * Any local task that knows the object identifier can delete the object. |
---|
440 | * |
---|
441 | * * Where the object class corresponding to the directive is configured to use |
---|
442 | * unlimited objects, the directive may free memory to the RTEMS Workspace. |
---|
443 | * @endparblock |
---|
444 | */ |
---|
445 | rtems_status_code rtems_timer_delete( rtems_id id ); |
---|
446 | |
---|
447 | /* Generated from spec:/rtems/timer/if/fire-after */ |
---|
448 | |
---|
449 | /** |
---|
450 | * @ingroup RTEMSAPIClassicTimer |
---|
451 | * |
---|
452 | * @brief Fires the timer after the interval. |
---|
453 | * |
---|
454 | * @param id is the timer identifier. |
---|
455 | * |
---|
456 | * @param ticks is the interval until the routine is fired in clock ticks. |
---|
457 | * |
---|
458 | * @param routine is the routine to schedule. |
---|
459 | * |
---|
460 | * @param user_data is the argument passed to the routine when it is fired. |
---|
461 | * |
---|
462 | * This directive initiates the timer specified by ``id``. If the timer is |
---|
463 | * running, it is automatically canceled before being initiated. The timer is |
---|
464 | * scheduled to fire after an interval of clock ticks has passed specified by |
---|
465 | * ``ticks``. When the timer fires, the timer service routine ``routine`` will |
---|
466 | * be invoked with the argument ``user_data`` in the context of the clock tick |
---|
467 | * ISR. |
---|
468 | * |
---|
469 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
470 | * |
---|
471 | * @retval ::RTEMS_INVALID_NUMBER The ``ticks`` parameter was 0. |
---|
472 | * |
---|
473 | * @retval ::RTEMS_INVALID_ADDRESS The ``routine`` parameter was NULL. |
---|
474 | * |
---|
475 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
476 | * specified by ``id``. |
---|
477 | * |
---|
478 | * @par Constraints |
---|
479 | * @parblock |
---|
480 | * The following constraints apply to this directive: |
---|
481 | * |
---|
482 | * * The directive may be called from within interrupt context. |
---|
483 | * |
---|
484 | * * The directive may be called from within device driver initialization |
---|
485 | * context. |
---|
486 | * |
---|
487 | * * The directive may be called from within task context. |
---|
488 | * |
---|
489 | * * The directive will not cause the calling task to be preempted. |
---|
490 | * @endparblock |
---|
491 | */ |
---|
492 | rtems_status_code rtems_timer_fire_after( |
---|
493 | rtems_id id, |
---|
494 | rtems_interval ticks, |
---|
495 | rtems_timer_service_routine_entry routine, |
---|
496 | void *user_data |
---|
497 | ); |
---|
498 | |
---|
499 | /* Generated from spec:/rtems/timer/if/fire-when */ |
---|
500 | |
---|
501 | /** |
---|
502 | * @ingroup RTEMSAPIClassicTimer |
---|
503 | * |
---|
504 | * @brief Fires the timer at the time of day. |
---|
505 | * |
---|
506 | * @param id is the timer identifier. |
---|
507 | * |
---|
508 | * @param wall_time is the time of day when the routine is fired. |
---|
509 | * |
---|
510 | * @param routine is the routine to schedule. |
---|
511 | * |
---|
512 | * @param user_data is the argument passed to the routine when it is fired. |
---|
513 | * |
---|
514 | * This directive initiates the timer specified by ``id``. If the timer is |
---|
515 | * running, it is automatically canceled before being initiated. The timer is |
---|
516 | * scheduled to fire at the time of day specified by ``wall_time``. When the |
---|
517 | * timer fires, the timer service routine ``routine`` will be invoked with the |
---|
518 | * argument ``user_data`` in the context of the clock tick ISR. |
---|
519 | * |
---|
520 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
521 | * |
---|
522 | * @retval ::RTEMS_NOT_DEFINED The system date and time was not set. |
---|
523 | * |
---|
524 | * @retval ::RTEMS_INVALID_ADDRESS The ``routine`` parameter was NULL. |
---|
525 | * |
---|
526 | * @retval ::RTEMS_INVALID_ADDRESS The ``wall_time`` parameter was NULL. |
---|
527 | * |
---|
528 | * @retval ::RTEMS_INVALID_CLOCK The time of day was invalid. |
---|
529 | * |
---|
530 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
531 | * specified by ``id``. |
---|
532 | * |
---|
533 | * @par Constraints |
---|
534 | * @parblock |
---|
535 | * The following constraints apply to this directive: |
---|
536 | * |
---|
537 | * * The directive may be called from within interrupt context. |
---|
538 | * |
---|
539 | * * The directive may be called from within device driver initialization |
---|
540 | * context. |
---|
541 | * |
---|
542 | * * The directive may be called from within task context. |
---|
543 | * |
---|
544 | * * The directive will not cause the calling task to be preempted. |
---|
545 | * @endparblock |
---|
546 | */ |
---|
547 | rtems_status_code rtems_timer_fire_when( |
---|
548 | rtems_id id, |
---|
549 | const rtems_time_of_day *wall_time, |
---|
550 | rtems_timer_service_routine_entry routine, |
---|
551 | void *user_data |
---|
552 | ); |
---|
553 | |
---|
554 | /* Generated from spec:/rtems/timer/if/initiate-server */ |
---|
555 | |
---|
556 | /** |
---|
557 | * @ingroup RTEMSAPIClassicTimer |
---|
558 | * |
---|
559 | * @brief Initiates the Timer Server. |
---|
560 | * |
---|
561 | * @param priority is the task priority. |
---|
562 | * |
---|
563 | * @param stack_size is the task stack size in bytes. |
---|
564 | * |
---|
565 | * @param attribute_set is the task attribute set. |
---|
566 | * |
---|
567 | * This directive initiates the Timer Server task. This task is responsible |
---|
568 | * for executing all timers initiated via the rtems_timer_server_fire_after() |
---|
569 | * or rtems_timer_server_fire_when() directives. |
---|
570 | * |
---|
571 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
572 | * |
---|
573 | * @retval ::RTEMS_INCORRECT_STATE The Timer Server was already initiated. |
---|
574 | * |
---|
575 | * @retval ::RTEMS_INVALID_PRIORITY The task priority was invalid. |
---|
576 | * |
---|
577 | * @retval ::RTEMS_TOO_MANY There was no inactive task object available to |
---|
578 | * create the Timer Server task. |
---|
579 | * |
---|
580 | * @retval ::RTEMS_UNSATISFIED There was not enough memory to allocate the task |
---|
581 | * storage area. The task storage area contains the task stack, the |
---|
582 | * thread-local storage, and the floating point context. |
---|
583 | * |
---|
584 | * @retval ::RTEMS_UNSATISFIED One of the task create extensions failed to |
---|
585 | * create the Timer Server task. |
---|
586 | * |
---|
587 | * @par Notes |
---|
588 | * The Timer Server task is created using the rtems_task_create() directive and |
---|
589 | * must be accounted for when configuring the system. |
---|
590 | * |
---|
591 | * @par Constraints |
---|
592 | * @parblock |
---|
593 | * The following constraints apply to this directive: |
---|
594 | * |
---|
595 | * * The directive may obtain and release the object allocator mutex. This may |
---|
596 | * cause the calling task to be preempted. |
---|
597 | * |
---|
598 | * * The directive may be called from within device driver initialization |
---|
599 | * context. |
---|
600 | * |
---|
601 | * * The directive may be called from within task context. |
---|
602 | * |
---|
603 | * * The number of timers available to the application is configured through |
---|
604 | * the @ref CONFIGURE_MAXIMUM_TIMERS application configuration option. |
---|
605 | * |
---|
606 | * * Where the object class corresponding to the directive is configured to use |
---|
607 | * unlimited objects, the directive may allocate memory from the RTEMS |
---|
608 | * Workspace. |
---|
609 | * @endparblock |
---|
610 | */ |
---|
611 | rtems_status_code rtems_timer_initiate_server( |
---|
612 | rtems_task_priority priority, |
---|
613 | size_t stack_size, |
---|
614 | rtems_attribute attribute_set |
---|
615 | ); |
---|
616 | |
---|
617 | /* Generated from spec:/rtems/timer/if/server-fire-after */ |
---|
618 | |
---|
619 | /** |
---|
620 | * @ingroup RTEMSAPIClassicTimer |
---|
621 | * |
---|
622 | * @brief Fires the timer after the interval using the Timer Server. |
---|
623 | * |
---|
624 | * @param id is the timer identifier. |
---|
625 | * |
---|
626 | * @param ticks is the interval until the routine is fired in clock ticks. |
---|
627 | * |
---|
628 | * @param routine is the routine to schedule. |
---|
629 | * |
---|
630 | * @param user_data is the argument passed to the routine when it is fired. |
---|
631 | * |
---|
632 | * This directive initiates the timer specified by ``id``. If the timer is |
---|
633 | * running, it is automatically canceled before being initiated. The timer is |
---|
634 | * scheduled to fire after an interval of clock ticks has passed specified by |
---|
635 | * ``ticks``. When the timer fires, the timer service routine ``routine`` will |
---|
636 | * be invoked with the argument ``user_data`` in the context of the Timer |
---|
637 | * Server task. |
---|
638 | * |
---|
639 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
640 | * |
---|
641 | * @retval ::RTEMS_INCORRECT_STATE The Timer Server was not initiated. |
---|
642 | * |
---|
643 | * @retval ::RTEMS_INVALID_NUMBER The ``ticks`` parameter was 0. |
---|
644 | * |
---|
645 | * @retval ::RTEMS_INVALID_ADDRESS The ``routine`` parameter was NULL. |
---|
646 | * |
---|
647 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
648 | * specified by ``id``. |
---|
649 | * |
---|
650 | * @par Constraints |
---|
651 | * @parblock |
---|
652 | * The following constraints apply to this directive: |
---|
653 | * |
---|
654 | * * The directive may be called from within interrupt context. |
---|
655 | * |
---|
656 | * * The directive may be called from within device driver initialization |
---|
657 | * context. |
---|
658 | * |
---|
659 | * * The directive may be called from within task context. |
---|
660 | * |
---|
661 | * * The directive will not cause the calling task to be preempted. |
---|
662 | * @endparblock |
---|
663 | */ |
---|
664 | rtems_status_code rtems_timer_server_fire_after( |
---|
665 | rtems_id id, |
---|
666 | rtems_interval ticks, |
---|
667 | rtems_timer_service_routine_entry routine, |
---|
668 | void *user_data |
---|
669 | ); |
---|
670 | |
---|
671 | /* Generated from spec:/rtems/timer/if/server-fire-when */ |
---|
672 | |
---|
673 | /** |
---|
674 | * @ingroup RTEMSAPIClassicTimer |
---|
675 | * |
---|
676 | * @brief Fires the timer at the time of day using the Timer Server. |
---|
677 | * |
---|
678 | * @param id is the timer identifier. |
---|
679 | * |
---|
680 | * @param wall_time is the time of day when the routine is fired. |
---|
681 | * |
---|
682 | * @param routine is the routine to schedule. |
---|
683 | * |
---|
684 | * @param user_data is the argument passed to the routine when it is fired. |
---|
685 | * |
---|
686 | * This directive initiates the timer specified by ``id``. If the timer is |
---|
687 | * running, it is automatically canceled before being initiated. The timer is |
---|
688 | * scheduled to fire at the time of day specified by ``wall_time``. When the |
---|
689 | * timer fires, the timer service routine ``routine`` will be invoked with the |
---|
690 | * argument ``user_data`` in the context of the Timer Server task. |
---|
691 | * |
---|
692 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
693 | * |
---|
694 | * @retval ::RTEMS_INCORRECT_STATE The Timer Server was not initiated. |
---|
695 | * |
---|
696 | * @retval ::RTEMS_NOT_DEFINED The system date and time was not set. |
---|
697 | * |
---|
698 | * @retval ::RTEMS_INVALID_ADDRESS The ``routine`` parameter was NULL. |
---|
699 | * |
---|
700 | * @retval ::RTEMS_INVALID_ADDRESS The ``wall_time`` parameter was NULL. |
---|
701 | * |
---|
702 | * @retval ::RTEMS_INVALID_CLOCK The time of day was invalid. |
---|
703 | * |
---|
704 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
705 | * specified by ``id``. |
---|
706 | * |
---|
707 | * @par Constraints |
---|
708 | * @parblock |
---|
709 | * The following constraints apply to this directive: |
---|
710 | * |
---|
711 | * * The directive may be called from within interrupt context. |
---|
712 | * |
---|
713 | * * The directive may be called from within device driver initialization |
---|
714 | * context. |
---|
715 | * |
---|
716 | * * The directive may be called from within task context. |
---|
717 | * |
---|
718 | * * The directive will not cause the calling task to be preempted. |
---|
719 | * @endparblock |
---|
720 | */ |
---|
721 | rtems_status_code rtems_timer_server_fire_when( |
---|
722 | rtems_id id, |
---|
723 | const rtems_time_of_day *wall_time, |
---|
724 | rtems_timer_service_routine_entry routine, |
---|
725 | void *user_data |
---|
726 | ); |
---|
727 | |
---|
728 | /* Generated from spec:/rtems/timer/if/reset */ |
---|
729 | |
---|
730 | /** |
---|
731 | * @ingroup RTEMSAPIClassicTimer |
---|
732 | * |
---|
733 | * @brief Resets the timer. |
---|
734 | * |
---|
735 | * @param id is the timer identifier. |
---|
736 | * |
---|
737 | * This directive resets the timer specified by ``id``. This timer must have |
---|
738 | * been previously initiated with either the rtems_timer_fire_after() or |
---|
739 | * rtems_timer_server_fire_after() directive. If active the timer is canceled, |
---|
740 | * after which the timer is reinitiated using the same interval and timer |
---|
741 | * service routine which the original rtems_timer_fire_after() or |
---|
742 | * rtems_timer_server_fire_after() directive used. |
---|
743 | * |
---|
744 | * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. |
---|
745 | * |
---|
746 | * @retval ::RTEMS_INVALID_ID There was no timer associated with the identifier |
---|
747 | * specified by ``id``. |
---|
748 | * |
---|
749 | * @retval ::RTEMS_NOT_DEFINED The timer was not of the interval class. |
---|
750 | * |
---|
751 | * @par Notes |
---|
752 | * @parblock |
---|
753 | * If the timer has not been used or the last usage of this timer was by a |
---|
754 | * rtems_timer_fire_when() or rtems_timer_server_fire_when() directive, then |
---|
755 | * the ::RTEMS_NOT_DEFINED error is returned. |
---|
756 | * |
---|
757 | * Restarting a cancelled after timer results in the timer being reinitiated |
---|
758 | * with its previous timer service routine and interval. |
---|
759 | * @endparblock |
---|
760 | * |
---|
761 | * @par Constraints |
---|
762 | * @parblock |
---|
763 | * The following constraints apply to this directive: |
---|
764 | * |
---|
765 | * * The directive may be called from within interrupt context. |
---|
766 | * |
---|
767 | * * The directive may be called from within device driver initialization |
---|
768 | * context. |
---|
769 | * |
---|
770 | * * The directive may be called from within task context. |
---|
771 | * |
---|
772 | * * The directive will not cause the calling task to be preempted. |
---|
773 | * @endparblock |
---|
774 | */ |
---|
775 | rtems_status_code rtems_timer_reset( rtems_id id ); |
---|
776 | |
---|
777 | #ifdef __cplusplus |
---|
778 | } |
---|
779 | #endif |
---|
780 | |
---|
781 | #endif /* _RTEMS_RTEMS_TIMER_H */ |
---|