diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-11-24 15:51:28 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-11-24 15:51:28 +0000 |
commit | 0faa9dad0768f0291cb44d8d0dcb74fd3f362cc2 (patch) | |
tree | 5fdf3fb63a7b901897891cf25b3958c9a750ed69 /cpukit/sapi/include/confdefs.h | |
parent | Remove duplicate entry. (diff) | |
download | rtems-0faa9dad0768f0291cb44d8d0dcb74fd3f362cc2.tar.bz2 |
2010-11-24 Gedare Bloom <giddyup44@yahoo.com>
PR 1647/cpukit
* posix/src/nanosleep.c, posix/src/sched_yield.c,
rtems/src/taskwakeafter.c, sapi/include/confdefs.h,
sapi/include/rtems/config.h, sapi/src/exinit.c, score/Makefile.am,
score/preinstall.am, score/include/rtems/score/prioritybitmap.h,
score/include/rtems/score/thread.h,
score/inline/rtems/score/thread.inl, score/src/thread.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/threadsettransient.c, score/src/threadsuspend.c,
score/src/threadtickletimeslice.c: Refactor scheduler out of thread
handler to facilitate alternate scheduler implementations.
* score/src/threadyieldprocessor.c: Removed.
* score/src/schedulerprioritythreadschedulerupdate.c,
score/src/schedulerprioritythreadschedulerfree.c,
score/src/schedulerpriorityblock.c, score/src/scheduler.c,
score/src/schedulerprioritythreadschedulerallocate.c,
score/src/schedulerpriorityunblock.c,
score/src/schedulerpriority.c, score/src/schedulerpriorityyield.c,
score/include/rtems/score/schedulerpriority.h,
score/include/rtems/score/scheduler.h,
score/inline/rtems/score/scheduler.inl,
score/inline/rtems/score/schedulerpriority.inl: New files.
Diffstat (limited to 'cpukit/sapi/include/confdefs.h')
-rw-r--r-- | cpukit/sapi/include/confdefs.h | 123 |
1 files changed, 114 insertions, 9 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index e6f8edaed2..0a1b49d173 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -535,6 +535,116 @@ rtems_fs_init_functions_t rtems_fs_init_helper = #endif /* + * Scheduler configuration. + * + * The scheduler configuration allows an application to select the + * scheduling policy to use. The supported configurations are: + * CONFIGURE_SCHEDULER_USER + * CONFIGURE_SCHEDULER_PRIORITY + * + * 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: + */ +#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 +#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. + */ +#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 the memory used by the priority scheduler + */ + #define CONFIGURE_MEMORY_SCHEDULER_PRIORITY ( \ + _Configure_From_workspace( \ + ((CONFIGURE_MAXIMUM_PRIORITY+1) * sizeof(Chain_Control)) ) \ + ) + #define CONFIGURE_MEMORY_PER_TASK_SCHEDULER_PRIORITY ( \ + _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. + */ + + /** + * An empty scheduler entry + */ + #define CONFIGURE_SCHEDULER_NULL { NULL } + +#ifdef CONFIGURE_INIT + /* the table of available schedulers. */ + const Scheduler_Table_t _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 + }; +#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. */ @@ -1607,7 +1717,8 @@ rtems_fs_init_functions_t rtems_fs_init_helper = (_Configure_From_workspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \ CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API + \ CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB + \ - CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API)) + \ + CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \ + CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER)) + \ _Configure_From_workspace( \ _Configure_Max_Objects(_number_FP_tasks) * CONTEXT_FP_SIZE) + \ _Configure_From_workspace( \ @@ -1705,13 +1816,6 @@ rtems_fs_init_functions_t rtems_fs_init_helper = _Configure_Object_RAM(1, sizeof(API_Mutex_Control)) /** - * This defines the memory used by the thread ready chains. There is - * one chain per priority. - */ -#define CONFIGURE_MEMORY_FOR_THREAD_READY_CHAINS \ - _Configure_From_workspace( \ - ((CONFIGURE_MAXIMUM_PRIORITY+1) * sizeof(Chain_Control)) ) -/** * This defines the amount of memory reserved for the IDLE task * control structures and stack. */ @@ -1724,7 +1828,7 @@ rtems_fs_init_functions_t rtems_fs_init_helper = */ #define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \ ( CONFIGURE_MEMORY_FOR_IDLE_TASK + /* IDLE and stack */ \ - CONFIGURE_MEMORY_FOR_THREAD_READY_CHAINS + /* Ready chains */ \ + CONFIGURE_MEMORY_FOR_SCHEDULER + /* Scheduler */ \ CONFIGURE_INTERRUPT_VECTOR_TABLE + /* interrupt vectors */ \ CONFIGURE_INTERRUPT_STACK_MEMORY + /* interrupt stack */ \ CONFIGURE_API_MUTEX_MEMORY /* allocation mutex */ \ @@ -2005,6 +2109,7 @@ 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 */ |