source: rtems/c/src/exec/rtems/headers/timer.h @ 3235ad9

4.104.114.84.95
Last change on this file since 3235ad9 was 3235ad9, checked in by Joel Sherrill <joel.sherrill@…>, on 08/23/95 at 19:30:23

Support for variable length names added to Object Handler. This supports
both fixed length "raw" names and strings from the API's point of view.

Both inline and macro implementations were tested.

  • Property mode set to 100644
File size: 6.1 KB
Line 
1/*  timer.h
2 *
3 *  This include file contains all the constants, structures, and
4 *  prototypes associated with the Timer Manager.  This manager provides
5 *  facilities to configure, initiate, cancel, and delete timers which will
6 *  fire at specified intervals of time.
7 *
8 *  Directives provided are:
9 *
10 *     + create a timer
11 *     + get an ID of a timer
12 *     + delete a timer
13 *     + set a timer to fire after a number of ticks have passed
14 *     + set a timer to fire when a specified date and time has been reached
15 *     + reset a timer
16 *     + cancel a time
17 *
18 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
19 *  On-Line Applications Research Corporation (OAR).
20 *  All rights assigned to U.S. Government, 1994.
21 *
22 *  This material may be reproduced by or for the U.S. Government pursuant
23 *  to the copyright license under the clause at DFARS 252.227-7013.  This
24 *  notice must appear in all copies of this file and its derivatives.
25 *
26 *  $Id$
27 */
28
29#ifndef __RTEMS_TIMER_h
30#define __RTEMS_TIMER_h
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#include <rtems.h>
37#include <rtems/object.h>
38#include <rtems/tod.h>
39#include <rtems/watchdog.h>
40
41/*
42 *  The following enumerated type details the classes to which a timer
43 *  may belong.
44 */
45
46typedef enum {
47  TIMER_INTERVAL,
48  TIMER_TIME_OF_DAY,
49  TIMER_DORMANT
50} Timer_Classes;
51
52/*
53 *  The following defines the type of a Timer Service Routine.
54 */
55
56typedef rtems_timer_service_routine_entry Timer_Service;
57
58/*
59 *  The following defines the information control block used to manage
60 *  this class of objects.
61 */
62
63EXTERN Objects_Information  _Timer_Information;
64
65/*
66 *  The following records define the control block used to manage
67 *  each timer.
68 */
69
70typedef struct {
71  Objects_Control  Object;
72  Watchdog_Control Ticker;
73  Timer_Classes    the_class;
74}   Timer_Control;
75
76/*
77 *  _Timer_Manager_initialization
78 *
79 *  DESCRIPTION:
80 *
81 *  This routine performs the initialization necessary for this manager.
82 */
83
84void _Timer_Manager_initialization(
85  unsigned32 maximum_timers
86);
87
88/*
89 *  rtems_timer_create
90 *
91 *  DESCRIPTION:
92 *
93 *  This routine implements the rtems_timer_create directive.  The
94 *  timer will have the name name.  It returns the id of the
95 *  created timer in ID.
96 */
97
98rtems_status_code rtems_timer_create(
99  rtems_name    name,
100  Objects_Id   *id
101);
102
103/*
104 *  rtems_timer_ident
105 *
106 *  DESCRIPTION:
107 *
108 *  This routine implements the rtems_timer_ident directive.
109 *  This directive returns the timer ID associated with name.
110 *  If more than one timer is named name, then the timer
111 *  to which the ID belongs is arbitrary.
112 */
113
114rtems_status_code rtems_timer_ident(
115  rtems_name    name,
116  Objects_Id   *id
117);
118
119/*
120 *  rtems_timer_cancel
121 *
122 *  DESCRIPTION:
123 *
124 *  This routine implements the rtems_timer_cancel directive.  It is used
125 *  to stop the timer associated with ID from firing.
126 */
127
128rtems_status_code rtems_timer_cancel(
129  Objects_Id id
130);
131
132/*
133 *  rtems_timer_delete
134 *
135 *  DESCRIPTION:
136 *
137 *  This routine implements the rtems_timer_delete directive.  The
138 *  timer indicated by ID is deleted.
139 */
140
141rtems_status_code rtems_timer_delete(
142  Objects_Id id
143);
144
145/*
146 *  rtems_timer_fire_after
147 *
148 *  DESCRIPTION:
149 *
150 *  This routine implements the rtems_timer_fire_after directive.  It
151 *  initiates the timer associated with ID to fire in ticks clock
152 *  ticks.  When the timer fires, the routine will be invoked.
153 */
154
155rtems_status_code rtems_timer_fire_after(
156  Objects_Id         id,
157  rtems_interval  ticks,
158  Timer_Service      routine,
159  void              *user_data
160);
161
162/*
163 *  rtems_timer_fire_when
164 *
165 *  DESCRIPTION:
166 *
167 *  This routine implements the rtems_timer_fire_when directive.  It
168 *  initiates the timer associated with ID to fire at wall_time
169 *  When the timer fires, the routine will be invoked.
170 */
171
172rtems_status_code rtems_timer_fire_when(
173  Objects_Id         id,
174  rtems_time_of_day       *wall_time,
175  Timer_Service      routine,
176  void              *user_data
177);
178
179/*
180 *  rtems_timer_reset
181 *
182 *  DESCRIPTION:
183 *
184 *  This routine implements the rtems_timer_reset directive.  It is used
185 *  to reinitialize the interval timer associated with ID just as if
186 *  rtems_timer_fire_after were re-invoked with the same arguments that
187 *  were used to initiate this timer.
188 */
189
190rtems_status_code rtems_timer_reset(
191  Objects_Id id
192);
193
194/*
195 *  _Timer_Allocate
196 *
197 *  DESCRIPTION:
198 *
199 *  This function allocates a timer control block from
200 *  the inactive chain of free timer control blocks.
201 */
202
203STATIC INLINE Timer_Control *_Timer_Allocate( void );
204
205/*
206 *  _Timer_Free
207 *
208 *  DESCRIPTION:
209 *
210 *  This routine frees a timer control block to the
211 *  inactive chain of free timer control blocks.
212 */
213
214STATIC INLINE void _Timer_Free (
215  Timer_Control *the_timer
216);
217
218/*
219 *  _Timer_Get
220 *
221 *  DESCRIPTION:
222 *
223 *  This function maps timer IDs to timer control blocks.
224 *  If ID corresponds to a local timer, then it returns
225 *  the timer control pointer which maps to ID and location
226 *  is set to OBJECTS_LOCAL.  Otherwise, location is set
227 *  to OBJECTS_ERROR and the returned value is undefined.
228 */
229
230STATIC INLINE Timer_Control *_Timer_Get (
231  Objects_Id         id,
232  Objects_Locations *location
233);
234
235/*
236 *  _Timer_Is_interval_class
237 *
238 *  DESCRIPTION:
239 *
240 *  This function returns TRUE if the class is that of an INTERVAL
241 *  timer, and FALSE otherwise.
242 */
243
244STATIC INLINE boolean _Timer_Is_interval_class (
245  Timer_Classes the_class
246);
247
248/*
249 *  _Timer_Is_time_of_day_class
250 *
251 *  DESCRIPTION:
252 *
253 *  This function returns TRUE if the class is that of an INTERVAL
254 *  timer, and FALSE otherwise.
255 */
256
257STATIC INLINE boolean _Timer_Is_timer_of_day_class (
258  Timer_Classes the_class
259);
260
261/*
262 *  _Timer_Is_dormant_class
263 *
264 *  DESCRIPTION:
265 *
266 *  This function returns TRUE if the class is that of a DORMANT
267 *  timer, and FALSE otherwise.
268 */
269
270STATIC INLINE boolean _Timer_Is_dormant_class (
271  Timer_Classes the_class
272);
273
274/*
275 *  _Timer_Is_null
276 *
277 *  DESCRIPTION:
278 *
279 *  This function returns TRUE if the_timer is NULL and FALSE otherwise.
280 */
281
282STATIC INLINE boolean _Timer_Is_null (
283  Timer_Control *the_timer
284);
285
286#include <rtems/timer.inl>
287
288#ifdef __cplusplus
289}
290#endif
291
292#endif
293/* end of include file */
Note: See TracBrowser for help on using the repository browser.