source: rtems/cpukit/rtems/include/rtems/rtems/ratemon.h @ 092f142a

4.104.114.84.95
Last change on this file since 092f142a was 092f142a, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/28/05 at 05:00:21

New header guard.

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