Ticket #1647: rtems-cvs.diff

File rtems-cvs.diff, 41.8 KB (added by Gedare Bloom, on 07/30/10 at 17:25:53)

Changes to existing files.

  • cpukit/posix/src/nanosleep.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/nanosleep.c,v
    retrieving revision 1.11
    diff -u -p -r1.11 nanosleep.c
     
    1818
    1919#include <rtems/system.h>
    2020#include <rtems/score/isr.h>
     21#include <rtems/score/scheduler.h>
    2122#include <rtems/score/thread.h>
    2223#include <rtems/score/tod.h>
    2324
    int nanosleep( 
    5657
    5758  if ( !ticks ) {
    5859    _Thread_Disable_dispatch();
    59       _Thread_Yield_processor();
     60      _Scheduler_Yield();
    6061    _Thread_Enable_dispatch();
    6162    if ( rmtp ) {
    6263       rmtp->tv_sec = 0;
  • cpukit/posix/src/sched_yield.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/sched_yield.c,v
    retrieving revision 1.1
    diff -u -p -r1.1 sched_yield.c
     
    1919#include <errno.h>
    2020
    2121#include <rtems/system.h>
     22#include <rtems/score/scheduler.h>
    2223#include <rtems/score/tod.h>
    2324#include <rtems/score/thread.h>
    2425#include <rtems/seterr.h>
     
    2829int sched_yield( void )
    2930{
    3031  _Thread_Disable_dispatch();
    31     _Thread_Yield_processor();
     32    _Scheduler_Yield();
    3233  _Thread_Enable_dispatch();
    3334  return 0;
    3435}
  • cpukit/rtems/src/taskwakeafter.c

    RCS file: /usr1/CVS/rtems/cpukit/rtems/src/taskwakeafter.c,v
    retrieving revision 1.4
    diff -u -p -r1.4 taskwakeafter.c
     
    2121#include <rtems/rtems/support.h>
    2222#include <rtems/rtems/modes.h>
    2323#include <rtems/score/object.h>
     24#include <rtems/score/scheduler.h>
    2425#include <rtems/score/stack.h>
    2526#include <rtems/score/states.h>
    2627#include <rtems/rtems/tasks.h>
    rtems_status_code rtems_task_wake_after( 
    5253{
    5354  _Thread_Disable_dispatch();
    5455    if ( ticks == 0 ) {
    55       _Thread_Yield_processor();
     56      _Scheduler_Yield();
    5657    } else {
    5758      _Thread_Set_state( _Thread_Executing, STATES_DELAYING );
    5859      _Watchdog_Initialize(
  • cpukit/sapi/include/confdefs.h

    RCS file: /usr1/CVS/rtems/cpukit/sapi/include/confdefs.h,v
    retrieving revision 1.147
    diff -u -p -r1.147 confdefs.h
    rtems_fs_init_functions_t rtems_fs_in 
    535535#endif
    536536
    537537/*
     538 * Scheduler configuration.
     539 *
     540 * The scheduler configuration allows an application to select the
     541 * scheduling policy to use.  The supported configurations are:
     542 *  CONFIGURE_SCHEDULER_USER
     543 *  CONFIGURE_SCHEDULER_PRIORITY
     544 *
     545 * If no configuration is specified by the application, then
     546 * CONFIGURE_SCHEDULER_PRIORITY is assumed to be the default.
     547 *
     548 * An application can define its own scheduling policy by defining
     549 * CONFIGURE_SCHEDULER_USER and CONFIGURE_SCHEDULER_ENTRY_USER to point
     550 * to an initialization routine.  Note: CONFIGURE_SCHEDULER_USER is not
     551 * fully supported, since it has no per-thread field.
     552 *
     553 * To add a new scheduler:
     554 */
     555#include <rtems/score/scheduler.h>
     556
     557#if defined(CONFIGURE_SCHEDULER_USER) && \
     558    !defined(CONFIGURE_SCHEDULER_ENTRY_USER)
     559  #error "CONFIGURE_ERROR: CONFIGURE_SCHEDULER_USER without CONFIGURE_SCHEDULER_ENTRY_USER"
     560#endif
     561
     562/* enable all RTEMS-provided schedulers */
     563#if defined(CONFIGURE_SCHEDULER_ALL)
     564  #define CONFIGURE_SCHEDULER_PRIORITY
     565#endif
     566
     567/* If no scheduler is specified, the priority scheduler is default. */
     568#if !defined(CONFIGURE_SCHEDULER_USER) && \
     569    !defined(CONFIGURE_SCHEDULER_PRIORITY)
     570  #define CONFIGURE_SCHEDULER_PRIORITY
     571  #define CONFIGURE_SCHEDULER_POLICY _Scheduler_PRIORITY
     572#endif
     573
     574/*
     575 * If a user scheduler is specified and no policy is set,
     576 * the user scheduler is the default policy.
     577 */
     578#if defined(CONFIGURE_SCHEDULER_USER) && \
     579    !defined(CONFIGURE_SCHEDULER_POLICY)
     580  #define CONFIGURE_SCHEDULER_POLICY _Scheduler_USER
     581#endif
     582
     583/*
     584 * Check for priority scheduler next, as it is the default policy if there
     585 * is no CONFIGURE_SCHEDULER_POLICY set and no USER scheduler provided.
     586 */
     587#if defined(CONFIGURE_SCHEDULER_PRIORITY)
     588  #include <rtems/score/schedulerpriority.h>
     589  #define CONFIGURE_SCHEDULER_ENTRY_PRIORITY { _Scheduler_priority_Initialize }
     590  #if !defined(CONFIGURE_SCHEDULER_POLICY)
     591    #define CONFIGURE_SCHEDULER_POLICY _Scheduler_PRIORITY
     592  #endif
     593#endif
     594
     595/*
     596 * Set up the scheduler table.  The scheduling code indexes this table to
     597 * invoke the correct scheduling implementation. The scheduler to use is
     598 * determined by the Configuration.scheduler_policy field, which is set
     599 * by CONFIGURE_SCHEDULER_POLICY.  If a particular scheduler is not enabled,
     600 * an empty entry is included in its entry in the scheduler table.
     601 */
     602
     603  /**
     604   * An empty scheduler entry
     605   */
     606  #define CONFIGURE_SCHEDULER_NULL { NULL }
     607
     608#ifdef CONFIGURE_INIT
     609  /* the table of available schedulers. */
     610  const Scheduler_Table_t _Scheduler_Table[] = {
     611    #if defined(CONFIGURE_SCHEDULER_USER) && \
     612        defined(CONFIGURE_SCHEDULER_ENTRY_USER)
     613      CONFIGURE_SCHEDULER_ENTRY_USER,
     614    #else
     615      CONFIGURE_SCHEDULER_NULL,
     616    #endif
     617    #if defined(CONFIGURE_SCHEDULER_PRIORITY) && \
     618        defined(CONFIGURE_SCHEDULER_ENTRY_PRIORITY)
     619      CONFIGURE_SCHEDULER_ENTRY_PRIORITY,
     620    #else
     621      CONFIGURE_SCHEDULER_NULL,
     622    #endif
     623  };
     624#endif
     625
     626
     627/*
    538628 *  If you said the IDLE task was going to do application initialization
    539629 *  and didn't override the IDLE body, then something is amiss.
    540630 */
    rtems_fs_init_functions_t rtems_fs_in 
    19602050    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
    19612051    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
    19622052    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
     2053    CONFIGURE_SCHEDULER_POLICY,               /* scheduling policy */
    19632054    CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
    19642055    CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
    19652056    CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
  • cpukit/sapi/include/rtems/config.h

    RCS file: /usr1/CVS/rtems/cpukit/sapi/include/rtems/config.h,v
    retrieving revision 1.53
    diff -u -p -r1.53 config.h
    typedef struct { 
    118118   */
    119119  uint32_t                       ticks_per_timeslice;
    120120
     121  /** This field specifies the scheduling policy to use.
     122   */
     123  uint32_t                       scheduler_policy;
     124
    121125  /** This element points to the BSP's optional idle task which may override
    122126   *  the default one provided with RTEMS.
    123127   */
  • cpukit/sapi/src/exinit.c

    RCS file: /usr1/CVS/rtems/cpukit/sapi/src/exinit.c,v
    retrieving revision 1.55
    diff -u -p -r1.55 exinit.c
     
    4242#include <rtems/score/mpci.h>
    4343#endif
    4444#include <rtems/score/priority.h>
    45 #include <rtems/score/prioritybitmap.h>
     45#include <rtems/score/scheduler.h>
    4646#include <rtems/score/thread.h>
    4747#include <rtems/score/tod.h>
    4848#include <rtems/score/userext.h>
    void rtems_initialize_data_structures(vo 
    131131
    132132  _Thread_Handler_initialization();
    133133
     134  _Scheduler_Handler_initialization();
     135
    134136  #if defined(RTEMS_MULTIPROCESSING)
    135137    _Objects_MP_Handler_initialization();
    136138    _MPCI_Handler_initialization( RTEMS_TIMEOUT );
  • cpukit/score/Makefile.am

    RCS file: /usr1/CVS/rtems/cpukit/score/Makefile.am,v
    retrieving revision 1.87
    diff -u -p -r1.87 Makefile.am
    include_rtems_score_HEADERS = include/rt 
    2626    include/rtems/score/interr.h include/rtems/score/isr.h \
    2727    include/rtems/score/object.h include/rtems/score/percpu.h \
    2828    include/rtems/score/priority.h include/rtems/score/prioritybitmap.h \
     29                include/rtems/score/readyq.h include/rtems/score/readyqpriority.h \
     30                include/rtems/score/scheduler.h include/rtems/score/schedulerpriority.h \
     31                include/rtems/score/schedulerqueue.h \
    2932    include/rtems/score/stack.h include/rtems/score/states.h \
    3033    include/rtems/score/sysstate.h include/rtems/score/thread.h \
    3134    include/rtems/score/threadq.h include/rtems/score/threadsync.h \
    include_rtems_score_HEADERS += inline/rt 
    5457    inline/rtems/score/coresem.inl inline/rtems/score/heap.inl \
    5558    inline/rtems/score/isr.inl inline/rtems/score/object.inl \
    5659    inline/rtems/score/priority.inl inline/rtems/score/prioritybitmap.inl \
     60                inline/rtems/score/readyq.inl inline/rtems/score/scheduler.inl \
    5761    inline/rtems/score/stack.inl inline/rtems/score/states.inl \
    5862    inline/rtems/score/sysstate.inl inline/rtems/score/thread.inl \
    5963    inline/rtems/score/threadq.inl inline/rtems/score/tod.inl \
    libscore_a_SOURCES += src/objectallocate 
    137141    src/objectgetinfo.c src/objectgetinfoid.c src/objectapimaximumclass.c \
    138142    src/objectnamespaceremove.c
    139143
     144## READYQPRIORITY_C_FILES
     145libscore_a_SOURCES += src/readyqpriority.c \
     146    src/readyqpriorityenqueue.c src/readyqpriorityenqueuefirst.c \
     147                src/readyqpriorityextract.c src/readyqpriorityfirst.c \
     148                src/readyqpriorityrequeue.c
     149
     150## SCHEDULER_C_FILES
     151libscore_a_SOURCES += src/scheduler.c
     152
     153## SCHEDULERQUEUE_C_FILES
     154libscore_a_SOURCES += src/schedulerqueueblock.c \
     155                                                                                        src/schedulerqueueschedule.c \
     156                                                                                        src/schedulerqueueunblock.c src/schedulerqueueyield.c
     157
     158## SCHEDULERPRIORITY_C_FILES
     159libscore_a_SOURCES += src/schedulerpriority.c \
     160                                                                                        src/schedulerpriorityschedallocate.c \
     161                                                                                        src/schedulerpriorityschedfree.c \
     162                                                                                        src/schedulerpriorityschedupdate.c
     163
    140164## PROTECTED_HEAP_C_FILES
    141165libscore_a_SOURCES += src/pheapallocate.c \
    142166    src/pheapextend.c src/pheapfree.c src/pheapgetsize.c \
    libscore_a_SOURCES += src/thread.c src/t 
    153177    src/threadsetstate.c src/threadsettransient.c \
    154178    src/threadstackallocate.c src/threadstackfree.c src/threadstart.c \
    155179    src/threadstartmultitasking.c src/threadsuspend.c \
    156     src/threadtickletimeslice.c src/threadyieldprocessor.c \
     180    src/threadtickletimeslice.c \
    157181    src/iterateoverthreads.c src/threadblockingoperationcancel.c
    158182
    159183## THREADQ_C_FILES
  • cpukit/score/preinstall.am

    RCS file: /usr1/CVS/rtems/cpukit/score/preinstall.am,v
    retrieving revision 1.24
    diff -u -p -r1.24 preinstall.am
    $(PROJECT_INCLUDE)/rtems/score/priorityb 
    111111        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/prioritybitmap.h
    112112PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/prioritybitmap.h
    113113
     114$(PROJECT_INCLUDE)/rtems/score/readyq.h: include/rtems/score/readyq.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     115        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/readyq.h
     116PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/readyq.h
     117
     118$(PROJECT_INCLUDE)/rtems/score/readyqpriority.h: include/rtems/score/readyqpriority.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     119        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/readyqpriority.h
     120PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/readyqpriority.h
     121
     122$(PROJECT_INCLUDE)/rtems/score/scheduler.h: include/rtems/score/scheduler.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     123        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/scheduler.h
     124PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/scheduler.h
     125
     126$(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h: include/rtems/score/schedulerpriority.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     127        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h
     128PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h
     129
     130$(PROJECT_INCLUDE)/rtems/score/schedulerqueue.h: include/rtems/score/schedulerqueue.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     131        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerqueue.h
     132PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerqueue.h
     133
    114134$(PROJECT_INCLUDE)/rtems/score/stack.h: include/rtems/score/stack.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
    115135        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.h
    116136PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.h
    $(PROJECT_INCLUDE)/rtems/score/priorityb 
    245265        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/prioritybitmap.inl
    246266PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/prioritybitmap.inl
    247267
     268$(PROJECT_INCLUDE)/rtems/score/readyq.inl: inline/rtems/score/readyq.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     269        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/readyq.inl
     270PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/readyq.inl
     271
     272$(PROJECT_INCLUDE)/rtems/score/scheduler.inl: inline/rtems/score/scheduler.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     273        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/scheduler.inl
     274PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/scheduler.inl
     275
    248276$(PROJECT_INCLUDE)/rtems/score/stack.inl: inline/rtems/score/stack.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
    249277        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.inl
    250278PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.inl
  • cpukit/score/include/rtems/score/prioritybitmap.h

    RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/prioritybitmap.h,v
    retrieving revision 1.1
    diff -u -p -r1.1 prioritybitmap.h
    extern "C" { 
    3737
    3838#include <rtems/score/priority.h>
    3939
     40
    4041/*
    41  * TODO:
    42  * These should only be instantiated if using the bit map handler.  The
    43  * logical place for this is in confdefs.h when a scheduler that uses the
    44  * bit map handler is configured.
     42 * The Priority_bit_map_Control variables are instantiated only
     43 * if using the bit map handler.
    4544 */
    4645
    4746/**
    4847 *  Each sixteen bit entry in this array is associated with one of
    4948 *  the sixteen entries in the Priority Bit map.
    5049 */
    51 SCORE_EXTERN volatile Priority_bit_map_Control _Priority_Major_bit_map;
     50extern volatile Priority_bit_map_Control _Priority_Major_bit_map;
    5251
    5352/** Each bit in the Priority Bitmap indicates whether or not there are
    5453 *  threads ready at a particular priority.  The mapping of
    SCORE_EXTERN volatile Priority_bit_map_C 
    5655 *  dependent as is the value of each bit used to indicate that
    5756 *  threads are ready at that priority.
    5857 */
    59 SCORE_EXTERN Priority_bit_map_Control
     58extern Priority_bit_map_Control
    6059               _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
    6160
    6261/*
  • cpukit/score/include/rtems/score/thread.h

    RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/thread.h,v
    retrieving revision 1.97
    diff -u -p -r1.97 thread.h
    extern "C" { 
    7070#endif
    7171#include <rtems/score/object.h>
    7272#include <rtems/score/priority.h>
    73 #include <rtems/score/prioritybitmap.h>
     73#include <rtems/score/scheduler.h>
    7474#include <rtems/score/stack.h>
    7575#include <rtems/score/states.h>
    7676#include <rtems/score/tod.h>
    struct Thread_Control_struct { 
    390390   *  since it was created.
    391391   */
    392392  Thread_CPU_usage_t                    cpu_time_used;
    393   /** This field points to the Ready FIFO for this priority. */
    394   Chain_Control                        *ready;
    395   /** This field contains precalculated priority map indices. */
    396   Priority_bit_map_Information          Priority_map;
     393  /** This union holds per-thread data for the scheduler and ready queue. */
     394  union {
     395    Scheduler_priority_Per_thread      *priority;
     396  } sched;
    397397  /** This field contains information about the starting state of
    398398   *  this thread.
    399399   */
    SCORE_EXTERN uint32_t _Thread_Maximum_ 
    456456SCORE_EXTERN uint32_t   _Thread_Ticks_per_timeslice;
    457457
    458458/**
    459  *  The following points to the array of FIFOs used to manage the
    460  *  set of ready threads.
    461  */
    462 SCORE_EXTERN Chain_Control *_Thread_Ready_chain;
    463 
    464 /**
    465459 *  The following points to the thread whose floating point
    466460 *  context is currently loaded.
    467461 */
    void _Thread_Set_transient( 
    654648void _Thread_Tickle_timeslice( void );
    655649
    656650/**
    657  *  This routine is invoked when a thread wishes to voluntarily
    658  *  transfer control of the processor to another thread of equal
    659  *  or greater priority.
    660  */
    661 void _Thread_Yield_processor( void );
    662 
    663 /**
    664651 *  This routine initializes the context of the_thread to its
    665652 *  appropriate starting state.
    666653 */
  • cpukit/score/inline/rtems/score/thread.inl

    RCS file: /usr1/CVS/rtems/cpukit/score/inline/rtems/score/thread.inl,v
    retrieving revision 1.42
    diff -u -p -r1.42 thread.inl
    RTEMS_INLINE_ROUTINE void _Thread_Restar 
    120120}
    121121
    122122/**
    123  *  This function returns a pointer to the highest priority
    124  *  ready thread.
    125  */
    126 
    127 RTEMS_INLINE_ROUTINE void _Thread_Calculate_heir( void )
    128 {
    129   _Thread_Heir = (Thread_Control *)
    130     _Thread_Ready_chain[ _Priority_bit_map_Get_highest() ].first;
    131 }
    132 
    133 /**
    134123 *  This function returns true if the floating point context of
    135124 *  the_thread is currently loaded in the floating point unit, and
    136125 *  false otherwise.
  • cpukit/score/src/thread.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/thread.c,v
    retrieving revision 1.63
    diff -u -p -r1.63 thread.c
     
    2424#include <rtems/score/isr.h>
    2525#include <rtems/score/object.h>
    2626#include <rtems/score/priority.h>
     27#include <rtems/score/readyq.h>
     28#include <rtems/score/scheduler.h>
    2729#include <rtems/score/states.h>
    2830#include <rtems/score/sysstate.h>
    2931#include <rtems/score/thread.h>
     
    4547
    4648void _Thread_Handler_initialization(void)
    4749{
    48   uint32_t     index;
    4950  uint32_t     ticks_per_timeslice;
    5051  uint32_t     maximum_extensions;
    5152  #if defined(RTEMS_MULTIPROCESSING)
    void _Thread_Handler_initialization(void 
    8081
    8182  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
    8283
    83   _Thread_Ready_chain = (Chain_Control *) _Workspace_Allocate_or_fatal_error(
    84     (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
    85   );
    86 
    87   for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
    88     _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
    89 
    9084#if defined(RTEMS_MULTIPROCESSING)
    9185  _Thread_MP_Handler_initialization( maximum_proxies );
    9286#endif
  • cpukit/score/src/threadchangepriority.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadchangepriority.c,v
    retrieving revision 1.13
    diff -u -p -r1.13 threadchangepriority.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/readyq.h>
     27#include <rtems/score/scheduler.h>
    2628#include <rtems/score/states.h>
    2729#include <rtems/score/sysstate.h>
    2830#include <rtems/score/thread.h>
    void _Thread_Change_priority( 
    120122     */
    121123    the_thread->current_state = _States_Clear( STATES_TRANSIENT, state );
    122124
    123     _Priority_bit_map_Add( &the_thread->Priority_map );
    124125    if ( prepend_it )
    125       _Chain_Prepend_unprotected( the_thread->ready, &the_thread->Object.Node );
     126      _Ready_queue_Enqueue_first( &_Scheduler.ready_queue, the_thread );
    126127    else
    127       _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node );
     128      _Ready_queue_Enqueue( &_Scheduler.ready_queue, the_thread );
    128129  }
    129130
    130131  _ISR_Flash( level );
    void _Thread_Change_priority( 
    133134   *  We altered the set of thread priorities.  So let's figure out
    134135   *  who is the heir and if we need to switch to them.
    135136   */
    136   _Thread_Calculate_heir();
     137  _Scheduler_Schedule(&_Scheduler);
    137138
    138   if ( !_Thread_Is_executing_also_the_heir() &&
    139        _Thread_Executing->is_preemptible )
    140     _Thread_Dispatch_necessary = true;
    141139  _ISR_Enable( level );
    142140}
  • cpukit/score/src/threadclearstate.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadclearstate.c,v
    retrieving revision 1.11
    diff -u -p -r1.11 threadclearstate.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/readyq.h>
     27#include <rtems/score/scheduler.h>
    2628#include <rtems/score/states.h>
    2729#include <rtems/score/sysstate.h>
    2830#include <rtems/score/thread.h>
    void _Thread_Clear_state( 
    6668      the_thread->current_state = _States_Clear( state, current_state );
    6769
    6870      if ( _States_Is_ready( current_state ) ) {
    69 
    70         _Priority_bit_map_Add( &the_thread->Priority_map );
    71 
    72         _Chain_Append_unprotected(the_thread->ready, &the_thread->Object.Node);
    73 
    74         _ISR_Flash( level );
    75 
    76         /*
    77          *  If the thread that was unblocked is more important than the heir,
    78          *  then we have a new heir.  This may or may not result in a
    79          *  context switch.
    80          *
    81          *  Normal case:
    82          *    If the current thread is preemptible, then we need to do
    83          *    a context switch.
    84          *  Pseudo-ISR case:
    85          *    Even if the thread isn't preemptible, if the new heir is
    86          *    a pseudo-ISR system task, we need to do a context switch.
    87          */
    88         if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
    89           _Thread_Heir = the_thread;
    90           if ( _Thread_Executing->is_preemptible ||
    91                the_thread->current_priority == 0 )
    92             _Thread_Dispatch_necessary = true;
    93         }
     71        _Scheduler_Unblock( &_Scheduler, the_thread);
    9472      }
    9573  }
    9674  _ISR_Enable( level );
  • cpukit/score/src/threadclose.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadclose.c,v
    retrieving revision 1.12
    diff -u -p -r1.12 threadclose.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/scheduler.h>
    2627#include <rtems/score/states.h>
    2728#include <rtems/score/sysstate.h>
    2829#include <rtems/score/thread.h>
    void _Thread_Close( 
    8687  }
    8788
    8889  /*
     90   * Free the per-thread scheduling information.
     91   */
     92  _Scheduler_Sched_free( &_Scheduler, the_thread );
     93
     94  /*
    8995   *  The thread might have been FP.  So deal with that.
    9096   */
    9197#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
  • cpukit/score/src/threadinitialize.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadinitialize.c,v
    retrieving revision 1.39
    diff -u -p -r1.39 threadinitialize.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/scheduler.h>
    2627#include <rtems/score/states.h>
    2728#include <rtems/score/sysstate.h>
    2829#include <rtems/score/thread.h>
    bool _Thread_Initialize( 
    6061  #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    6162    void              *fp_area;
    6263  #endif
     64  void                *sched = NULL;
    6365  void                *extensions_area;
    6466  bool                 extension_status;
    6567  int                  i;
    bool _Thread_Initialize( 
    192194  the_thread->resource_count          = 0;
    193195  the_thread->real_priority           = priority;
    194196  the_thread->Start.initial_priority  = priority;
     197  sched =_Scheduler_Sched_allocate( &_Scheduler, the_thread );
     198  if ( !sched )
     199    goto failed;
    195200  _Thread_Set_priority( the_thread, priority );
    196201
    197202  /*
    failed: 
    235240      (void) _Workspace_Free( fp_area );
    236241  #endif
    237242
     243  if ( sched )
     244    (void) _Workspace_Free( sched );
     245
    238246   _Thread_Stack_Free( the_thread );
    239247  return false;
    240248
  • cpukit/score/src/threadready.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadready.c,v
    retrieving revision 1.8
    diff -u -p -r1.8 threadready.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/readyq.h>
     27#include <rtems/score/scheduler.h>
    2628#include <rtems/score/states.h>
    2729#include <rtems/score/sysstate.h>
    2830#include <rtems/score/thread.h>
    void _Thread_Ready( 
    5557)
    5658{
    5759  ISR_Level              level;
    58   Thread_Control *heir;
    5960
    6061  _ISR_Disable( level );
    6162
    6263  the_thread->current_state = STATES_READY;
    6364
    64   _Priority_bit_map_Add( &the_thread->Priority_map );
    65 
    66   _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node );
    67 
    68   _ISR_Flash( level );
    69 
    70   _Thread_Calculate_heir();
    71 
    72   heir = _Thread_Heir;
    73 
    74   if ( !_Thread_Is_executing( heir ) && _Thread_Executing->is_preemptible )
    75     _Thread_Dispatch_necessary = true;
     65  _Scheduler_Unblock( &_Scheduler, the_thread );
    7666
    7767  _ISR_Enable( level );
    7868}
  • cpukit/score/src/threadresume.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadresume.c,v
    retrieving revision 1.11
    diff -u -p -r1.11 threadresume.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/readyq.h>
     27#include <rtems/score/scheduler.h>
    2628#include <rtems/score/states.h>
    2729#include <rtems/score/sysstate.h>
    2830#include <rtems/score/thread.h>
    void _Thread_Resume( 
    6870    the_thread->current_state = _States_Clear(STATES_SUSPENDED, current_state);
    6971
    7072    if ( _States_Is_ready( current_state ) ) {
    71 
    72       _Priority_bit_map_Add( &the_thread->Priority_map );
    73 
    74       _Chain_Append_unprotected(the_thread->ready, &the_thread->Object.Node);
    75 
    76       _ISR_Flash( level );
    77 
    78       if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
    79         _Thread_Heir = the_thread;
    80         if ( _Thread_Executing->is_preemptible ||
    81              the_thread->current_priority == 0 )
    82           _Thread_Dispatch_necessary = true;
    83       }
     73      _Scheduler_Unblock( &_Scheduler, the_thread );
    8474    }
    8575  }
    8676
  • cpukit/score/src/threadsetpriority.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadsetpriority.c,v
    retrieving revision 1.5
    diff -u -p -r1.5 threadsetpriority.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/readyq.h>
     27#include <rtems/score/scheduler.h>
    2628#include <rtems/score/states.h>
    2729#include <rtems/score/sysstate.h>
    2830#include <rtems/score/thread.h>
    void _Thread_Set_priority( 
    5052)
    5153{
    5254  the_thread->current_priority = new_priority;
    53   the_thread->ready            = &_Thread_Ready_chain[ new_priority ];
    5455
    55   _Priority_bit_map_Initialize_information(
    56       &the_thread->Priority_map,
    57       new_priority
    58   );
     56  _Scheduler_Sched_update(&_Scheduler, the_thread);
    5957}
  • cpukit/score/src/threadsetstate.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadsetstate.c,v
    retrieving revision 1.7
    diff -u -p -r1.7 threadsetstate.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/readyq.h>
     27#include <rtems/score/scheduler.h>
    2628#include <rtems/score/states.h>
    2729#include <rtems/score/sysstate.h>
    2830#include <rtems/score/thread.h>
    void _Thread_Set_state( 
    5456)
    5557{
    5658  ISR_Level      level;
    57   Chain_Control *ready;
    58 
    59   ready = the_thread->ready;
     59 
    6060  _ISR_Disable( level );
    6161  if ( !_States_Is_ready( the_thread->current_state ) ) {
    6262    the_thread->current_state =
    void _Thread_Set_state( 
    6767
    6868  the_thread->current_state = state;
    6969
    70   if ( _Chain_Has_only_one_node( ready ) ) {
    71 
    72     _Chain_Initialize_empty( ready );
    73     _Priority_bit_map_Remove( &the_thread->Priority_map );
    74 
    75   } else
    76     _Chain_Extract_unprotected( &the_thread->Object.Node );
    77 
    78   _ISR_Flash( level );
    79 
    80   if ( _Thread_Is_heir( the_thread ) )
    81      _Thread_Calculate_heir();
    82 
    83   if ( _Thread_Is_executing( the_thread ) )
    84     _Thread_Dispatch_necessary = true;
     70  _Scheduler_Block( &_Scheduler, the_thread);
    8571
    8672  _ISR_Enable( level );
    8773}
  • cpukit/score/src/threadsettransient.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadsettransient.c,v
    retrieving revision 1.6
    diff -u -p -r1.6 threadsettransient.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/readyq.h>
     27#include <rtems/score/scheduler.h>
    2628#include <rtems/score/states.h>
    2729#include <rtems/score/sysstate.h>
    2830#include <rtems/score/thread.h>
    void _Thread_Set_transient( 
    5456{
    5557  ISR_Level             level;
    5658  uint32_t              old_state;
    57   Chain_Control *ready;
    58 
    59   ready = the_thread->ready;
     59 
    6060  _ISR_Disable( level );
    6161
    6262  old_state = the_thread->current_state;
    6363  the_thread->current_state = _States_Set( STATES_TRANSIENT, old_state );
    6464
    6565  if ( _States_Is_ready( old_state ) ) {
    66     if ( _Chain_Has_only_one_node( ready ) ) {
    67 
    68       _Chain_Initialize_empty( ready );
    69       _Priority_bit_map_Remove( &the_thread->Priority_map );
    70 
    71     } else
    72       _Chain_Extract_unprotected( &the_thread->Object.Node );
     66    _Ready_queue_Extract(&_Scheduler.ready_queue, the_thread);
    7367  }
    7468
    7569  _ISR_Enable( level );
  • cpukit/score/src/threadsuspend.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadsuspend.c,v
    retrieving revision 1.8
    diff -u -p -r1.8 threadsuspend.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/readyq.h>
     27#include <rtems/score/scheduler.h>
    2628#include <rtems/score/states.h>
    2729#include <rtems/score/sysstate.h>
    2830#include <rtems/score/thread.h>
    void _Thread_Suspend( 
    5254)
    5355{
    5456  ISR_Level      level;
    55   Chain_Control *ready;
    56 
    57   ready = the_thread->ready;
     57 
    5858  _ISR_Disable( level );
    5959  if ( !_States_Is_ready( the_thread->current_state ) ) {
    6060    the_thread->current_state =
    void _Thread_Suspend( 
    6565
    6666  the_thread->current_state = STATES_SUSPENDED;
    6767
    68   if ( _Chain_Has_only_one_node( ready ) ) {
    69 
    70     _Chain_Initialize_empty( ready );
    71     _Priority_bit_map_Remove( &the_thread->Priority_map );
    72 
    73   } else
    74     _Chain_Extract_unprotected( &the_thread->Object.Node );
    75 
    76   _ISR_Flash( level );
    77 
    78   if ( _Thread_Is_heir( the_thread ) )
    79      _Thread_Calculate_heir();
    80 
    81   if ( _Thread_Is_executing( the_thread ) )
    82     _Thread_Dispatch_necessary = true;
     68  _Scheduler_Block(&_Scheduler, the_thread);
    8369
    8470  _ISR_Enable( level );
    8571}
  • cpukit/score/src/threadtickletimeslice.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threadtickletimeslice.c,v
    retrieving revision 1.12
    diff -u -p -r1.12 threadtickletimeslice.c
     
    2323#include <rtems/score/isr.h>
    2424#include <rtems/score/object.h>
    2525#include <rtems/score/priority.h>
     26#include <rtems/score/scheduler.h>
    2627#include <rtems/score/states.h>
    2728#include <rtems/score/sysstate.h>
    2829#include <rtems/score/thread.h>
    void _Thread_Tickle_timeslice( void ) 
    8990         *  currently executing thread is placed at the rear of the
    9091         *  FIFO for this priority and a new heir is selected.
    9192         */
    92         _Thread_Yield_processor();
     93        _Scheduler_Yield( );
    9394        executing->cpu_time_budget = _Thread_Ticks_per_timeslice;
    9495      }
    9596      break;
  • testsuites/sptests/spsize/size.c

    RCS file: /usr1/CVS/rtems/testsuites/sptests/spsize/size.c,v
    retrieving revision 1.65
    diff -u -p -r1.65 size.c
     
    3737#include <rtems/rtems/region.h>
    3838#include <rtems/rtems/sem.h>
    3939#include <rtems/rtems/signal.h>
     40#include <rtems/score/scheduler.h>
    4041#include <rtems/score/sysstate.h>
    4142#include <rtems/score/thread.h>
    4243#include <rtems/rtems/timer.h>
     
    4950#include <unistd.h>
    5051#include <tmacros.h>
    5152
     53#include "system.h"
     54
    5255/* external function prototypes */
    5356int getint( void );
    5457void size_rtems(int mode);
    void print_formula(void); 
    6467 */
    6568#define  HEAP_OVHD        16    /* wasted heap space per task stack */
    6669#define  NAME_PTR_SIZE     8    /* size of name and pointer table entries */
    67 #define  READYCHAINS_SIZE  \
     70
     71#if CONFIGURE_SCHEDULER_POLICY == _Scheduler_PRIORITY
     72  #include <rtems/score/prioritybitmap.h>
     73
     74  /* Priority scheduling uninitialized (globals) consumption */
     75  #define SCHEDULER_OVHD          ((sizeof _Scheduler)              + \
     76                                   (sizeof _Priority_Major_bit_map) + \
     77                                   (sizeof _Priority_Bit_map))
     78
     79  /* Priority scheduling per-thread consumption. Gets
     80   * included in the PER_TASK consumption. */
     81  #define SCHEDULER_TASK_WKSP     (sizeof(Scheduler_priority_Per_thread))
     82
     83  /* Priority scheduling workspace consumption
     84   *
     85   * Include allocation of ready queue.  Pointers are already counted by
     86   * including _Scheduler in SCHEDULER_OVHD.
     87   */
     88  #define  SCHEDULER_WKSP_SIZE  \
    6889    ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control ))
     90#endif
    6991
    7092#define PER_TASK      \
    7193     (long) (sizeof (Thread_Control) + \
    72       NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control ))
     94      NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control ) + \
     95      SCHEDULER_TASK_WKSP )
    7396#define PER_SEMAPHORE \
    7497     (long) (sizeof (Semaphore_Control) + NAME_PTR_SIZE)
    7598#define PER_TIMER     \
    int initialized = 0; 
    159182 *
    160183 *    + Object MP
    161184 *      - Global Object CB's
    162  *    + Thread
    163  *      - Ready Chain
    164185 *    + Thread MP
    165186 *      - Proxies Chain
     187 *    + Scheduler
     188 *      - Ready queue
    166189 *    + Interrupt Manager
    167190 *      - Interrupt Stack
    168191 *    + Timer Manager
    int initialized = 0; 
    195218 *  The following calculates the overhead needed by RTEMS from the
    196219 *  Workspace Area.
    197220 */
    198 sys_req = SYSTEM_TASKS     +     /* MPCI Receive Server and IDLE */
    199           NAME_PTR_SIZE    +     /* Task Overhead */
    200           READYCHAINS_SIZE +     /* Ready Chains */
    201           NAME_PTR_SIZE    +     /* Timer Overhead */
    202           NAME_PTR_SIZE    +     /* Semaphore Overhead */
    203           NAME_PTR_SIZE    +     /* Message Queue Overhead */
    204           NAME_PTR_SIZE    +     /* Region Overhead */
    205           NAME_PTR_SIZE    +     /* Partition Overhead */
    206           NAME_PTR_SIZE    +     /* Dual-Ported Memory Overhead */
    207           NAME_PTR_SIZE    +     /* Rate Monotonic Overhead */
    208           NAME_PTR_SIZE    +     /* Extension Overhead */
    209           PER_NODE;              /* Extra Gobject Table */
     221sys_req = SYSTEM_TASKS        +     /* MPCI Receive Server and IDLE */
     222          NAME_PTR_SIZE       +     /* Task Overhead */
     223          SCHEDULER_WKSP_SIZE +     /* Scheduler Overhead */
     224          NAME_PTR_SIZE       +     /* Timer Overhead */
     225          NAME_PTR_SIZE       +     /* Semaphore Overhead */
     226          NAME_PTR_SIZE       +     /* Message Queue Overhead */
     227          NAME_PTR_SIZE       +     /* Region Overhead */
     228          NAME_PTR_SIZE       +     /* Partition Overhead */
     229          NAME_PTR_SIZE       +     /* Dual-Ported Memory Overhead */
     230          NAME_PTR_SIZE       +     /* Rate Monotonic Overhead */
     231          NAME_PTR_SIZE       +     /* Extension Overhead */
     232          PER_NODE;                 /* Extra Gobject Table */
    210233
    211234uninitialized =
    212235/*address.h*/   0                                         +
    uninitialized = 
    311334
    312335/*percpu.h*/    (sizeof _Per_CPU_Information)             +
    313336
    314 /*priority.h*/  (sizeof _Priority_Major_bit_map)          +
    315                 (sizeof _Priority_Bit_map)                +
    316 
    317337/*ratemon.h*/   (sizeof _Rate_monotonic_Information)      +
    318338
    319339/*region.h*/    (sizeof _Region_Information)              +
    uninitialized = 
    324344
    325345/*rtems.h*/     /* Not applicable */
    326346
     347/*scheduler.h*/ SCHEDULER_OVHD                            +
     348
    327349/*sem.h*/       (sizeof _Semaphore_Information)           +
    328350
    329351#if defined(RTEMS_MULTIPROCESSING)
    uninitialized = 
    355377                (sizeof _Thread_Dispatch_disable_level)   +
    356378                (sizeof _Thread_Maximum_extensions)       +
    357379                (sizeof _Thread_Ticks_per_timeslice)      +
    358                 (sizeof _Thread_Ready_chain)              +
    359380                (sizeof _Thread_Executing)                +
    360381                (sizeof _Thread_Heir)                     +
    361382#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
  • testsuites/tmtests/tm26/task1.c

    RCS file: /usr1/CVS/rtems/testsuites/tmtests/tm26/task1.c,v
    retrieving revision 1.30
    diff -u -p -r1.30 task1.c
    rtems_task Middle_task( 
    242242  Middle_tcb   = _Thread_Executing;
    243243
    244244  _Thread_Executing =
    245         (Thread_Control *) _Thread_Ready_chain[LOW_PRIORITY].first;
     245        (Thread_Control *)
     246        _Scheduler.ready_queue.Queues.Priority[LOW_PRIORITY].first;
    246247
    247248  /* do not force context switch */
    248249
    rtems_task Low_task( 
    279280  context_switch_another_task_time = benchmark_timer_read();
    280281
    281282  _Thread_Executing =
    282         (Thread_Control *) _Thread_Ready_chain[FP1_PRIORITY].first;
     283        (Thread_Control *)
     284        _Scheduler.ready_queue.Queues.Priority[FP1_PRIORITY].first;
    283285
    284286  /* do not force context switch */
    285287
    rtems_task Floating_point_task_1( 
    306308  executing = _Thread_Executing;
    307309
    308310  _Thread_Executing =
    309         (Thread_Control *) _Thread_Ready_chain[FP2_PRIORITY].first;
     311        (Thread_Control *)
     312        _Scheduler.ready_queue.Queues.Priority[FP2_PRIORITY].first;
    310313
    311314  /* do not force context switch */
    312315
    rtems_task Floating_point_task_1( 
    329332  executing = _Thread_Executing;
    330333
    331334  _Thread_Executing =
    332        (Thread_Control *) _Thread_Ready_chain[FP2_PRIORITY].first;
     335       (Thread_Control *)
     336       _Scheduler.ready_queue.Queues.Priority[FP2_PRIORITY].first;
    333337
    334338  /* do not force context switch */
    335339
    rtems_task Floating_point_task_2( 
    358362  executing = _Thread_Executing;
    359363
    360364  _Thread_Executing =
    361        (Thread_Control *) _Thread_Ready_chain[FP1_PRIORITY].first;
     365       (Thread_Control *)
     366       _Scheduler.ready_queue.Queues.Priority[FP1_PRIORITY].first;
    362367
    363368  FP_LOAD( 1.0 );
    364369
  • testsuites/tmtests/tm27/task1.c

    RCS file: /usr1/CVS/rtems/testsuites/tmtests/tm27/task1.c,v
    retrieving revision 1.27
    diff -u -p -r1.27 task1.c
    rtems_task Task_1( 
    170170
    171171  _Thread_Dispatch_disable_level = 0;
    172172
    173   _Thread_Heir = (rtems_tcb *) _Thread_Ready_chain[LOW_PRIORITY].last;
     173  _Thread_Heir = (rtems_tcb *)
     174        _Scheduler.ready_queue.Queues.Priority[LOW_PRIORITY].last;
    174175
    175176  _Thread_Dispatch_necessary = 1;
    176177
    rtems_task Task_2( 
    227228
    228229  _Thread_Dispatch_disable_level = 0;
    229230
    230   _Thread_Heir = (rtems_tcb *) _Thread_Ready_chain[LOW_PRIORITY].first;
     231  _Thread_Heir = (rtems_tcb *)
     232      _Scheduler.ready_queue.Queues.Priority[LOW_PRIORITY].first;
    231233
    232234  _Thread_Dispatch_necessary = 1;
    233235