2011-02-17 Joel Sherrill <joel.sherrill@oarcorp.com>

* sapi/include/confdefs.h, sapi/include/rtems/config.h,
	score/include/rtems/score/scheduler.h,
	score/include/rtems/score/schedulerpriority.h,
	score/inline/rtems/score/scheduler.inl,
	score/inline/rtems/score/schedulerpriority.inl,
	score/src/scheduler.c, score/src/schedulerpriority.c,
	score/src/schedulerpriorityblock.c,
	score/src/schedulerpriorityschedule.c,
	score/src/schedulerprioritythreadschedulerallocate.c,
	score/src/schedulerprioritythreadschedulerfree.c,
	score/src/schedulerprioritythreadschedulerupdate.c,
	score/src/schedulerpriorityunblock.c,
	score/src/schedulerpriorityyield.c, score/src/threadchangepriority.c,
	score/src/threadclearstate.c, score/src/threadclose.c,
	score/src/threadinitialize.c, score/src/threadready.c,
	score/src/threadresume.c, score/src/threadsetpriority.c,
	score/src/threadsetstate.c, score/src/threadsuspend.c: Simplify the
	pluggable scheduler interface. Its configuration made a table
	of available schedulers and set a pointer to one of the.
	This was heavy handed since you can only use one scheduler
	in an application. This configuration mechanism resulted in a
	scheduler pointer being passed around when you could put all
	scheduler configuration in an initialized structure.
This commit is contained in:
Joel Sherrill
2011-02-17 22:21:44 +00:00
parent d18d5890ab
commit 010192dd9f
25 changed files with 202 additions and 577 deletions
+22 -72
View File
@@ -26,7 +26,7 @@
*/
/*
* COPYRIGHT (c) 1989-2010.
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -521,6 +521,9 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
* 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
@@ -540,8 +543,7 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
* + 127, 125 application priorities, 1536 bytes saved
* + 255, 253 application priorities, 0 bytes saved
*
* It is specified in terms of Classic API
* priority values.
* It is specified in terms of Classic API priority values.
*/
#ifndef CONFIGURE_MAXIMUM_PRIORITY
#define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM
@@ -552,111 +554,60 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
*
* The scheduler configuration allows an application to select the
* scheduling policy to use. The supported configurations are:
* CONFIGURE_SCHEDULER_USER
* CONFIGURE_SCHEDULER_PRIORITY
* CONFIGURE_SCHEDULER_USER - user provided scheduler
* CONFIGURE_SCHEDULER_PRIORITY - Deterministic Priority Scheduler
*
* If no configuration is specified by the application, then
* CONFIGURE_SCHEDULER_PRIORITY is assumed to be the default.
*
* An application can define its own scheduling policy by defining
* CONFIGURE_SCHEDULER_USER and CONFIGURE_SCHEDULER_ENTRY_USER to point
* to an initialization routine. Note: CONFIGURE_SCHEDULER_USER is not
* fully supported, since it has no per-thread field.
*
* To add a new scheduler:
* CONFIGURE_SCHEDULER_USER and the following:
* - CONFIGURE_SCHEDULER_ENTRY_POINTS
* - CONFIGURE_MEMORY_FOR_SCHEDULER - base memory
* - CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER - per task memory
*/
#include <rtems/score/scheduler.h>
#if defined(CONFIGURE_SCHEDULER_USER) && \
!defined(CONFIGURE_SCHEDULER_ENTRY_USER)
#error "CONFIGURE_ERROR: CONFIGURE_SCHEDULER_USER without CONFIGURE_SCHEDULER_ENTRY_USER"
#endif
/* enable all RTEMS-provided schedulers */
#if defined(CONFIGURE_SCHEDULER_ALL)
#define CONFIGURE_SCHEDULER_PRIORITY
!defined(CONFIGURE_SCHEDULER_USER_ENTRY_POINTS)
#error "CONFIGURE_ERROR: CONFIGURE_SCHEDULER_USER requires CONFIGURE_SCHEDULER_USER_ENTRY_POINTS"
#endif
/* If no scheduler is specified, the priority scheduler is default. */
#if !defined(CONFIGURE_SCHEDULER_USER) && \
!defined(CONFIGURE_SCHEDULER_PRIORITY)
#define CONFIGURE_SCHEDULER_PRIORITY
#define CONFIGURE_SCHEDULER_POLICY _Scheduler_PRIORITY
#endif
/*
* If a user scheduler is specified and no policy is set,
* the user scheduler is the default policy.
*/
#if defined(CONFIGURE_SCHEDULER_USER) && \
!defined(CONFIGURE_SCHEDULER_POLICY)
#define CONFIGURE_SCHEDULER_POLICY _Scheduler_USER
#endif
/*
* Check for priority scheduler next, as it is the default policy if there
* is no CONFIGURE_SCHEDULER_POLICY set and no USER scheduler provided.
* Is the Priority Scheduler is selected, then configure for it.
*/
#if defined(CONFIGURE_SCHEDULER_PRIORITY)
#include <rtems/score/schedulerpriority.h>
#define CONFIGURE_SCHEDULER_ENTRY_PRIORITY { _Scheduler_priority_Initialize }
#if !defined(CONFIGURE_SCHEDULER_POLICY)
#define CONFIGURE_SCHEDULER_POLICY _Scheduler_PRIORITY
#endif
#define SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_ENTRY_POINTS
/**
* define the memory used by the priority scheduler
*/
#define CONFIGURE_MEMORY_SCHEDULER_PRIORITY ( \
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
_Configure_From_workspace( \
((CONFIGURE_MAXIMUM_PRIORITY+1) * sizeof(Chain_Control)) ) \
)
#define CONFIGURE_MEMORY_PER_TASK_SCHEDULER_PRIORITY ( \
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
_Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
#endif
/*
* Set up the scheduler table. The scheduling code indexes this table to
* invoke the correct scheduling implementation. The scheduler to use is
* determined by the Configuration.scheduler_policy field, which is set
* by CONFIGURE_SCHEDULER_POLICY. If a particular scheduler is not enabled,
* an empty entry is included in its entry in the scheduler table.
* Set up the scheduler entry points table. The scheduling code uses
* this code to know which scheduler is configured by the user.
*/
/**
* An empty scheduler entry
*/
#define CONFIGURE_SCHEDULER_NULL { NULL }
#ifdef CONFIGURE_INIT
/* the table of available schedulers. */
const Scheduler_Table_entry _Scheduler_Table[] = {
#if defined(CONFIGURE_SCHEDULER_USER) && \
defined(CONFIGURE_SCHEDULER_ENTRY_USER)
CONFIGURE_SCHEDULER_ENTRY_USER,
#else
CONFIGURE_SCHEDULER_NULL,
#endif
#if defined(CONFIGURE_SCHEDULER_PRIORITY) && \
defined(CONFIGURE_SCHEDULER_ENTRY_PRIORITY)
CONFIGURE_SCHEDULER_ENTRY_PRIORITY,
#else
CONFIGURE_SCHEDULER_NULL,
#endif
Scheduler_Control _Scheduler = {
.Ready_queues.priority = NULL,
.Operations = SCHEDULER_ENTRY_POINTS
};
#endif
/**
* Define the memory overhead for the scheduler
*/
#define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
CONFIGURE_MEMORY_SCHEDULER_PRIORITY \
)
#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
CONFIGURE_MEMORY_PER_TASK_SCHEDULER_PRIORITY \
)
/*
* If you said the IDLE task was going to do application initialization
* and didn't override the IDLE body, then something is amiss.
@@ -2129,7 +2080,6 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
CONFIGURE_MAXIMUM_USER_EXTENSIONS, /* maximum dynamic extensions */
CONFIGURE_MICROSECONDS_PER_TICK, /* microseconds per clock tick */
CONFIGURE_TICKS_PER_TIMESLICE, /* ticks per timeslice quantum */
CONFIGURE_SCHEDULER_POLICY, /* scheduling policy */
CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */
CONFIGURE_IDLE_TASK_STACK_SIZE, /* IDLE task stack size */
CONFIGURE_INTERRUPT_STACK_SIZE, /* interrupt stack size */
+1 -5
View File
@@ -6,7 +6,7 @@
* This include file contains the table of user defined configuration
* parameters.
*
* COPYRIGHT (c) 1989-2008.
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -118,10 +118,6 @@ typedef struct {
*/
uint32_t ticks_per_timeslice;
/** This field specifies the scheduling policy to use.
*/
uint32_t scheduler_policy;
/** This element points to the BSP's optional idle task which may override
* the default one provided with RTEMS.
*/