RTEMS
ratemonimpl.h
Go to the documentation of this file.
1 
9 /* COPYRIGHT (c) 1989-2008.
10  * On-Line Applications Research Corporation (OAR).
11  * Copyright (c) 2016 embedded brains GmbH.
12  * COPYRIGHT (c) 2016 Kuan-Hsun Chen.
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_RTEMS_RATEMONIMPL_H
20 #define _RTEMS_RTEMS_RATEMONIMPL_H
21 
23 #include <rtems/score/objectimpl.h>
25 #include <rtems/score/threadimpl.h>
27 
28 #include <string.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
42 #define RATE_MONOTONIC_INTEND_TO_BLOCK \
43  ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_INTEND_TO_BLOCK )
44 
45 #define RATE_MONOTONIC_BLOCKED \
46  ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_BLOCKED )
47 
48 #define RATE_MONOTONIC_READY_AGAIN \
49  ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_READY_AGAIN )
50 
59 {
60  return (Rate_monotonic_Control *)
62 }
63 
64 RTEMS_INLINE_ROUTINE void _Rate_monotonic_Acquire_critical(
65  Rate_monotonic_Control *the_period,
66  ISR_lock_Context *lock_context
67 )
68 {
69  _ISR_lock_Acquire( &the_period->Lock, lock_context );
70 }
71 
72 RTEMS_INLINE_ROUTINE void _Rate_monotonic_Release(
73  Rate_monotonic_Control *the_period,
74  ISR_lock_Context *lock_context
75 )
76 {
77  _ISR_lock_Release_and_ISR_enable( &the_period->Lock, lock_context );
78 }
79 
80 RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get(
81  Objects_Id id,
82  ISR_lock_Context *lock_context
83 )
84 {
85  return (Rate_monotonic_Control *)
86  _Objects_Get( id, lock_context, &_Rate_monotonic_Information );
87 }
88 
89 void _Rate_monotonic_Timeout( Watchdog_Control *watchdog );
90 
107  const Rate_monotonic_Control *the_period,
108  Timestamp_Control *wall_since_last_period,
109  Timestamp_Control *cpu_since_last_period
110 );
111 
112 void _Rate_monotonic_Restart(
113  Rate_monotonic_Control *the_period,
114  Thread_Control *owner,
115  ISR_lock_Context *lock_context
116 );
117 
118 void _Rate_monotonic_Cancel(
119  Rate_monotonic_Control *the_period,
120  Thread_Control *owner,
121  ISR_lock_Context *lock_context
122 );
123 
124 RTEMS_INLINE_ROUTINE void _Rate_monotonic_Reset_min_time(
125  Timestamp_Control *min_time
126 )
127 {
128  _Timestamp_Set( min_time, 0x7fffffff, 0x7fffffff );
129 }
130 
131 RTEMS_INLINE_ROUTINE void _Rate_monotonic_Reset_statistics(
132  Rate_monotonic_Control *the_period
133 )
134 {
135  Rate_monotonic_Statistics *statistics;
136 
137  statistics = &the_period->Statistics;
138  memset( statistics, 0, sizeof( *statistics ) );
139  _Rate_monotonic_Reset_min_time( &statistics->min_wall_time );
140  _Rate_monotonic_Reset_min_time( &statistics->min_cpu_time );
141 }
142 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif
150 /* end of include file */
int64_t Timestamp_Control
Definition: timestamp.h:57
Timestamp_Control min_cpu_time
Definition: ratemondata.h:47
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Definition: isrlock.h:257
Objects_Information _Rate_monotonic_Information
The Classic Rate Monotonic objects information.
Definition: ratemon.c:47
Inlined Routines in the Watchdog Handler.
Inlined Routines Associated with the Manipulation of the Scheduler.
The control block used to manage each watchdog timer.
Definition: watchdog.h:90
static __inline__ void _Timestamp_Set(Timestamp_Control *_time, time_t _seconds, long _nanoseconds)
Sets timestamp to specified seconds and nanoseconds.
Definition: timestampimpl.h:48
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
Inlined Routines in the Object Handler.
Classic Rate Monotonic Scheduler Data Structures.
Timestamp_Control min_wall_time
Definition: ratemondata.h:54
bool _Rate_monotonic_Get_status(const Rate_monotonic_Control *the_period, Timestamp_Control *wall_since_last_period, Timestamp_Control *cpu_since_last_period)
_Rate_monotonic_Get_status(
Definition: ratemonperiod.c:27
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:284
Rate_monotonic_Statistics Statistics
Definition: ratemondata.h:118
The following structure defines the control block used to manage each period.
Definition: ratemondata.h:69
Inlined Routines from the Thread Handler.
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.
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
static __inline__ Rate_monotonic_Control * _Rate_monotonic_Allocate(void)
Allocates a period control block from the inactive chain of free period control blocks.
Definition: ratemonimpl.h:58
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Definition: basedefs.h:683