1 | /** |
---|
2 | * @file rtems/rtems/timer.inl |
---|
3 | * |
---|
4 | * This file contains the static inline implementation of the inlined routines |
---|
5 | * from the Timer Manager. |
---|
6 | */ |
---|
7 | |
---|
8 | /* COPYRIGHT (c) 1989-2008. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_RTEMS_TIMER_INL |
---|
19 | #define _RTEMS_RTEMS_TIMER_INL |
---|
20 | |
---|
21 | /** |
---|
22 | * @addtogroup ClassicTimer |
---|
23 | * @{ |
---|
24 | */ |
---|
25 | |
---|
26 | /** |
---|
27 | * @brief Timer_Allocate |
---|
28 | * |
---|
29 | * This function allocates a timer control block from |
---|
30 | * the inactive chain of free timer control blocks. |
---|
31 | */ |
---|
32 | RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Allocate( void ) |
---|
33 | { |
---|
34 | return (Timer_Control *) _Objects_Allocate( &_Timer_Information ); |
---|
35 | } |
---|
36 | |
---|
37 | /** |
---|
38 | * @brief Timer_Free |
---|
39 | * |
---|
40 | * This routine frees a timer control block to the |
---|
41 | * inactive chain of free timer control blocks. |
---|
42 | */ |
---|
43 | RTEMS_INLINE_ROUTINE void _Timer_Free ( |
---|
44 | Timer_Control *the_timer |
---|
45 | ) |
---|
46 | { |
---|
47 | _Objects_Free( &_Timer_Information, &the_timer->Object ); |
---|
48 | } |
---|
49 | |
---|
50 | /** |
---|
51 | * @brief Timer_Get |
---|
52 | * |
---|
53 | * This function maps timer IDs to timer control blocks. |
---|
54 | * If ID corresponds to a local timer, then it returns |
---|
55 | * the timer control pointer which maps to ID and location |
---|
56 | * is set to OBJECTS_LOCAL. Otherwise, location is set |
---|
57 | * to OBJECTS_ERROR and the returned value is undefined. |
---|
58 | */ |
---|
59 | RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Get ( |
---|
60 | Objects_Id id, |
---|
61 | Objects_Locations *location |
---|
62 | ) |
---|
63 | { |
---|
64 | return (Timer_Control *) |
---|
65 | _Objects_Get( &_Timer_Information, id, location ); |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * @brief Timer_Is_interval_class |
---|
70 | * |
---|
71 | * This function returns TRUE if the class is that of an INTERVAL |
---|
72 | * timer, and FALSE otherwise. |
---|
73 | */ |
---|
74 | RTEMS_INLINE_ROUTINE boolean _Timer_Is_interval_class ( |
---|
75 | Timer_Classes the_class |
---|
76 | ) |
---|
77 | { |
---|
78 | return (the_class == TIMER_INTERVAL) || (the_class == TIMER_INTERVAL_ON_TASK); |
---|
79 | } |
---|
80 | |
---|
81 | /** |
---|
82 | * @brief Timer_Is_time_of_day_class |
---|
83 | * |
---|
84 | * This function returns TRUE if the class is that of an INTERVAL |
---|
85 | * timer, and FALSE otherwise. |
---|
86 | */ |
---|
87 | RTEMS_INLINE_ROUTINE boolean _Timer_Is_timer_of_day_class ( |
---|
88 | Timer_Classes the_class |
---|
89 | ) |
---|
90 | { |
---|
91 | return ( the_class == TIMER_TIME_OF_DAY ); |
---|
92 | } |
---|
93 | |
---|
94 | /** |
---|
95 | * @brief Timer_Is_dormant_class |
---|
96 | * |
---|
97 | * This function returns TRUE if the class is that of a DORMANT |
---|
98 | * timer, and FALSE otherwise. |
---|
99 | */ |
---|
100 | RTEMS_INLINE_ROUTINE boolean _Timer_Is_dormant_class ( |
---|
101 | Timer_Classes the_class |
---|
102 | ) |
---|
103 | { |
---|
104 | return ( the_class == TIMER_DORMANT ); |
---|
105 | } |
---|
106 | |
---|
107 | /** |
---|
108 | * @brief Timer_Is_null |
---|
109 | * |
---|
110 | * This function returns TRUE if the_timer is NULL and FALSE otherwise. |
---|
111 | */ |
---|
112 | RTEMS_INLINE_ROUTINE boolean _Timer_Is_null ( |
---|
113 | Timer_Control *the_timer |
---|
114 | ) |
---|
115 | { |
---|
116 | return ( the_timer == NULL ); |
---|
117 | } |
---|
118 | |
---|
119 | /**@}*/ |
---|
120 | |
---|
121 | #endif |
---|
122 | /* end of include file */ |
---|