RTEMS 6.1-rc4
Loading...
Searching...
No Matches
schedulernode.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
13/*
14 * Copyright (C) 2014, 2016 embedded brains GmbH & Co. KG
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _RTEMS_SCORE_SCHEDULERNODE_H
39#define _RTEMS_SCORE_SCHEDULERNODE_H
40
42#include <rtems/score/chain.h>
44#include <rtems/score/isrlock.h>
45
52struct _Thread_Control;
53
54#ifdef __cplusplus
55extern "C" {
56#endif /* __cplusplus */
57
58#if defined(RTEMS_SMP)
62typedef enum {
66 SCHEDULER_NODE_REQUEST_NOT_PENDING,
67
72 SCHEDULER_NODE_REQUEST_ADD,
73
78 SCHEDULER_NODE_REQUEST_REMOVE,
79
84 SCHEDULER_NODE_REQUEST_NOTHING,
85
86} Scheduler_Node_request;
87#endif
88
89typedef struct Scheduler_Node Scheduler_Node;
90
95#if defined(RTEMS_SMP)
105 union {
106 Chain_Node Chain;
107 RBTree_Node RBTree;
108 } Node;
109
115 int sticky_level;
116
122 struct _Thread_Control *user;
123
132 struct _Thread_Control *idle;
133#endif
134
139
140#if defined(RTEMS_SMP)
145 struct {
150 Chain_Node Wait_node;
151
156 union {
160 Chain_Node Chain;
161
167 Scheduler_Node *next;
168 } Scheduler_node;
169
174 Scheduler_Node *next_request;
175
179 Scheduler_Node_request request;
180 } Thread;
181#endif
182
186 struct {
187 Priority_Aggregation Priority;
189
201 struct {
216#if defined(RTEMS_SMP) && CPU_SIZEOF_POINTER == 8
217 Atomic_Ulong value;
218#else
220#endif
221
222#if defined(RTEMS_SMP) && CPU_SIZEOF_POINTER != 8
226 ISR_lock_Control Lock;
227#endif
228 } Priority;
229};
230
231#if defined(RTEMS_SMP)
237extern const size_t _Scheduler_Node_size;
238#endif
239
240#if defined(RTEMS_SMP)
241#define SCHEDULER_NODE_OF_THREAD_WAIT_NODE( node ) \
242 RTEMS_CONTAINER_OF( node, Scheduler_Node, Thread.Wait_node )
243
244#define SCHEDULER_NODE_OF_THREAD_SCHEDULER_NODE( node ) \
245 RTEMS_CONTAINER_OF( node, Scheduler_Node, Thread.Scheduler_node.Chain )
246#endif
247
248#ifdef __cplusplus
249}
250#endif /* __cplusplus */
251
254#endif /* _RTEMS_SCORE_SCHEDULERNODE_H */
This header file provides basic definitions used by the API and the implementation.
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:91
This header file provides the interfaces of the ISR Locks.
This header file provides interfaces of the Priority Handler which are used by the implementation and...
This header file provides interfaces of the Chain Handler which are used by the implementation and th...
This structure represents a chain node.
Definition: chain.h:78
The priority aggregation.
Definition: priority.h:147
Red-black tree node.
Definition: rbtree.h:73
Scheduler node for per-thread data.
Definition: schedulernode.h:94
Priority_Control value
The thread priority value of this scheduler node.
Definition: schedulernode.h:219
struct _Thread_Control * owner
The thread owning this node.
Definition: schedulernode.h:138
struct Scheduler_Node::@4406 Wait
Thread wait support block.
Definition: thread.h:837