source: rtems/cpukit/include/rtems/score/schedulersmp.h @ 255fe43

Last change on this file since 255fe43 was 255fe43, checked in by Joel Sherrill <joel@…>, on 03/01/22 at 20:40:44

cpukit/: Scripted embedded brains header file clean up

Updates #4625.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSScoreSchedulerSMP
7 *
8 * @brief This header file provides interfaces of the
9 *   @ref RTEMSScoreSchedulerSMP which are used by the implementation and the
10 *   @ref RTEMSImplApplConfig.
11 */
12
13/*
14 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
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_SCHEDULERSMP_H
39#define _RTEMS_SCORE_SCHEDULERSMP_H
40
41#include <rtems/score/chain.h>
42#include <rtems/score/scheduler.h>
43
44#ifdef __cplusplus
45extern "C" {
46#endif /* __cplusplus */
47
48/**
49 * @defgroup RTEMSScoreSchedulerSMP SMP Scheduler
50 *
51 * @ingroup RTEMSScoreScheduler
52 *
53 * @brief This group contains the SMP Scheduler implementation.
54 *
55 * @{
56 */
57
58/**
59 * @brief Scheduler context specialization for SMP schedulers.
60 */
61typedef struct {
62  /**
63   * @brief Basic scheduler context.
64   */
65  Scheduler_Context Base;
66
67  /**
68   * @brief The chain of scheduled nodes.
69   */
70  Chain_Control Scheduled;
71} Scheduler_SMP_Context;
72
73/**
74 * @brief SMP scheduler node states.
75 */
76typedef enum {
77  /**
78   * @brief This scheduler node is blocked.
79   *
80   * A scheduler node is blocked if the corresponding thread is not ready.
81   */
82  SCHEDULER_SMP_NODE_BLOCKED,
83
84  /**
85   * @brief The scheduler node is scheduled.
86   *
87   * A scheduler node is scheduled if the corresponding thread is ready and the
88   * scheduler allocated a processor for it.  A scheduled node is assigned to
89   * exactly one processor.  The count of scheduled nodes in this scheduler
90   * instance equals the processor count owned by the scheduler instance.
91   */
92  SCHEDULER_SMP_NODE_SCHEDULED,
93
94  /**
95   * @brief This scheduler node is ready.
96   *
97   * A scheduler node is ready if the corresponding thread is ready and the
98   * scheduler did not allocate a processor for it.
99   */
100  SCHEDULER_SMP_NODE_READY
101} Scheduler_SMP_Node_state;
102
103/**
104 * @brief Scheduler node specialization for SMP schedulers.
105 */
106typedef struct {
107  /**
108   * @brief Basic scheduler node.
109   */
110  Scheduler_Node Base;
111
112  /**
113   * @brief The state of this node.
114   */
115  Scheduler_SMP_Node_state state;
116
117  /**
118   * @brief The current priority of thread owning this node.
119   */
120  Priority_Control priority;
121} Scheduler_SMP_Node;
122
123/**
124 * @brief Starts an idle thread on the specified cpu.
125 *
126 * @param scheduler The scheduler instance.
127 * @param[in, out] idle The idle thread to schedule.
128 * @param[out] cpu The cpu to run the idle thread on.
129 */
130void _Scheduler_SMP_Start_idle(
131  const Scheduler_Control *scheduler,
132  Thread_Control          *idle,
133  struct Per_CPU_Control  *cpu
134);
135
136/** @} */
137
138#ifdef __cplusplus
139}
140#endif /* __cplusplus */
141
142#endif /* _RTEMS_SCORE_SCHEDULERSMP_H */
Note: See TracBrowser for help on using the repository browser.