Changeset e1598a6 in rtems


Ignore:
Timestamp:
Apr 4, 2014, 8:56:36 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
69aa3349
Parents:
dc18190
git-author:
Sebastian Huber <sebastian.huber@…> (04/04/14 08:56:36)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/15/14 06:37:11)
Message:

score: Static scheduler configuration

Do not allocate the scheduler control structures from the workspace.
This is a preparation step for configuration of clustered/partitioned
schedulers on SMP.

Files:
1 added
84 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/Makefile.am

    rdc18190 re1598a6  
    1818include_rtems_HEADERS += include/rtems/rbheap.h
    1919include_rtems_HEADERS += include/rtems/rbtree.h
     20include_rtems_HEADERS += include/rtems/scheduler.h
    2021include_rtems_HEADERS += include/rtems/sptables.h
    2122include_rtems_HEADERS += include/rtems/test.h
  • cpukit/sapi/include/confdefs.h

    rdc18190 re1598a6  
    640640 * An application can define its own scheduling policy by defining
    641641 * CONFIGURE_SCHEDULER_USER and the following:
    642  *    - CONFIGURE_SCHEDULER_ENTRY_POINTS
    643  *    - CONFIGURE_MEMORY_FOR_SCHEDULER - base memory
     642 *    - CONFIGURE_SCHEDULER_CONTEXT
     643 *    - CONFIGURE_SCHEDULER_CONTROLS
    644644 *    - CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER - per task memory
    645645 */
    646 #include <rtems/score/scheduler.h>
    647 
    648 #if !defined(RTEMS_SMP)
    649   #undef CONFIGURE_SCHEDULER_SIMPLE_SMP
    650 #endif
    651646
    652647/* If no scheduler is specified, the priority scheduler is default. */
     
    666661#endif
    667662
     663#include <rtems/scheduler.h>
     664
    668665/*
    669666 * If the Priority Scheduler is selected, then configure for it.
    670667 */
    671668#if defined(CONFIGURE_SCHEDULER_PRIORITY)
    672   #include <rtems/score/schedulerpriority.h>
    673   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_ENTRY_POINTS
     669  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     670    #define CONFIGURE_SCHEDULER_CONTEXT \
     671      RTEMS_SCHEDULER_CONTEXT_PRIORITY( \
     672        dflt, \
     673        CONFIGURE_MAXIMUM_PRIORITY + 1 \
     674      )
     675
     676    #define CONFIGURE_SCHEDULER_CONTROLS \
     677      RTEMS_SCHEDULER_CONTROL_PRIORITY(dflt)
     678  #endif
    674679
    675680  /**
    676681   * This defines the memory used by the priority scheduler.
    677682   */
    678   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    679     _Configure_From_workspace( \
    680       sizeof(Scheduler_priority_Control) +  \
    681       ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
    682   )
    683683  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    684684    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
     
    690690 */
    691691#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
    692   #include <rtems/score/schedulerprioritysmp.h>
    693   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_SMP_ENTRY_POINTS
     692  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     693    #define CONFIGURE_SCHEDULER_CONTEXT \
     694      RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( \
     695        dflt, \
     696        CONFIGURE_MAXIMUM_PRIORITY + 1 \
     697      )
     698
     699    #define CONFIGURE_SCHEDULER_CONTROLS \
     700      RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(dflt)
     701  #endif
    694702
    695703  /**
    696704   * This defines the memory used by the priority scheduler.
    697705   */
    698   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    699     _Configure_From_workspace( \
    700       sizeof(Scheduler_priority_SMP_Control) +  \
    701       ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
    702   )
    703706  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    704707    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
     
    710713 */
    711714#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
    712   #include <rtems/score/schedulerpriorityaffinitysmp.h>
    713   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS
     715  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     716    #define CONFIGURE_SCHEDULER_CONTEXT \
     717      RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( \
     718        dflt, \
     719        CONFIGURE_MAXIMUM_PRIORITY + 1 \
     720      )
     721
     722    #define CONFIGURE_SCHEDULER_CONTROLS \
     723      RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP(dflt)
     724  #endif
    714725
    715726  /**
    716727   * This defines the memory used by the priority scheduler.
    717728   */
    718   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    719     _Configure_From_workspace( \
    720       sizeof(Scheduler_SMP_Control) +  \
    721       ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
    722   )
    723729  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    724730    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
     
    729735 */
    730736#if defined(CONFIGURE_SCHEDULER_SIMPLE)
    731   #include <rtems/score/schedulersimple.h>
    732   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
     737  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     738    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_SIMPLE(dflt)
     739
     740    #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_SIMPLE(dflt)
     741  #endif
    733742
    734743  /**
    735744   * define the memory used by the simple scheduler
    736745   */
    737   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    738     _Configure_From_workspace( sizeof( Scheduler_simple_Control ) ) \
    739   )
    740746  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
    741747#endif
     
    745751 */
    746752#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
    747   #include <rtems/score/schedulersimplesmp.h>
    748   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_SMP_ENTRY_POINTS
     753  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     754    #define CONFIGURE_SCHEDULER_CONTEXT \
     755      RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(dflt)
     756
     757    #define CONFIGURE_SCHEDULER_CONTROLS \
     758      RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(dflt)
     759  #endif
    749760
    750761  /**
     
    753764   * NOTE: This is the same as the Simple Scheduler
    754765   */
    755   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    756     _Configure_From_workspace( sizeof( Scheduler_simple_SMP_Control ) ) \
    757   )
    758766  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
    759767#endif
     
    763771 */
    764772#if defined(CONFIGURE_SCHEDULER_EDF)
    765   #include <rtems/score/scheduleredf.h>
    766   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_EDF_ENTRY_POINTS
     773  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     774    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_EDF(dflt)
     775
     776    #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_EDF(dflt)
     777  #endif
    767778
    768779  /**
    769780   * define the memory used by the EDF scheduler
    770781   */
    771   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    772     _Configure_From_workspace(sizeof(Scheduler_EDF_Control)))
    773782  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    774783    _Configure_From_workspace(sizeof(Scheduler_EDF_Per_thread)))
     
    779788 */
    780789#if defined(CONFIGURE_SCHEDULER_CBS)
    781   #include <rtems/score/schedulercbs.h>
    782   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_CBS_ENTRY_POINTS
     790  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     791    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_CBS(dflt)
     792
     793    #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_CBS(dflt)
     794  #endif
    783795
    784796  #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
     
    787799
    788800  #ifdef CONFIGURE_INIT
    789     uint32_t _Scheduler_CBS_Maximum_servers = CONFIGURE_CBS_MAXIMUM_SERVERS;
     801    const uint32_t _Scheduler_CBS_Maximum_servers =
     802      CONFIGURE_CBS_MAXIMUM_SERVERS;
     803
     804    Scheduler_CBS_Server
     805      _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ];
    790806  #endif
    791807
     
    793809   * define the memory used by the CBS scheduler
    794810   */
    795   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    796     _Configure_From_workspace(sizeof(Scheduler_EDF_Control)) + \
    797       _Configure_From_workspace(CONFIGURE_CBS_MAXIMUM_SERVERS * \
    798         sizeof(Scheduler_CBS_Server *)) + \
    799       CONFIGURE_CBS_MAXIMUM_SERVERS * \
    800         _Configure_From_workspace(sizeof(Scheduler_CBS_Server)))
    801811  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    802812    _Configure_From_workspace(sizeof(Scheduler_CBS_Per_thread)))
     
    808818 */
    809819#ifdef CONFIGURE_INIT
    810   Scheduler_Control  _Scheduler = {
    811     NULL,                             /* Scheduler Specific Data Pointer */
    812     CONFIGURE_SCHEDULER_ENTRY_POINTS  /* Scheduler Operations */
     820  CONFIGURE_SCHEDULER_CONTEXT;
     821
     822  const Scheduler_Control _Scheduler_Table[] = {
     823    CONFIGURE_SCHEDULER_CONTROLS
    813824  };
     825
     826  #if defined(RTEMS_SMP)
     827    const size_t _Scheduler_Count =
     828      RTEMS_ARRAY_SIZE( _Scheduler_Table );
     829  #endif
    814830
    815831  #if defined(CONFIGURE_SCHEDULER_EDF)
     
    22082224#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
    22092225  ( CONFIGURE_MEMORY_FOR_IDLE_TASK +                /* IDLE and stack */ \
    2210     CONFIGURE_MEMORY_FOR_SCHEDULER +                /* Scheduler */ \
    22112226    CONFIGURE_INTERRUPT_VECTOR_TABLE +             /* interrupt vectors */ \
    22122227    CONFIGURE_INTERRUPT_STACK_MEMORY +             /* interrupt stack */ \
     
    24762491    #endif
    24772492    #ifdef RTEMS_SMP
    2478       CONFIGURE_SMP_MAXIMUM_PROCESSORS
     2493      CONFIGURE_SMP_MAXIMUM_PROCESSORS,
    24792494    #endif
    24802495  };
     
    25582573    uint32_t INTERRUPT_STACK_MEMORY;
    25592574    uint32_t MEMORY_FOR_IDLE_TASK;
    2560     uint32_t MEMORY_FOR_SCHEDULER;
    25612575    uint32_t MEMORY_PER_TASK_FOR_SCHEDULER;
    25622576
     
    26152629    CONFIGURE_INTERRUPT_STACK_MEMORY,
    26162630    CONFIGURE_MEMORY_FOR_IDLE_TASK,
    2617     CONFIGURE_MEMORY_FOR_SCHEDULER,
    26182631    CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER,
    26192632
  • cpukit/sapi/preinstall.am

    rdc18190 re1598a6  
    8585PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rbtree.h
    8686
     87$(PROJECT_INCLUDE)/rtems/scheduler.h: include/rtems/scheduler.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
     88        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/scheduler.h
     89PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/scheduler.h
     90
    8791$(PROJECT_INCLUDE)/rtems/sptables.h: include/rtems/sptables.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
    8892        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/sptables.h
  • cpukit/score/include/rtems/score/scheduler.h

    rdc18190 re1598a6  
    2121
    2222#include <rtems/score/percpu.h>
    23 #include <rtems/score/chain.h>
    2423#include <rtems/score/priority.h>
     24#include <rtems/score/thread.h>
    2525#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
    2626  #include <sys/cpuset.h>
     
    4949typedef struct {
    5050  /** Implements the scheduling decision logic (policy). */
    51   void ( *initialize )(void);
     51  void ( *initialize )( const Scheduler_Control * );
    5252
    5353  /** Implements the scheduling decision logic (policy). */
    54   void ( *schedule )( Scheduler_Control *, Thread_Control *);
     54  void ( *schedule )( const Scheduler_Control *, Thread_Control *);
    5555
    5656  /**
     
    5959   * @see _Scheduler_Yield().
    6060   */
    61   void ( *yield )( Scheduler_Control *, Thread_Control *);
     61  void ( *yield )( const Scheduler_Control *, Thread_Control *);
    6262
    6363  /** Removes the given thread from scheduling decisions. */
    64   void ( *block )( Scheduler_Control *, Thread_Control * );
     64  void ( *block )( const Scheduler_Control *, Thread_Control * );
    6565
    6666  /** Adds the given thread to scheduling decisions. */
    67   void ( *unblock )( Scheduler_Control *, Thread_Control * );
     67  void ( *unblock )( const Scheduler_Control *, Thread_Control * );
    6868
    6969  /** allocates the scheduler field of the given thread */
    70   void * ( *allocate )( Scheduler_Control *, Thread_Control * );
     70  void * ( *allocate )( const Scheduler_Control *, Thread_Control * );
    7171
    7272  /** frees the scheduler field of the given thread */
    73   void ( *free )( Scheduler_Control *, Thread_Control * );
     73  void ( *free )( const Scheduler_Control *, Thread_Control * );
    7474
    7575  /** updates the scheduler field of the given thread -- primarily used
    7676   * when changing the thread's priority. */
    77   void ( *update )( Scheduler_Control *, Thread_Control * );
     77  void ( *update )( const Scheduler_Control *, Thread_Control * );
    7878
    7979  /** enqueue a thread as the last of its priority group */
    80   void ( *enqueue )( Scheduler_Control *, Thread_Control * );
     80  void ( *enqueue )( const Scheduler_Control *, Thread_Control * );
    8181
    8282  /** enqueue a thread as the first of its priority group */
    83   void ( *enqueue_first )( Scheduler_Control *, Thread_Control * );
     83  void ( *enqueue_first )( const Scheduler_Control *, Thread_Control * );
    8484
    8585  /** extract a thread from the ready set */
    86   void ( *extract )( Scheduler_Control *, Thread_Control * );
     86  void ( *extract )( const Scheduler_Control *, Thread_Control * );
    8787
    8888  /**
     
    9696
    9797  /** This routine is called upon release of a new job. */
    98   void ( *release_job ) ( Scheduler_Control *, Thread_Control *, uint32_t );
     98  void ( *release_job ) (
     99    const Scheduler_Control *,
     100    Thread_Control *,
     101    uint32_t
     102  );
    99103
    100104  /** perform scheduler update actions required at each clock tick */
    101   void ( *tick )( Scheduler_Control * );
     105  void ( *tick )( const Scheduler_Control * );
    102106
    103107  /**
     
    107111   */
    108112  void ( *start_idle )(
    109     Scheduler_Control *,
     113    const Scheduler_Control *,
    110114    Thread_Control *,
    111115    Per_CPU_Control *
     
    119123   */
    120124  bool ( *get_affinity )(
    121     Scheduler_Control *,
     125    const Scheduler_Control *,
    122126    Thread_Control *,
    123127    size_t,
     
    131135   */
    132136  bool ( *set_affinity )(
    133     Scheduler_Control *,
     137    const Scheduler_Control *,
    134138    Thread_Control *,
    135139    size_t,
     
    140144
    141145/**
    142  * This is the structure used to manage the scheduler.
     146 * @brief Scheduler context.
     147 *
     148 * The scheduler context of a particular scheduler implementation must place
     149 * this structure at the begin of its context structure.
     150 */
     151typedef struct {
     152  /* No fields yet */
     153} Scheduler_Context;
     154
     155/**
     156 * @brief Scheduler control.
    143157 */
    144158struct Scheduler_Control {
    145159  /**
    146    *  This points to the data structure used to manage the ready set of
    147    *  tasks. The pointer varies based upon the type of
    148    *  ready queue required by the scheduler.
    149    */
    150   void                   *information;
    151 
    152   /** The jump table for scheduler-specific functions */
    153   Scheduler_Operations    Operations;
     160   * @brief Reference to a statically allocated scheduler context.
     161   */
     162  Scheduler_Context *context;
     163
     164  /**
     165   * @brief The scheduler operations.
     166  */
     167  Scheduler_Operations Operations;
    154168};
    155169
    156170/**
    157  *  The _Scheduler holds the structures used to manage the
    158  *  scheduler.
    159  *
    160  * @note Can we make this per-cpu? then _Scheduler will be a macro.
    161  *
    162  * @note This is instantiated and initialized in confdefs.h.
    163  */
    164 extern Scheduler_Control  _Scheduler;
     171 * @brief Registered schedulers.
     172 *
     173 * Application provided via <rtems/confdefs.h>.
     174 *
     175 * @see _Scheduler_Count.
     176 */
     177extern const Scheduler_Control _Scheduler_Table[];
     178
     179/**
     180 * @brief Count of registered schedulers.
     181 *
     182 * Application provided via <rtems/confdefs.h> on SMP configurations.
     183 *
     184 * It is very important that this is a compile-time constant on uni-processor
     185 * configurations (in this case RTEMS_SMP is not defined) so that the compiler
     186 * can optimize the some loops away
     187 *
     188 * @see _Scheduler_Table.
     189 */
     190#if defined(RTEMS_SMP)
     191  extern const size_t _Scheduler_Count;
     192#else
     193  #define _Scheduler_Count ( (size_t) 1 )
     194#endif
    165195
    166196/**
     
    173203 */
    174204void *_Scheduler_default_Allocate(
    175   Scheduler_Control *scheduler,
    176   Thread_Control    *the_thread
     205  const Scheduler_Control *scheduler,
     206  Thread_Control          *the_thread
    177207);
    178208
     
    184214 */
    185215void _Scheduler_default_Free(
    186   Scheduler_Control *scheduler,
    187   Thread_Control    *the_thread
     216  const Scheduler_Control *scheduler,
     217  Thread_Control          *the_thread
    188218);
    189219
     
    195225 */
    196226void _Scheduler_default_Update(
    197   Scheduler_Control *scheduler,
    198   Thread_Control    *the_thread
     227  const Scheduler_Control *scheduler,
     228  Thread_Control          *the_thread
    199229);
    200230
     
    207237 */
    208238void _Scheduler_default_Release_job(
    209   Scheduler_Control *scheduler,
    210   Thread_Control    *the_thread,
    211   uint32_t           deadline
     239  const Scheduler_Control *scheduler,
     240  Thread_Control          *the_thread,
     241  uint32_t                 deadline
    212242);
    213243
     
    220250 * @param[in] scheduler The scheduler.
    221251 */
    222 void _Scheduler_default_Tick( Scheduler_Control *scheduler );
     252void _Scheduler_default_Tick( const Scheduler_Control *scheduler );
    223253
    224254/**
     
    230260 */
    231261void _Scheduler_default_Start_idle(
    232   Scheduler_Control *scheduler,
    233   Thread_Control    *the_thread,
    234   Per_CPU_Control   *cpu
     262  const Scheduler_Control *scheduler,
     263  Thread_Control          *the_thread,
     264  Per_CPU_Control         *cpu
    235265);
    236266
     
    247277   */
    248278  bool _Scheduler_default_Get_affinity(
    249     Scheduler_Control *scheduler,
    250     Thread_Control    *thread,
    251     size_t             cpusetsize,
    252     cpu_set_t         *cpuset
     279    const Scheduler_Control *scheduler,
     280    Thread_Control          *thread,
     281    size_t                   cpusetsize,
     282    cpu_set_t               *cpuset
    253283  );
    254284
     
    266296   */
    267297  bool _Scheduler_default_Set_affinity(
    268     Scheduler_Control *scheduler,
    269     Thread_Control    *thread,
    270     size_t             cpusetsize,
    271     const cpu_set_t   *cpuset
     298    const Scheduler_Control *scheduler,
     299    Thread_Control          *thread,
     300    size_t                   cpusetsize,
     301    const cpu_set_t         *cpuset
    272302  );
    273303#endif
  • cpukit/score/include/rtems/score/schedulercbs.h

    rdc18190 re1598a6  
    8282
    8383/** Maximum number of simultaneous servers. */
    84 extern uint32_t _Scheduler_CBS_Maximum_servers;
     84extern const uint32_t _Scheduler_CBS_Maximum_servers;
    8585
    8686/** Server id. */
     
    116116  /** Callback function invoked when a budget overrun occurs. */
    117117  Scheduler_CBS_Budget_overrun  cbs_budget_overrun;
     118
     119  /**
     120   * @brief Indicates if this CBS server is initialized.
     121   *
     122   * @see _Scheduler_CBS_Create_server() and _Scheduler_CBS_Destroy_server().
     123   */
     124  bool initialized;
    118125} Scheduler_CBS_Server;
    119126
     
    133140 * of pointers to @a _Scheduler_CBS_Server_list.
    134141 */
    135 extern Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
     142extern Scheduler_CBS_Server _Scheduler_CBS_Server_list[];
    136143
    137144/**
     
    149156 */
    150157void _Scheduler_CBS_Unblock(
    151   Scheduler_Control *scheduler,
    152   Thread_Control    *the_thread
     158  const Scheduler_Control *scheduler,
     159  Thread_Control          *the_thread
    153160);
    154161
     
    166173
    167174void _Scheduler_CBS_Release_job (
    168   Scheduler_Control *scheduler,
    169   Thread_Control    *the_thread,
    170   uint32_t           length
     175  const Scheduler_Control *scheduler,
     176  Thread_Control          *the_thread,
     177  uint32_t                 length
    171178);
    172179
     
    339346 */
    340347void *_Scheduler_CBS_Allocate(
    341   Scheduler_Control *scheduler,
    342   Thread_Control    *the_thread
    343 );
     348  const Scheduler_Control *scheduler,
     349  Thread_Control          *the_thread
     350);
     351
    344352#ifdef __cplusplus
    345353}
  • cpukit/score/include/rtems/score/scheduleredf.h

    rdc18190 re1598a6  
    6969typedef struct {
    7070  /**
     71   * @brief Basic scheduler context.
     72   */
     73  Scheduler_Context Base;
     74
     75  /**
    7176   * Top of the ready queue.
    7277   */
    7378  RBTree_Control Ready;
    74 } Scheduler_EDF_Control;
     79} Scheduler_EDF_Context;
    7580
    7681/**
     
    109114 * This routine initializes the EDF scheduler.
    110115 */
    111 void _Scheduler_EDF_Initialize( void );
     116void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
    112117
    113118/**
     
    122127 */
    123128void _Scheduler_EDF_Block(
    124   Scheduler_Control *scheduler,
    125   Thread_Control    *the_thread
     129  const Scheduler_Control *scheduler,
     130  Thread_Control          *the_thread
    126131);
    127132
     
    134139 */
    135140void _Scheduler_EDF_Schedule(
    136   Scheduler_Control *scheduler,
    137   Thread_Control    *the_thread
     141  const Scheduler_Control *scheduler,
     142  Thread_Control          *the_thread
    138143);
    139144
     
    147152 */
    148153void *_Scheduler_EDF_Allocate(
    149   Scheduler_Control *scheduler,
    150   Thread_Control    *the_thread
     154  const Scheduler_Control *scheduler,
     155  Thread_Control          *the_thread
    151156);
    152157
     
    160165 */
    161166void _Scheduler_EDF_Free(
    162   Scheduler_Control *scheduler,
    163   Thread_Control    *the_thread
     167  const Scheduler_Control *scheduler,
     168  Thread_Control          *the_thread
    164169);
    165170
     
    173178 */
    174179void _Scheduler_EDF_Update(
    175   Scheduler_Control *scheduler,
    176   Thread_Control    *the_thread
     180  const Scheduler_Control *scheduler,
     181  Thread_Control          *the_thread
    177182);
    178183
     
    187192 */
    188193void _Scheduler_EDF_Unblock(
    189   Scheduler_Control *scheduler,
    190   Thread_Control    *the_thread
     194  const Scheduler_Control *scheduler,
     195  Thread_Control          *the_thread
    191196);
    192197
     
    207212 */
    208213void _Scheduler_EDF_Yield(
    209   Scheduler_Control *scheduler,
    210   Thread_Control    *the_thread
     214  const Scheduler_Control *scheduler,
     215  Thread_Control          *the_thread
    211216);
    212217
     
    219224 */
    220225void _Scheduler_EDF_Enqueue(
    221   Scheduler_Control *scheduler,
    222   Thread_Control    *the_thread
     226  const Scheduler_Control *scheduler,
     227  Thread_Control          *the_thread
    223228);
    224229
     
    232237 */
    233238void _Scheduler_EDF_Enqueue_first(
    234   Scheduler_Control *scheduler,
    235   Thread_Control    *the_thread
     239  const Scheduler_Control *scheduler,
     240  Thread_Control          *the_thread
    236241);
    237242
     
    246251 */
    247252void _Scheduler_EDF_Extract(
    248   Scheduler_Control *scheduler,
    249   Thread_Control    *the_thread
     253  const Scheduler_Control *scheduler,
     254  Thread_Control          *the_thread
    250255);
    251256
     
    276281 */
    277282void _Scheduler_EDF_Release_job (
    278   Scheduler_Control *scheduler,
    279   Thread_Control    *the_thread,
    280   uint32_t           deadline
     283  const Scheduler_Control *scheduler,
     284  Thread_Control          *the_thread,
     285  uint32_t                 deadline
    281286);
    282287
  • cpukit/score/include/rtems/score/scheduleredfimpl.h

    rdc18190 re1598a6  
    3232 */
    3333
    34 RTEMS_INLINE_ROUTINE Scheduler_EDF_Control *
    35   _Scheduler_EDF_Self_from_base( Scheduler_Control *scheduler_base )
     34RTEMS_INLINE_ROUTINE Scheduler_EDF_Context *
     35  _Scheduler_EDF_Get_context( const Scheduler_Control *scheduler )
    3636{
    37   return (Scheduler_EDF_Control *) scheduler_base->information;
     37  return (Scheduler_EDF_Context *) scheduler->context;
    3838}
    3939
    4040RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
    41   Scheduler_Control *scheduler_base,
    42   Thread_Control    *the_thread,
    43   bool               force_dispatch
     41  const Scheduler_Control *scheduler,
     42  Thread_Control          *the_thread,
     43  bool                     force_dispatch
    4444)
    4545{
    46   Scheduler_EDF_Control *scheduler =
    47     _Scheduler_EDF_Self_from_base( scheduler_base );
    48   RBTree_Node *first = _RBTree_First(&scheduler->Ready, RBT_LEFT);
     46  Scheduler_EDF_Context *context =
     47    _Scheduler_EDF_Get_context( scheduler );
     48  RBTree_Node *first = _RBTree_First( &context->Ready, RBT_LEFT );
    4949  Scheduler_EDF_Per_thread *sched_info =
    5050    _RBTree_Container_of(first, Scheduler_EDF_Per_thread, Node);
  • cpukit/score/include/rtems/score/schedulerimpl.h

    rdc18190 re1598a6  
    6565 */
    6666RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
    67   Scheduler_Control *scheduler,
    68   Thread_Control    *the_thread
     67  const Scheduler_Control *scheduler,
     68  Thread_Control          *the_thread
    6969)
    7070{
     
    8181 */
    8282RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
    83   Scheduler_Control *scheduler,
    84   Thread_Control    *the_thread
     83  const Scheduler_Control *scheduler,
     84  Thread_Control          *the_thread
    8585)
    8686{
     
    9797 */
    9898RTEMS_INLINE_ROUTINE void _Scheduler_Block(
    99   Scheduler_Control *scheduler,
    100   Thread_Control    *the_thread
     99  const Scheduler_Control *scheduler,
     100  Thread_Control               *the_thread
    101101)
    102102{
     
    113113 */
    114114RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
    115   Scheduler_Control *scheduler,
    116   Thread_Control    *the_thread
     115  const Scheduler_Control *scheduler,
     116  Thread_Control          *the_thread
    117117)
    118118{
     
    126126 */
    127127RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
    128   Scheduler_Control *scheduler,
    129   Thread_Control    *the_thread
     128  const Scheduler_Control *scheduler,
     129  Thread_Control          *the_thread
    130130)
    131131{
     
    139139 */
    140140RTEMS_INLINE_ROUTINE void _Scheduler_Free(
    141   Scheduler_Control *scheduler,
    142   Thread_Control    *the_thread
     141  const Scheduler_Control *scheduler,
     142  Thread_Control          *the_thread
    143143)
    144144{
     
    152152 */
    153153RTEMS_INLINE_ROUTINE void _Scheduler_Update(
    154   Scheduler_Control *scheduler,
    155   Thread_Control    *the_thread
     154  const Scheduler_Control *scheduler,
     155  Thread_Control          *the_thread
    156156)
    157157{
     
    165165 */
    166166RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
    167   Scheduler_Control *scheduler,
    168   Thread_Control    *the_thread
     167  const Scheduler_Control *scheduler,
     168  Thread_Control          *the_thread
    169169)
    170170{
     
    178178 */
    179179RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
    180   Scheduler_Control *scheduler,
    181   Thread_Control    *the_thread
     180  const Scheduler_Control *scheduler,
     181  Thread_Control          *the_thread
    182182)
    183183{
     
    191191 */
    192192RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
    193   Scheduler_Control *scheduler,
    194   Thread_Control    *the_thread
     193  const Scheduler_Control *scheduler,
     194  Thread_Control          *the_thread
    195195)
    196196{
     
    204204 */
    205205RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
    206   Scheduler_Control *scheduler,
    207   Priority_Control p1,
    208   Priority_Control p2
     206  const Scheduler_Control *scheduler,
     207  Priority_Control         p1,
     208  Priority_Control         p2
    209209)
    210210{
     
    218218 */
    219219RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
    220   Scheduler_Control *scheduler,
    221   Thread_Control    *the_thread,
    222   uint32_t           length
     220  const Scheduler_Control *scheduler,
     221  Thread_Control          *the_thread,
     222  uint32_t                 length
    223223)
    224224{
     
    234234 * time-slicing management.
    235235 */
    236 RTEMS_INLINE_ROUTINE void _Scheduler_Tick( Scheduler_Control *scheduler )
     236RTEMS_INLINE_ROUTINE void _Scheduler_Tick(
     237  const Scheduler_Control *scheduler
     238)
    237239{
    238240  ( *scheduler->Operations.tick )( scheduler );
     
    248250 */
    249251RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
    250   Scheduler_Control *scheduler,
    251   Thread_Control    *the_thread,
    252   Per_CPU_Control   *cpu
     252  const Scheduler_Control *scheduler,
     253  Thread_Control          *the_thread,
     254  Per_CPU_Control         *cpu
    253255)
    254256{
     
    264266   */
    265267  RTEMS_INLINE_ROUTINE int _Scheduler_Get_affinity(
    266     Scheduler_Control *scheduler,
    267     Thread_Control    *thread,
    268     size_t             cpusetsize,
    269     cpu_set_t         *cpuset
     268    const Scheduler_Control *scheduler,
     269    Thread_Control          *the_thread,
     270    size_t                   cpusetsize,
     271    cpu_set_t               *cpuset
    270272  )
    271273  {
    272274    return ( *scheduler->Operations.get_affinity )(
    273275      scheduler,
    274       thread,
     276      the_thread,
    275277      cpusetsize,
    276278      cpuset
     
    285287   */
    286288  RTEMS_INLINE_ROUTINE int _Scheduler_Set_affinity(
    287     Scheduler_Control *scheduler,
    288     Thread_Control    *thread,
    289     size_t             cpusetsize,
    290     const cpu_set_t   *cpuset
     289    const Scheduler_Control *scheduler,
     290    Thread_Control          *the_thread,
     291    size_t                   cpusetsize,
     292    const cpu_set_t         *cpuset
    291293  )
    292294  {
    293295    return ( *scheduler->Operations.set_affinity )(
    294296      scheduler,
    295       thread,
     297      the_thread,
    296298      cpusetsize,
    297299      cpuset
     
    314316
    315317RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
    316   Scheduler_Control *scheduler,
    317   Thread_Control    *the_thread,
    318   void            ( *extract )( Scheduler_Control *, Thread_Control * ),
    319   void            ( *schedule )( Scheduler_Control *, Thread_Control *, bool )
     318  const Scheduler_Control *scheduler,
     319  Thread_Control          *the_thread,
     320  void                  ( *extract )(
     321                             const Scheduler_Control *,
     322                             Thread_Control * ),
     323  void                  ( *schedule )(
     324                             const Scheduler_Control *,
     325                             Thread_Control *,
     326                             bool )
    320327)
    321328{
     
    334341 */
    335342RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
    336   Scheduler_Control *scheduler,
    337   Priority_Control   p1,
    338   Priority_Control   p2
     343  const Scheduler_Control *scheduler,
     344  Priority_Control         p1,
     345  Priority_Control         p2
    339346)
    340347{
     
    347354 */
    348355RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
    349   Scheduler_Control *scheduler,
    350   Priority_Control   p1,
    351   Priority_Control   p2
     356  const Scheduler_Control *scheduler,
     357  Priority_Control         p1,
     358  Priority_Control         p2
    352359)
    353360{
     
    360367 */
    361368RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Highest_priority_of_two(
    362   Scheduler_Control *scheduler,
    363   Priority_Control   p1,
    364   Priority_Control   p2
     369  const Scheduler_Control *scheduler,
     370  Priority_Control         p1,
     371  Priority_Control         p2
    365372)
    366373{
     
    373380 */
    374381RTEMS_INLINE_ROUTINE void _Scheduler_Set_priority_if_higher(
    375   Scheduler_Control *scheduler,
    376   Thread_Control    *the_thread,
    377   Priority_Control   priority
     382  const Scheduler_Control *scheduler,
     383  Thread_Control          *the_thread,
     384  Priority_Control         priority
    378385)
    379386{
     
    390397 */
    391398RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority_if_higher(
    392   Scheduler_Control *scheduler,
    393   Thread_Control    *the_thread,
    394   Priority_Control   priority,
    395   bool               prepend_it
     399  const Scheduler_Control *scheduler,
     400  Thread_Control          *the_thread,
     401  Priority_Control         priority,
     402  bool                     prepend_it
    396403)
    397404{
     
    403410}
    404411
    405 RTEMS_INLINE_ROUTINE Scheduler_Control *_Scheduler_Get(
     412RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get(
    406413  Thread_Control *the_thread
    407414)
     
    409416  (void) the_thread;
    410417
    411   return &_Scheduler;
     418  return &_Scheduler_Table[ 0 ];
    412419}
    413420
  • cpukit/score/include/rtems/score/schedulerpriority.h

    rdc18190 re1598a6  
    6868typedef struct {
    6969  /**
     70   * @brief Basic scheduler context.
     71   */
     72  Scheduler_Context Base;
     73
     74  /**
    7075   * @brief Bit map to indicate non-empty ready queues.
    7176   */
     
    7580   * @brief One ready queue per priority level.
    7681   */
    77   Chain_Control Ready[ 1 ];
    78 } Scheduler_priority_Control;
     82  Chain_Control Ready[ 0 ];
     83} Scheduler_priority_Context;
    7984
    8085/**
     
    9398 * This routine initializes the priority scheduler.
    9499 */
    95 void _Scheduler_priority_Initialize(void);
     100void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler );
    96101
    97102/**
     
    106111 */
    107112void _Scheduler_priority_Block(
    108   Scheduler_Control *scheduler,
    109   Thread_Control    *the_thread
     113  const Scheduler_Control *scheduler,
     114  Thread_Control          *the_thread
    110115);
    111116
     
    117122 */
    118123void _Scheduler_priority_Schedule(
    119   Scheduler_Control *scheduler,
    120   Thread_Control    *the_thread
     124  const Scheduler_Control *scheduler,
     125  Thread_Control          *the_thread
    121126);
    122127
     
    130135 */
    131136void * _Scheduler_priority_Allocate(
    132   Scheduler_Control *scheduler,
    133   Thread_Control    *the_thread
     137  const Scheduler_Control *scheduler,
     138  Thread_Control          *the_thread
    134139);
    135140
     
    143148 */
    144149void _Scheduler_priority_Free(
    145   Scheduler_Control *scheduler,
    146   Thread_Control    *the_thread
     150  const Scheduler_Control *scheduler,
     151  Thread_Control          *the_thread
    147152);
    148153
     
    156161 */
    157162void _Scheduler_priority_Update(
    158   Scheduler_Control *scheduler,
    159   Thread_Control    *the_thread
     163  const Scheduler_Control *scheduler,
     164  Thread_Control          *the_thread
    160165);
    161166
     
    170175 */
    171176void _Scheduler_priority_Unblock(
    172   Scheduler_Control *scheduler,
    173   Thread_Control    *the_thread
     177  const Scheduler_Control *scheduler,
     178  Thread_Control          *the_thread
    174179);
    175180
     
    194199 */
    195200void _Scheduler_priority_Yield(
    196   Scheduler_Control *scheduler,
    197   Thread_Control    *the_thread
     201  const Scheduler_Control *scheduler,
     202  Thread_Control          *the_thread
    198203);
    199204
     
    206211 */
    207212void _Scheduler_priority_Enqueue(
    208   Scheduler_Control *scheduler,
    209   Thread_Control    *the_thread
     213  const Scheduler_Control *scheduler,
     214  Thread_Control          *the_thread
    210215);
    211216
     
    220225 */
    221226void _Scheduler_priority_Enqueue_first(
    222   Scheduler_Control *scheduler,
    223   Thread_Control    *the_thread
     227  const Scheduler_Control *scheduler,
     228  Thread_Control          *the_thread
    224229);
    225230
     
    233238 */
    234239void _Scheduler_priority_Extract(
    235   Scheduler_Control *scheduler,
    236   Thread_Control    *the_thread
     240  const Scheduler_Control *scheduler,
     241  Thread_Control          *the_thread
    237242);
    238243
  • cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h

    rdc18190 re1598a6  
    7979 */
    8080void * _Scheduler_priority_affinity_SMP_Allocate(
    81   Scheduler_Control *scheduler,
    82   Thread_Control    *the_thread
     81  const Scheduler_Control *scheduler,
     82  Thread_Control          *the_thread
    8383);
    8484
     
    9595 */
    9696bool _Scheduler_priority_affinity_SMP_Get_affinity(
    97   Scheduler_Control *scheduler,
    98   Thread_Control    *thread,
    99   size_t             cpusetsize,
    100   cpu_set_t         *cpuset
     97  const Scheduler_Control *scheduler,
     98  Thread_Control          *thread,
     99  size_t                   cpusetsize,
     100  cpu_set_t               *cpuset
    101101);
    102102
     
    112112 */
    113113bool _Scheduler_priority_affinity_SMP_Set_affinity(
    114   Scheduler_Control *scheduler,
    115   Thread_Control    *thread,
    116   size_t             cpusetsize,
    117   cpu_set_t         *cpuset
     114  const Scheduler_Control *scheduler,
     115  Thread_Control          *thread,
     116  size_t                   cpusetsize,
     117  cpu_set_t               *cpuset
    118118);
    119119
  • cpukit/score/include/rtems/score/schedulerpriorityimpl.h

    rdc18190 re1598a6  
    3636/**@{**/
    3737
    38 RTEMS_INLINE_ROUTINE Scheduler_priority_Control *
    39   _Scheduler_priority_Self_from_base( Scheduler_Control *scheduler_base )
    40 {
    41   return (Scheduler_priority_Control *) scheduler_base->information;
     38RTEMS_INLINE_ROUTINE Scheduler_priority_Context *
     39  _Scheduler_priority_Get_context( const Scheduler_Control *scheduler )
     40{
     41  return (Scheduler_priority_Context *) scheduler->context;
    4242}
    4343
     
    135135
    136136RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body(
    137   Scheduler_Control *scheduler_base,
    138   Thread_Control    *the_thread
    139 )
    140 {
    141   Scheduler_priority_Control *scheduler =
    142     _Scheduler_priority_Self_from_base( scheduler_base );
    143 
    144   _Scheduler_priority_Ready_queue_extract( the_thread, &scheduler->Bit_map );
     137  const Scheduler_Control *scheduler,
     138  Thread_Control          *the_thread
     139)
     140{
     141  Scheduler_priority_Context *context =
     142    _Scheduler_priority_Get_context( scheduler );
     143
     144  _Scheduler_priority_Ready_queue_extract( the_thread, &context->Bit_map );
    145145}
    146146
     
    194194 */
    195195RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(
    196   Scheduler_Control *scheduler_base,
    197   Thread_Control    *the_thread,
    198   bool               force_dispatch
    199 )
    200 {
    201   Scheduler_priority_Control *scheduler =
    202     _Scheduler_priority_Self_from_base( scheduler_base );
     196  const Scheduler_Control *scheduler,
     197  Thread_Control          *the_thread,
     198  bool                     force_dispatch
     199)
     200{
     201  Scheduler_priority_Context *context =
     202    _Scheduler_priority_Get_context( scheduler );
    203203  Thread_Control *heir = _Scheduler_priority_Ready_queue_first(
    204     &scheduler->Bit_map,
    205     &scheduler->Ready[ 0 ]
     204    &context->Bit_map,
     205    &context->Ready[ 0 ]
    206206  );
    207207
  • cpukit/score/include/rtems/score/schedulerprioritysmp.h

    rdc18190 re1598a6  
    4848 */
    4949
     50typedef struct {
     51  Scheduler_SMP_Context    Base;
     52  Priority_bit_map_Control Bit_map;
     53  Chain_Control            Ready[ 0 ];
     54} Scheduler_priority_SMP_Context;
     55
    5056/**
    5157 * @brief Entry points for the Priority SMP Scheduler.
     
    7278  }
    7379
    74 void _Scheduler_priority_SMP_Initialize( void );
     80void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
    7581
    7682void _Scheduler_priority_SMP_Schedule(
    77   Scheduler_Control *base,
     83  const Scheduler_Control *scheduler,
    7884  Thread_Control *thread
    7985);
    8086
    8187void _Scheduler_priority_SMP_Block(
    82   Scheduler_Control *base,
     88  const Scheduler_Control *scheduler,
    8389  Thread_Control *thread
    8490);
    8591
    8692void _Scheduler_priority_SMP_Update(
    87   Scheduler_Control *base,
     93  const Scheduler_Control *scheduler,
    8894  Thread_Control *thread
    8995);
    9096
    9197void _Scheduler_priority_SMP_Enqueue_fifo(
    92   Scheduler_Control *base,
     98  const Scheduler_Control *scheduler,
    9399  Thread_Control *thread
    94100);
    95101
    96102void _Scheduler_priority_SMP_Enqueue_lifo(
    97   Scheduler_Control *base,
     103  const Scheduler_Control *scheduler,
    98104  Thread_Control *thread
    99105);
    100106
    101107void _Scheduler_priority_SMP_Extract(
    102   Scheduler_Control *base,
     108  const Scheduler_Control *scheduler,
    103109  Thread_Control *thread
    104110);
    105111
    106112void _Scheduler_priority_SMP_Yield(
    107   Scheduler_Control *base,
     113  const Scheduler_Control *scheduler,
    108114  Thread_Control *thread
    109115);
    110116
    111117void _Scheduler_priority_SMP_Start_idle(
    112   Scheduler_Control *base,
     118  const Scheduler_Control *scheduler,
    113119  Thread_Control *thread,
    114120  Per_CPU_Control *cpu
  • cpukit/score/include/rtems/score/schedulersimple.h

    rdc18190 re1598a6  
    5656
    5757/**
    58  * @brief Simple scheduler control.
     58 * @brief Simple scheduler context.
    5959 */
    6060typedef struct {
     61  /**
     62   * @brief Basic scheduler context.
     63   */
     64  Scheduler_Context Base;
     65
    6166  /**
    6267   * @brief One ready queue for all ready threads.
    6368   */
    6469  Chain_Control Ready;
    65 } Scheduler_simple_Control;
     70} Scheduler_simple_Context;
    6671
    6772/**
     
    7075 *  This routine initializes the simple scheduler.
    7176 */
    72 void _Scheduler_simple_Initialize( void );
     77void _Scheduler_simple_Initialize( const Scheduler_Control *scheduler );
    7378
    7479/**
     
    7883 */
    7984void _Scheduler_simple_Schedule(
    80   Scheduler_Control *scheduler,
    81   Thread_Control    *the_thread
     85  const Scheduler_Control *scheduler,
     86  Thread_Control          *the_thread
    8287);
    8388
     
    99104 */
    100105void _Scheduler_simple_Yield(
    101   Scheduler_Control *scheduler,
    102   Thread_Control    *the_thread
     106  const Scheduler_Control *scheduler,
     107  Thread_Control          *the_thread
    103108);
    104109
     
    114119 */
    115120void _Scheduler_simple_Block(
    116   Scheduler_Control *scheduler,
    117   Thread_Control    *the_thread
     121  const Scheduler_Control *scheduler,
     122  Thread_Control          *the_thread
    118123);
    119124
     
    128133 */
    129134void _Scheduler_simple_Unblock(
    130   Scheduler_Control *scheduler,
    131   Thread_Control    *the_thread
     135  const Scheduler_Control *scheduler,
     136  Thread_Control          *the_thread
    132137);
    133138
     
    141146 */
    142147void _Scheduler_simple_Extract(
    143   Scheduler_Control *scheduler,
    144   Thread_Control    *the_thread
     148  const Scheduler_Control *scheduler,
     149  Thread_Control          *the_thread
    145150);
    146151
     
    153158 */
    154159void _Scheduler_simple_Enqueue(
    155   Scheduler_Control *scheduler,
    156   Thread_Control    *the_thread
     160  const Scheduler_Control *scheduler,
     161  Thread_Control          *the_thread
    157162);
    158163
     
    167172 */
    168173void _Scheduler_simple_Enqueue_first(
    169   Scheduler_Control *scheduler,
    170   Thread_Control    *the_thread
     174  const Scheduler_Control *scheduler,
     175  Thread_Control          *the_thread
    171176);
    172177
     
    180185 */
    181186void _Scheduler_simple_Ready_queue_enqueue(
    182   Scheduler_Control *scheduler,
    183   Thread_Control    *the_thread
     187  const Scheduler_Control *scheduler,
     188  Thread_Control          *the_thread
    184189);
    185190
     
    194199 */
    195200void _Scheduler_simple_Ready_queue_enqueue_first(
    196   Scheduler_Control *scheduler,
    197   Thread_Control    *the_thread
     201  const Scheduler_Control *scheduler,
     202  Thread_Control          *the_thread
    198203);
    199204
  • cpukit/score/include/rtems/score/schedulersimpleimpl.h

    rdc18190 re1598a6  
    3333/**@{**/
    3434
    35 RTEMS_INLINE_ROUTINE Scheduler_simple_Control *
    36   _Scheduler_simple_Self_from_base( Scheduler_Control *scheduler_base )
     35RTEMS_INLINE_ROUTINE Scheduler_simple_Context *
     36  _Scheduler_simple_Get_context( const Scheduler_Control *scheduler )
    3737{
    38   return (Scheduler_simple_Control *) scheduler_base->information;
     38  return (Scheduler_simple_Context *) scheduler->context;
    3939}
    4040
     
    4646 */
    4747RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_requeue(
    48   Scheduler_Control *scheduler,
    49   Thread_Control    *the_thread
     48  const Scheduler_Control *scheduler,
     49  Thread_Control          *the_thread
    5050)
    5151{
     
    104104
    105105RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(
    106   Scheduler_Control *scheduler_base,
    107   Thread_Control    *the_thread,
    108   bool               force_dispatch
     106  const Scheduler_Control *scheduler,
     107  Thread_Control          *the_thread,
     108  bool                     force_dispatch
    109109)
    110110{
    111   Scheduler_simple_Control *scheduler =
    112     _Scheduler_simple_Self_from_base( scheduler_base );
    113   Thread_Control *heir = (Thread_Control *) _Chain_First( &scheduler->Ready );
     111  Scheduler_simple_Context *context =
     112    _Scheduler_simple_Get_context( scheduler );
     113  Thread_Control *heir = (Thread_Control *) _Chain_First( &context->Ready );
    114114
    115115  ( void ) the_thread;
  • cpukit/score/include/rtems/score/schedulersimplesmp.h

    rdc18190 re1598a6  
    5050 */
    5151
     52typedef struct {
     53  Scheduler_SMP_Context Base;
     54  Chain_Control         Ready;
     55} Scheduler_simple_SMP_Context;
     56
    5257/**
    5358 * @brief Entry points for the Simple SMP Scheduler.
     
    7479  }
    7580
    76 void _Scheduler_simple_smp_Initialize( void );
     81void _Scheduler_simple_smp_Initialize( const Scheduler_Control *scheduler );
    7782
    7883void _Scheduler_simple_smp_Block(
    79   Scheduler_Control *base,
     84  const Scheduler_Control *scheduler,
    8085  Thread_Control *thread
    8186);
    8287
    8388void _Scheduler_simple_smp_Enqueue_priority_fifo(
    84   Scheduler_Control *base,
     89  const Scheduler_Control *scheduler,
    8590  Thread_Control *thread
    8691);
    8792
    8893void _Scheduler_simple_smp_Enqueue_priority_lifo(
    89   Scheduler_Control *base,
     94  const Scheduler_Control *scheduler,
    9095  Thread_Control *thread
    9196);
    9297
    9398void _Scheduler_simple_smp_Extract(
    94   Scheduler_Control *base,
     99  const Scheduler_Control *scheduler,
    95100  Thread_Control *thread
    96101);
    97102
    98103void _Scheduler_simple_smp_Yield(
    99   Scheduler_Control *base,
     104  const Scheduler_Control *scheduler,
    100105  Thread_Control *thread
    101106);
    102107
    103108void _Scheduler_simple_smp_Schedule(
    104   Scheduler_Control *base,
     109  const Scheduler_Control *scheduler,
    105110  Thread_Control *thread
    106111);
    107112
    108113void _Scheduler_simple_smp_Start_idle(
    109   Scheduler_Control *base,
     114  const Scheduler_Control *scheduler,
    110115  Thread_Control *thread,
    111116  Per_CPU_Control *cpu
  • cpukit/score/include/rtems/score/schedulersmp.h

    rdc18190 re1598a6  
    4242
    4343typedef struct {
     44  /**
     45   * @brief Basic scheduler context.
     46   */
     47  Scheduler_Context Base;
     48
    4449  Chain_Control Scheduled;
    45 } Scheduler_SMP_Control;
    46 
    47 typedef struct {
    48   Scheduler_SMP_Control Base;
    49   Chain_Control         Ready;
    50 } Scheduler_simple_SMP_Control;
    51 
    52 typedef struct {
    53   Scheduler_SMP_Control    Base;
    54   Priority_bit_map_Control Bit_map;
    55   Chain_Control            Ready[ 1 ];
    56 } Scheduler_priority_SMP_Control;
     50} Scheduler_SMP_Context;
    5751
    5852/** @} */
  • cpukit/score/include/rtems/score/schedulersmpimpl.h

    rdc18190 re1598a6  
    4040
    4141typedef Thread_Control *( *Scheduler_SMP_Get_highest_ready )(
    42   Scheduler_SMP_Control *self
     42  Scheduler_SMP_Context *self
    4343);
    4444
    4545typedef void ( *Scheduler_SMP_Extract )(
    46   Scheduler_SMP_Control *self,
     46  Scheduler_SMP_Context *self,
    4747  Thread_Control *thread
    4848);
    4949
    5050typedef void ( *Scheduler_SMP_Insert )(
    51   Scheduler_SMP_Control *self,
     51  Scheduler_SMP_Context *self,
    5252  Thread_Control *thread_to_insert
    5353);
    5454
    5555typedef void ( *Scheduler_SMP_Move )(
    56   Scheduler_SMP_Control *self,
     56  Scheduler_SMP_Context *self,
    5757  Thread_Control *thread_to_move
    5858);
    5959
    6060static inline void _Scheduler_SMP_Initialize(
    61   Scheduler_SMP_Control *self
     61  Scheduler_SMP_Context *self
    6262)
    6363{
     
    108108
    109109static inline Thread_Control *_Scheduler_SMP_Get_lowest_scheduled(
    110   Scheduler_SMP_Control *self
     110  Scheduler_SMP_Context *self
    111111)
    112112{
     
    122122
    123123static inline void _Scheduler_SMP_Enqueue_ordered(
    124   Scheduler_SMP_Control *self,
     124  Scheduler_SMP_Context *self,
    125125  Thread_Control *thread,
    126126  Chain_Node_order order,
     
    178178
    179179static inline void _Scheduler_SMP_Schedule_highest_ready(
    180   Scheduler_SMP_Control *self,
     180  Scheduler_SMP_Context *self,
    181181  Thread_Control *victim,
    182182  Scheduler_SMP_Get_highest_ready get_highest_ready,
     
    192192
    193193static inline void _Scheduler_SMP_Block(
    194   Scheduler_SMP_Control *self,
     194  Scheduler_SMP_Context *self,
    195195  Thread_Control *thread,
    196196  Scheduler_SMP_Extract extract,
     
    214214
    215215static inline void _Scheduler_SMP_Extract(
    216   Scheduler_SMP_Control *self,
     216  Scheduler_SMP_Context *self,
    217217  Thread_Control *thread,
    218218  Scheduler_SMP_Extract extract
     
    223223
    224224static inline void _Scheduler_SMP_Schedule(
    225   Scheduler_SMP_Control *self,
     225  Scheduler_SMP_Context *self,
    226226  Thread_Control *thread,
    227227  Scheduler_SMP_Get_highest_ready get_highest_ready,
     
    242242
    243243static inline void _Scheduler_SMP_Insert_scheduled_lifo(
    244   Scheduler_SMP_Control *self,
     244  Scheduler_SMP_Context *self,
    245245  Thread_Control *thread
    246246)
     
    254254
    255255static inline void _Scheduler_SMP_Insert_scheduled_fifo(
    256   Scheduler_SMP_Control *self,
     256  Scheduler_SMP_Context *self,
    257257  Thread_Control *thread
    258258)
     
    266266
    267267static inline void _Scheduler_SMP_Start_idle(
    268   Scheduler_SMP_Control *self,
     268  Scheduler_SMP_Context *self,
    269269  Thread_Control *thread,
    270270  Per_CPU_Control *cpu
  • cpukit/score/src/scheduler.c

    rdc18190 re1598a6  
    2323void _Scheduler_Handler_initialization(void)
    2424{
    25   (*_Scheduler.Operations.initialize)();
     25  size_t n = _Scheduler_Count;
     26  size_t i;
     27
     28  for ( i = 0 ; i < n ; ++i ) {
     29    const Scheduler_Control *scheduler = &_Scheduler_Table[ i ];
     30
     31    ( *scheduler->Operations.initialize )( scheduler );
     32  }
    2633}
  • cpukit/score/src/schedulercbs.c

    rdc18190 re1598a6  
    2222#include <rtems/score/threadimpl.h>
    2323#include <rtems/score/wkspace.h>
    24 
    25 Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
    2624
    2725void _Scheduler_CBS_Budget_callout(
     
    5351int _Scheduler_CBS_Initialize(void)
    5452{
    55   unsigned int i;
    56   _Scheduler_CBS_Server_list = (Scheduler_CBS_Server **) _Workspace_Allocate(
    57       _Scheduler_CBS_Maximum_servers * sizeof(Scheduler_CBS_Server*) );
    58   if ( !_Scheduler_CBS_Server_list )
    59     return SCHEDULER_CBS_ERROR_NO_MEMORY;
    60   for (i = 0; i<_Scheduler_CBS_Maximum_servers; i++) {
    61     _Scheduler_CBS_Server_list[i] = NULL;
    62   }
    6353  return SCHEDULER_CBS_OK;
    6454}
  • cpukit/score/src/schedulercbsallocate.c

    rdc18190 re1598a6  
    2727
    2828void *_Scheduler_CBS_Allocate(
    29   Scheduler_Control *scheduler,
    30   Thread_Control    *the_thread
     29  const Scheduler_Control *scheduler,
     30  Thread_Control          *the_thread
    3131)
    3232{
  • cpukit/score/src/schedulercbsattachthread.c

    rdc18190 re1598a6  
    3434
    3535  /* Server is not valid. */
    36   if ( !_Scheduler_CBS_Server_list[server_id] )
     36  if ( !_Scheduler_CBS_Server_list[server_id].initialized )
    3737    return SCHEDULER_CBS_ERROR_NOSERVER;
    3838
    3939  /* Server is already attached to a thread. */
    40   if ( _Scheduler_CBS_Server_list[server_id]->task_id != -1 )
     40  if ( _Scheduler_CBS_Server_list[server_id].task_id != -1 )
    4141    return SCHEDULER_CBS_ERROR_FULL;
    4242
     
    5454    }
    5555
    56     _Scheduler_CBS_Server_list[server_id]->task_id = task_id;
    57     sched_info->cbs_server = (void *) _Scheduler_CBS_Server_list[server_id];
     56    _Scheduler_CBS_Server_list[server_id].task_id = task_id;
     57    sched_info->cbs_server = &_Scheduler_CBS_Server_list[server_id];
    5858
    5959    the_thread->budget_callout   = _Scheduler_CBS_Budget_callout;
  • cpukit/score/src/schedulercbscleanup.c

    rdc18190 re1598a6  
    2727
    2828  for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
    29     if ( _Scheduler_CBS_Server_list[ i ] )
     29    if ( _Scheduler_CBS_Server_list[ i ].initialized )
    3030      _Scheduler_CBS_Destroy_server( i );
    3131  }
    32   _Workspace_Free( _Scheduler_CBS_Server_list );
    3332  return SCHEDULER_CBS_OK;
    3433}
  • cpukit/score/src/schedulercbscreateserver.c

    rdc18190 re1598a6  
    2020
    2121#include <rtems/score/schedulercbs.h>
    22 #include <rtems/score/wkspace.h>
    2322
    2423int _Scheduler_CBS_Create_server (
     
    3837
    3938  for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
    40     if ( !_Scheduler_CBS_Server_list[i] )
     39    if ( !_Scheduler_CBS_Server_list[i].initialized )
    4140      break;
    4241  }
     
    4645
    4746  *server_id = i;
    48   _Scheduler_CBS_Server_list[*server_id] = (Scheduler_CBS_Server *)
    49     _Workspace_Allocate( sizeof(Scheduler_CBS_Server) );
    50   the_server = _Scheduler_CBS_Server_list[*server_id];
    51   if ( !the_server )
    52     return SCHEDULER_CBS_ERROR_NO_MEMORY;
    53 
     47  the_server = &_Scheduler_CBS_Server_list[*server_id];
    5448  the_server->parameters = *params;
    5549  the_server->task_id = -1;
    5650  the_server->cbs_budget_overrun = budget_overrun_callback;
     51  the_server->initialized = true;
    5752  return SCHEDULER_CBS_OK;
    5853}
  • cpukit/score/src/schedulercbsdestroyserver.c

    rdc18190 re1598a6  
    3333    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
    3434
    35   if ( !_Scheduler_CBS_Server_list[server_id] )
     35  if ( !_Scheduler_CBS_Server_list[server_id].initialized )
    3636    return SCHEDULER_CBS_ERROR_NOSERVER;
    3737
    38   if ( (tid = _Scheduler_CBS_Server_list[server_id]->task_id) != -1 )
     38  if ( (tid = _Scheduler_CBS_Server_list[server_id].task_id) != -1 )
    3939    ret = _Scheduler_CBS_Detach_thread ( server_id, tid );
    4040
    41   _Workspace_Free( _Scheduler_CBS_Server_list[server_id] );
    42   _Scheduler_CBS_Server_list[server_id] = NULL;
     41  _Scheduler_CBS_Server_list[server_id].initialized = false;
    4342  return ret;
    4443}
  • cpukit/score/src/schedulercbsdetachthread.c

    rdc18190 re1598a6  
    3535    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
    3636  /* Server is not valid. */
    37   if ( !_Scheduler_CBS_Server_list[server_id] )
     37  if ( !_Scheduler_CBS_Server_list[server_id].initialized )
    3838    return SCHEDULER_CBS_ERROR_NOSERVER;
    3939  /* Thread and server are not attached. */
    40   if ( _Scheduler_CBS_Server_list[server_id]->task_id != task_id )
     40  if ( _Scheduler_CBS_Server_list[server_id].task_id != task_id )
    4141    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
    4242
     
    4444  /* The routine _Thread_Get may disable dispatch and not enable again. */
    4545  if ( the_thread ) {
    46     _Scheduler_CBS_Server_list[server_id]->task_id = -1;
     46    _Scheduler_CBS_Server_list[server_id].task_id = -1;
    4747    sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
    4848    sched_info->cbs_server = NULL;
  • cpukit/score/src/schedulercbsgetapprovedbudget.c

    rdc18190 re1598a6  
    3131  if ( server_id >= _Scheduler_CBS_Maximum_servers )
    3232    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
    33   if ( !_Scheduler_CBS_Server_list[server_id] )
     33  if ( !_Scheduler_CBS_Server_list[server_id].initialized )
    3434    return SCHEDULER_CBS_ERROR_NOSERVER;
    3535
    36   *approved_budget = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
     36  *approved_budget = _Scheduler_CBS_Server_list[server_id].parameters.budget;
    3737  return SCHEDULER_CBS_OK;
    3838}
  • cpukit/score/src/schedulercbsgetexecutiontime.c

    rdc18190 re1598a6  
    3434  if ( server_id >= _Scheduler_CBS_Maximum_servers )
    3535    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
    36   if ( !_Scheduler_CBS_Server_list[server_id] )
     36  if ( !_Scheduler_CBS_Server_list[server_id].initialized )
    3737    return SCHEDULER_CBS_ERROR_NOSERVER;
    38   if ( _Scheduler_CBS_Server_list[server_id]->task_id == -1 ) {
     38  if ( _Scheduler_CBS_Server_list[server_id].task_id == -1 ) {
    3939    *exec_time = 0;
    4040    return SCHEDULER_CBS_OK;
     
    4242
    4343  the_thread = _Thread_Get(
    44                  _Scheduler_CBS_Server_list[server_id]->task_id,
     44                 _Scheduler_CBS_Server_list[server_id].task_id,
    4545                 &location
    4646               );
    4747  /* The routine _Thread_Get may disable dispatch and not enable again. */
    4848  if ( the_thread ) {
    49     *exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget -
     49    *exec_time = _Scheduler_CBS_Server_list[server_id].parameters.budget -
    5050      the_thread->cpu_time_budget;
    5151    _Objects_Put( &the_thread->Object );
    5252  }
    5353  else {
    54     *exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
     54    *exec_time = _Scheduler_CBS_Server_list[server_id].parameters.budget;
    5555  }
    5656  return SCHEDULER_CBS_OK;
  • cpukit/score/src/schedulercbsgetparameters.c

    rdc18190 re1598a6  
    3131  if ( server_id >= _Scheduler_CBS_Maximum_servers )
    3232    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
    33   if ( !_Scheduler_CBS_Server_list[server_id] )
     33  if ( !_Scheduler_CBS_Server_list[server_id].initialized )
    3434    return SCHEDULER_CBS_ERROR_NOSERVER;
    3535
    36   *params = _Scheduler_CBS_Server_list[server_id]->parameters;
     36  *params = _Scheduler_CBS_Server_list[server_id].parameters;
    3737  return SCHEDULER_CBS_OK;
    3838}
  • cpukit/score/src/schedulercbsgetremainingbudget.c

    rdc18190 re1598a6  
    3232  if ( server_id >= _Scheduler_CBS_Maximum_servers )
    3333    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
    34   if ( !_Scheduler_CBS_Server_list[server_id] )
     34  if ( !_Scheduler_CBS_Server_list[server_id].initialized )
    3535    return SCHEDULER_CBS_ERROR_NOSERVER;
    36   if ( _Scheduler_CBS_Server_list[server_id]->task_id == -1 ) {
    37     *remaining_budget = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
     36  if ( _Scheduler_CBS_Server_list[server_id].task_id == -1 ) {
     37    *remaining_budget = _Scheduler_CBS_Server_list[server_id].parameters.budget;
    3838    return SCHEDULER_CBS_OK;
    3939  }
    4040
    4141  the_thread = _Thread_Get(
    42                  _Scheduler_CBS_Server_list[server_id]->task_id,
     42                 _Scheduler_CBS_Server_list[server_id].task_id,
    4343                 &location
    4444               );
  • cpukit/score/src/schedulercbsgetserverid.c

    rdc18190 re1598a6  
    3131  unsigned int i;
    3232  for ( i = 0; i<_Scheduler_CBS_Maximum_servers; i++ ) {
    33     if ( _Scheduler_CBS_Server_list[i] &&
    34          _Scheduler_CBS_Server_list[i]->task_id == task_id ) {
     33    if ( _Scheduler_CBS_Server_list[i].initialized &&
     34         _Scheduler_CBS_Server_list[i].task_id == task_id ) {
    3535      *server_id = i;
    3636      return SCHEDULER_CBS_OK;
  • cpukit/score/src/schedulercbsreleasejob.c

    rdc18190 re1598a6  
    2525
    2626void _Scheduler_CBS_Release_job(
    27   Scheduler_Control *scheduler,
    28   Thread_Control    *the_thread,
    29   uint32_t           deadline
     27  const Scheduler_Control *scheduler,
     28  Thread_Control          *the_thread,
     29  uint32_t                 deadline
    3030)
    3131{
  • cpukit/score/src/schedulercbssetparameters.c

    rdc18190 re1598a6  
    3939    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
    4040
    41   if ( !_Scheduler_CBS_Server_list[server_id] )
     41  if ( !_Scheduler_CBS_Server_list[server_id].initialized )
    4242    return SCHEDULER_CBS_ERROR_NOSERVER;
    4343
    44   _Scheduler_CBS_Server_list[server_id]->parameters = *params;
     44  _Scheduler_CBS_Server_list[server_id].parameters = *params;
    4545  return SCHEDULER_CBS_OK;
    4646}
  • cpukit/score/src/schedulercbsunblock.c

    rdc18190 re1598a6  
    2626
    2727void _Scheduler_CBS_Unblock(
    28   Scheduler_Control *scheduler,
    29   Thread_Control    *the_thread
     28  const Scheduler_Control *scheduler,
     29  Thread_Control          *the_thread
    3030)
    3131{
  • cpukit/score/src/schedulerdefaultallocatefree.c

    rdc18190 re1598a6  
    2323
    2424void *_Scheduler_default_Allocate(
    25   Scheduler_Control *scheduler,
    26   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2727)
    2828{
     
    3434
    3535void _Scheduler_default_Free(
    36   Scheduler_Control *scheduler,
    37   Thread_Control    *the_thread
     36  const Scheduler_Control *scheduler,
     37  Thread_Control          *the_thread
    3838)
    3939{
  • cpukit/score/src/schedulerdefaultgetaffinity.c

    rdc18190 re1598a6  
    2424
    2525bool _Scheduler_default_Get_affinity(
    26   Scheduler_Control *scheduler,
    27   Thread_Control    *thread,
    28   size_t             cpusetsize,
    29   cpu_set_t         *cpuset
     26  const Scheduler_Control *scheduler,
     27  Thread_Control          *thread,
     28  size_t                   cpusetsize,
     29  cpu_set_t               *cpuset
    3030)
    3131{
  • cpukit/score/src/schedulerdefaultreleasejob.c

    rdc18190 re1598a6  
    2323
    2424void _Scheduler_default_Release_job(
    25   Scheduler_Control *scheduler,
    26   Thread_Control    *the_thread,
    27   uint32_t           deadline
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread,
     27  uint32_t                 deadline
    2828)
    2929{
  • cpukit/score/src/schedulerdefaultsetaffinity.c

    rdc18190 re1598a6  
    2424
    2525bool _Scheduler_default_Set_affinity(
    26   Scheduler_Control *scheduler,
    27   Thread_Control    *thread,
    28   size_t             cpusetsize,
    29   const cpu_set_t   *cpuset
     26  const Scheduler_Control *scheduler,
     27  Thread_Control          *thread,
     28  size_t                   cpusetsize,
     29  const cpu_set_t         *cpuset
    3030)
    3131{
  • cpukit/score/src/schedulerdefaultstartidle.c

    rdc18190 re1598a6  
    1414
    1515void _Scheduler_default_Start_idle(
    16   Scheduler_Control *scheduler,
    17   Thread_Control    *the_thread,
    18   Per_CPU_Control   *cpu
     16  const Scheduler_Control *scheduler,
     17  Thread_Control          *the_thread,
     18  Per_CPU_Control         *cpu
    1919)
    2020{
  • cpukit/score/src/schedulerdefaulttick.c

    rdc18190 re1598a6  
    2626
    2727static void _Scheduler_default_Tick_for_executing(
    28   Scheduler_Control *scheduler,
    29   Thread_Control *executing
     28  const Scheduler_Control *scheduler,
     29  Thread_Control          *executing
    3030)
    3131{
     
    8585}
    8686
    87 void _Scheduler_default_Tick( Scheduler_Control *scheduler )
     87void _Scheduler_default_Tick( const Scheduler_Control *scheduler )
    8888{
    8989  uint32_t processor_count = _SMP_Get_processor_count();
  • cpukit/score/src/schedulerdefaultupdate.c

    rdc18190 re1598a6  
    2323
    2424void _Scheduler_default_Update(
    25   Scheduler_Control *scheduler,
    26   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2727)
    2828{
  • cpukit/score/src/scheduleredf.c

    rdc18190 re1598a6  
    1919#endif
    2020
    21 #include <rtems/score/scheduleredf.h>
    22 #include <rtems/score/schedulerimpl.h>
    23 #include <rtems/score/thread.h>
    24 #include <rtems/score/wkspace.h>
     21#include <rtems/score/scheduleredfimpl.h>
    2522
    2623static int _Scheduler_EDF_RBTree_compare_function
     
    4239}
    4340
    44 void _Scheduler_EDF_Initialize(void)
     41void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler )
    4542{
    46   Scheduler_EDF_Control *scheduler =
    47     _Workspace_Allocate_or_fatal_error( sizeof( *scheduler ) );
     43  Scheduler_EDF_Context *context =
     44    _Scheduler_EDF_Get_context( scheduler );
    4845
    4946  _RBTree_Initialize_empty(
    50     &scheduler->Ready,
     47    &context->Ready,
    5148    _Scheduler_EDF_RBTree_compare_function,
    5249    0
    5350  );
    54 
    55   _Scheduler.information = scheduler;
    5651}
  • cpukit/score/src/scheduleredfallocate.c

    rdc18190 re1598a6  
    2626
    2727void *_Scheduler_EDF_Allocate(
    28   Scheduler_Control *scheduler,
    29   Thread_Control    *the_thread
     28  const Scheduler_Control *scheduler,
     29  Thread_Control          *the_thread
    3030)
    3131{
  • cpukit/score/src/scheduleredfblock.c

    rdc18190 re1598a6  
    2323
    2424void _Scheduler_EDF_Block(
    25   Scheduler_Control *scheduler,
    26   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2727)
    2828{
  • cpukit/score/src/scheduleredfenqueue.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_EDF_Enqueue(
    24   Scheduler_Control *scheduler_base,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
    28   Scheduler_EDF_Control *scheduler =
    29     _Scheduler_EDF_Self_from_base( scheduler_base );
     28  Scheduler_EDF_Context *context =
     29    _Scheduler_EDF_Get_context( scheduler );
    3030  Scheduler_EDF_Per_thread *sched_info =
    3131    (Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
    3232  RBTree_Node *node = &(sched_info->Node);
    3333
    34   _RBTree_Insert( &scheduler->Ready, node );
     34  _RBTree_Insert( &context->Ready, node );
    3535  sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES;
    3636}
  • cpukit/score/src/scheduleredfenqueuefirst.c

    rdc18190 re1598a6  
    2525
    2626void _Scheduler_EDF_Enqueue_first(
    27   Scheduler_Control *scheduler,
    28   Thread_Control    *the_thread
     27  const Scheduler_Control *scheduler,
     28  Thread_Control          *the_thread
    2929)
    3030{
  • cpukit/score/src/scheduleredfextract.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_EDF_Extract(
    24   Scheduler_Control *scheduler_base,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
    28   Scheduler_EDF_Control *scheduler =
    29     _Scheduler_EDF_Self_from_base( scheduler_base );
     28  Scheduler_EDF_Context *context =
     29    _Scheduler_EDF_Get_context( scheduler );
    3030  Scheduler_EDF_Per_thread *sched_info =
    3131    (Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
    3232  RBTree_Node *node = &(sched_info->Node);
    3333
    34   _RBTree_Extract( &scheduler->Ready, node );
     34  _RBTree_Extract( &context->Ready, node );
    3535  sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;
    3636}
  • cpukit/score/src/scheduleredffree.c

    rdc18190 re1598a6  
    2727
    2828void _Scheduler_EDF_Free(
    29   Scheduler_Control *scheduler,
    30   Thread_Control    *the_thread
     29  const Scheduler_Control *scheduler,
     30  Thread_Control          *the_thread
    3131)
    3232{
  • cpukit/score/src/scheduleredfreleasejob.c

    rdc18190 re1598a6  
    2424
    2525void _Scheduler_EDF_Release_job(
    26   Scheduler_Control *scheduler,
    27   Thread_Control    *the_thread,
    28   uint32_t           deadline
     26  const Scheduler_Control *scheduler,
     27  Thread_Control          *the_thread,
     28  uint32_t                 deadline
    2929)
    3030{
  • cpukit/score/src/scheduleredfschedule.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_EDF_Schedule(
    24   Scheduler_Control *scheduler,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
  • cpukit/score/src/scheduleredfunblock.c

    rdc18190 re1598a6  
    2424
    2525void _Scheduler_EDF_Unblock(
    26   Scheduler_Control *scheduler,
    27   Thread_Control    *the_thread
     26  const Scheduler_Control *scheduler,
     27  Thread_Control          *the_thread
    2828)
    2929{
  • cpukit/score/src/scheduleredfupdate.c

    rdc18190 re1598a6  
    2727
    2828void _Scheduler_EDF_Update(
    29   Scheduler_Control *scheduler,
    30   Thread_Control    *the_thread
     29  const Scheduler_Control *scheduler,
     30  Thread_Control          *the_thread
    3131)
    3232{
  • cpukit/score/src/scheduleredfyield.c

    rdc18190 re1598a6  
    2323
    2424void _Scheduler_EDF_Yield(
    25   Scheduler_Control *scheduler_base,
    26   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2727)
    2828{
    29   Scheduler_EDF_Control *scheduler =
    30     _Scheduler_EDF_Self_from_base( scheduler_base );
     29  Scheduler_EDF_Context *context =
     30    _Scheduler_EDF_Get_context( scheduler );
    3131  ISR_Level              level;
    3232
     
    4141   * with the same priority in case there are such ones.
    4242   */
    43   _RBTree_Extract( &scheduler->Ready, thread_node );
    44   _RBTree_Insert( &scheduler->Ready, thread_node );
     43  _RBTree_Extract( &context->Ready, thread_node );
     44  _RBTree_Insert( &context->Ready, thread_node );
    4545
    4646  _ISR_Flash( level );
    4747
    48   _Scheduler_EDF_Schedule_body( scheduler_base, the_thread, false );
     48  _Scheduler_EDF_Schedule_body( scheduler, the_thread, false );
    4949
    5050  _ISR_Enable( level );
  • cpukit/score/src/schedulerpriority.c

    rdc18190 re1598a6  
    2222#include <rtems/score/wkspace.h>
    2323
    24 void _Scheduler_priority_Initialize(void)
     24void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler )
    2525{
    26   Scheduler_priority_Control *self = _Workspace_Allocate_or_fatal_error(
    27     sizeof( *self ) + PRIORITY_MAXIMUM * sizeof( Chain_Control )
    28   );
     26  Scheduler_priority_Context *context =
     27    _Scheduler_priority_Get_context( scheduler );
    2928
    30   _Priority_bit_map_Initialize( &self->Bit_map );
    31   _Scheduler_priority_Ready_queue_initialize( &self->Ready[ 0 ] );
    32 
    33   _Scheduler.information = self;
     29  _Priority_bit_map_Initialize( &context->Bit_map );
     30  _Scheduler_priority_Ready_queue_initialize( &context->Ready[ 0 ] );
    3431}
  • cpukit/score/src/schedulerpriorityaffinitysmp.c

    rdc18190 re1598a6  
    3333
    3434void * _Scheduler_priority_affinity_SMP_Allocate(
    35   Scheduler_Control *scheduler,
    36   Thread_Control    *the_thread
     35  const Scheduler_Control *scheduler,
     36  Thread_Control          *the_thread
    3737)
    3838{
     
    4949
    5050bool _Scheduler_priority_affinity_SMP_Get_affinity(
    51   Scheduler_Control *scheduler,
    52   Thread_Control    *thread,
    53   size_t             cpusetsize,
    54   cpu_set_t         *cpuset
     51  const Scheduler_Control *scheduler,
     52  Thread_Control          *thread,
     53  size_t                   cpusetsize,
     54  cpu_set_t               *cpuset
    5555)
    5656{
     
    6969
    7070bool _Scheduler_priority_affinity_SMP_Set_affinity(
    71   Scheduler_Control *scheduler,
    72   Thread_Control    *thread,
    73   size_t             cpusetsize,
    74   cpu_set_t         *cpuset
     71  const Scheduler_Control *scheduler,
     72  Thread_Control          *thread,
     73  size_t                   cpusetsize,
     74  cpu_set_t               *cpuset
    7575)
    7676{
  • cpukit/score/src/schedulerpriorityallocate.c

    rdc18190 re1598a6  
    2424
    2525void *_Scheduler_priority_Allocate (
    26   Scheduler_Control *scheduler,
    27   Thread_Control    *the_thread
     26  const Scheduler_Control *scheduler,
     27  Thread_Control          *the_thread
    2828)
    2929{
  • cpukit/score/src/schedulerpriorityblock.c

    rdc18190 re1598a6  
    2424
    2525void _Scheduler_priority_Block(
    26   Scheduler_Control *scheduler,
    27   Thread_Control    *the_thread
     26  const Scheduler_Control *scheduler,
     27  Thread_Control          *the_thread
    2828)
    2929{
  • cpukit/score/src/schedulerpriorityenqueue.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_priority_Enqueue(
    24   Scheduler_Control *base,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
    28   Scheduler_priority_Control *scheduler =
    29     _Scheduler_priority_Self_from_base( base );
     28  Scheduler_priority_Context *context =
     29    _Scheduler_priority_Get_context( scheduler );
    3030
    31   _Scheduler_priority_Ready_queue_enqueue( the_thread, &scheduler->Bit_map );
     31  _Scheduler_priority_Ready_queue_enqueue( the_thread, &context->Bit_map );
    3232}
  • cpukit/score/src/schedulerpriorityenqueuefirst.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_priority_Enqueue_first(
    24   Scheduler_Control *base,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
    28   Scheduler_priority_Control *self =
    29     _Scheduler_priority_Self_from_base( base );
     28  Scheduler_priority_Context *context =
     29    _Scheduler_priority_Get_context( scheduler );
    3030
    3131  _Scheduler_priority_Ready_queue_enqueue_first(
    3232    the_thread,
    33     &self->Bit_map
     33    &context->Bit_map
    3434  );
    3535}
  • cpukit/score/src/schedulerpriorityextract.c

    rdc18190 re1598a6  
    2323
    2424void _Scheduler_priority_Extract(
    25   Scheduler_Control *base,
    26   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2727)
    2828{
    29   _Scheduler_priority_Extract_body( base, the_thread );
     29  _Scheduler_priority_Extract_body( scheduler, the_thread );
    3030}
  • cpukit/score/src/schedulerpriorityfree.c

    rdc18190 re1598a6  
    2626
    2727void _Scheduler_priority_Free (
    28   Scheduler_Control *base,
    29   Thread_Control    *the_thread
     28  const Scheduler_Control *scheduler,
     29  Thread_Control          *the_thread
    3030)
    3131{
    32   (void) base;
     32  (void) scheduler;
    3333
    3434  _Workspace_Free( the_thread->scheduler_info );
  • cpukit/score/src/schedulerpriorityschedule.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_priority_Schedule(
    24   Scheduler_Control *base,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
    28   _Scheduler_priority_Schedule_body( base, the_thread, false );
     28  _Scheduler_priority_Schedule_body( scheduler, the_thread, false );
    2929}
  • cpukit/score/src/schedulerprioritysmp.c

    rdc18190 re1598a6  
    3030#include <rtems/score/wkspace.h>
    3131
    32 static Scheduler_priority_SMP_Control *
    33 _Scheduler_priority_SMP_Self_from_base( Scheduler_Control *base )
    34 {
    35   return (Scheduler_priority_SMP_Control *) base->information;
    36 }
    37 
    38 static Scheduler_priority_SMP_Control *
    39 _Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
    40 {
    41   return (Scheduler_priority_SMP_Control *)
     32static Scheduler_priority_SMP_Context *
     33_Scheduler_priority_SMP_Get_context( const Scheduler_Control *scheduler )
     34{
     35  return (Scheduler_priority_SMP_Context *) scheduler->context;
     36}
     37
     38static Scheduler_priority_SMP_Context *
     39_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Context *smp_base )
     40{
     41  return (Scheduler_priority_SMP_Context *)
    4242    ( (char *) smp_base
    43       - offsetof( Scheduler_priority_SMP_Control, Base ) );
    44 }
    45 
    46 void _Scheduler_priority_SMP_Initialize( void )
    47 {
    48   Scheduler_priority_SMP_Control *self = _Workspace_Allocate_or_fatal_error(
    49     sizeof( *self ) + PRIORITY_MAXIMUM * sizeof( Chain_Control )
    50   );
     43      - offsetof( Scheduler_priority_SMP_Context, Base ) );
     44}
     45
     46void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
     47{
     48  Scheduler_priority_SMP_Context *self =
     49    _Scheduler_priority_SMP_Get_context( scheduler );
    5150
    5251  _Scheduler_SMP_Initialize( &self->Base );
    5352  _Priority_bit_map_Initialize( &self->Bit_map );
    5453  _Scheduler_priority_Ready_queue_initialize( &self->Ready[ 0 ] );
    55 
    56   _Scheduler.information = self;
    5754}
    5855
    5956void _Scheduler_priority_SMP_Update(
    60   Scheduler_Control *base,
    61   Thread_Control *thread
    62 )
    63 {
    64   Scheduler_priority_SMP_Control *self =
    65     _Scheduler_priority_SMP_Self_from_base( base );
     57  const Scheduler_Control *scheduler,
     58  Thread_Control *thread
     59)
     60{
     61  Scheduler_priority_SMP_Context *self =
     62    _Scheduler_priority_SMP_Get_context( scheduler );
    6663
    6764  _Scheduler_priority_Update_body(
     
    7370
    7471static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
    75   Scheduler_SMP_Control *smp_base
    76 )
    77 {
    78   Scheduler_priority_SMP_Control *self =
     72  Scheduler_SMP_Context *smp_base
     73)
     74{
     75  Scheduler_priority_SMP_Context *self =
    7976    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    8077  Thread_Control *highest_ready = NULL;
     
    9188
    9289static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
    93   Scheduler_SMP_Control *smp_base,
     90  Scheduler_SMP_Context *smp_base,
    9491  Thread_Control *scheduled_to_ready
    9592)
    9693{
    97   Scheduler_priority_SMP_Control *self =
     94  Scheduler_priority_SMP_Context *self =
    9895    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    9996
     
    106103
    107104static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
    108   Scheduler_SMP_Control *smp_base,
     105  Scheduler_SMP_Context *smp_base,
    109106  Thread_Control *ready_to_scheduled
    110107)
    111108{
    112   Scheduler_priority_SMP_Control *self =
     109  Scheduler_priority_SMP_Context *self =
    113110    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    114111
     
    124121
    125122static void _Scheduler_priority_SMP_Insert_ready_lifo(
    126   Scheduler_SMP_Control *smp_base,
    127   Thread_Control *thread
    128 )
    129 {
    130   Scheduler_priority_SMP_Control *self =
     123  Scheduler_SMP_Context *smp_base,
     124  Thread_Control *thread
     125)
     126{
     127  Scheduler_priority_SMP_Context *self =
    131128    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    132129
     
    135132
    136133static void _Scheduler_priority_SMP_Insert_ready_fifo(
    137   Scheduler_SMP_Control *smp_base,
    138   Thread_Control *thread
    139 )
    140 {
    141   Scheduler_priority_SMP_Control *self =
     134  Scheduler_SMP_Context *smp_base,
     135  Thread_Control *thread
     136)
     137{
     138  Scheduler_priority_SMP_Context *self =
    142139    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    143140
     
    146143
    147144static void _Scheduler_priority_SMP_Do_extract(
    148   Scheduler_SMP_Control *smp_base,
    149   Thread_Control *thread
    150 )
    151 {
    152   Scheduler_priority_SMP_Control *self =
     145  Scheduler_SMP_Context *smp_base,
     146  Thread_Control *thread
     147)
     148{
     149  Scheduler_priority_SMP_Context *self =
    153150    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    154151  bool is_scheduled = thread->is_scheduled;
     
    165162
    166163void _Scheduler_priority_SMP_Block(
    167   Scheduler_Control *base,
    168   Thread_Control *thread
    169 )
    170 {
    171   Scheduler_priority_SMP_Control *self =
    172     _Scheduler_priority_SMP_Self_from_base( base );
     164  const Scheduler_Control *scheduler,
     165  Thread_Control *thread
     166)
     167{
     168  Scheduler_priority_SMP_Context *self =
     169    _Scheduler_priority_SMP_Get_context( scheduler );
    173170
    174171  _Scheduler_SMP_Block(
     
    182179
    183180static void _Scheduler_priority_SMP_Enqueue_ordered(
    184   Scheduler_SMP_Control *self,
     181  Scheduler_SMP_Context *self,
    185182  Thread_Control *thread,
    186183  Chain_Node_order order,
     
    202199
    203200void _Scheduler_priority_SMP_Enqueue_lifo(
    204   Scheduler_Control *base,
    205   Thread_Control *thread
    206 )
    207 {
    208   Scheduler_priority_SMP_Control *self =
    209     _Scheduler_priority_SMP_Self_from_base( base );
     201  const Scheduler_Control *scheduler,
     202  Thread_Control *thread
     203)
     204{
     205  Scheduler_priority_SMP_Context *self =
     206    _Scheduler_priority_SMP_Get_context( scheduler );
    210207
    211208  _Scheduler_priority_SMP_Enqueue_ordered(
     
    219216
    220217void _Scheduler_priority_SMP_Enqueue_fifo(
    221   Scheduler_Control *base,
    222   Thread_Control *thread
    223 )
    224 {
    225   Scheduler_priority_SMP_Control *self =
    226     _Scheduler_priority_SMP_Self_from_base( base );
     218  const Scheduler_Control *scheduler,
     219  Thread_Control *thread
     220)
     221{
     222  Scheduler_priority_SMP_Context *self =
     223    _Scheduler_priority_SMP_Get_context( scheduler );
    227224
    228225  _Scheduler_priority_SMP_Enqueue_ordered(
     
    236233
    237234void _Scheduler_priority_SMP_Extract(
    238   Scheduler_Control *base,
    239   Thread_Control *thread
    240 )
    241 {
    242   Scheduler_priority_SMP_Control *self =
    243     _Scheduler_priority_SMP_Self_from_base( base );
     235  const Scheduler_Control *scheduler,
     236  Thread_Control *thread
     237)
     238{
     239  Scheduler_priority_SMP_Context *self =
     240    _Scheduler_priority_SMP_Get_context( scheduler );
    244241
    245242  _Scheduler_SMP_Extract(
     
    251248
    252249void _Scheduler_priority_SMP_Yield(
    253   Scheduler_Control *base,
     250  const Scheduler_Control *scheduler,
    254251  Thread_Control *thread
    255252)
     
    259256  _ISR_Disable( level );
    260257
    261   _Scheduler_priority_SMP_Extract( base, thread );
    262   _Scheduler_priority_SMP_Enqueue_fifo( base, thread );
     258  _Scheduler_priority_SMP_Extract( scheduler, thread );
     259  _Scheduler_priority_SMP_Enqueue_fifo( scheduler, thread );
    263260
    264261  _ISR_Enable( level );
     
    266263
    267264void _Scheduler_priority_SMP_Schedule(
    268   Scheduler_Control *base,
    269   Thread_Control *thread
    270 )
    271 {
    272   Scheduler_priority_SMP_Control *self =
    273     _Scheduler_priority_SMP_Self_from_base( base );
     265  const Scheduler_Control *scheduler,
     266  Thread_Control *thread
     267)
     268{
     269  Scheduler_priority_SMP_Context *self =
     270    _Scheduler_priority_SMP_Get_context( scheduler );
    274271
    275272  _Scheduler_SMP_Schedule(
     
    282279
    283280void _Scheduler_priority_SMP_Start_idle(
    284   Scheduler_Control *base,
     281  const Scheduler_Control *scheduler,
    285282  Thread_Control *thread,
    286283  Per_CPU_Control *cpu
    287284)
    288285{
    289   Scheduler_priority_SMP_Control *self =
    290     _Scheduler_priority_SMP_Self_from_base( base );
     286  Scheduler_priority_SMP_Context *self =
     287    _Scheduler_priority_SMP_Get_context( scheduler );
    291288
    292289  _Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
  • cpukit/score/src/schedulerpriorityunblock.c

    rdc18190 re1598a6  
    2424
    2525void _Scheduler_priority_Unblock (
    26   Scheduler_Control *base,
    27   Thread_Control    *the_thread
     26  const Scheduler_Control *scheduler,
     27  Thread_Control          *the_thread
    2828)
    2929{
    30   Scheduler_priority_Control *self =
    31     _Scheduler_priority_Self_from_base( base );
     30  Scheduler_priority_Context *context =
     31    _Scheduler_priority_Get_context( scheduler );
    3232
    33   _Scheduler_priority_Ready_queue_enqueue( the_thread, &self->Bit_map );
     33  _Scheduler_priority_Ready_queue_enqueue( the_thread, &context->Bit_map );
    3434
    3535  /* TODO: flash critical section? */
  • cpukit/score/src/schedulerpriorityupdate.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_priority_Update(
    24   Scheduler_Control *base,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
    28   Scheduler_priority_Control *self =
    29     _Scheduler_priority_Self_from_base( base );
     28  Scheduler_priority_Context *context =
     29    _Scheduler_priority_Get_context( scheduler );
    3030
    3131  _Scheduler_priority_Update_body(
    3232    the_thread,
    33     &self->Bit_map,
    34     &self->Ready[ 0 ]
     33    &context->Bit_map,
     34    &context->Ready[ 0 ]
    3535  );
    3636}
  • cpukit/score/src/schedulerpriorityyield.c

    rdc18190 re1598a6  
    2424
    2525void _Scheduler_priority_Yield(
    26   Scheduler_Control *base,
    27   Thread_Control    *the_thread
     26  const Scheduler_Control *scheduler,
     27  Thread_Control          *the_thread
    2828)
    2929{
     
    3333  ISR_Level level;
    3434
    35   (void) base;
     35  (void) scheduler;
    3636
    3737  _ISR_Disable( level );
  • cpukit/score/src/schedulersimple.c

    rdc18190 re1598a6  
    2020#endif
    2121
    22 #include <rtems/score/schedulersimple.h>
     22#include <rtems/score/schedulersimpleimpl.h>
    2323#include <rtems/score/chainimpl.h>
    24 #include <rtems/score/wkspace.h>
    2524
    26 void _Scheduler_simple_Initialize ( void )
     25void _Scheduler_simple_Initialize( const Scheduler_Control *scheduler )
    2726{
    28   Scheduler_simple_Control *scheduler =
    29     _Workspace_Allocate_or_fatal_error( sizeof( *scheduler ) );
     27  Scheduler_simple_Context *context =
     28    _Scheduler_simple_Get_context( scheduler );
    3029
    31   _Chain_Initialize_empty( &scheduler->Ready );
    32 
    33   _Scheduler.information = scheduler;
     30  _Chain_Initialize_empty( &context->Ready );
    3431}
  • cpukit/score/src/schedulersimpleblock.c

    rdc18190 re1598a6  
    2323
    2424void _Scheduler_simple_Block(
    25   Scheduler_Control *scheduler,
    26   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2727)
    2828{
  • cpukit/score/src/schedulersimpleenqueue.c

    rdc18190 re1598a6  
    2020#endif
    2121
    22 #include <rtems/system.h>
    23 #include <rtems/score/chain.h>
    24 #include <rtems/score/isr.h>
    25 #include <rtems/score/thread.h>
    26 #include <rtems/score/schedulersimple.h>
     22#include <rtems/score/schedulersimpleimpl.h>
    2723
    2824void _Scheduler_simple_Enqueue(
    29   Scheduler_Control *scheduler,
    30   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    3127)
    3228{
  • cpukit/score/src/schedulersimpleenqueuefirst.c

    rdc18190 re1598a6  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/chain.h>
    23 #include <rtems/score/thread.h>
    2421#include <rtems/score/schedulersimple.h>
    2522
    2623void _Scheduler_simple_Enqueue_first(
    27   Scheduler_Control *scheduler,
    28   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2926)
    3027{
  • cpukit/score/src/schedulersimpleextract.c

    rdc18190 re1598a6  
    2020#endif
    2121
    22 #include <rtems/score/schedulersimple.h>
    23 #include <rtems/score/chainimpl.h>
    24 #include <rtems/score/thread.h>
     22#include <rtems/score/schedulersimpleimpl.h>
    2523
    2624void _Scheduler_simple_Extract(
    27   Scheduler_Control *scheduler,
    28   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2927)
    3028{
  • cpukit/score/src/schedulersimplereadyqueueenqueue.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_simple_Ready_queue_enqueue(
    24   Scheduler_Control *scheduler_base,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
    28   Scheduler_simple_Control *scheduler =
    29     _Scheduler_simple_Self_from_base( scheduler_base );
     28  Scheduler_simple_Context *context =
     29    _Scheduler_simple_Get_context( scheduler );
    3030
    31   _Scheduler_simple_Insert_priority_fifo( &scheduler->Ready, the_thread );
     31  _Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread );
    3232}
  • cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_simple_Ready_queue_enqueue_first(
    24   Scheduler_Control *scheduler_base,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
    28   Scheduler_simple_Control *scheduler =
    29     _Scheduler_simple_Self_from_base( scheduler_base );
     28  Scheduler_simple_Context *context =
     29    _Scheduler_simple_Get_context( scheduler );
    3030
    31   _Scheduler_simple_Insert_priority_lifo( &scheduler->Ready, the_thread );
     31  _Scheduler_simple_Insert_priority_lifo( &context->Ready, the_thread );
    3232}
  • cpukit/score/src/schedulersimpleschedule.c

    rdc18190 re1598a6  
    2222
    2323void _Scheduler_simple_Schedule(
    24   Scheduler_Control *scheduler,
    25   Thread_Control    *the_thread
     24  const Scheduler_Control *scheduler,
     25  Thread_Control          *the_thread
    2626)
    2727{
  • cpukit/score/src/schedulersimplesmp.c

    rdc18190 re1598a6  
    2323#include <rtems/score/wkspace.h>
    2424
    25 static Scheduler_simple_SMP_Control *
    26 _Scheduler_simple_SMP_Self_from_base( Scheduler_Control *base )
    27 {
    28   return (Scheduler_simple_SMP_Control *) base->information;
    29 }
    30 
    31 static Scheduler_simple_SMP_Control *
    32 _Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
    33 {
    34   return (Scheduler_simple_SMP_Control *)
    35     ( (char *) smp_base - offsetof( Scheduler_simple_SMP_Control, Base ) );
    36 }
    37 
    38 void _Scheduler_simple_smp_Initialize( void )
    39 {
    40   Scheduler_simple_SMP_Control *self =
    41     _Workspace_Allocate_or_fatal_error( sizeof( *self ) );
     25static Scheduler_simple_SMP_Context *
     26_Scheduler_simple_SMP_Get_context( const Scheduler_Control *scheduler )
     27{
     28  return (Scheduler_simple_SMP_Context *) scheduler->context;
     29}
     30
     31static Scheduler_simple_SMP_Context *
     32_Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Context *smp_base )
     33{
     34  return (Scheduler_simple_SMP_Context *)
     35    ( (char *) smp_base - offsetof( Scheduler_simple_SMP_Context, Base ) );
     36}
     37
     38void _Scheduler_simple_smp_Initialize( const Scheduler_Control *scheduler )
     39{
     40  Scheduler_simple_SMP_Context *self =
     41    _Scheduler_simple_SMP_Get_context( scheduler );
    4242
    4343  _Scheduler_SMP_Initialize( &self->Base );
    4444  _Chain_Initialize_empty( &self->Ready );
    45 
    46   _Scheduler.information = self;
    4745}
    4846
    4947static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
    50   Scheduler_SMP_Control *smp_base
    51 )
    52 {
    53   Scheduler_simple_SMP_Control *self =
     48  Scheduler_SMP_Context *smp_base
     49)
     50{
     51  Scheduler_simple_SMP_Context *self =
    5452    _Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
    5553  Thread_Control *highest_ready = NULL;
     
    6462
    6563static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
    66   Scheduler_SMP_Control *smp_base,
     64  Scheduler_SMP_Context *smp_base,
    6765  Thread_Control *scheduled_to_ready
    6866)
    6967{
    70   Scheduler_simple_SMP_Control *self =
     68  Scheduler_simple_SMP_Context *self =
    7169    _Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
    7270
     
    7977
    8078static void _Scheduler_simple_smp_Move_from_ready_to_scheduled(
    81   Scheduler_SMP_Control *smp_base,
     79  Scheduler_SMP_Context *smp_base,
    8280  Thread_Control *ready_to_scheduled
    8381)
     
    9189
    9290static void _Scheduler_simple_smp_Insert_ready_lifo(
    93   Scheduler_SMP_Control *smp_base,
    94   Thread_Control *thread
    95 )
    96 {
    97   Scheduler_simple_SMP_Control *self =
     91  Scheduler_SMP_Context *smp_base,
     92  Thread_Control *thread
     93)
     94{
     95  Scheduler_simple_SMP_Context *self =
    9896    _Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
    9997
     
    106104
    107105static void _Scheduler_simple_smp_Insert_ready_fifo(
    108   Scheduler_SMP_Control *smp_base,
    109   Thread_Control *thread
    110 )
    111 {
    112   Scheduler_simple_SMP_Control *self =
     106  Scheduler_SMP_Context *smp_base,
     107  Thread_Control *thread
     108)
     109{
     110  Scheduler_simple_SMP_Context *self =
    113111    _Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
    114112
     
    121119
    122120static void _Scheduler_simple_smp_Do_extract(
    123   Scheduler_SMP_Control *smp_base,
     121  Scheduler_SMP_Context *smp_base,
    124122  Thread_Control *thread
    125123)
     
    134132
    135133void _Scheduler_simple_smp_Block(
    136   Scheduler_Control *base,
    137   Thread_Control *thread
    138 )
    139 {
    140   Scheduler_simple_SMP_Control *self =
    141     _Scheduler_simple_SMP_Self_from_base( base );
     134  const Scheduler_Control *scheduler,
     135  Thread_Control *thread
     136)
     137{
     138  Scheduler_simple_SMP_Context *self =
     139    _Scheduler_simple_SMP_Get_context( scheduler );
    142140
    143141  _Scheduler_SMP_Block(
     
    151149
    152150static void _Scheduler_simple_smp_Enqueue_ordered(
    153   Scheduler_SMP_Control *smp_base,
     151  Scheduler_SMP_Context *smp_base,
    154152  Thread_Control *thread,
    155153  Chain_Node_order order,
     
    171169
    172170void _Scheduler_simple_smp_Enqueue_priority_lifo(
    173   Scheduler_Control *base,
    174   Thread_Control *thread
    175 )
    176 {
    177   Scheduler_simple_SMP_Control *self =
    178     _Scheduler_simple_SMP_Self_from_base( base );
     171  const Scheduler_Control *scheduler,
     172  Thread_Control *thread
     173)
     174{
     175  Scheduler_simple_SMP_Context *self =
     176    _Scheduler_simple_SMP_Get_context( scheduler );
    179177
    180178  _Scheduler_simple_smp_Enqueue_ordered(
     
    188186
    189187void _Scheduler_simple_smp_Enqueue_priority_fifo(
    190   Scheduler_Control *base,
    191   Thread_Control *thread
    192 )
    193 {
    194   Scheduler_simple_SMP_Control *self =
    195     _Scheduler_simple_SMP_Self_from_base( base );
     188  const Scheduler_Control *scheduler,
     189  Thread_Control *thread
     190)
     191{
     192  Scheduler_simple_SMP_Context *self =
     193    _Scheduler_simple_SMP_Get_context( scheduler );
    196194
    197195  _Scheduler_simple_smp_Enqueue_ordered(
     
    205203
    206204void _Scheduler_simple_smp_Extract(
    207   Scheduler_Control *base,
    208   Thread_Control *thread
    209 )
    210 {
    211   Scheduler_simple_SMP_Control *self =
    212     _Scheduler_simple_SMP_Self_from_base( base );
     205  const Scheduler_Control *scheduler,
     206  Thread_Control *thread
     207)
     208{
     209  Scheduler_simple_SMP_Context *self =
     210    _Scheduler_simple_SMP_Get_context( scheduler );
    213211
    214212  _Scheduler_SMP_Extract(
     
    220218
    221219void _Scheduler_simple_smp_Yield(
    222   Scheduler_Control *base,
     220  const Scheduler_Control *scheduler,
    223221  Thread_Control *thread
    224222)
     
    228226  _ISR_Disable( level );
    229227
    230   _Scheduler_simple_smp_Extract( base, thread );
    231   _Scheduler_simple_smp_Enqueue_priority_fifo( base, thread );
     228  _Scheduler_simple_smp_Extract( scheduler, thread );
     229  _Scheduler_simple_smp_Enqueue_priority_fifo( scheduler, thread );
    232230
    233231  _ISR_Enable( level );
     
    235233
    236234void _Scheduler_simple_smp_Schedule(
    237   Scheduler_Control *base,
    238   Thread_Control *thread
    239 )
    240 {
    241   Scheduler_simple_SMP_Control *self =
    242     _Scheduler_simple_SMP_Self_from_base( base );
     235  const Scheduler_Control *scheduler,
     236  Thread_Control *thread
     237)
     238{
     239  Scheduler_simple_SMP_Context *self =
     240    _Scheduler_simple_SMP_Get_context( scheduler );
    243241
    244242  _Scheduler_SMP_Schedule(
     
    251249
    252250void _Scheduler_simple_smp_Start_idle(
    253   Scheduler_Control *base,
     251  const Scheduler_Control *scheduler,
    254252  Thread_Control *thread,
    255253  Per_CPU_Control *cpu
    256254)
    257255{
    258   Scheduler_simple_SMP_Control *self =
    259     _Scheduler_simple_SMP_Self_from_base( base );
     256  Scheduler_simple_SMP_Context *self =
     257    _Scheduler_simple_SMP_Get_context( scheduler );
    260258
    261259  _Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
  • cpukit/score/src/schedulersimpleunblock.c

    rdc18190 re1598a6  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/isr.h>
    23 #include <rtems/score/schedulersimple.h>
     21#include <rtems/score/schedulersimpleimpl.h>
    2422#include <rtems/score/thread.h>
    2523
    2624void _Scheduler_simple_Unblock(
    27   Scheduler_Control *scheduler,
    28   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2927)
    3028{
  • cpukit/score/src/schedulersimpleyield.c

    rdc18190 re1598a6  
    2121#include <rtems/score/schedulersimpleimpl.h>
    2222#include <rtems/score/isr.h>
    23 #include <rtems/score/threadimpl.h>
    2423
    2524void _Scheduler_simple_Yield(
    26   Scheduler_Control *scheduler,
    27   Thread_Control    *the_thread
     25  const Scheduler_Control *scheduler,
     26  Thread_Control          *the_thread
    2827)
    2928{
  • cpukit/score/src/threadchangepriority.c

    rdc18190 re1598a6  
    3030)
    3131{
    32   Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
    33   ISR_Level          level;
    34   States_Control     state, original_state;
     32  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     33  ISR_Level                level;
     34  States_Control           state, original_state;
    3535
    3636  /*
  • cpukit/score/src/threadrestart.c

    rdc18190 re1598a6  
    217217
    218218static void _Thread_Start_life_change(
    219   Thread_Control    *the_thread,
    220   Scheduler_Control *scheduler,
    221   Priority_Control   priority
     219  Thread_Control          *the_thread,
     220  const Scheduler_Control *scheduler,
     221  Priority_Control         priority
    222222)
    223223{
     
    246246  Per_CPU_Control *cpu;
    247247  ISR_Level level;
    248   Scheduler_Control *scheduler;
     248  const Scheduler_Control *scheduler;
    249249
    250250  cpu = _Thread_Action_ISR_disable_and_acquire( the_thread, &level );
  • doc/user/conf.t

    rdc18190 re1598a6  
    37173717
    37183718@item DATA TYPE:
    3719 Entry points for scheduler
    3720 
    3721 @item RANGE:
    3722 Undefined or scheduler entry set
     3719Boolean feature macro.
     3720
     3721@item RANGE:
     3722Defined or undefined.
    37233723
    37243724@item DEFAULT VALUE:
     
    37353735
    37363736@itemize @bullet
    3737 @item @code{CONFIGURE_MEMORY_FOR_SCHEDULER} must be defined with the
    3738 amount of memory required as a base amount for the scheduler.
    3739 
    3740 @item @code{CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER(_tasks)} must be
    3741 defined as a formula which computes the amount of memory required based
    3742 upon the number of tasks configured.
     3737@item @code{CONFIGURE_SCHEDULER_CONTEXT} must be defined to a static definition
     3738of the scheduler context of the user scheduler.
     3739
     3740@item @code{CONFIGURE_SCHEDULER_CONTROLS} must be defined to a scheduler
     3741control initializer for the user scheduler.
     3742
     3743@item @code{CONFIGURE_SCHEDULER_USER_PER_THREAD} must be defined to the type of
     3744the per-thread information of the user scheduler.
    37433745
    37443746@end itemize
  • testsuites/rhealstone/rhilatency/ilatency.c

    rdc18190 re1598a6  
    1616#define CONFIGURE_INIT
    1717#include <timesys.h>
     18#include <rtems/score/schedulerpriorityimpl.h>
    1819#include <rtems/timerdrv.h>
    1920#include <coverhd.h>
     
    5960  puts( "*** START OF RHILATENCY ***" );
    6061
    61   if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
     62  if (
     63    _Scheduler_Table[ 0 ].Operations.initialize
     64      != _Scheduler_priority_Initialize
     65  ) {
    6266    puts( "  Error ==> " );
    6367    puts( "Test only supported for deterministic priority scheduler\n" );
  • testsuites/sptests/spinternalerror01/init.c

    rdc18190 re1598a6  
    7171#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
    7272
    73 #define CONFIGURE_SCHEDULER_ENTRY_POINTS NULL
    74 
    7573#define CONFIGURE_SCHEDULER_USER
    7674
    77 #define CONFIGURE_MEMORY_FOR_SCHEDULER 0
     75#define CONFIGURE_SCHEDULER_CONTEXT
     76
     77#define CONFIGURE_SCHEDULER_CONTROLS { }
    7878
    7979#define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER 0
  • testsuites/sptests/spsize/size.c

    rdc18190 re1598a6  
    8585#include <rtems/score/schedulerpriority.h>
    8686
    87 /* Priority scheduling uninitialized (globals) consumption */
    88 #define SCHEDULER_OVHD      (sizeof _Scheduler)
    89 
    9087/* Priority scheduling per-thread consumption. Gets
    9188 * included in the PER_TASK consumption.
     
    9592/* Priority scheduling workspace consumption
    9693 *
    97  * Include allocation of ready queue.  Pointers are already counted by
    98  * including _Scheduler in SCHEDULER_OVHD.
     94 * Include allocation of ready queue.
    9995 */
    10096#define SCHEDULER_WKSP_SIZE  \
    101     (sizeof(Scheduler_priority_Control) + \
     97    (sizeof(Scheduler_priority_Context) + \
    10298     RTEMS_MAXIMUM_PRIORITY * sizeof(Chain_Control ))
    10399/****** END OF MEMORY USAGE OF DEFAULT PRIORITY SCHEDULER ******/
     
    352348
    353349/*rtems.h*/     /* Not applicable */
    354 
    355 /*scheduler.h*/ SCHEDULER_OVHD                            +
    356350
    357351/*semimpl.h*/   (sizeof _Semaphore_Information)           +
  • testsuites/tmtests/tm26/task1.c

    rdc18190 re1598a6  
    224224  TEST_BEGIN();
    225225
    226   if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
     226  if (
     227    _Scheduler_Table[ 0 ].Operations.initialize
     228      != _Scheduler_priority_Initialize
     229  ) {
    227230    puts("  Error ==> " );
    228231    puts("Test only supported for deterministic priority scheduler\n" );
     
    372375)
    373376{
    374   Scheduler_priority_Control *scheduler =
    375     _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
     377  Scheduler_priority_Context *scheduler_context =
     378    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
    376379
    377380  thread_dispatch_no_fp_time = benchmark_timer_read();
     
    382385
    383386  set_thread_executing(
    384     (Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY])
     387    (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY])
    385388  );
    386389
     
    405408)
    406409{
    407   Scheduler_priority_Control *scheduler =
    408     _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
     410  Scheduler_priority_Context *scheduler_context =
     411    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
    409412  Thread_Control             *executing;
    410413
     
    425428
    426429  set_thread_executing(
    427     (Thread_Control *) _Chain_First(&scheduler->Ready[FP1_PRIORITY])
     430    (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP1_PRIORITY])
    428431  );
    429432
     
    448451)
    449452{
    450   Scheduler_priority_Control *scheduler =
    451     _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
     453  Scheduler_priority_Context *scheduler_context =
     454    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
    452455  Thread_Control             *executing;
    453456  FP_DECLARE;
     
    458461
    459462  set_thread_executing(
    460     (Thread_Control *) _Chain_First(&scheduler->Ready[FP2_PRIORITY])
     463    (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP2_PRIORITY])
    461464  );
    462465
     
    485488
    486489  set_thread_executing(
    487     (Thread_Control *) _Chain_First(&scheduler->Ready[FP2_PRIORITY])
     490    (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP2_PRIORITY])
    488491  );
    489492
     
    504507)
    505508{
    506   Scheduler_priority_Control *scheduler =
    507     _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
     509  Scheduler_priority_Context *scheduler_context =
     510    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
    508511  Thread_Control             *executing;
    509512  FP_DECLARE;
     
    514517
    515518  set_thread_executing(
    516     (Thread_Control *) _Chain_First(&scheduler->Ready[FP1_PRIORITY])
     519    (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP1_PRIORITY])
    517520  );
    518521
  • testsuites/tmtests/tm27/task1.c

    rdc18190 re1598a6  
    2121#include "system.h"
    2222
     23#include <bsp.h>
    2324#include <rtems/score/schedulerpriorityimpl.h>
    24 #include <bsp.h>
    2525
    2626#define _RTEMS_TMTEST27
     
    5656
    5757  TEST_BEGIN();
    58   if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
     58
     59  if (
     60    _Scheduler_Table[ 0 ].Operations.initialize
     61      != _Scheduler_priority_Initialize
     62  ) {
    5963    puts("  Error ==> " );
    6064    puts("Test only supported for deterministic priority scheduler\n" );
     
    103107)
    104108{
    105   Scheduler_priority_Control *scheduler =
    106     _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
     109  Scheduler_priority_Context *scheduler_context =
     110    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
    107111#if defined(RTEMS_SMP)
    108112  rtems_interrupt_level level;
     
    189193
    190194  _Thread_Executing =
    191         (Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY]);
     195        (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]);
    192196
    193197  _Thread_Dispatch_necessary = 1;
     
    221225)
    222226{
    223   Scheduler_priority_Control *scheduler =
    224     _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
     227  Scheduler_priority_Context *scheduler_context =
     228    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
    225229#if defined(RTEMS_SMP)
    226230  rtems_interrupt_level level;
     
    259263
    260264  _Thread_Executing =
    261         (Thread_Control *) _Chain_First(&scheduler->Ready[LOW_PRIORITY]);
     265        (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]);
    262266
    263267  _Thread_Dispatch_necessary = 1;
Note: See TracChangeset for help on using the changeset viewer.