source: rtems/cpukit/rtems/include/rtems/rtems/timerimpl.h @ 4cd55724

4.115
Last change on this file since 4cd55724 was 4cd55724, checked in by Sebastian Huber <sebastian.huber@…>, on 07/26/14 at 10:52:22

Delete unused *_Is_null() functions

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicTimerImpl
5 *
6 * @brief Classic Timer Implementation
7 */
8
9/*
10 * COPYRIGHT (c) 1989-2011.
11 * On-Line Applications Research Corporation (OAR).
12 *
13 * The license and distribution terms for this file may be
14 * found in the file LICENSE in this distribution or at
15 * http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_RTEMS_TIMER_INL
19#define _RTEMS_RTEMS_TIMER_INL
20
21#include <rtems/rtems/timer.h>
22#include <rtems/score/objectimpl.h>
23#include <rtems/score/thread.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/**
30 * @defgroup ClassicTimerImpl Classic Timer Implementation
31 *
32 * @ingroup ClassicTimer
33 *
34 * @{
35 */
36
37/**
38 *  @brief Instantiate RTEMS Timer Data
39 *
40 *  This constant is defined to extern most of the time when using
41 *  this header file.  However by defining it to nothing, the data
42 *  declared in this header file can be instantiated.  This is done
43 *  in a single per manager file.
44 */
45#ifndef RTEMS_TIMER_EXTERN
46#define RTEMS_TIMER_EXTERN extern
47#endif
48
49typedef struct Timer_server_Control Timer_server_Control;
50
51/**
52 * @brief Method used to schedule the insertion of task based timers.
53 */
54typedef void (*Timer_server_Schedule_operation)(
55  Timer_server_Control *timer_server,
56  Timer_Control        *timer
57);
58
59typedef struct {
60  /**
61   * @brief This watchdog that will be registered in the system tick mechanic
62   * for timer server wake-up.
63   */
64  Watchdog_Control System_watchdog;
65
66  /**
67   * @brief Chain for watchdogs which will be triggered by the timer server.
68   */
69  Chain_Control Chain;
70
71  /**
72   * @brief Last known time snapshot of the timer server.
73   *
74   * The units may be ticks or seconds.
75   */
76  Watchdog_Interval volatile last_snapshot;
77} Timer_server_Watchdogs;
78
79struct Timer_server_Control {
80  /**
81   * @brief Timer server thread.
82   */
83  Thread_Control *thread;
84
85  /**
86   * @brief The schedule operation method of the timer server.
87   */
88  Timer_server_Schedule_operation schedule_operation;
89
90  /**
91   * @brief Interval watchdogs triggered by the timer server.
92   */
93  Timer_server_Watchdogs Interval_watchdogs;
94
95  /**
96   * @brief TOD watchdogs triggered by the timer server.
97   */
98  Timer_server_Watchdogs TOD_watchdogs;
99
100  /**
101   * @brief Chain of timers scheduled for insert.
102   *
103   * This pointer is not @c NULL whenever the interval and TOD chains are
104   * processed.  After the processing this list will be checked and if
105   * necessary the processing will be restarted.  Processing of these chains
106   * can be only interrupted through interrupts.
107   */
108  Chain_Control *volatile insert_chain;
109
110  /**
111   * @brief Indicates that the timer server is active or not.
112   *
113   * The server is active after the delay on a system watchdog.  The activity
114   * period of the server ends when no more watchdogs managed by the server
115   * fire.  The system watchdogs must not be manipulated when the server is
116   * active.
117   */
118  bool volatile active;
119};
120
121/**
122 * @brief Pointer to default timer server control block.
123 *
124 * This value is @c NULL when the default timer server is not initialized.
125 */
126RTEMS_TIMER_EXTERN Timer_server_Control *volatile _Timer_server;
127
128/**
129 *  The following defines the information control block used to manage
130 *  this class of objects.
131 */
132RTEMS_TIMER_EXTERN Objects_Information  _Timer_Information;
133
134/**
135 *  @brief Timer Manager Initialization
136 *
137 *  This routine performs the initialization necessary for this manager.
138 */
139void _Timer_Manager_initialization(void);
140
141/**
142 *  @brief Timer_Allocate
143 *
144 *  This function allocates a timer control block from
145 *  the inactive chain of free timer control blocks.
146 */
147RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Allocate( void )
148{
149  return (Timer_Control *) _Objects_Allocate( &_Timer_Information );
150}
151
152/**
153 *  @brief Timer_Free
154 *
155 *  This routine frees a timer control block to the
156 *  inactive chain of free timer control blocks.
157 */
158RTEMS_INLINE_ROUTINE void _Timer_Free (
159  Timer_Control *the_timer
160)
161{
162  _Objects_Free( &_Timer_Information, &the_timer->Object );
163}
164
165/**
166 *  @brief Timer_Get
167 *
168 *  This function maps timer IDs to timer control blocks.
169 *  If ID corresponds to a local timer, then it returns
170 *  the timer control pointer which maps to ID and location
171 *  is set to OBJECTS_LOCAL.  Otherwise, location is set
172 *  to OBJECTS_ERROR and the returned value is undefined.
173 */
174RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Get (
175  Objects_Id         id,
176  Objects_Locations *location
177)
178{
179  return (Timer_Control *)
180    _Objects_Get( &_Timer_Information, id, location );
181}
182
183/**
184 *  @brief Timer_Is_interval_class
185 *
186 *  This function returns TRUE if the class is that of an INTERVAL
187 *  timer, and FALSE otherwise.
188 */
189RTEMS_INLINE_ROUTINE bool _Timer_Is_interval_class (
190  Timer_Classes the_class
191)
192{
193  return (the_class == TIMER_INTERVAL) || (the_class == TIMER_INTERVAL_ON_TASK);
194}
195
196/**
197 *  @brief Timer_Is_time_of_day_class
198 *
199 *  This function returns TRUE if the class is that of an INTERVAL
200 *  timer, and FALSE otherwise.
201 */
202RTEMS_INLINE_ROUTINE bool _Timer_Is_timer_of_day_class (
203  Timer_Classes the_class
204)
205{
206  return ( the_class == TIMER_TIME_OF_DAY );
207}
208
209/**
210 *  @brief Timer_Is_dormant_class
211 *
212 *  This function returns TRUE if the class is that of a DORMANT
213 *  timer, and FALSE otherwise.
214 */
215RTEMS_INLINE_ROUTINE bool _Timer_Is_dormant_class (
216  Timer_Classes the_class
217)
218{
219  return ( the_class == TIMER_DORMANT );
220}
221
222/**@}*/
223
224#ifdef __cplusplus
225}
226#endif
227
228#endif
229/* end of include file */
Note: See TracBrowser for help on using the repository browser.