RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
timerimpl.h
Go to the documentation of this file.
1
9/*
10 * COPYRIGHT (c) 1989-2011.
11 * On-Line Applications Research Corporation (OAR).
12 *
13 * Copyright (c) 2016 embedded brains GmbH.
14 *
15 * The license and distribution terms for this file may be
16 * found in the file LICENSE in this distribution or at
17 * http://www.rtems.org/license/LICENSE.
18 */
19
20#ifndef _RTEMS_RTEMS_TIMER_INL
21#define _RTEMS_RTEMS_TIMER_INL
22
25#include <rtems/score/thread.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
40typedef struct Timer_server_Control {
41 ISR_LOCK_MEMBER( Lock )
42
43 Chain_Control Pending;
44
45 Objects_Id server_id;
47
53extern Timer_server_Control *volatile _Timer_server;
54
62{
64}
65
73 Timer_Control *the_timer
74)
75{
77}
78
80 Objects_Id id,
81 ISR_lock_Context *lock_context
82)
83{
84 return (Timer_Control *) _Objects_Get(
85 id,
86 lock_context,
88 );
89}
90
91RTEMS_INLINE_ROUTINE Per_CPU_Control *_Timer_Acquire_critical(
92 Timer_Control *the_timer,
93 ISR_lock_Context *lock_context
94)
95{
96 Per_CPU_Control *cpu;
97
98 cpu = _Watchdog_Get_CPU( &the_timer->Ticker );
99 _Watchdog_Per_CPU_acquire_critical( cpu, lock_context );
100
101 return cpu;
102}
103
104RTEMS_INLINE_ROUTINE void _Timer_Release(
105 Per_CPU_Control *cpu,
106 ISR_lock_Context *lock_context
107)
108{
109 _Watchdog_Per_CPU_release_critical( cpu, lock_context );
110 _ISR_lock_ISR_enable( lock_context );
111}
112
113RTEMS_INLINE_ROUTINE bool _Timer_Is_interval_class(
114 Timer_Classes the_class
115)
116{
117 Timer_Classes mask =
118 TIMER_CLASS_BIT_NOT_DORMANT | TIMER_CLASS_BIT_TIME_OF_DAY;
119
120 return ( the_class & mask ) == TIMER_CLASS_BIT_NOT_DORMANT;
121}
122
123RTEMS_INLINE_ROUTINE bool _Timer_Is_on_task_class(
124 Timer_Classes the_class
125)
126{
127 Timer_Classes mask =
128 TIMER_CLASS_BIT_NOT_DORMANT | TIMER_CLASS_BIT_ON_TASK;
129
130 return ( the_class & mask ) == mask;
131}
132
133RTEMS_INLINE_ROUTINE Per_CPU_Watchdog_index _Timer_Watchdog_header_index(
134 Timer_Classes the_class
135)
136{
137 return ( the_class & TIMER_CLASS_BIT_TIME_OF_DAY );
138}
139
140RTEMS_INLINE_ROUTINE Watchdog_Interval _Timer_Get_CPU_ticks(
141 const Per_CPU_Control *cpu
142)
143{
144 return (Watchdog_Interval) cpu->Watchdog.ticks;
145}
146
147rtems_status_code _Timer_Fire(
148 rtems_id id,
149 rtems_interval interval,
151 void *user_data,
152 Timer_Classes the_class,
154);
155
156rtems_status_code _Timer_Fire_after(
157 rtems_id id,
158 rtems_interval ticks,
160 void *user_data,
161 Timer_Classes the_class,
163);
164
165rtems_status_code _Timer_Fire_when(
166 rtems_id id,
167 const rtems_time_of_day *wall_time,
169 void *user_data,
170 Timer_Classes the_class,
172);
173
174void _Timer_Cancel( Per_CPU_Control *cpu, Timer_Control *the_timer );
175
176void _Timer_Routine_adaptor( Watchdog_Control *the_watchdog );
177
178void _Timer_server_Routine_adaptor( Watchdog_Control *the_watchdog );
179
180RTEMS_INLINE_ROUTINE void _Timer_server_Acquire_critical(
181 Timer_server_Control *timer_server,
182 ISR_lock_Context *lock_context
183)
184{
185 _ISR_lock_Acquire( &timer_server->Lock, lock_context );
186}
187
188RTEMS_INLINE_ROUTINE void _Timer_server_Release_critical(
189 Timer_server_Control *timer_server,
190 ISR_lock_Context *lock_context
191)
192{
193 _ISR_lock_Release( &timer_server->Lock, lock_context );
194}
195
198#ifdef __cplusplus
199}
200#endif
201
202#endif
203/* end of include file */
rtems_status_code
Classic API Status.
Definition: status.h:43
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
Watchdog_Interval rtems_interval
Used to manage and manipulate intervals specified by clock ticks.
Definition: types.h:127
Timer_server_Control *volatile _Timer_server
Pointer to default timer server control block.
Definition: timercreate.c:37
RTEMS_INLINE_ROUTINE Timer_Control * _Timer_Allocate(void)
Timer_Allocate.
Definition: timerimpl.h:61
RTEMS_INLINE_ROUTINE void _Timer_Free(Timer_Control *the_timer)
Timer_Free.
Definition: timerimpl.h:72
Objects_Information _Timer_Information
The Classic Timer objects information.
rtems_timer_service_routine(* rtems_timer_service_routine_entry)(rtems_id, void *)
Definition: timer.h:101
Timer_Classes
Definition: timer.h:56
Per_CPU_Watchdog_index
Per-CPU watchdog header index.
Definition: percpu.h:308
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
#define ISR_LOCK_MEMBER(_designator)
Defines an ISR lock member.
Definition: isrlock.h:89
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:419
#define _ISR_lock_Release(_lock, _context)
Releases an ISR lock inside an ISR disabled section.
Definition: isrlock.h:316
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:293
RTEMS_INLINE_ROUTINE void _Objects_Free(Objects_Information *information, Objects_Control *the_object)
Frees an object.
Definition: objectimpl.h:930
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
Definition: objectallocate.c:42
uint32_t Objects_Id
Definition: object.h:80
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
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_acquire_critical(Per_CPU_Control *cpu, ISR_lock_Context *lock_context)
Acquires the per cpu watchdog lock in a critical section.
Definition: watchdogimpl.h:561
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_release_critical(Per_CPU_Control *cpu, ISR_lock_Context *lock_context)
Releases the per cpu watchdog lock in a critical section.
Definition: watchdogimpl.h:575
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Definition: watchdogticks.h:38
RTEMS_INLINE_ROUTINE Per_CPU_Control * _Watchdog_Get_CPU(const Watchdog_Control *the_watchdog)
Gets the watchdog's cpu.
Definition: watchdogimpl.h:177
Watchdog_Service_routine(* Watchdog_Service_routine_entry)(Watchdog_Control *)
Pointer to a watchdog service routine.
Definition: watchdog.h:66
Inlined Routines in the Object Handler.
Constants and Structures Related with the Thread Control Block.
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
Per CPU Core Structure.
Definition: percpu.h:347
uint64_t ticks
Protects all watchdog operations on this processor.
Definition: percpu.h:467
struct Per_CPU_Control::@3978 Watchdog
Watchdog state for this processor.
Definition: timerdata.h:41
Objects_Control Object
Definition: timerdata.h:43
Watchdog_Control Ticker
Definition: timerdata.h:45
Definition: timerimpl.h:40
The control block used to manage each watchdog timer.
Definition: watchdog.h:90
Data structure to manage and manipulate calendar time.
Definition: types.h:141
Classic Partition Manager Data Structures.
Definition: chain.h:86
Inlined Routines in the Watchdog Handler.