source: rtems/cpukit/include/rtems/rtems/timer.h @ b7af3e44

5
Last change on this file since b7af3e44 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 11.7 KB
Line 
1/**
2 * @file rtems/rtems/timer.h
3 *
4 * @defgroup ClassicTimer Timers
5 *
6 * @ingroup ClassicRTEMS
7 * @brief Instantiate RTEMS Timer Data
8 *
9 * This include file contains all the constants, structures, and
10 * prototypes associated with the Timer Manager. This manager provides
11 * facilities to configure, initiate, cancel, and delete timers which will
12 * fire at specified intervals of time.
13 *
14 * Directives provided are:
15 *
16 * - create a timer
17 * - get an ID of a timer
18 * - delete a timer
19 * - set timer to fire in context of clock tick
20 * - after a number of ticks have passed
21 * - when a specified date and time has been reached
22 * - initiate the timer server task
23 * - set timer to fire in context of the timer server task
24 * - after a number of ticks have passed
25 * - when a specified date and time has been reached
26 * - reset a timer
27 * - cancel a time
28 */
29
30/*
31 * COPYRIGHT (c) 1989-2011.
32 * On-Line Applications Research Corporation (OAR).
33 *
34 * Copyright (c) 2009, 2016 embedded brains GmbH.
35 *
36 * The license and distribution terms for this file may be
37 * found in the file LICENSE in this distribution or at
38 * http://www.rtems.org/license/LICENSE.
39 */
40
41#ifndef _RTEMS_RTEMS_TIMER_H
42#define _RTEMS_RTEMS_TIMER_H
43
44#include <rtems/rtems/attr.h>
45#include <rtems/rtems/status.h>
46#include <rtems/rtems/tasks.h>
47#include <rtems/rtems/types.h>
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/**
54 *  @defgroup ClassicTimer Timers
55 *
56 *  @ingroup ClassicRTEMS
57 *
58 *  This encapsulates functionality related to the Classic API Timer
59 *  Manager.  This manager provides functionality which allows the
60 *  application to schedule the execution of methods at a specified
61 *  time in the future.  These methods may be scheduled based upon
62 *  interval or wall time and may be executed in either the clock tick
63 *  ISR or in a special dedicated timer server task.
64 */
65/**@{*/
66
67#define TIMER_CLASS_BIT_TIME_OF_DAY 0x1
68
69#define TIMER_CLASS_BIT_ON_TASK 0x2
70
71#define TIMER_CLASS_BIT_NOT_DORMANT 0x4
72
73/**
74 *  The following enumerated type details the classes to which a timer
75 *  may belong.
76 */
77typedef enum {
78  /**
79   * This value indicates the timer is currently not in use.
80   */
81  TIMER_DORMANT,
82
83  /**
84   * This value indicates the timer is currently in use as an interval
85   * timer which will fire in the clock tick ISR.
86   */
87  TIMER_INTERVAL = TIMER_CLASS_BIT_NOT_DORMANT,
88
89  /**
90   * This value indicates the timer is currently in use as an interval
91   * timer which will fire in the timer server task.
92   */
93  TIMER_INTERVAL_ON_TASK =
94    TIMER_CLASS_BIT_NOT_DORMANT | TIMER_CLASS_BIT_ON_TASK,
95
96  /**
97   * This value indicates the timer is currently in use as an time of day
98   * timer which will fire in the clock tick ISR.
99   */
100  TIMER_TIME_OF_DAY =
101    TIMER_CLASS_BIT_NOT_DORMANT | TIMER_CLASS_BIT_TIME_OF_DAY,
102
103  /**
104   * This value indicates the timer is currently in use as an time of day
105   * timer which will fire in the timer server task.
106   */
107  TIMER_TIME_OF_DAY_ON_TASK =
108    TIMER_CLASS_BIT_NOT_DORMANT | TIMER_CLASS_BIT_TIME_OF_DAY |
109    TIMER_CLASS_BIT_ON_TASK
110} Timer_Classes;
111
112/**
113 *  The following types define a pointer to a timer service routine.
114 */
115typedef void rtems_timer_service_routine;
116
117/**
118 *  This type defines the type used to manage and indirectly invoke
119 *  Timer Service Routines (TSRs).  This defines the prototype and interface
120 *  for a function which is to be used as a TSR.
121 */
122typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )(
123                 rtems_id,
124                 void *
125             );
126
127/**
128 *  The following records define the control block used to manage
129 *  each timer.
130 */
131typedef struct {
132  /** This field is the object management portion of a Timer instance. */
133  Objects_Control  Object;
134  /** This field is the Watchdog instance which will be the scheduled. */
135  Watchdog_Control Ticker;
136  /** This field indicates what type of timer this currently is. */
137  Timer_Classes    the_class;
138  /** This field is the timer service routine. */
139  rtems_timer_service_routine_entry routine;
140  /** This field is the timer service routine user data. */
141  void *user_data;
142  /** This field is the timer interval in ticks or seconds. */
143  Watchdog_Interval initial;
144  /** This field is the timer start time point in ticks. */
145  Watchdog_Interval start_time;
146  /** This field is the timer stop time point in ticks. */
147  Watchdog_Interval stop_time;
148}   Timer_Control;
149
150/**
151 * @brief RTEMS Create Timer
152 *
153 * This routine implements the rtems_timer_create directive. The
154 * timer will have the name name. It returns the id of the
155 * created timer in ID.
156 *
157 * @param[in] name is the timer name
158 * @param[out] id is the pointer to timer id
159 *
160 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful
161 */
162rtems_status_code rtems_timer_create(
163  rtems_name    name,
164  rtems_id     *id
165);
166
167/**
168 * @brief RTEMS Timer Name to Id
169 *
170 * This routine implements the rtems_timer_ident directive.
171 * This directive returns the timer ID associated with name.
172 * If more than one timer is named name, then the timer
173 * to which the ID belongs is arbitrary.
174 *
175 * @param[in] name is the user defined message queue name
176 * @param[in] id is the pointer to timer id
177 *
178 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful and
179 * id filled with the message queue id
180 */
181rtems_status_code rtems_timer_ident(
182  rtems_name    name,
183  rtems_id     *id
184);
185
186/**
187 *  @brief rtems_timer_cancel
188 *
189 *  This routine implements the rtems_timer_cancel directive.  It is used
190 *  to stop the timer associated with ID from firing.
191 */
192rtems_status_code rtems_timer_cancel(
193  rtems_id   id
194);
195
196/**
197 * @brief RTEMS Delete Timer
198 *
199 * This routine implements the rtems_timer_delete directive. The
200 * timer indicated by ID is deleted.
201 *
202 * @param[in] id is the timer id
203 *
204 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
205 *         error. Otherwise, a status code is returned indicating the
206 *         source of the error.
207 */
208rtems_status_code rtems_timer_delete(
209  rtems_id   id
210);
211
212/**
213 * @brief RTEMS Timer Fire After
214 *
215 * This routine implements the rtems_timer_fire_after directive. It
216 * initiates the timer associated with ID to fire in ticks clock ticks.
217 * When the timer fires, the routine will be invoked in the context
218 * of the rtems_clock_tick directive which is normally invoked as
219 * part of servicing a periodic interupt.
220 *
221 * @param[in] id is the timer id
222 * @param[in] ticks is the interval until routine is fired
223 * @param[in] routine is the routine to schedule
224 * @param[in] user_data is the passed as argument to routine when it is fired
225 *
226 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
227 *         error. Otherwise, a status code is returned indicating the
228 *         source of the error.
229 */
230rtems_status_code rtems_timer_fire_after(
231  rtems_id                           id,
232  rtems_interval                     ticks,
233  rtems_timer_service_routine_entry  routine,
234  void                              *user_data
235);
236
237/**
238 * @brief RTEMS Timer Server Fire After
239 *
240 * This routine implements the rtems_timer_server_fire_after directive. It
241 * initiates the timer associated with ID to fire in ticks clock
242 * ticks. When the timer fires, the routine will be invoked by the
243 * Timer Server in the context of a task NOT IN THE CONTEXT of the
244 * clock tick interrupt.
245 *
246 * @param[in] id is the timer id
247 * @param[in] ticks is the interval until routine is fired
248 * @param[in] routine is the routine to schedule
249 * @param[in] user_data is the passed as argument to routine when it is fired
250 *
251 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
252 *         error. Otherwise, a status code is returned indicating the
253 *         source of the error.
254 */
255rtems_status_code rtems_timer_server_fire_after(
256  rtems_id                           id,
257  rtems_interval                     ticks,
258  rtems_timer_service_routine_entry  routine,
259  void                              *user_data
260);
261
262/**
263 * @brief RTEMS Timer Fire When
264 *
265 * This routine implements the rtems_timer_fire_when directive. It
266 * initiates the timer associated with ID to fire at wall_time
267 * When the timer fires, the routine will be invoked in the context
268 * of the rtems_clock_tick directive which is normally invoked as
269 * part of servicing a periodic interupt.
270 *
271 * @param[in] id is the timer id
272 * @param[in] wall_time is the time of day to fire timer
273 * @param[in] routine is the routine to schedule
274 * @param[in] user_data is the passed as argument to routine when it is fired
275 *
276 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
277 *         error. Otherwise, a status code is returned indicating the
278 *         source of the error.
279 */
280rtems_status_code rtems_timer_fire_when(
281  rtems_id                            id,
282  rtems_time_of_day                  *wall_time,
283  rtems_timer_service_routine_entry   routine,
284  void                               *user_data
285);
286
287/**
288 *  @brief RTEMS Timer Server Fire When Directive
289 *
290 *  Timer Manager - RTEMS Timer Server Fire When Directive
291 *
292 *  This routine implements the rtems_timer_server_fire_when directive.  It
293 *  initiates the timer associated with ID to fire at wall_time
294 *  When the timer fires, the routine will be invoked by the
295 *  Timer Server in the context of a task NOT IN THE CONTEXT of the
296 *  clock tick interrupt.
297 */
298rtems_status_code rtems_timer_server_fire_when(
299  rtems_id                            id,
300  rtems_time_of_day                  *wall_time,
301  rtems_timer_service_routine_entry   routine,
302  void                               *user_data
303);
304
305/**
306 *  @brief RTEMS Timer Reset
307 *
308 *  Timer Manager - RTEMS Timer Reset
309 *
310 *  This routine implements the rtems_timer_reset directive.  It is used
311 *  to reinitialize the interval timer associated with ID just as if
312 *  rtems_timer_fire_after were re-invoked with the same arguments that
313 *  were used to initiate this timer.
314 */
315rtems_status_code rtems_timer_reset(
316  rtems_id   id
317);
318
319/**
320 *  @brief Initiates the timer server.
321 *
322 *  This directive creates and starts the server for task-based timers.
323 *  It must be invoked before any task-based timers can be initiated.
324 *
325 *  @param priority The timer server task priority.
326 *  @param stack_size The stack size in bytes for the timer server task.
327 *  @param attribute_set The timer server task attributes.
328 *
329 *  @return This method returns RTEMS_SUCCESSFUL if successful and an
330 *          error code otherwise.
331 */
332rtems_status_code rtems_timer_initiate_server(
333  rtems_task_priority priority,
334  size_t              stack_size,
335  rtems_attribute     attribute_set
336);
337
338/**
339 *  This is the default value for the priority of the Timer Server.
340 *  When given this priority, a special high priority not accessible
341 *  via the Classic API is used.
342 */
343#define RTEMS_TIMER_SERVER_DEFAULT_PRIORITY (uint32_t) -1
344
345/**
346 *  This is the structure filled in by the timer get information
347 *  service.
348 */
349typedef struct {
350  /** This indicates the current type of the timer. */
351  Timer_Classes      the_class;
352  /** This indicates the initial requested interval. */
353  Watchdog_Interval  initial;
354  /** This indicates the time the timer was initially scheduled. */
355  Watchdog_Interval  start_time;
356  /** This indicates the time the timer is scheduled to fire. */
357  Watchdog_Interval  stop_time;
358} rtems_timer_information;
359
360/**
361 * @brief RTEMS Get Timer Information
362 *
363 * This routine implements the rtems_timer_get_information directive.
364 * This directive returns information about the timer.
365 *
366 * @param[in] id is the timer id
367 * @param[in] the_info is the pointer to timer information block
368 *
369 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful and
370 *              *the_info region information block filled in
371 */
372rtems_status_code rtems_timer_get_information(
373  rtems_id                 id,
374  rtems_timer_information *the_info
375);
376
377/**@}*/
378
379#ifdef __cplusplus
380}
381#endif
382
383#endif
384/* end of include file */
Note: See TracBrowser for help on using the repository browser.