RTEMS: cpukit/include/rtems/rtems/ratemonimpl.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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
22#include <rtems/rtems/ratemondata.h>
23#include <rtems/score/objectimpl.h>
24#include <rtems/score/schedulerimpl.h>
25#include <rtems/score/threadimpl.h>
26#include <rtems/score/watchdogimpl.h>
27
28#include <string.h>
29
30#ifdef __cplusplus
31extern "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
58 RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void )
59{
60 return (Rate_monotonic_Control *)
61 _Objects_Allocate( &_Rate_monotonic_Information );
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
89void _Rate_monotonic_Timeout( Watchdog_Control *watchdog );
90
106bool _Rate_monotonic_Get_status(
107 const Rate_monotonic_Control *the_period,
108 Timestamp_Control *wall_since_last_period,
109 Timestamp_Control *cpu_since_last_period
110);
111
112void _Rate_monotonic_Restart(
113 Rate_monotonic_Control *the_period,
114 Thread_Control *owner,
115 ISR_lock_Context *lock_context
116);
117
118void _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 */
_Rate_monotonic_Get_status
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
_Rate_monotonic_Allocate
RTEMS_INLINE_ROUTINE 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
_Rate_monotonic_Information
Objects_Information _Rate_monotonic_Information
The Classic Rate Monotonic objects information.
RTEMS_INLINE_ROUTINE
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
_ISR_lock_Acquire
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:293
_ISR_lock_Release_and_ISR_enable
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Definition: isrlock.h:263
_Objects_Allocate
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
Definition: objectallocate.c:42
Objects_Id
uint32_t Objects_Id
Definition: object.h:80
_Objects_Get
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
_Timestamp_Set
RTEMS_INLINE_ROUTINE void _Timestamp_Set(Timestamp_Control *_time, time_t _seconds, long _nanoseconds)
Sets timestamp to specified seconds and nanoseconds.
Definition: timestampimpl.h:48
Timestamp_Control
int64_t Timestamp_Control
Definition: timestamp.h:57
objectimpl.h
Inlined Routines in the Object Handler.
ratemondata.h
Classic Rate Monotonic Scheduler Data Structures.
schedulerimpl.h
Inlined Routines Associated with the Manipulation of the Scheduler.
ISR_lock_Context
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
Rate_monotonic_Control
The following structure defines the control block used to manage each period.
Definition: ratemondata.h:69
Rate_monotonic_Control::Statistics
Rate_monotonic_Statistics Statistics
Definition: ratemondata.h:118
Rate_monotonic_Statistics
Definition: ratemondata.h:40
Rate_monotonic_Statistics::min_wall_time
Timestamp_Control min_wall_time
Definition: ratemondata.h:54
Rate_monotonic_Statistics::min_cpu_time
Timestamp_Control min_cpu_time
Definition: ratemondata.h:47
Watchdog_Control
The control block used to manage each watchdog timer.
Definition: watchdog.h:90
_Thread_Control
Definition: thread.h:732
threadimpl.h
Inlined Routines from the Thread Handler.
watchdogimpl.h
Inlined Routines in the Watchdog Handler.