RTEMS 6.1-rc4
Loading...
Searching...
No Matches
ratemonimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/* COPYRIGHT (c) 1989-2008.
13 * On-Line Applications Research Corporation (OAR).
14 * Copyright (c) 2016 embedded brains GmbH & Co. KG
15 * COPYRIGHT (c) 2016 Kuan-Hsun Chen.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef _RTEMS_RTEMS_RATEMONIMPL_H
40#define _RTEMS_RTEMS_RATEMONIMPL_H
41
47
48#include <string.h>
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
64#define RATE_MONOTONIC_INTEND_TO_BLOCK \
65 ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_INTEND_TO_BLOCK )
66
67#define RATE_MONOTONIC_BLOCKED \
68 ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_BLOCKED )
69
77static inline Rate_monotonic_Control *_Rate_monotonic_Allocate( void )
78{
79 return (Rate_monotonic_Control *)
81}
82
83static inline void _Rate_monotonic_Acquire_critical(
84 Rate_monotonic_Control *the_period,
85 ISR_lock_Context *lock_context
86)
87{
88 _ISR_lock_Acquire( &the_period->Lock, lock_context );
89}
90
91static inline void _Rate_monotonic_Release(
92 Rate_monotonic_Control *the_period,
93 ISR_lock_Context *lock_context
94)
95{
96 _ISR_lock_Release_and_ISR_enable( &the_period->Lock, lock_context );
97}
98
99static inline Rate_monotonic_Control *_Rate_monotonic_Get(
100 Objects_Id id,
101 ISR_lock_Context *lock_context
102)
103{
104 return (Rate_monotonic_Control *)
105 _Objects_Get( id, lock_context, &_Rate_monotonic_Information );
106}
107
108void _Rate_monotonic_Timeout( Watchdog_Control *watchdog );
109
123 const Rate_monotonic_Control *the_period,
124 Timestamp_Control *wall_since_last_period,
125 Timestamp_Control *cpu_since_last_period
126);
127
128void _Rate_monotonic_Restart(
129 Rate_monotonic_Control *the_period,
130 Thread_Control *owner,
131 ISR_lock_Context *lock_context
132);
133
134void _Rate_monotonic_Cancel(
135 Rate_monotonic_Control *the_period,
136 Thread_Control *owner,
137 ISR_lock_Context *lock_context
138);
139
140static inline void _Rate_monotonic_Reset_min_time(
141 Timestamp_Control *min_time
142)
143{
144 _Timestamp_Set( min_time, 0x7fffffff, 0x7fffffff );
145}
146
147static inline void _Rate_monotonic_Reset_statistics(
148 Rate_monotonic_Control *the_period
149)
150{
151 Rate_monotonic_Statistics *statistics;
152
153 statistics = &the_period->Statistics;
154 memset( statistics, 0, sizeof( *statistics ) );
155 _Rate_monotonic_Reset_min_time( &statistics->min_wall_time );
156 _Rate_monotonic_Reset_min_time( &statistics->min_cpu_time );
157}
158
161#ifdef __cplusplus
162}
163#endif
164
165#endif
166/* end of include file */
Objects_Information _Rate_monotonic_Information
The Classic Rate Monotonic objects information.
void _Rate_monotonic_Get_status(const Rate_monotonic_Control *the_period, Timestamp_Control *wall_since_last_period, Timestamp_Control *cpu_since_last_period)
Gets the rate monotonic CPU usage status.
Definition: ratemonperiod.c:48
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:259
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Definition: isrlock.h:229
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
int64_t Timestamp_Control
Definition: timestamp.h:76
This header file provides data structures used by the implementation and the Application Configuratio...
This header file provides interfaces of the Scheduler Handler which are only used by the implementati...
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
The following structure defines the control block used to manage each period.
Definition: ratemondata.h:89
Rate_monotonic_Statistics Statistics
Definition: ratemondata.h:140
Definition: ratemondata.h:60
Timestamp_Control min_wall_time
Definition: ratemondata.h:74
Timestamp_Control min_cpu_time
Definition: ratemondata.h:67
The control block used to manage each watchdog timer.
Definition: watchdog.h:109
Definition: thread.h:837
This header file provides interfaces of the Thread Handler which are only used by the implementation.
This header file provides interfaces of the Watchdog Handler which are only used by the implementatio...