RTEMS 6.1-rc5
Loading...
Searching...
No Matches
timerimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * COPYRIGHT (c) 1989-2013.
14 * On-Line Applications Research Corporation (OAR).
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _RTEMS_POSIX_TIMERIMPL_H
39#define _RTEMS_POSIX_TIMERIMPL_H
40
41#include <rtems/posix/timer.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
50#define POSIX_TIMER_STATE_FREE 0x01
51
53#define POSIX_TIMER_STATE_CREATE_NEW 0x02
54
56#define POSIX_TIMER_STATE_CREATE_RUN 0x03
57
59#define POSIX_TIMER_STATE_CREATE_STOP 0x04
60
62#define POSIX_TIMER_RELATIVE 0
63
64/*
65 * POSIX defines TIMER_ABSTIME but no constant for relative. So
66 * we have one internally but we need to be careful it has a different
67 * value.
68 */
69#if (POSIX_TIMER_RELATIVE == TIMER_ABSTIME)
70#error "POSIX_TIMER_RELATIVE == TIMER_ABSTIME"
71#endif
72
79static inline POSIX_Timer_Control *_POSIX_Timer_Allocate( void )
80{
82}
83
90static inline void _POSIX_Timer_Free (
91 POSIX_Timer_Control *the_timer
92)
93{
94 _Objects_Free( &_POSIX_Timer_Information, &the_timer->Object );
95}
96
97void _POSIX_Timer_TSR( Watchdog_Control *the_watchdog );
98
108static inline POSIX_Timer_Control *_POSIX_Timer_Get (
109 timer_t id,
110 ISR_lock_Context *lock_context
111)
112{
114 (Objects_Id) id,
115 lock_context,
117 );
118}
119
120static inline Per_CPU_Control *_POSIX_Timer_Acquire_critical(
121 POSIX_Timer_Control *ptimer,
122 ISR_lock_Context *lock_context
123)
124{
125 Per_CPU_Control *cpu;
126
127 cpu = _Watchdog_Get_CPU( &ptimer->Timer );
128 _Watchdog_Per_CPU_acquire_critical( cpu, lock_context );
129
130 return cpu;
131}
132
133static inline void _POSIX_Timer_Release(
134 Per_CPU_Control *cpu,
135 ISR_lock_Context *lock_context
136)
137{
138 _Watchdog_Per_CPU_release_critical( cpu, lock_context );
139 _ISR_lock_ISR_enable( lock_context );
140}
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif
147/* end of include file */
POSIX Timers Internal Support.
Objects_Information _POSIX_Timer_Information
The POSIX Timer objects information.
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:385
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
Definition: objectallocate.c:43
uint32_t Objects_Id
Definition: object.h:101
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:43
This header file provides interfaces of the Object Handler which are only used by the implementation.
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:94
Definition: timer.h:60
Per CPU Core Structure.
Definition: percpu.h:384
The control block used to manage each watchdog timer.
Definition: watchdog.h:109
This header file provides interfaces of the Watchdog Handler which are only used by the implementatio...