Remove all comments and copyrightable content from the moved content. Use BSD-2-Clause license for new file.
Update #3053. Update #3875. --- cpukit/headers.am | 1 + cpukit/include/rtems/confdefs.h | 453 +----------------------------- cpukit/include/rtems/confdefs/scheduler.h | 370 ++++++++++++++++++++++++ 3 files changed, 372 insertions(+), 452 deletions(-) create mode 100644 cpukit/include/rtems/confdefs/scheduler.h diff --git a/cpukit/headers.am b/cpukit/headers.am index f64e9867ff..2cb59165bf 100644 --- a/cpukit/headers.am +++ b/cpukit/headers.am @@ -188,6 +188,7 @@ include_rtems_confdefs_HEADERS += include/rtems/confdefs/libio.h include_rtems_confdefs_HEADERS += include/rtems/confdefs/libpci.h include_rtems_confdefs_HEADERS += include/rtems/confdefs/obsolete.h include_rtems_confdefs_HEADERS += include/rtems/confdefs/percpu.h +include_rtems_confdefs_HEADERS += include/rtems/confdefs/scheduler.h include_rtems_debugger_HEADERS += include/rtems/debugger/rtems-debugger-bsp.h include_rtems_debugger_HEADERS += include/rtems/debugger/rtems-debugger-remote.h include_rtems_debugger_HEADERS += include/rtems/debugger/rtems-debugger-server.h diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h index a51693834b..ba37f0abe7 100644 --- a/cpukit/include/rtems/confdefs.h +++ b/cpukit/include/rtems/confdefs.h @@ -53,6 +53,7 @@ #include <rtems/confdefs/libio.h> #include <rtems/confdefs/libpci.h> #include <rtems/confdefs/percpu.h> +#include <rtems/confdefs/scheduler.h> #include <limits.h> @@ -101,441 +102,6 @@ extern "C" { #undef RTEMS_NEWLIB #endif -/** - * @brief Maximum priority configuration. - * - * This configures the maximum priority value that - * a task may have. - * - * The following applies to the data space requirements - * of the Priority Scheduler. - * - * By reducing the number of priorities in a system, - * the amount of RAM required by RTEMS can be significantly - * reduced. RTEMS allocates a Chain_Control structure per - * priority and this structure contains 3 pointers. So - * the default is (256 * 12) = 3K on 32-bit architectures. - * - * This must be one less than a power of 2 between - * 4 and 256. Valid values along with the application - * priority levels and memory saved when pointers are - * 32-bits in size are: - * - * + 3, 2 application priorities, 3024 bytes saved - * + 7, 5 application priorities, 2976 bytes saved - * + 15, 13 application priorities, 2880 bytes saved - * + 31, 29 application priorities, 2688 bytes saved - * + 63, 61 application priorities, 2304 bytes saved - * + 127, 125 application priorities, 1536 bytes saved - * + 255, 253 application priorities, 0 bytes saved - * - * It is specified in terms of Classic API priority values. - */ -#ifndef CONFIGURE_MAXIMUM_PRIORITY - #define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM -#endif - -/** - * @defgroup ConfigScheduler Scheduler configuration - * - * @ingroup Configuration - * - * The scheduler configuration allows an application to select the - * scheduling policy to use. The supported configurations are: - * - * - CONFIGURE_SCHEDULER_PRIORITY - Deterministic Priority Scheduler - * - CONFIGURE_SCHEDULER_PRIORITY_SMP - Deterministic Priority SMP Scheduler - * - CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP - Deterministic - * Priority SMP Affinity Scheduler - * - CONFIGURE_SCHEDULER_STRONG_APA - Strong APA Scheduler - * - CONFIGURE_SCHEDULER_SIMPLE - Light-weight Priority Scheduler - * - CONFIGURE_SCHEDULER_SIMPLE_SMP - Simple SMP Priority Scheduler - * - CONFIGURE_SCHEDULER_EDF - EDF Scheduler - * - CONFIGURE_SCHEDULER_EDF_SMP - EDF SMP Scheduler - * - CONFIGURE_SCHEDULER_CBS - CBS Scheduler - * - CONFIGURE_SCHEDULER_USER - user provided scheduler - * - * If no configuration is specified by the application in a uniprocessor - * configuration, then CONFIGURE_SCHEDULER_PRIORITY is the default. - * - * If no configuration is specified by the application in SMP - * configuration, then CONFIGURE_SCHEDULER_PRIORITY_SMP is the default. - * - * An application can define its own scheduling policy by defining - * CONFIGURE_SCHEDULER_USER and the following: - * - * - CONFIGURE_SCHEDULER - * - CONFIGURE_SCHEDULER_TABLE_ENTRIES - * - CONFIGURE_SCHEDULER_USER_PER_THREAD - */ - -#if !defined(CONFIGURE_SCHEDULER_USER) && \ - !defined(CONFIGURE_SCHEDULER_PRIORITY) && \ - !defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) && \ - !defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) && \ - !defined(CONFIGURE_SCHEDULER_STRONG_APA) && \ - !defined(CONFIGURE_SCHEDULER_SIMPLE) && \ - !defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) && \ - !defined(CONFIGURE_SCHEDULER_EDF) && \ - !defined(CONFIGURE_SCHEDULER_EDF_SMP) && \ - !defined(CONFIGURE_SCHEDULER_CBS) - #if defined(RTEMS_SMP) && _CONFIGURE_MAXIMUM_PROCESSORS > 1 - /** - * If no scheduler is specified in an SMP configuration, the - * EDF scheduler is default. - */ - #define CONFIGURE_SCHEDULER_EDF_SMP - #else - /** - * If no scheduler is specified in a uniprocessor configuration, the - * priority scheduler is default. - */ - #define CONFIGURE_SCHEDULER_PRIORITY - #endif -#endif - -#include <rtems/scheduler.h> - -/* - * If the Priority Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_PRIORITY) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'D', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER \ - RTEMS_SCHEDULER_PRIORITY( \ - dflt, \ - CONFIGURE_MAXIMUM_PRIORITY + 1 \ - ) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_PRIORITY(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the Deterministic Priority SMP Scheduler is selected, then configure for - * it. - */ -#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'D', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER \ - RTEMS_SCHEDULER_PRIORITY_SMP( \ - dflt, \ - CONFIGURE_MAXIMUM_PRIORITY + 1 \ - ) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_PRIORITY_SMP(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the Deterministic Priority Affinity SMP Scheduler is selected, then configure for - * it. - */ -#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'A', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER \ - RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( \ - dflt, \ - CONFIGURE_MAXIMUM_PRIORITY + 1 \ - ) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( \ - dflt, \ - CONFIGURE_SCHEDULER_NAME \ - ) - #endif -#endif - -/* - * If the Strong APA Scheduler is selected, then configure for - * it. - */ -#if defined(CONFIGURE_SCHEDULER_STRONG_APA) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'A', 'P', 'A') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER \ - RTEMS_SCHEDULER_STRONG_APA( \ - dflt, \ - CONFIGURE_MAXIMUM_PRIORITY + 1 \ - ) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_STRONG_APA(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the Simple Priority Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_SIMPLE) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'S', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_SIMPLE(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_SIMPLE(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the Simple SMP Priority Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'S', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER \ - RTEMS_SCHEDULER_SIMPLE_SMP(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_SIMPLE_SMP(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the EDF Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_EDF) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'E', 'D', 'F') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_EDF(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_EDF(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the EDF SMP Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_EDF_SMP) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'E', 'D', 'F') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_EDF_SMP(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_EDF_SMP(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the CBS Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_CBS) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'C', 'B', 'S') - #endif - - #if !defined(CONFIGURE_SCHEDULER_TABLE_ENTRIES) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_CBS(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ - RTEMS_SCHEDULER_TABLE_CBS(dflt, CONFIGURE_SCHEDULER_NAME) - #endif - - #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS - #define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS - #endif - - #ifdef CONFIGURE_INIT - const uint32_t _Scheduler_CBS_Maximum_servers = - CONFIGURE_CBS_MAXIMUM_SERVERS; - - Scheduler_CBS_Server - _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ]; - #endif -#endif - -/* - * Set up the scheduler entry points table. The scheduling code uses - * this code to know which scheduler is configured by the user. - */ -#ifdef CONFIGURE_INIT - #if defined(CONFIGURE_SCHEDULER) - CONFIGURE_SCHEDULER; - #endif - - const Scheduler_Control _Scheduler_Table[] = { - CONFIGURE_SCHEDULER_TABLE_ENTRIES - }; - - #define _CONFIGURE_SCHEDULER_COUNT RTEMS_ARRAY_SIZE( _Scheduler_Table ) - - #if defined(RTEMS_SMP) - const size_t _Scheduler_Count = _CONFIGURE_SCHEDULER_COUNT; - - const Scheduler_Assignment _Scheduler_Initial_assignments[] = { - #if defined(CONFIGURE_SCHEDULER_ASSIGNMENTS) - CONFIGURE_SCHEDULER_ASSIGNMENTS - #else - #define _CONFIGURE_SCHEDULER_ASSIGN \ - RTEMS_SCHEDULER_ASSIGN( \ - 0, \ - RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \ - ) - _CONFIGURE_SCHEDULER_ASSIGN - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 2 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 3 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 4 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 5 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 6 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 7 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 8 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 9 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 10 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 11 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 12 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 13 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 14 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 15 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 16 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 17 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 18 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 19 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 20 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 21 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 22 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 23 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 24 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 25 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 26 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 27 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 28 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 29 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 30 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 31 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #if _CONFIGURE_MAXIMUM_PROCESSORS >= 32 - , _CONFIGURE_SCHEDULER_ASSIGN - #endif - #undef _CONFIGURE_SCHEDULER_ASSIGN - #endif - }; - - RTEMS_STATIC_ASSERT( - _CONFIGURE_MAXIMUM_PROCESSORS - == RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ), - _Scheduler_Initial_assignments - ); - #endif -#endif -/**@}*/ /* end of Scheduler Configuration */ - /** * @defgroup ConfigurationMalloc RTEMS Malloc configuration * @@ -2129,23 +1695,6 @@ struct _reent *__getreent(void) #endif #endif /* !defined(RTEMS_SCHEDSIM) */ -/* - * Validate the configured maximum priority - */ -#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 7) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 15) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 31) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 63) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 127) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 255)) - #error "Maximum priority is not 1 less than a power of 2 between 4 and 256" -#endif - -#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM) - #error "Maximum priority configured higher than supported by target." -#endif - /* * POSIX Key pair shouldn't be less than POSIX Key, which is highly * likely to be error. diff --git a/cpukit/include/rtems/confdefs/scheduler.h b/cpukit/include/rtems/confdefs/scheduler.h new file mode 100644 index 0000000000..12f7c631fa --- /dev/null +++ b/cpukit/include/rtems/confdefs/scheduler.h @@ -0,0 +1,370 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * + * @ingroup RTEMSApplicationConfiguration + * + * @brief Evaluate Scheduler Configuration Options + */ + +#ifndef _RTEMS_CONFDEFS_SCHEDULER_H +#define _RTEMS_CONFDEFS_SCHEDULER_H + +#ifndef __CONFIGURATION_TEMPLATE_h +#error "Do not include this file directly, use <rtems/confdefs.h> instead" +#endif + +#ifdef CONFIGURE_INIT + +#include <rtems/confdefs/percpu.h> + +#if !defined(CONFIGURE_SCHEDULER_CBS) \ + && !defined(CONFIGURE_SCHEDULER_EDF) \ + && !defined(CONFIGURE_SCHEDULER_EDF_SMP) \ + && !defined(CONFIGURE_SCHEDULER_PRIORITY) \ + && !defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) \ + && !defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) \ + && !defined(CONFIGURE_SCHEDULER_SIMPLE) \ + && !defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) \ + && !defined(CONFIGURE_SCHEDULER_STRONG_APA) \ + && !defined(CONFIGURE_SCHEDULER_USER) + #if defined(RTEMS_SMP) && _CONFIGURE_MAXIMUM_PROCESSORS > 1 + #define CONFIGURE_SCHEDULER_EDF_SMP + #else + #define CONFIGURE_SCHEDULER_PRIORITY + #endif +#endif + +#include <rtems/scheduler.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CONFIGURE_MAXIMUM_PRIORITY + #define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM +#endif + +#if CONFIGURE_MAXIMUM_PRIORITY != 3 \ + && CONFIGURE_MAXIMUM_PRIORITY != 7 \ + && CONFIGURE_MAXIMUM_PRIORITY != 15 \ + && CONFIGURE_MAXIMUM_PRIORITY != 31 \ + && CONFIGURE_MAXIMUM_PRIORITY != 63 \ + && CONFIGURE_MAXIMUM_PRIORITY != 127 \ + && CONFIGURE_MAXIMUM_PRIORITY != 255 + #error "CONFIGURE_MAXIMUM_PRIORITY must be one of 3, 7, 15, 31, 63, 127, and 255" +#endif + +#if CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM + #error "CONFIGURE_SCHEDULER_PRIORITY must be less than or equal to the architecture defined maximum priority" +#endif + +#ifdef CONFIGURE_SCHEDULER_PRIORITY + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'U', 'P', 'D', ' ' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER \ + RTEMS_SCHEDULER_PRIORITY( \ + dflt, \ + CONFIGURE_MAXIMUM_PRIORITY + 1 \ + ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_PRIORITY( dflt, CONFIGURE_SCHEDULER_NAME ) + #endif +#endif + +#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'P', 'D', ' ' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER \ + RTEMS_SCHEDULER_PRIORITY_SMP( \ + dflt, \ + CONFIGURE_MAXIMUM_PRIORITY + 1 \ + ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( dflt, CONFIGURE_SCHEDULER_NAME ) + #endif +#endif + +#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'P', 'A', ' ' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER \ + RTEMS_SCHEDULER_PRIORITY_AFFINITY_SMP( \ + dflt, \ + CONFIGURE_MAXIMUM_PRIORITY + 1 \ + ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_PRIORITY_AFFINITY_SMP( \ + dflt, \ + CONFIGURE_SCHEDULER_NAME \ + ) + #endif +#endif + +#ifdef CONFIGURE_SCHEDULER_STRONG_APA + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'A', 'P', 'A' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER \ + RTEMS_SCHEDULER_STRONG_APA( \ + dflt, \ + CONFIGURE_MAXIMUM_PRIORITY + 1 \ + ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_STRONG_APA( dflt, CONFIGURE_SCHEDULER_NAME ) + #endif +#endif + +#ifdef CONFIGURE_SCHEDULER_SIMPLE + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'U', 'P', 'S', ' ' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_SIMPLE( dflt ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_SIMPLE( dflt, CONFIGURE_SCHEDULER_NAME ) + #endif +#endif + +#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'P', 'S', ' ' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER \ + RTEMS_SCHEDULER_SIMPLE_SMP( dflt ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_SIMPLE_SMP( dflt, CONFIGURE_SCHEDULER_NAME ) + #endif +#endif + +#ifdef CONFIGURE_SCHEDULER_EDF + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'U', 'E', 'D', 'F' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_EDF( dflt ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_EDF( dflt, CONFIGURE_SCHEDULER_NAME ) + #endif +#endif + +#ifdef CONFIGURE_SCHEDULER_EDF_SMP + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'M', 'E', 'D', 'F' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_EDF_SMP( dflt ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_EDF_SMP( dflt, CONFIGURE_SCHEDULER_NAME ) + #endif +#endif + +#ifdef CONFIGURE_SCHEDULER_CBS + #ifndef CONFIGURE_SCHEDULER_NAME + #define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'U', 'C', 'B', 'S' ) + #endif + + #ifndef CONFIGURE_SCHEDULER_TABLE_ENTRIES + #define CONFIGURE_SCHEDULER RTEMS_SCHEDULER_CBS( dflt ) + + #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_CBS( dflt, CONFIGURE_SCHEDULER_NAME ) + #endif + + #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS + #define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS + #endif + + const uint32_t _Scheduler_CBS_Maximum_servers = + CONFIGURE_CBS_MAXIMUM_SERVERS; + + Scheduler_CBS_Server + _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ]; +#endif + +#ifdef CONFIGURE_SCHEDULER + CONFIGURE_SCHEDULER; +#endif + +const Scheduler_Control _Scheduler_Table[] = { + CONFIGURE_SCHEDULER_TABLE_ENTRIES +}; + +#define _CONFIGURE_SCHEDULER_COUNT RTEMS_ARRAY_SIZE( _Scheduler_Table ) + +#ifdef RTEMS_SMP + +const size_t _Scheduler_Count = _CONFIGURE_SCHEDULER_COUNT; + +const Scheduler_Assignment _Scheduler_Initial_assignments[] = { + #ifdef CONFIGURE_SCHEDULER_ASSIGNMENTS + CONFIGURE_SCHEDULER_ASSIGNMENTS + #else + #define _CONFIGURE_SCHEDULER_ASSIGN \ + RTEMS_SCHEDULER_ASSIGN( \ + 0, \ + RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \ + ) + _CONFIGURE_SCHEDULER_ASSIGN + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 2 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 3 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 4 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 5 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 6 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 7 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 8 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 9 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 10 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 11 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 12 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 13 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 14 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 15 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 16 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 17 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 18 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 19 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 20 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 21 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 22 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 23 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 24 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 25 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 26 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 27 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 28 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 29 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 30 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 31 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #if _CONFIGURE_MAXIMUM_PROCESSORS >= 32 + , _CONFIGURE_SCHEDULER_ASSIGN + #endif + #undef _CONFIGURE_SCHEDULER_ASSIGN + #endif +}; + +RTEMS_STATIC_ASSERT( + _CONFIGURE_MAXIMUM_PROCESSORS + == RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ), + _Scheduler_Initial_assignments +); + +#endif /* RTEMS_SMP */ + +#ifdef __cplusplus +} +#endif + +#endif /* CONFIGURE_INIT */ + +#endif /* _RTEMS_CONFDEFS_SCHEDULER_H */ -- 2.16.4 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel