RTEMS 7.0-rc1
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#ifndef RTEMS_SMP
90 (void) the_period;
91#endif
92}
93
94static inline void _Rate_monotonic_Release(
95 Rate_monotonic_Control *the_period,
96 ISR_lock_Context *lock_context
97)
98{
99 _ISR_lock_Release_and_ISR_enable( &the_period->Lock, lock_context );
100#ifndef RTEMS_SMP
101 (void) the_period;
102#endif
103}
104
105static inline Rate_monotonic_Control *_Rate_monotonic_Get(
106 Objects_Id id,
107 ISR_lock_Context *lock_context
108)
109{
110 return (Rate_monotonic_Control *)
111 _Objects_Get( id, lock_context, &_Rate_monotonic_Information );
112}
113
114void _Rate_monotonic_Timeout( Watchdog_Control *watchdog );
115
129 const Rate_monotonic_Control *the_period,
130 Timestamp_Control *wall_since_last_period,
131 Timestamp_Control *cpu_since_last_period
132);
133
134void _Rate_monotonic_Restart(
135 Rate_monotonic_Control *the_period,
136 Thread_Control *owner,
137 ISR_lock_Context *lock_context
138);
139
140void _Rate_monotonic_Cancel(
141 Rate_monotonic_Control *the_period,
142 Thread_Control *owner,
143 ISR_lock_Context *lock_context
144);
145
146static inline void _Rate_monotonic_Reset_min_time(
147 Timestamp_Control *min_time
148)
149{
150 _Timestamp_Set( min_time, 0x7fffffff, 0x7fffffff );
151}
152
153static inline void _Rate_monotonic_Reset_statistics(
154 Rate_monotonic_Control *the_period
155)
156{
157 Rate_monotonic_Statistics *statistics;
158
159 statistics = &the_period->Statistics;
160 memset( statistics, 0, sizeof( *statistics ) );
161 _Rate_monotonic_Reset_min_time( &statistics->min_wall_time );
162 _Rate_monotonic_Reset_min_time( &statistics->min_cpu_time );
163}
164
167#ifdef __cplusplus
168}
169#endif
170
171#endif
172/* 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...