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

4.104.114.84.9
Last change on this file since 113ef9fc was 113ef9fc, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 9, 1997 at 8:02:29 PM

added support for statistics on rate monotonic periods.

  • Property mode set to 100644
File size: 5.5 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}   rtems_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 defines the period status structure.
60 */ 
61
62typedef struct {
63  rtems_rate_monotonic_period_states  state;
64  unsigned32                          ticks_since_last_period;
65  unsigned32                          ticks_executed_since_last_period;
66}  rtems_rate_monotonic_period_status;
67
68/*
69 *  The following structure defines the control block used to manage
70 *  each period.
71 */
72
73typedef struct {
74  Objects_Control                     Object;
75  Watchdog_Control                    Timer;
76  rtems_rate_monotonic_period_states  state;
77  unsigned32                          owner_ticks_executed_at_period;
78  unsigned32                          time_at_period;
79  Thread_Control                     *owner;
80}   Rate_monotonic_Control;
81
82RTEMS_EXTERN Objects_Information _Rate_monotonic_Information;
83
84/*
85 *  _Rate_monotonic_Manager_initialization
86 *
87 *  DESCRIPTION:
88 *
89 *  This routine performs the initialization necessary for this manager.
90 */
91
92void _Rate_monotonic_Manager_initialization(
93  unsigned32 maximum_periods
94);
95
96/*
97 *  rtems_rate_monotonic_create
98 *
99 *  DESCRIPTION:
100 *
101 *  This routine implements the rate_monotonic_create directive.  The
102 *  period will have the name name.  It returns the id of the
103 *  created period in ID.
104 */
105
106rtems_status_code rtems_rate_monotonic_create(
107  rtems_name    name,
108  Objects_Id   *id
109);
110
111/*
112 *  rtems_rate_monotonic_ident
113 *
114 *  DESCRIPTION:
115 *
116 *  This routine implements the rtems_rate_monotonic_ident directive.
117 *  This directive returns the period ID associated with name.
118 *  If more than one period is named name, then the period
119 *  to which the ID belongs is arbitrary.
120 */
121
122rtems_status_code rtems_rate_monotonic_ident(
123  rtems_name    name,
124  Objects_Id   *id
125);
126
127/*
128 *  rtems_rate_monotonic_cancel
129 *
130 *  DESCRIPTION:
131 *
132 *  This routine implements the rtems_rate_monotonic_cancel directive.  This
133 *  directive stops the period associated with ID from continuing to
134 *  run.
135 */
136
137rtems_status_code rtems_rate_monotonic_cancel(
138  Objects_Id id
139);
140
141/*
142 *  rtems_rate_monotonic_delete
143 *
144 *  DESCRIPTION:
145 *
146 *  This routine implements the rtems_rate_monotonic_delete directive.  The
147 *  period indicated by ID is deleted.
148 */
149
150rtems_status_code rtems_rate_monotonic_delete(
151  Objects_Id id
152);
153
154/*
155 *  rtems_rate_monotonic_get_status
156 *
157 *  DESCRIPTION:
158 *
159 *  This routine implements the rtems_rate_monotonic_get_status directive.
160 *  Information about the period indicated by ID is returned.
161 *
162 */
163
164rtems_status_code rtems_rate_monotonic_get_status(
165  Objects_Id                           id,
166  rtems_rate_monotonic_period_status  *status
167);
168
169/*
170 *  rtems_rate_monotonic_period
171 *
172 *  DESCRIPTION:
173 *
174 *  This routine implements the rtems_rate_monotonic_period directive.  When
175 *  length is non-zero, this directive initiates the period associated with
176 *  ID from continuing for a period of length.  If length is zero, then
177 *  result is set to indicate the current state of the period.
178 */
179
180rtems_status_code rtems_rate_monotonic_period(
181  Objects_Id      id,
182  rtems_interval  length
183);
184
185/*
186 *  _Rate_monotonic_Timeout
187 *
188 *  DESCRIPTION:
189 *
190 *  This routine is invoked when the period represented
191 *  by ID expires.  If the task which owns this period is blocked
192 *  waiting for the period to expire, then it is readied and the
193 *  period is restarted.  If the owning task is not waiting for the
194 *  period to expire, then the period is placed in the EXPIRED
195 *  state and not restarted.
196 */
197
198void _Rate_monotonic_Timeout (
199  Objects_Id  id,
200  void       *ignored
201);
202
203#ifndef __RTEMS_APPLICATION__
204#include <rtems/rtems/ratemon.inl>
205#endif
206
207#ifdef __cplusplus
208}
209#endif
210
211#endif
212/* end of include file */
Note: See TracBrowser for help on using the repository browser.