source: rtems/c/src/exec/rtems/include/rtems/rtems/ratemon.h @ c627b2a

4.104.114.84.9
Last change on this file since c627b2a was c627b2a, checked in by Joel Sherrill <joel.sherrill@…>, on May 28, 1996 at 9:40:52 PM

split the inclusion of "EXTERN" data based on whether it was sapi,
score, rtems api, or posix api related.

  • Property mode set to 100644
File size: 4.7 KB
Line 
1/*  ratemon.h
2 *
3 *  This include file contains all the constants, structures, and
4 *  prototypes associated with the Rate Monotonic Manager.  This manager
5 *  provides facilities to implement tasks which execute in a periodic fashion.
6 *
7 *  Directives provided are:
8 *
9 *     + create a rate monotonic timer
10 *     + cancel a period
11 *     + delete a rate monotonic timer
12 *     + conclude current and start the next period
13 *
14 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
15 *  On-Line Applications Research Corporation (OAR).
16 *  All rights assigned to U.S. Government, 1994.
17 *
18 *  This material may be reproduced by or for the U.S. Government pursuant
19 *  to the copyright license under the clause at DFARS 252.227-7013.  This
20 *  notice must appear in all copies of this file and its derivatives.
21 *
22 *  $Id$
23 */
24
25#ifndef __RTEMS_RATE_MONOTONIC_h
26#define __RTEMS_RATE_MONOTONIC_h
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <rtems/score/object.h>
33#include <rtems/score/thread.h>
34#include <rtems/score/watchdog.h>
35
36/*
37 *  The following enumerated type defines the states in which a
38 *  period may be.
39 */
40
41typedef enum {
42  RATE_MONOTONIC_INACTIVE,               /* off chain, never initialized */
43  RATE_MONOTONIC_OWNER_IS_BLOCKING,      /* on chain, owner is blocking on it */
44  RATE_MONOTONIC_ACTIVE,                 /* on chain, running continuously */
45  RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING, /* on chain, expired while owner was */
46                                         /*   was blocking on it */
47  RATE_MONOTONIC_EXPIRED                 /* off chain, will be reset by next */
48                                         /*   rtems_rate_monotonic_period */
49}   Rate_Monotonic_Period_states;
50
51/*
52 *  The following constant is the interval passed to the rate_monontonic_period
53 *  directive to obtain status information.
54 */
55
56#define RTEMS_PERIOD_STATUS       WATCHDOG_NO_TIMEOUT
57
58/*
59 *  The following structure defines the control block used to manage
60 *  each period.
61 */
62
63typedef struct {
64  Objects_Control               Object;
65  Watchdog_Control              Timer;
66  Rate_Monotonic_Period_states  state;
67  Thread_Control               *owner;
68}   Rate_monotonic_Control;
69
70RTEMS_EXTERN Objects_Information _Rate_monotonic_Information;
71
72/*
73 *  _Rate_monotonic_Manager_initialization
74 *
75 *  DESCRIPTION:
76 *
77 *  This routine performs the initialization necessary for this manager.
78 */
79
80void _Rate_monotonic_Manager_initialization(
81  unsigned32 maximum_periods
82);
83
84/*
85 *  rtems_rate_monotonic_create
86 *
87 *  DESCRIPTION:
88 *
89 *  This routine implements the rate_monotonic_create directive.  The
90 *  period will have the name name.  It returns the id of the
91 *  created period in ID.
92 */
93
94rtems_status_code rtems_rate_monotonic_create(
95  rtems_name    name,
96  Objects_Id   *id
97);
98
99/*
100 *  rtems_rate_monotonic_ident
101 *
102 *  DESCRIPTION:
103 *
104 *  This routine implements the rtems_rate_monotonic_ident directive.
105 *  This directive returns the period ID associated with name.
106 *  If more than one period is named name, then the period
107 *  to which the ID belongs is arbitrary.
108 */
109
110rtems_status_code rtems_rate_monotonic_ident(
111  rtems_name    name,
112  Objects_Id   *id
113);
114
115/*
116 *  rtems_rate_monotonic_cancel
117 *
118 *  DESCRIPTION:
119 *
120 *  This routine implements the rtems_rate_monotonic_cancel directive.  This
121 *  directive stops the period associated with ID from continuing to
122 *  run.
123 */
124
125rtems_status_code rtems_rate_monotonic_cancel(
126  Objects_Id id
127);
128
129/*
130 *  rtems_rate_monotonic_delete
131 *
132 *  DESCRIPTION:
133 *
134 *  This routine implements the rtems_rate_monotonic_delete directive.  The
135 *  period indicated by ID is deleted.
136 */
137
138rtems_status_code rtems_rate_monotonic_delete(
139  Objects_Id id
140);
141
142/*
143 *  rtems_rate_monotonic_period
144 *
145 *  DESCRIPTION:
146 *
147 *  This routine implements the rtems_rate_monotonic_period directive.  When
148 *  length is non-zero, this directive initiates the period associated with
149 *  ID from continuing for a period of length.  If length is zero, then
150 *  result is set to indicate the current state of the period.
151 */
152
153rtems_status_code rtems_rate_monotonic_period(
154  Objects_Id      id,
155  rtems_interval  length
156);
157
158/*
159 *  _Rate_monotonic_Timeout
160 *
161 *  DESCRIPTION:
162 *
163 *  This routine is invoked when the period represented
164 *  by ID expires.  If the task which owns this period is blocked
165 *  waiting for the period to expire, then it is readied and the
166 *  period is restarted.  If the owning task is not waiting for the
167 *  period to expire, then the period is placed in the EXPIRED
168 *  state and not restarted.
169 */
170
171void _Rate_monotonic_Timeout (
172  Objects_Id  id,
173  void       *ignored
174);
175
176#ifndef __RTEMS_APPLICATION__
177#include <rtems/rtems/ratemon.inl>
178#endif
179
180#ifdef __cplusplus
181}
182#endif
183
184#endif
185/* end of include file */
Note: See TracBrowser for help on using the repository browser.