source: rtems/c/src/exec/rtems/headers/ratemon.h @ f8f5106

4.104.114.84.95
Last change on this file since f8f5106 was f8f5106, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 25, 1997 at 6:13:26 PM

Added to comment header block to include new status directive.

  • Property mode set to 100644
File size: 5.4 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 *     + obtain status information on a period
14 *
15 *  COPYRIGHT (c) 1989-1997.
16 *  On-Line Applications Research Corporation (OAR).
17 *  Copyright assigned to U.S. Government, 1994.
18 *
19 *  The license and distribution terms for this file may in
20 *  the file LICENSE in this distribution or at
21 *  http://www.OARcorp.com/rtems/license.html.
22 *
23 *  $Id$
24 */
25
26#ifndef __RTEMS_RATE_MONOTONIC_h
27#define __RTEMS_RATE_MONOTONIC_h
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include <rtems/score/object.h>
34#include <rtems/score/thread.h>
35#include <rtems/score/watchdog.h>
36
37/*
38 *  The following enumerated type defines the states in which a
39 *  period may be.
40 */
41
42typedef enum {
43  RATE_MONOTONIC_INACTIVE,               /* off chain, never initialized */
44  RATE_MONOTONIC_OWNER_IS_BLOCKING,      /* on chain, owner is blocking on it */
45  RATE_MONOTONIC_ACTIVE,                 /* on chain, running continuously */
46  RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING, /* on chain, expired while owner was */
47                                         /*   was blocking on it */
48  RATE_MONOTONIC_EXPIRED                 /* off chain, will be reset by next */
49                                         /*   rtems_rate_monotonic_period */
50}   rtems_rate_monotonic_period_states;
51
52/*
53 *  The following constant is the interval passed to the rate_monontonic_period
54 *  directive to obtain status information.
55 */
56
57#define RTEMS_PERIOD_STATUS       WATCHDOG_NO_TIMEOUT
58
59/*
60 *  The following defines the period status structure.
61 */ 
62
63typedef struct {
64  rtems_rate_monotonic_period_states  state;
65  unsigned32                          ticks_since_last_period;
66  unsigned32                          ticks_executed_since_last_period;
67}  rtems_rate_monotonic_period_status;
68
69/*
70 *  The following structure defines the control block used to manage
71 *  each period.
72 */
73
74typedef struct {
75  Objects_Control                     Object;
76  Watchdog_Control                    Timer;
77  rtems_rate_monotonic_period_states  state;
78  unsigned32                          owner_ticks_executed_at_period;
79  unsigned32                          time_at_period;
80  Thread_Control                     *owner;
81}   Rate_monotonic_Control;
82
83RTEMS_EXTERN Objects_Information _Rate_monotonic_Information;
84
85/*
86 *  _Rate_monotonic_Manager_initialization
87 *
88 *  DESCRIPTION:
89 *
90 *  This routine performs the initialization necessary for this manager.
91 */
92
93void _Rate_monotonic_Manager_initialization(
94  unsigned32 maximum_periods
95);
96
97/*
98 *  rtems_rate_monotonic_create
99 *
100 *  DESCRIPTION:
101 *
102 *  This routine implements the rate_monotonic_create directive.  The
103 *  period will have the name name.  It returns the id of the
104 *  created period in ID.
105 */
106
107rtems_status_code rtems_rate_monotonic_create(
108  rtems_name    name,
109  Objects_Id   *id
110);
111
112/*
113 *  rtems_rate_monotonic_ident
114 *
115 *  DESCRIPTION:
116 *
117 *  This routine implements the rtems_rate_monotonic_ident directive.
118 *  This directive returns the period ID associated with name.
119 *  If more than one period is named name, then the period
120 *  to which the ID belongs is arbitrary.
121 */
122
123rtems_status_code rtems_rate_monotonic_ident(
124  rtems_name    name,
125  Objects_Id   *id
126);
127
128/*
129 *  rtems_rate_monotonic_cancel
130 *
131 *  DESCRIPTION:
132 *
133 *  This routine implements the rtems_rate_monotonic_cancel directive.  This
134 *  directive stops the period associated with ID from continuing to
135 *  run.
136 */
137
138rtems_status_code rtems_rate_monotonic_cancel(
139  Objects_Id id
140);
141
142/*
143 *  rtems_rate_monotonic_delete
144 *
145 *  DESCRIPTION:
146 *
147 *  This routine implements the rtems_rate_monotonic_delete directive.  The
148 *  period indicated by ID is deleted.
149 */
150
151rtems_status_code rtems_rate_monotonic_delete(
152  Objects_Id id
153);
154
155/*
156 *  rtems_rate_monotonic_get_status
157 *
158 *  DESCRIPTION:
159 *
160 *  This routine implements the rtems_rate_monotonic_get_status directive.
161 *  Information about the period indicated by ID is returned.
162 *
163 */
164
165rtems_status_code rtems_rate_monotonic_get_status(
166  Objects_Id                           id,
167  rtems_rate_monotonic_period_status  *status
168);
169
170/*
171 *  rtems_rate_monotonic_period
172 *
173 *  DESCRIPTION:
174 *
175 *  This routine implements the rtems_rate_monotonic_period directive.  When
176 *  length is non-zero, this directive initiates the period associated with
177 *  ID from continuing for a period of length.  If length is zero, then
178 *  result is set to indicate the current state of the period.
179 */
180
181rtems_status_code rtems_rate_monotonic_period(
182  Objects_Id      id,
183  rtems_interval  length
184);
185
186/*
187 *  _Rate_monotonic_Timeout
188 *
189 *  DESCRIPTION:
190 *
191 *  This routine is invoked when the period represented
192 *  by ID expires.  If the task which owns this period is blocked
193 *  waiting for the period to expire, then it is readied and the
194 *  period is restarted.  If the owning task is not waiting for the
195 *  period to expire, then the period is placed in the EXPIRED
196 *  state and not restarted.
197 */
198
199void _Rate_monotonic_Timeout (
200  Objects_Id  id,
201  void       *ignored
202);
203
204#ifndef __RTEMS_APPLICATION__
205#include <rtems/rtems/ratemon.inl>
206#endif
207
208#ifdef __cplusplus
209}
210#endif
211
212#endif
213/* end of include file */
Note: See TracBrowser for help on using the repository browser.