RTEMS  5.0.0
timerimpl.h
Go to the documentation of this file.
1 
10 /*
11  * COPYRIGHT (c) 1989-2013.
12  * On-Line Applications Research Corporation (OAR).
13  *
14  * The license and distribution terms for this file may be
15  * found in the file LICENSE in this distribution or at
16  * http://www.rtems.org/license/LICENSE.
17  */
18 
19 #ifndef _RTEMS_POSIX_TIMERIMPL_H
20 #define _RTEMS_POSIX_TIMERIMPL_H
21 
22 #include <rtems/posix/timer.h>
23 #include <rtems/score/objectimpl.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
31 #define POSIX_TIMER_STATE_FREE 0x01
32 
34 #define POSIX_TIMER_STATE_CREATE_NEW 0x02
35 
37 #define POSIX_TIMER_STATE_CREATE_RUN 0x03
38 
40 #define POSIX_TIMER_STATE_CREATE_STOP 0x04
41 
43 #define POSIX_TIMER_RELATIVE 0
44 
45 /*
46  * POSIX defines TIMER_ABSTIME but no constant for relative. So
47  * we have one internally but we need to be careful it has a different
48  * value.
49  */
50 #if (POSIX_TIMER_RELATIVE == TIMER_ABSTIME)
51 #error "POSIX_TIMER_RELATIVE == TIMER_ABSTIME"
52 #endif
53 
61 {
63 }
64 
72  POSIX_Timer_Control *the_timer
73 )
74 {
75  _Objects_Free( &_POSIX_Timer_Information, &the_timer->Object );
76 }
77 
78 void _POSIX_Timer_TSR( Watchdog_Control *the_watchdog );
79 
90  timer_t id,
91  ISR_lock_Context *lock_context
92 )
93 {
95  (Objects_Id) id,
96  lock_context,
98  );
99 }
100 
101 RTEMS_INLINE_ROUTINE Per_CPU_Control *_POSIX_Timer_Acquire_critical(
102  POSIX_Timer_Control *ptimer,
103  ISR_lock_Context *lock_context
104 )
105 {
106  Per_CPU_Control *cpu;
107 
108  cpu = _Watchdog_Get_CPU( &ptimer->Timer );
109  _Watchdog_Per_CPU_acquire_critical( cpu, lock_context );
110 
111  return cpu;
112 }
113 
114 RTEMS_INLINE_ROUTINE void _POSIX_Timer_Release(
115  Per_CPU_Control *cpu,
116  ISR_lock_Context *lock_context
117 )
118 {
119  _Watchdog_Per_CPU_release_critical( cpu, lock_context );
120  _ISR_lock_ISR_enable( lock_context );
121 }
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif
128 /* end of include file */
void _Objects_Free(Objects_Information *information, Objects_Control *the_object)
Frees an object.
Definition: objectfree.c:25
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
Definition: objectallocate.c:89
Inlined Routines in the Watchdog Handler.
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
Objects_Information _POSIX_Timer_Information
The POSIX Timer objects information.
Objects_Control * _Objects_Get(Objects_Id id, ISR_lock_Context *lock_context, const Objects_Information *information)
Maps the specified object identifier to the associated local object control block.
Definition: objectgetlocal.c:28
The control block used to manage each watchdog timer.
Definition: watchdog.h:87
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:404
Per CPU Core Structure.
Definition: percpu.h:290
RTEMS_INLINE_ROUTINE POSIX_Timer_Control * _POSIX_Timer_Allocate(void)
POSIX Timer Allocate.
Definition: timerimpl.h:60
POSIX Timers Internal Support.
RTEMS_INLINE_ROUTINE POSIX_Timer_Control * _POSIX_Timer_Get(timer_t id, ISR_lock_Context *lock_context)
POSIX Timer Get.
Definition: timerimpl.h:89
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
RTEMS_INLINE_ROUTINE void _POSIX_Timer_Free(POSIX_Timer_Control *the_timer)
POSIX Timer Free.
Definition: timerimpl.h:71
Inlined Routines in the Object Handler.
Definition: timer.h:41
uint32_t Objects_Id
Definition: object.h:75