source: rtems-docs/c-user/rate-monotonic/directives.rst @ bd4dedc

Last change on this file since bd4dedc was efb8e7c, checked in by Sebastian Huber <sebastian.huber@…>, on 07/30/21 at 06:51:07

c-user: Add "Kernel Character I/O Support" chapter

Close #4482.

  • Property mode set to 100644
File size: 19.6 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 2020, 2021 embedded brains GmbH (http://www.embedded-brains.de)
4.. Copyright (C) 2017 Kuan-Hsun Chen
5.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
6
7.. This file is part of the RTEMS quality process and was automatically
8.. generated.  If you find something that needs to be fixed or
9.. worded better please post a report or patch to an RTEMS mailing list
10.. or raise a bug report:
11..
12.. https://www.rtems.org/bugs.html
13..
14.. For information on updating and regenerating please refer to the How-To
15.. section in the Software Requirements Engineering chapter of the
16.. RTEMS Software Engineering manual.  The manual is provided as a part of
17.. a release.  For development sources please refer to the online
18.. documentation at:
19..
20.. https://docs.rtems.org
21
22.. _RateMonotonicManagerDirectives:
23
24Directives
25==========
26
27This section details the directives of the Rate-Monotonic Manager. A subsection
28is dedicated to each of this manager's directives and lists the calling
29sequence, parameters, description, return values, and notes of the directive.
30
31.. Generated from spec:/rtems/ratemon/if/create
32
33.. raw:: latex
34
35    \clearpage
36
37.. index:: rtems_rate_monotonic_create()
38.. index:: create a period
39
40.. _InterfaceRtemsRateMonotonicCreate:
41
42rtems_rate_monotonic_create()
43-----------------------------
44
45Creates a period.
46
47.. rubric:: CALLING SEQUENCE:
48
49.. code-block:: c
50
51    rtems_status_code rtems_rate_monotonic_create( rtems_name name, rtems_id *id );
52
53.. rubric:: PARAMETERS:
54
55``name``
56    This parameter is the object name of the period.
57
58``id``
59    This parameter is the pointer to an :c:type:`rtems_id` object.  When the
60    directive call is successful, the identifier of the created period will be
61    stored in this object.
62
63.. rubric:: DESCRIPTION:
64
65This directive creates a period which resides on the local node.  The period
66has the user-defined object name specified in ``name`` The assigned object
67identifier is returned in ``id``.  This identifier is used to access the period
68with other rate monotonic related directives.
69
70.. rubric:: RETURN VALUES:
71
72:c:macro:`RTEMS_SUCCESSFUL`
73    The requested operation was successful.
74
75:c:macro:`RTEMS_INVALID_NAME`
76    The ``name`` parameter was invalid.
77
78:c:macro:`RTEMS_TOO_MANY`
79    There was no inactive object available to create a period.  The number of
80    periods available to the application is configured through the
81    :ref:`CONFIGURE_MAXIMUM_PERIODS` application configuration option.
82
83.. rubric:: NOTES:
84
85The calling task is registered as the owner of the created period.  Some
86directives can be only used by this task for the created period.
87
88For control and maintenance of the period, RTEMS allocates a :term:`PCB` from
89the local PCB free pool and initializes it.
90
91.. rubric:: CONSTRAINTS:
92
93The following constraints apply to this directive:
94
95* The directive may be called from within device driver initialization context.
96
97* The directive may be called from within task context.
98
99* The directive may obtain and release the object allocator mutex.  This may
100  cause the calling task to be preempted.
101
102* The number of periods available to the application is configured through the
103  :ref:`CONFIGURE_MAXIMUM_PERIODS` application configuration option.
104
105* Where the object class corresponding to the directive is configured to use
106  unlimited objects, the directive may allocate memory from the RTEMS
107  Workspace.
108
109.. Generated from spec:/rtems/ratemon/if/ident
110
111.. raw:: latex
112
113    \clearpage
114
115.. index:: rtems_rate_monotonic_ident()
116
117.. _InterfaceRtemsRateMonotonicIdent:
118
119rtems_rate_monotonic_ident()
120----------------------------
121
122Identifies a period by the object name.
123
124.. rubric:: CALLING SEQUENCE:
125
126.. code-block:: c
127
128    rtems_status_code rtems_rate_monotonic_ident( rtems_name name, rtems_id *id );
129
130.. rubric:: PARAMETERS:
131
132``name``
133    This parameter is the object name to look up.
134
135``id``
136    This parameter is the pointer to an :c:type:`rtems_id` object.  When the
137    directive call is successful, the object identifier of an object with the
138    specified name will be stored in this object.
139
140.. rubric:: DESCRIPTION:
141
142This directive obtains a period identifier associated with the period name
143specified in ``name``.
144
145.. rubric:: RETURN VALUES:
146
147:c:macro:`RTEMS_SUCCESSFUL`
148    The requested operation was successful.
149
150:c:macro:`RTEMS_INVALID_ADDRESS`
151    The ``id`` parameter was `NULL
152    <https://en.cppreference.com/w/c/types/NULL>`_.
153
154:c:macro:`RTEMS_INVALID_NAME`
155    The ``name`` parameter was 0.
156
157:c:macro:`RTEMS_INVALID_NAME`
158    There was no object with the specified name on the local node.
159
160.. rubric:: NOTES:
161
162If the period name is not unique, then the period identifier will match the
163first period with that name in the search order.  However, this period
164identifier is not guaranteed to correspond to the desired period.
165
166The objects are searched from lowest to the highest index.  Only the local node
167is searched.
168
169The period identifier is used with other rate monotonic related directives to
170access the period.
171
172.. rubric:: CONSTRAINTS:
173
174The following constraints apply to this directive:
175
176* The directive may be called from within any runtime context.
177
178* The directive will not cause the calling task to be preempted.
179
180.. Generated from spec:/rtems/ratemon/if/cancel
181
182.. raw:: latex
183
184    \clearpage
185
186.. index:: rtems_rate_monotonic_cancel()
187.. index:: cancel a period
188
189.. _InterfaceRtemsRateMonotonicCancel:
190
191rtems_rate_monotonic_cancel()
192-----------------------------
193
194Cancels the period.
195
196.. rubric:: CALLING SEQUENCE:
197
198.. code-block:: c
199
200    rtems_status_code rtems_rate_monotonic_cancel( rtems_id id );
201
202.. rubric:: PARAMETERS:
203
204``id``
205    This parameter is the rate monotonic period identifier.
206
207.. rubric:: DESCRIPTION:
208
209This directive cancels the rate monotonic period specified by ``id``.  This
210period may be reinitiated by the next invocation of
211:ref:`InterfaceRtemsRateMonotonicPeriod`.
212
213.. rubric:: RETURN VALUES:
214
215:c:macro:`RTEMS_SUCCESSFUL`
216    The requested operation was successful.
217
218:c:macro:`RTEMS_INVALID_ID`
219    There was no rate monotonic period associated with the identifier specified
220    by ``id``.
221
222:c:macro:`RTEMS_NOT_OWNER_OF_RESOURCE`
223    The rate monotonic period was not created by the calling task.
224
225.. rubric:: CONSTRAINTS:
226
227The following constraints apply to this directive:
228
229* The directive may be called from within task context.
230
231* The directive will not cause the calling task to be preempted.
232
233* The directive may be used exclusively by the task which created the
234  associated object.
235
236.. Generated from spec:/rtems/ratemon/if/delete
237
238.. raw:: latex
239
240    \clearpage
241
242.. index:: rtems_rate_monotonic_delete()
243.. index:: delete a period
244
245.. _InterfaceRtemsRateMonotonicDelete:
246
247rtems_rate_monotonic_delete()
248-----------------------------
249
250Deletes the period.
251
252.. rubric:: CALLING SEQUENCE:
253
254.. code-block:: c
255
256    rtems_status_code rtems_rate_monotonic_delete( rtems_id id );
257
258.. rubric:: PARAMETERS:
259
260``id``
261    This parameter is the period identifier.
262
263.. rubric:: DESCRIPTION:
264
265This directive deletes the period specified by ``id``.  If the period is
266running, it is automatically canceled.
267
268.. rubric:: RETURN VALUES:
269
270:c:macro:`RTEMS_SUCCESSFUL`
271    The requested operation was successful.
272
273:c:macro:`RTEMS_INVALID_ID`
274    There was no period associated with the identifier specified by ``id``.
275
276.. rubric:: NOTES:
277
278The :term:`PCB` for the deleted period is reclaimed by RTEMS.
279
280.. rubric:: CONSTRAINTS:
281
282The following constraints apply to this directive:
283
284* The directive may be called from within device driver initialization context.
285
286* The directive may be called from within task context.
287
288* The directive may obtain and release the object allocator mutex.  This may
289  cause the calling task to be preempted.
290
291* The calling task does not have to be the task that created the object.  Any
292  local task that knows the object identifier can delete the object.
293
294* Where the object class corresponding to the directive is configured to use
295  unlimited objects, the directive may free memory to the RTEMS Workspace.
296
297.. Generated from spec:/rtems/ratemon/if/period
298
299.. raw:: latex
300
301    \clearpage
302
303.. index:: rtems_rate_monotonic_period()
304.. index:: conclude current period
305.. index:: start current period
306.. index:: period initiation
307
308.. _InterfaceRtemsRateMonotonicPeriod:
309
310rtems_rate_monotonic_period()
311-----------------------------
312
313Concludes the current period and start the next period, or gets the period
314status.
315
316.. rubric:: CALLING SEQUENCE:
317
318.. code-block:: c
319
320    rtems_status_code rtems_rate_monotonic_period(
321      rtems_id       id,
322      rtems_interval length
323    );
324
325.. rubric:: PARAMETERS:
326
327``id``
328    This parameter is the rate monotonic period identifier.
329
330``length``
331    This parameter is the period length in :term:`clock ticks <clock tick>` or
332    :c:macro:`RTEMS_PERIOD_STATUS` to get the period status.
333
334.. rubric:: DESCRIPTION:
335
336This directive initiates the rate monotonic period specified by ``id``  with a
337length of period ticks specified by ``length``.  If the period is running, then
338the calling task will block for the remainder of the period before reinitiating
339the period with the specified period length.  If the period was not running
340(either expired or never initiated), the period is immediately initiated and
341the directive returns immediately.  If the period has expired, the postponed
342job will be released immediately and the following calls of this directive will
343release postponed jobs until there is no more deadline miss.
344
345If invoked with a period length of :c:macro:`RTEMS_PERIOD_STATUS` ticks, the
346current state of the period will be returned.  The directive status indicates
347the current state of the period.  This does not alter the state or period
348length of the period.
349
350.. rubric:: RETURN VALUES:
351
352:c:macro:`RTEMS_SUCCESSFUL`
353    The requested operation was successful.
354
355:c:macro:`RTEMS_INVALID_ID`
356    There was no rate monotonic period associated with the identifier specified
357    by ``id``.
358
359:c:macro:`RTEMS_NOT_OWNER_OF_RESOURCE`
360    The rate monotonic period was not created by the calling task.
361
362:c:macro:`RTEMS_NOT_DEFINED`
363    The rate monotonic period has never been initiated (only possible when the
364    ``length`` parameter was equal to :c:macro:`RTEMS_PERIOD_STATUS`).
365
366:c:macro:`RTEMS_TIMEOUT`
367    The rate monotonic period has expired.
368
369.. rubric:: CONSTRAINTS:
370
371The following constraints apply to this directive:
372
373* The directive may be called from within task context.
374
375* The directive may be used exclusively by the task which created the
376  associated object.
377
378.. Generated from spec:/rtems/ratemon/if/get-status
379
380.. raw:: latex
381
382    \clearpage
383
384.. index:: rtems_rate_monotonic_get_status()
385.. index:: get status of period
386.. index:: obtain status of period
387
388.. _InterfaceRtemsRateMonotonicGetStatus:
389
390rtems_rate_monotonic_get_status()
391---------------------------------
392
393Gets the detailed status of the period.
394
395.. rubric:: CALLING SEQUENCE:
396
397.. code-block:: c
398
399    rtems_status_code rtems_rate_monotonic_get_status(
400      rtems_id                            id,
401      rtems_rate_monotonic_period_status *status
402    );
403
404.. rubric:: PARAMETERS:
405
406``id``
407    This parameter is the rate monotonic period identifier.
408
409``status``
410    This parameter is the pointer to an
411    :c:type:`rtems_rate_monotonic_period_status` object.  When the directive
412    call is successful, the detailed period status will be stored in this
413    object.
414
415.. rubric:: DESCRIPTION:
416
417This directive returns the detailed status of the rate monotonic period
418specified by ``id``.  The detailed status of the period will be returned in the
419members of the period status object referenced by ``status``:
420
421* The ``owner`` member is set to the identifier of the owner task of the
422  period.
423
424* The ``state`` member is set to the current state of the period.
425
426* The ``postponed_jobs_count`` member is set to the count of jobs which are not
427  released yet.
428
429* If the current state of the period is :c:macro:`RATE_MONOTONIC_INACTIVE`, the
430  ``since_last_period`` and ``executed_since_last_period`` members will be set
431  to zero.  Otherwise, both members will contain time information since the
432  last successful invocation of the :ref:`InterfaceRtemsRateMonotonicPeriod`
433  directive by the owner task.  More specifically, the ``since_last_period``
434  member will be set to the time elapsed since the last successful invocation.
435  The ``executed_since_last_period`` member will be set to the processor time
436  consumed by the owner task since the last successful invocation.
437
438.. rubric:: RETURN VALUES:
439
440:c:macro:`RTEMS_SUCCESSFUL`
441    The requested operation was successful.
442
443:c:macro:`RTEMS_INVALID_ID`
444    There was no rate monotonic period associated with the identifier specified
445    by ``id``.
446
447:c:macro:`RTEMS_INVALID_ADDRESS`
448    The ``status`` parameter was `NULL
449    <https://en.cppreference.com/w/c/types/NULL>`_.
450
451:c:macro:`RTEMS_NOT_DEFINED`
452    There was no status available due to a reset of the processor time usage of
453    the owner task of the period.
454
455.. rubric:: CONSTRAINTS:
456
457The following constraints apply to this directive:
458
459* The directive may be called from within task context.
460
461* The directive may be called from within interrupt context.
462
463* The directive will not cause the calling task to be preempted.
464
465.. Generated from spec:/rtems/ratemon/if/get-statistics
466
467.. raw:: latex
468
469    \clearpage
470
471.. index:: rtems_rate_monotonic_get_statistics()
472.. index:: get statistics of period
473.. index:: obtain statistics of period
474
475.. _InterfaceRtemsRateMonotonicGetStatistics:
476
477rtems_rate_monotonic_get_statistics()
478-------------------------------------
479
480Gets the statistics of the period.
481
482.. rubric:: CALLING SEQUENCE:
483
484.. code-block:: c
485
486    rtems_status_code rtems_rate_monotonic_get_statistics(
487      rtems_id                                id,
488      rtems_rate_monotonic_period_statistics *status
489    );
490
491.. rubric:: PARAMETERS:
492
493``id``
494    This parameter is the rate monotonic period identifier.
495
496``status``
497    This parameter is the pointer to an
498    :c:type:`rtems_rate_monotonic_period_statistics` object.  When the
499    directive call is successful, the period statistics will be stored in this
500    object.
501
502.. rubric:: DESCRIPTION:
503
504This directive returns the statistics of the rate monotonic period specified by
505``id``.  The statistics of the period will be returned in the members of the
506period statistics object referenced by ``status``:
507
508* The ``count`` member is set to the number of periods executed.
509
510* The ``missed_count`` member is set to the number of periods missed.
511
512* The ``min_cpu_time`` member is set to the least amount of processor time used
513  in the period.
514
515* The ``max_cpu_time`` member is set to the highest amount of processor time
516  used in the period.
517
518* The ``total_cpu_time`` member is set to the total amount of processor time
519  used in the period.
520
521* The ``min_wall_time`` member is set to the least amount of
522  :term:`CLOCK_MONOTONIC` time used in the period.
523
524* The ``max_wall_time`` member is set to the highest amount of
525  :term:`CLOCK_MONOTONIC` time used in the period.
526
527* The ``total_wall_time`` member is set to the total amount of
528  :term:`CLOCK_MONOTONIC` time used in the period.
529
530.. rubric:: RETURN VALUES:
531
532:c:macro:`RTEMS_SUCCESSFUL`
533    The requested operation was successful.
534
535:c:macro:`RTEMS_INVALID_ID`
536    There was no rate monotonic period associated with the identifier specified
537    by ``id``.
538
539:c:macro:`RTEMS_INVALID_ADDRESS`
540    The ``status`` parameter was `NULL
541    <https://en.cppreference.com/w/c/types/NULL>`_.
542
543.. rubric:: CONSTRAINTS:
544
545The following constraints apply to this directive:
546
547* The directive may be called from within task context.
548
549* The directive may be called from within interrupt context.
550
551* The directive will not cause the calling task to be preempted.
552
553.. Generated from spec:/rtems/ratemon/if/reset-statistics
554
555.. raw:: latex
556
557    \clearpage
558
559.. index:: rtems_rate_monotonic_reset_statistics()
560.. index:: reset statistics of period
561
562.. _InterfaceRtemsRateMonotonicResetStatistics:
563
564rtems_rate_monotonic_reset_statistics()
565---------------------------------------
566
567Resets the statistics of the period.
568
569.. rubric:: CALLING SEQUENCE:
570
571.. code-block:: c
572
573    rtems_status_code rtems_rate_monotonic_reset_statistics( rtems_id id );
574
575.. rubric:: PARAMETERS:
576
577``id``
578    This parameter is the rate monotonic period identifier.
579
580.. rubric:: DESCRIPTION:
581
582This directive resets the statistics of the rate monotonic period specified by
583``id``.
584
585.. rubric:: RETURN VALUES:
586
587:c:macro:`RTEMS_SUCCESSFUL`
588    The requested operation was successful.
589
590:c:macro:`RTEMS_INVALID_ID`
591    There was no rate monotonic period associated with the identifier specified
592    by ``id``.
593
594.. rubric:: CONSTRAINTS:
595
596The following constraints apply to this directive:
597
598* The directive may be called from within task context.
599
600* The directive may be called from within interrupt context.
601
602* The directive will not cause the calling task to be preempted.
603
604.. Generated from spec:/rtems/ratemon/if/reset-all-statistics
605
606.. raw:: latex
607
608    \clearpage
609
610.. index:: rtems_rate_monotonic_reset_all_statistics()
611.. index:: reset statistics of all periods
612
613.. _InterfaceRtemsRateMonotonicResetAllStatistics:
614
615rtems_rate_monotonic_reset_all_statistics()
616-------------------------------------------
617
618Resets the statistics of all periods.
619
620.. rubric:: CALLING SEQUENCE:
621
622.. code-block:: c
623
624    void rtems_rate_monotonic_reset_all_statistics( void );
625
626.. rubric:: DESCRIPTION:
627
628This directive resets the statistics information associated with all rate
629monotonic period instances.
630
631.. rubric:: CONSTRAINTS:
632
633The following constraints apply to this directive:
634
635* The directive may be called from within task context.
636
637* The directive may obtain and release the object allocator mutex.  This may
638  cause the calling task to be preempted.
639
640.. Generated from spec:/rtems/ratemon/if/report-statistics
641
642.. raw:: latex
643
644    \clearpage
645
646.. index:: rtems_rate_monotonic_report_statistics()
647.. index:: print period statistics report
648.. index:: period statistics report
649
650.. _InterfaceRtemsRateMonotonicReportStatistics:
651
652rtems_rate_monotonic_report_statistics()
653----------------------------------------
654
655Reports the period statistics using the :ref:`InterfacePrintk` printer.
656
657.. rubric:: CALLING SEQUENCE:
658
659.. code-block:: c
660
661    void rtems_rate_monotonic_report_statistics( void );
662
663.. rubric:: DESCRIPTION:
664
665This directive prints a report on all active periods which have executed at
666least one period using the :ref:`InterfacePrintk` printer.
667
668.. rubric:: CONSTRAINTS:
669
670The following constraints apply to this directive:
671
672* The directive may be called from within task context.
673
674* The directive may obtain and release the object allocator mutex.  This may
675  cause the calling task to be preempted.
676
677.. Generated from spec:/rtems/ratemon/if/report-statistics-with-plugin
678
679.. raw:: latex
680
681    \clearpage
682
683.. index:: rtems_rate_monotonic_report_statistics_with_plugin()
684.. index:: print period statistics report
685.. index:: period statistics report
686
687.. _InterfaceRtemsRateMonotonicReportStatisticsWithPlugin:
688
689rtems_rate_monotonic_report_statistics_with_plugin()
690----------------------------------------------------
691
692Reports the period statistics using the printer plugin.
693
694.. rubric:: CALLING SEQUENCE:
695
696.. code-block:: c
697
698    void rtems_rate_monotonic_report_statistics_with_plugin(
699      const struct rtems_printer *printer
700    );
701
702.. rubric:: PARAMETERS:
703
704``printer``
705    This parameter is the printer plugin to output the report.
706
707.. rubric:: DESCRIPTION:
708
709This directive prints a report on all active periods which have executed at
710least one period using the printer plugin specified by ``printer``.
711
712.. rubric:: CONSTRAINTS:
713
714The following constraints apply to this directive:
715
716* The directive may be called from within task context.
717
718* The directive may obtain and release the object allocator mutex.  This may
719  cause the calling task to be preempted.
Note: See TracBrowser for help on using the repository browser.