RTEMS 6.1-rc1
schedulersimpleimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _RTEMS_SCORE_SCHEDULERSIMPLEIMPL_H
38#define _RTEMS_SCORE_SCHEDULERSIMPLEIMPL_H
39
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
61static inline Scheduler_simple_Context *
62 _Scheduler_simple_Get_context( const Scheduler_Control *scheduler )
63{
64 return (Scheduler_simple_Context *) _Scheduler_Get_context( scheduler );
65}
66
79static inline bool _Scheduler_simple_Priority_less_equal(
80 const void *key,
81 const Chain_Node *to_insert,
82 const Chain_Node *next
83)
84{
85 const unsigned int *priority_to_insert;
86 const Thread_Control *thread_next;
87
88 (void) to_insert;
89 priority_to_insert = (const unsigned int *) key;
90 thread_next = (const Thread_Control *) next;
91
92 return *priority_to_insert <= _Thread_Get_priority( thread_next );
93}
94
102static inline void _Scheduler_simple_Insert(
103 Chain_Control *chain,
104 Thread_Control *to_insert,
105 unsigned int insert_priority
106)
107{
108 _Chain_Insert_ordered_unprotected(
109 chain,
110 &to_insert->Object.Node,
111 &insert_priority,
112 _Scheduler_simple_Priority_less_equal
113 );
114}
115
123static inline void _Scheduler_simple_Extract(
124 const Scheduler_Control *scheduler,
125 Thread_Control *the_thread,
126 Scheduler_Node *node
127)
128{
129 (void) scheduler;
130 (void) node;
131
132 _Chain_Extract_unprotected( &the_thread->Object.Node );
133}
134
140static inline Thread_Control *_Scheduler_simple_Get_highest_ready(
141 const Scheduler_Control *scheduler
142)
143{
145 _Scheduler_simple_Get_context( scheduler );
146
147 return (Thread_Control *) _Chain_First( &context->Ready );
148}
149
152#ifdef __cplusplus
153}
154#endif
155
156#endif
157/* end of include file */
This header file provides interfaces of the Chain Handler which are only used by the implementation.
rtems_termios_device_context * context
Definition: console-config.c:62
This header file provides interfaces of the Simple Priority Scheduler which are used by the implement...
This header file provides interfaces of the supporting the implementation of uniprocessor schedulers.
This structure represents a chain node.
Definition: chain.h:78
Chain_Node Node
Definition: objectdata.h:63
Scheduler node for per-thread data.
Definition: schedulernode.h:94
Simple scheduler context.
Definition: schedulersimple.h:85
Scheduler control.
Definition: scheduler.h:335
Definition: thread.h:812
Objects_Control Object
Definition: thread.h:814
This union represents a chain control block.
Definition: chain.h:96