From 010192dd9fcfe40b82ca7595a732ed3ffbe9fdc1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 17 Feb 2011 22:21:44 +0000 Subject: 2011-02-17 Joel Sherrill * 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. --- cpukit/ChangeLog | 26 ++++ cpukit/sapi/include/confdefs.h | 94 ++++----------- cpukit/sapi/include/rtems/config.h | 6 +- cpukit/score/include/rtems/score/scheduler.h | 36 +++--- .../score/include/rtems/score/schedulerpriority.h | 50 +++++--- cpukit/score/inline/rtems/score/scheduler.inl | 31 ++--- .../score/inline/rtems/score/schedulerpriority.inl | 132 ++++++--------------- cpukit/score/src/scheduler.c | 14 +-- cpukit/score/src/schedulerpriority.c | 35 +----- cpukit/score/src/schedulerpriorityblock.c | 19 +-- cpukit/score/src/schedulerpriorityschedule.c | 29 +---- .../src/schedulerprioritythreadschedulerallocate.c | 24 +--- .../src/schedulerprioritythreadschedulerfree.c | 16 +-- .../src/schedulerprioritythreadschedulerupdate.c | 25 +--- cpukit/score/src/schedulerpriorityunblock.c | 34 +----- cpukit/score/src/schedulerpriorityyield.c | 18 +-- cpukit/score/src/threadchangepriority.c | 30 +---- cpukit/score/src/threadclearstate.c | 24 +--- cpukit/score/src/threadclose.c | 17 +-- cpukit/score/src/threadinitialize.c | 7 +- cpukit/score/src/threadready.c | 24 +--- cpukit/score/src/threadresume.c | 24 +--- cpukit/score/src/threadsetpriority.c | 21 +--- cpukit/score/src/threadsetstate.c | 22 +--- cpukit/score/src/threadsuspend.c | 21 +--- 25 files changed, 202 insertions(+), 577 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 59a5376b6f..2b159e2491 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,29 @@ +2011-02-17 Joel Sherrill + + * 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. + 2011-02-17 Joel Sherrill * libmisc/Makefile.am, libmisc/fb/mw_uid.c, libmisc/fb/mw_uid.h: Clean diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index 7f40275239..68cb95b540 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -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 #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 - #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 */ diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h index 541bc9ddff..cdf33874d7 100644 --- a/cpukit/sapi/include/rtems/config.h +++ b/cpukit/sapi/include/rtems/config.h @@ -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. */ diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h index 391dc92992..2ca6c4a0fe 100644 --- a/cpukit/score/include/rtems/score/scheduler.h +++ b/cpukit/score/include/rtems/score/scheduler.h @@ -7,6 +7,7 @@ /* * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -35,15 +36,6 @@ extern "C" { */ /**@{*/ -/* - * These defines are used to set the scheduler_policy value. The values - * must correspond directly with the order of the fields in the scheduler - * table (Scheduler_Table_entry), because the Configuration.scheduler_policy - * field is used to index the scheduler table. - */ -#define _Scheduler_USER (0) -#define _Scheduler_PRIORITY (1) - typedef struct Scheduler_Control_struct Scheduler_Control; /* @@ -54,9 +46,6 @@ typedef struct { void ( *scheduler_init )( Scheduler_Control * ); } Scheduler_Table_entry; -/* instantiated and initialized in confdefs.h */ -extern const Scheduler_Table_entry _Scheduler_Table[]; - /** * The following Scheduler_Per_thread_xxx structures are used to * hold per-thread data used by the scheduler. Thread_Control->scheduler is a @@ -82,26 +71,29 @@ typedef struct { */ typedef struct { /** Implements the scheduling decision logic (policy). */ - void ( *schedule ) ( Scheduler_Control * ); + void ( *initialize )(void); + + /** Implements the scheduling decision logic (policy). */ + void ( *schedule )(void); /** Voluntarily yields the processor per the scheduling policy. */ - void ( *yield ) ( Scheduler_Control * ); + void ( *yield )(void); /** Removes the given thread from scheduling decisions. */ - void ( *block ) ( Scheduler_Control *, Thread_Control * ); + void ( *block )(Thread_Control *); /** Adds the given thread to scheduling decisions. */ - void ( *unblock ) ( Scheduler_Control *, Thread_Control * ); + void ( *unblock )(Thread_Control *); /** allocates the scheduler field of the given thread */ - void * ( *scheduler_allocate ) ( Scheduler_Control *, Thread_Control * ); + void * ( *scheduler_allocate )(Thread_Control *); /** frees the scheduler field of the given thread */ - void ( *scheduler_free ) ( Scheduler_Control *, Thread_Control * ); + void ( *scheduler_free )(Thread_Control *); /** updates the scheduler field of the given thread -- primarily used * when changing the thread's priority. */ - void ( *scheduler_update ) ( Scheduler_Control *, Thread_Control * ); + void ( *scheduler_update )(Thread_Control *); } Scheduler_Operations; /** @@ -123,7 +115,7 @@ struct Scheduler_Control_struct { } Ready_queues; /** The jump table for scheduler-specific functions */ - Scheduler_Operations Operations; + Scheduler_Operations Operations; }; /** @@ -131,8 +123,10 @@ struct Scheduler_Control_struct { * scheduler. * * @note Can we make this per-cpu? then _Scheduler will be a macro. + * + * @note This is instantiated and initialized in confdefs.h. */ -SCORE_EXTERN Scheduler_Control _Scheduler; +extern Scheduler_Control _Scheduler; /** * This routine initializes the scheduler to the policy chosen by the user diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h index 67ef6b9e93..162cb7011a 100644 --- a/cpukit/score/include/rtems/score/schedulerpriority.h +++ b/cpukit/score/include/rtems/score/schedulerpriority.h @@ -7,6 +7,7 @@ /* * Copryight (c) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -34,12 +35,25 @@ extern "C" { */ /**@{*/ +/** + * Entry points for Scheduler Priority + */ +#define SCHEDULER_PRIORITY_ENTRY_POINTS \ + { \ + .initialize = _Scheduler_priority_Initialize, \ + .schedule = _Scheduler_priority_Schedule, \ + .yield = _Scheduler_priority_Yield, \ + .block = _Scheduler_priority_Block, \ + .unblock = _Scheduler_priority_Unblock, \ + .scheduler_allocate = _Scheduler_priority_Thread_scheduler_allocate, \ + .scheduler_free = _Scheduler_priority_Thread_scheduler_free, \ + .scheduler_update = _Scheduler_priority_Thread_scheduler_update \ + } + /** * This routine initializes the priority scheduler. */ -void _Scheduler_priority_Initialize( - Scheduler_Control *the_scheduler -); +void _Scheduler_priority_Initialize(void); /** * This routine removes @a the_thread from the scheduling decision, @@ -48,32 +62,27 @@ void _Scheduler_priority_Initialize( * a new heir thread. */ void _Scheduler_priority_Block( - Scheduler_Control *the_scheduler, - Thread_Control *the_thread + Thread_Control *the_thread ); /** * This kernel routine sets the heir thread to be the next ready thread * by invoking the_scheduler->ready_queue->operations->first(). */ -void _Scheduler_priority_Schedule( - Scheduler_Control *the_scheduler -); +void _Scheduler_priority_Schedule(void); /** * This routine allocates @a the_thread->scheduler. */ void * _Scheduler_priority_Thread_scheduler_allocate( - Scheduler_Control *the_scheduler, - Thread_Control *the_thread + Thread_Control *the_thread ); /** * This routine frees @a the_thread->scheduler. */ void _Scheduler_priority_Thread_scheduler_free( - Scheduler_Control *the_scheduler, - Thread_Control *the_thread + Thread_Control *the_thread ); /** @@ -81,8 +90,7 @@ void _Scheduler_priority_Thread_scheduler_free( * structures and thread state */ void _Scheduler_priority_Thread_scheduler_update( - Scheduler_Control *the_scheduler, - Thread_Control *the_thread + Thread_Control *the_thread ); /** @@ -91,17 +99,21 @@ void _Scheduler_priority_Thread_scheduler_update( * updates any appropriate scheduling variables, for example the heir thread. */ void _Scheduler_priority_Unblock( - Scheduler_Control *the_scheduler, - Thread_Control *the_thread + Thread_Control *the_thread ); /** * This routine is invoked when a thread wishes to voluntarily * transfer control of the processor to another thread in the queue. + * + * This routine will remove the running THREAD from the ready queue + * and place it immediately at the rear of this chain. Reset timeslice + * and yield the processor functions both use this routine, therefore if + * reset is true and this is the only thread on the queue then the + * timeslice counter is reset. The heir THREAD will be updated if the + * running is also the currently the heir. */ -void _Scheduler_priority_Yield( - Scheduler_Control *the_scheduler -); +void _Scheduler_priority_Yield( void ); #ifndef __RTEMS_APPLICATION__ #include diff --git a/cpukit/score/inline/rtems/score/scheduler.inl b/cpukit/score/inline/rtems/score/scheduler.inl index 81290eb84a..813365fcf9 100644 --- a/cpukit/score/inline/rtems/score/scheduler.inl +++ b/cpukit/score/inline/rtems/score/scheduler.inl @@ -7,6 +7,7 @@ /* * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -45,13 +46,11 @@ /** @brief _Scheduler_Schedule * * This kernel routine implements the scheduling decision logic for - * @a the_scheduler. It does NOT dispatch. + * the scheduler. It does NOT dispatch. */ -RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( - Scheduler_Control *the_scheduler -) +RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( void ) { - the_scheduler->Operations.schedule( the_scheduler ); + _Scheduler.Operations.schedule(); } /** @brief _Scheduler_Yield @@ -63,37 +62,35 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( */ RTEMS_INLINE_ROUTINE void _Scheduler_Yield( void ) { - _Scheduler.Operations.yield( &_Scheduler ); + _Scheduler.Operations.yield(); } /** @brief _Scheduler_Block * * This routine removes @a the_thread from the scheduling decision for - * @a the_scheduler. The primary task is to remove the thread from the + * the scheduler. The primary task is to remove the thread from the * ready queue. It performs any necessary schedulering operations * including the selection of a new heir thread. */ RTEMS_INLINE_ROUTINE void _Scheduler_Block( - Scheduler_Control *the_scheduler, Thread_Control *the_thread ) { - the_scheduler->Operations.block( the_scheduler, the_thread ); + _Scheduler.Operations.block( the_thread ); } /** @brief _Scheduler_Unblock * * This routine adds @a the_thread to the scheduling decision for - * @a the_scheduler. The primary task is to add the thread to the + * the scheduler. The primary task is to add the thread to the * ready queue per the schedulering policy and update any appropriate * scheduling variables, for example the heir thread. */ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( - Scheduler_Control *the_scheduler, Thread_Control *the_thread ) { - the_scheduler->Operations.unblock( the_scheduler, the_thread ); + _Scheduler.Operations.unblock( the_thread ); } /** @brief _Scheduler_Thread_scheduler_allocate @@ -101,12 +98,10 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( * This routine allocates @a the_thread->scheduler */ RTEMS_INLINE_ROUTINE void* _Scheduler_Thread_scheduler_allocate( - Scheduler_Control *the_scheduler, Thread_Control *the_thread ) { - return - the_scheduler->Operations.scheduler_allocate( the_scheduler, the_thread ); + return _Scheduler.Operations.scheduler_allocate( the_thread ); } /** @brief _Scheduler_Thread_scheduler_free @@ -114,11 +109,10 @@ RTEMS_INLINE_ROUTINE void* _Scheduler_Thread_scheduler_allocate( * This routine frees @a the_thread->scheduler */ RTEMS_INLINE_ROUTINE void _Scheduler_Thread_scheduler_free( - Scheduler_Control *the_scheduler, Thread_Control *the_thread ) { - return the_scheduler->Operations.scheduler_free( the_scheduler, the_thread ); + return _Scheduler.Operations.scheduler_free( the_thread ); } /** @brief _Scheduler_Thread_scheduler_update @@ -126,11 +120,10 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Thread_scheduler_free( * This routine updates @a the_thread->scheduler */ RTEMS_INLINE_ROUTINE void _Scheduler_Thread_scheduler_update( - Scheduler_Control *the_scheduler, Thread_Control *the_thread ) { - the_scheduler->Operations.scheduler_update( the_scheduler, the_thread ); + _Scheduler.Operations.scheduler_update( the_thread ); } /**@}*/ diff --git a/cpukit/score/inline/rtems/score/schedulerpriority.inl b/cpukit/score/inline/rtems/score/schedulerpriority.inl index b35682fa67..4b6bace9c6 100644 --- a/cpukit/score/inline/rtems/score/schedulerpriority.inl +++ b/cpukit/score/inline/rtems/score/schedulerpriority.inl @@ -7,6 +7,7 @@ /* * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -31,35 +32,28 @@ * * This routine initializes @a the_ready_queue for priority-based scheduling. */ -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize( - Scheduler_Control *the_scheduler -) { +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_initialize(void) +{ size_t index; /* allocate ready queue structures */ - the_scheduler->Ready_queues.priority = (Chain_Control *) + _Scheduler.Ready_queues.priority = (Chain_Control *) _Workspace_Allocate_or_fatal_error( ((size_t) PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control) ); /* initialize ready queue structures */ for( index=0; index <= PRIORITY_MAXIMUM; index++) - _Chain_Initialize_empty( &the_scheduler->Ready_queues.priority[index] ); + _Chain_Initialize_empty( &_Scheduler.Ready_queues.priority[index] ); } -/* - * _Scheduler_priority_Ready_queue_enqueue +/** + * @brief _Scheduler_priority_Ready_queue_enqueue * * This routine puts @a the_thread on to the priority-based ready queue. * - * Input parameters: - * the_thread - pointer to thread - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: + * @param[in] the_thread - pointer to thread */ - RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue( Thread_Control *the_thread ) @@ -70,21 +64,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue( &the_thread->Object.Node ); } -/* - * _Scheduler_priority_Ready_queue_Enqueue_first +/** + * @brief _Scheduler_priority_Ready_queue_Enqueue_first * * This routine puts @a the_thread to the head of the ready queue. * For priority-based ready queues, the thread will be the first thread * at its priority level. * - * Input parameters: - * the_thread - pointer to thread - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: + * @param[in] the_thread - pointer to thread */ - RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first( Thread_Control *the_thread ) @@ -95,20 +83,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first( &the_thread->Object.Node ); } -/* - * _Scheduler_priority_Ready_queue_extract +/** + * @brief _Scheduler_priority_Ready_queue_extract * * This routine removes a specific thread from the specified * priority-based ready queue. * - * Input parameters: - * the_thread - pointer to a thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: NONE + * @param[in] the_thread - pointer to thread */ - RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract( Thread_Control *the_thread ) @@ -122,18 +104,15 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract( _Chain_Extract_unprotected( &the_thread->Object.Node ); } -/* - * _Scheduler_priority_Ready_queue_first +/** + * @brief _Scheduler_priority_Ready_queue_first * * This routines returns a pointer to the first thread on @a the_ready_queue. * - * Input parameters: - * the_ready_queue - pointer to thread queue + * @param[in] the_ready_queue - pointer to thread queue * - * Output parameters: - * returns - first thread or NULL + * @return This method returns the first thread or NULL */ - RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_priority_Ready_queue_first( Chain_Control *the_ready_queue ) @@ -146,20 +125,14 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_priority_Ready_queue_first( return NULL; } -/* - * _Scheduler_priority_Ready_queue_requeue +/** + * @brief _Scheduler_priority_Ready_queue_requeue * * This routine is invoked when a thread changes priority and should be * moved to a different position on the ready queue. * - * Input parameters: - * the_thread - pointer to a thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: NONE + * @param[in] the_thread - pointer to thread */ - RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_requeue( Thread_Control *the_thread ) @@ -174,47 +147,30 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_requeue( } } -/* - * _Scheduler_priority_Schedule_body - * - * This kernel routine implements scheduling decision logic for priority-based - * scheduling. - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block +/** + * @brief _Scheduler_priority_Schedule_body * - * Output parameters: NONE + * This kernel routine implements scheduling decision logic + * for priority-based scheduling. * - * INTERRUPT LATENCY: + * @param[in] the_thread - pointer to thread */ - -RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body( - Scheduler_Control *the_scheduler -) +RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(void) { _Thread_Heir = _Scheduler_priority_Ready_queue_first( - the_scheduler->Ready_queues.priority + _Scheduler.Ready_queues.priority ); } -/* - * _Scheduler_priority_Block_body +/** + * @brief _Scheduler_priority_Block_body * - * This kernel routine removes the_thread from scheduling decisions based + * This kernel routine removes the_thread from scheduling decisions based * on simple queue extraction. * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: + * @param[in] the_thread - pointer to thread */ - RTEMS_INLINE_ROUTINE void _Scheduler_priority_Block_body( - Scheduler_Control *the_scheduler, Thread_Control *the_thread ) { @@ -223,7 +179,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Block_body( /* TODO: flash critical section */ if ( _Thread_Is_heir( the_thread ) ) - _Scheduler_priority_Schedule_body(the_scheduler); + _Scheduler_priority_Schedule_body(); if ( _Thread_Is_executing( the_thread ) ) _Thread_Dispatch_necessary = true; @@ -231,32 +187,22 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Block_body( return; } -/* - * _Scheduler_priority_Unblock_body +/** + * @brief _Scheduler_priority_Unblock_body * * This kernel routine readies the requested thread according to the queuing * discipline. A new heir thread may be selected. * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * NOTE: This routine uses the "blocking" heir selection mechanism. - * This ensures the correct heir after a thread restart. + * @param[in] the_thread - pointer to thread * - * INTERRUPT LATENCY: + * @note This routine uses the "blocking" heir selection mechanism. + * This ensures the correct heir after a thread restart. */ - RTEMS_INLINE_ROUTINE void _Scheduler_priority_Unblock_body ( - Scheduler_Control *the_scheduler __attribute__((unused)), Thread_Control *the_thread ) { - _Scheduler_priority_Ready_queue_enqueue( - the_thread - ); + _Scheduler_priority_Ready_queue_enqueue(the_thread); /* TODO: flash critical section */ diff --git a/cpukit/score/src/scheduler.c b/cpukit/score/src/scheduler.c index 9d7424eef6..60d8bc7fe7 100644 --- a/cpukit/score/src/scheduler.c +++ b/cpukit/score/src/scheduler.c @@ -2,6 +2,7 @@ * Scheduler Handler * * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -27,19 +28,14 @@ /* * _Scheduler_Handler_initialization * - * This routine initializes the scheduler by calling the scheduler_init - * function registered in the Configuration Scheduler Table. + * This routine initializes the scheduler by calling the scheduler + * initialize function registered in the Configuration Scheduler Table. * * Input parameters: NONE * * Output parameters: NONE */ - -void _Scheduler_Handler_initialization( ) +void _Scheduler_Handler_initialization(void) { - Scheduler_Control *the_scheduler = &_Scheduler; - - (*(_Scheduler_Table[Configuration.scheduler_policy].scheduler_init))( - the_scheduler - ); + (*_Scheduler.Operations.initialize)(); } diff --git a/cpukit/score/src/schedulerpriority.c b/cpukit/score/src/schedulerpriority.c index aa7ecee72e..93586a8a7b 100644 --- a/cpukit/score/src/schedulerpriority.c +++ b/cpukit/score/src/schedulerpriority.c @@ -2,6 +2,7 @@ * Scheduler Handler * * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -29,38 +30,8 @@ volatile Priority_bit_map_Control _Priority_Major_bit_map; Priority_bit_map_Control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT; -/* - * _Scheduler_priority_Initialize - * - * Initializes the scheduler for priority scheduling. - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * - * Output parameters: NONE - */ - -void _Scheduler_priority_Initialize ( - Scheduler_Control *the_scheduler -) +void _Scheduler_priority_Initialize(void) { - /* the operations table is a jump table to redirect generic scheduler - * function calls to scheduler implementation specific functions. The - * main purpose of scheduler initialization is to set up the jump table - * for the scheduler. Every scheduler implementation provides its own - * scheduler operations table. - */ - the_scheduler->Operations.schedule = &_Scheduler_priority_Schedule; - the_scheduler->Operations.yield = &_Scheduler_priority_Yield; - the_scheduler->Operations.block = &_Scheduler_priority_Block; - the_scheduler->Operations.unblock = &_Scheduler_priority_Unblock; - the_scheduler->Operations.scheduler_allocate = - &_Scheduler_priority_Thread_scheduler_allocate; - the_scheduler->Operations.scheduler_free = - &_Scheduler_priority_Thread_scheduler_free; - the_scheduler->Operations.scheduler_update = - &_Scheduler_priority_Thread_scheduler_update; - - _Scheduler_priority_Ready_queue_initialize( the_scheduler ); + _Scheduler_priority_Ready_queue_initialize(); _Priority_bit_map_Handler_initialization( ); } diff --git a/cpukit/score/src/schedulerpriorityblock.c b/cpukit/score/src/schedulerpriorityblock.c index 984c9b96c9..3babe6e0cc 100644 --- a/cpukit/score/src/schedulerpriorityblock.c +++ b/cpukit/score/src/schedulerpriorityblock.c @@ -2,6 +2,7 @@ * Scheduler Handler * * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -24,25 +25,9 @@ #include #include -/* - * _Scheduler_priority_Block - * - * This kernel routine removes the_thread from scheduling decisions based - * on simple queue extraction. - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - */ - void _Scheduler_priority_Block( - Scheduler_Control *the_scheduler, Thread_Control *the_thread ) { - _Scheduler_priority_Block_body(the_scheduler, the_thread); + _Scheduler_priority_Block_body(the_thread); } diff --git a/cpukit/score/src/schedulerpriorityschedule.c b/cpukit/score/src/schedulerpriorityschedule.c index 44395949c6..052de7156a 100644 --- a/cpukit/score/src/schedulerpriorityschedule.c +++ b/cpukit/score/src/schedulerpriorityschedule.c @@ -2,6 +2,7 @@ * Scheduler Handler * * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -15,34 +16,10 @@ #endif #include -#include -#include -#include -#include -#include -#include #include #include -#include -/* - * _Scheduler_priority_Schedule - * - * This kernel routine implements scheduling decision logic for priority-based - * scheduling. - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - */ - -void _Scheduler_priority_Schedule( - Scheduler_Control *the_scheduler -) +void _Scheduler_priority_Schedule(void) { - _Scheduler_priority_Schedule_body( the_scheduler ); + _Scheduler_priority_Schedule_body(); } diff --git a/cpukit/score/src/schedulerprioritythreadschedulerallocate.c b/cpukit/score/src/schedulerprioritythreadschedulerallocate.c index 8dedabea15..3cce3e866e 100644 --- a/cpukit/score/src/schedulerprioritythreadschedulerallocate.c +++ b/cpukit/score/src/schedulerprioritythreadschedulerallocate.c @@ -16,38 +16,20 @@ #include #include -#include -#include -#include #include #include -#include #include #include -/* - * _Scheduler_priority_Thread_scheduler_allocate - * - * Allocates @a the_thread->scheduler - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block - * - * Output parameters: - * Returns pointer to allocated space. - */ - -void* _Scheduler_priority_Thread_scheduler_allocate ( - Scheduler_Control *the_scheduler __attribute__((unused)), +void *_Scheduler_priority_Thread_scheduler_allocate ( Thread_Control *the_thread ) { - void *sched; + void *sched; sched = _Workspace_Allocate( sizeof(Scheduler_priority_Per_thread) ); - the_thread->scheduler.priority = (Scheduler_priority_Per_thread*) sched; + the_thread->scheduler.priority = (Scheduler_priority_Per_thread *) sched; return sched; } diff --git a/cpukit/score/src/schedulerprioritythreadschedulerfree.c b/cpukit/score/src/schedulerprioritythreadschedulerfree.c index b43ee963b1..5b13d20952 100644 --- a/cpukit/score/src/schedulerprioritythreadschedulerfree.c +++ b/cpukit/score/src/schedulerprioritythreadschedulerfree.c @@ -2,6 +2,7 @@ * Scheduler Handler * * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -25,21 +26,8 @@ #include #include -/* - * _Scheduler_priority_Thread_scheduler_free - * - * Frees @a the_thread->scheduler - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block - * - * Output parameters: NONE - */ - void _Scheduler_priority_Thread_scheduler_free ( - Scheduler_Control *the_scheduler __attribute__((unused)), - Thread_Control *the_thread + Thread_Control *the_thread ) { _Workspace_Free( the_thread->scheduler.priority ); diff --git a/cpukit/score/src/schedulerprioritythreadschedulerupdate.c b/cpukit/score/src/schedulerprioritythreadschedulerupdate.c index 16878111ab..4b75d1d084 100644 --- a/cpukit/score/src/schedulerprioritythreadschedulerupdate.c +++ b/cpukit/score/src/schedulerprioritythreadschedulerupdate.c @@ -2,6 +2,7 @@ * Scheduler Handler * * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -16,34 +17,18 @@ #include #include -#include -#include -#include #include #include #include #include -#include #include -/* - * _Scheduler_priority_Thread_scheduler_update - * - * Updates @a the_thread->scheduler - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block - * - * Output parameters: NONE - */ - -void _Scheduler_priority_Thread_scheduler_update ( - Scheduler_Control *the_scheduler, - Thread_Control *the_thread +void _Scheduler_priority_Thread_scheduler_update( + Thread_Control *the_thread ) { - Chain_Control *rq = the_scheduler->Ready_queues.priority; + Chain_Control *rq = _Scheduler.Ready_queues.priority; + the_thread->scheduler.priority->ready_chain = &rq[ the_thread->current_priority ]; diff --git a/cpukit/score/src/schedulerpriorityunblock.c b/cpukit/score/src/schedulerpriorityunblock.c index 798a614bb9..c0ca1924d2 100644 --- a/cpukit/score/src/schedulerpriorityunblock.c +++ b/cpukit/score/src/schedulerpriorityunblock.c @@ -2,6 +2,7 @@ * Scheduler Handler * * Copyright (C) 2010 Gedare Bloom. + * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -15,43 +16,12 @@ #endif #include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include - -/* - * _Scheduler_priority_Unblock - * - * This kernel routine readies the requested thread according to the queuing - * discipline. A new heir thread may be selected. - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * NOTE: This routine uses the "blocking" heir selection mechanism. - * This ensures the correct heir after a thread restart. - * - * INTERRUPT LATENCY: - */ void _Scheduler_priority_Unblock ( - Scheduler_Control *the_scheduler, Thread_Control *the_thread ) { - _Scheduler_priority_Unblock_body(the_scheduler, the_thread); + _Scheduler_priority_Unblock_body(the_thread); } diff --git a/cpukit/score/src/schedulerpriorityyield.c b/cpukit/score/src/schedulerpriorityyield.c index 0383e41833..d25820993d 100644 --- a/cpukit/score/src/schedulerpriorityyield.c +++ b/cpukit/score/src/schedulerpriorityyield.c @@ -30,28 +30,12 @@ #include /* - * _Scheduler_priority_Yield - * - * This kernel routine will remove the running THREAD from the ready queue - * and place it immediately at the rear of this chain. Reset timeslice - * and yield the processor functions both use this routine, therefore if - * reset is true and this is the only thread on the queue then the - * timeslice counter is reset. The heir THREAD will be updated if the - * running is also the currently the heir. - * - * Input parameters: - * the_scheduler - pointer to scheduler control - * - * Output parameters: NONE - * * INTERRUPT LATENCY: * ready chain * select heir */ -void _Scheduler_priority_Yield( - Scheduler_Control *the_scheduler __attribute__((unused)) -) +void _Scheduler_priority_Yield(void) { ISR_Level level; Thread_Control *executing; diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c index bad36b92d7..313d1697e8 100644 --- a/cpukit/score/src/threadchangepriority.c +++ b/cpukit/score/src/threadchangepriority.c @@ -17,39 +17,11 @@ #endif #include -#include -#include -#include #include -#include -#include #include #include -#include -#include #include #include -#include -#include - -/*PAGE - * - * _Thread_Change_priority - * - * This kernel routine changes the priority of the thread. The - * thread chain is adjusted if necessary. - * - * Input parameters: - * the_thread - pointer to thread control block - * new_priority - ultimate priority - * prepend_it - true if the thread should be prepended to the chain - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ void _Thread_Change_priority( Thread_Control *the_thread, @@ -137,7 +109,7 @@ void _Thread_Change_priority( * We altered the set of thread priorities. So let's figure out * who is the heir and if we need to switch to them. */ - _Scheduler_Schedule(&_Scheduler); + _Scheduler_Schedule(); if ( !_Thread_Is_executing_also_the_heir() && _Thread_Executing->is_preemptible ) diff --git a/cpukit/score/src/threadclearstate.c b/cpukit/score/src/threadclearstate.c index 87f959024f..afeab04e8e 100644 --- a/cpukit/score/src/threadclearstate.c +++ b/cpukit/score/src/threadclearstate.c @@ -1,8 +1,7 @@ /* - * Thread Handler + * Thread Handler / Thread Clear State * - * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,26 +30,11 @@ #include #include -/*PAGE - * - * _Thread_Clear_state - * - * This kernel routine clears the appropriate states in the - * requested thread. The thread ready chain is adjusted if - * necessary and the Heir thread is set accordingly. - * - * Input parameters: - * the_thread - pointer to thread control block - * state - state set to clear - * - * Output parameters: NONE - * +/* * INTERRUPT LATENCY: * priority map * select heir */ - - void _Thread_Clear_state( Thread_Control *the_thread, States_Control state @@ -67,7 +51,7 @@ void _Thread_Clear_state( the_thread->current_state = _States_Clear( state, current_state ); if ( _States_Is_ready( current_state ) ) { - _Scheduler_Unblock( &_Scheduler, the_thread); + _Scheduler_Unblock( the_thread ); } } _ISR_Enable( level ); diff --git a/cpukit/score/src/threadclose.c b/cpukit/score/src/threadclose.c index 2ba29519d9..853451aab1 100644 --- a/cpukit/score/src/threadclose.c +++ b/cpukit/score/src/threadclose.c @@ -1,8 +1,7 @@ /* - * Thread Handler + * Thread Handler / Thread Close * - * - * COPYRIGHT (c) 1989-2008. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,16 +30,6 @@ #include #include -/* - * _Thread_Close - * - * DESCRIPTION: - * - * This routine frees all memory associated with the specified - * thread and removes it from the local object table so no further - * operations on this thread are allowed. - */ - void _Thread_Close( Objects_Information *information, Thread_Control *the_thread @@ -89,7 +78,7 @@ void _Thread_Close( /* * Free the per-thread scheduling information. */ - _Scheduler_Thread_scheduler_free( &_Scheduler, the_thread ); + _Scheduler_Thread_scheduler_free( the_thread ); /* * The thread might have been FP. So deal with that. diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c index df20017af4..cda596bc56 100644 --- a/cpukit/score/src/threadinitialize.c +++ b/cpukit/score/src/threadinitialize.c @@ -1,8 +1,7 @@ /* - * Thread Handler + * Thread Handler / Thread Initialize * - * - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -194,7 +193,7 @@ bool _Thread_Initialize( the_thread->resource_count = 0; the_thread->real_priority = priority; the_thread->Start.initial_priority = priority; - sched =_Scheduler_Thread_scheduler_allocate( &_Scheduler, the_thread ); + sched =_Scheduler_Thread_scheduler_allocate( the_thread ); if ( !sched ) goto failed; _Thread_Set_priority( the_thread, priority ); diff --git a/cpukit/score/src/threadready.c b/cpukit/score/src/threadready.c index aa81a05582..9e3a285d22 100644 --- a/cpukit/score/src/threadready.c +++ b/cpukit/score/src/threadready.c @@ -1,8 +1,7 @@ /* - * Thread Handler + * Thread Handler / Thread Ready * - * - * COPYRIGHT (c) 1989-2006. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,26 +30,11 @@ #include #include -/*PAGE - * - * _Thread_Ready - * - * This kernel routine readies the requested thread, the thread chain - * is adjusted. A new heir thread may be selected. - * - * Input parameters: - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * NOTE: This routine uses the "blocking" heir selection mechanism. - * This ensures the correct heir after a thread restart. - * +/* * INTERRUPT LATENCY: * ready chain * select heir */ - void _Thread_Ready( Thread_Control *the_thread ) @@ -61,7 +45,7 @@ void _Thread_Ready( the_thread->current_state = STATES_READY; - _Scheduler_Unblock( &_Scheduler, the_thread ); + _Scheduler_Unblock( the_thread ); _ISR_Enable( level ); } diff --git a/cpukit/score/src/threadresume.c b/cpukit/score/src/threadresume.c index faed53d185..a3a4f03ee9 100644 --- a/cpukit/score/src/threadresume.c +++ b/cpukit/score/src/threadresume.c @@ -1,8 +1,8 @@ /* - * Thread Handler + * Thread Handler / Thread Resume * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,27 +31,11 @@ #include #include -/*PAGE - * - * _Thread_Resume - * - * This kernel routine clears the SUSPEND state if the suspend_count - * drops below one. If the force parameter is set the suspend_count - * is forced back to zero. The thread ready chain is adjusted if - * necessary and the Heir thread is set accordingly. - * - * Input parameters: - * the_thread - pointer to thread control block - * force - force the suspend count back to 0 - * - * Output parameters: NONE - * +/* * INTERRUPT LATENCY: * priority map * select heir */ - - void _Thread_Resume( Thread_Control *the_thread, bool force @@ -69,7 +53,7 @@ void _Thread_Resume( the_thread->current_state = _States_Clear(STATES_SUSPENDED, current_state); if ( _States_Is_ready( current_state ) ) { - _Scheduler_Unblock( &_Scheduler, the_thread ); + _Scheduler_Unblock( the_thread ); } } diff --git a/cpukit/score/src/threadsetpriority.c b/cpukit/score/src/threadsetpriority.c index fa4676fdb5..5c43c376a5 100644 --- a/cpukit/score/src/threadsetpriority.c +++ b/cpukit/score/src/threadsetpriority.c @@ -1,8 +1,7 @@ /* - * Thread Handler + * Thread Handler / Thread Set Priority * - * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,20 +30,6 @@ #include #include -/*PAGE - * - * _Thread_Set_priority - * - * This directive enables and disables several modes of - * execution for the requesting thread. - * - * Input parameters: - * the_thread - pointer to thread priority - * new_priority - new priority - * - * Output: NONE - */ - void _Thread_Set_priority( Thread_Control *the_thread, Priority_Control new_priority @@ -52,5 +37,5 @@ void _Thread_Set_priority( { the_thread->current_priority = new_priority; - _Scheduler_Thread_scheduler_update(&_Scheduler, the_thread); + _Scheduler_Thread_scheduler_update( the_thread ); } diff --git a/cpukit/score/src/threadsetstate.c b/cpukit/score/src/threadsetstate.c index 89366f8c7d..1dcf33344c 100644 --- a/cpukit/score/src/threadsetstate.c +++ b/cpukit/score/src/threadsetstate.c @@ -1,8 +1,7 @@ /* - * Thread Handler + * Thread Handler / Thread Set State * - * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,24 +30,11 @@ #include #include -/*PAGE - * - * _Thread_Set_state - * - * This kernel routine sets the requested state in the THREAD. The - * THREAD chain is adjusted if necessary. - * - * Input parameters: - * the_thread - pointer to thread control block - * state - state to be set - * - * Output parameters: NONE - * +/* * INTERRUPT LATENCY: * ready chain * select map */ - void _Thread_Set_state( Thread_Control *the_thread, States_Control state @@ -66,7 +52,7 @@ void _Thread_Set_state( the_thread->current_state = state; - _Scheduler_Block( &_Scheduler, the_thread); + _Scheduler_Block( the_thread ); _ISR_Enable( level ); } diff --git a/cpukit/score/src/threadsuspend.c b/cpukit/score/src/threadsuspend.c index 69e5d9a277..f5169a25f2 100644 --- a/cpukit/score/src/threadsuspend.c +++ b/cpukit/score/src/threadsuspend.c @@ -1,8 +1,8 @@ /* - * Thread Handler + * Thread Handler / Thread Suspend * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,23 +31,10 @@ #include #include -/*PAGE - * - * _Thread_Suspend - * - * This kernel routine sets the SUSPEND state in the THREAD. The - * THREAD chain and suspend count are adjusted if necessary. - * - * Input parameters: - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: +/* INTERRUPT LATENCY: * ready chain * select map */ - void _Thread_Suspend( Thread_Control *the_thread ) @@ -64,7 +51,7 @@ void _Thread_Suspend( the_thread->current_state = STATES_SUSPENDED; - _Scheduler_Block(&_Scheduler, the_thread); + _Scheduler_Block( the_thread ); _ISR_Enable( level ); } -- cgit v1.2.3