Changeset 0c551f7 in rtems


Ignore:
Timestamp:
Aug 8, 2013, 6:45:33 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
f20b3d56
Parents:
e5ca54c9
git-author:
Sebastian Huber <sebastian.huber@…> (08/08/13 06:45:33)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/20/13 08:14:02)
Message:

score: Add _Scheduler_priority_Get_scheduler_info

Add and use _Scheduler_priority_Get_scheduler_info().

Location:
cpukit/score
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/schedulerpriorityimpl.h

    re5ca54c9 r0c551f7  
    5858}
    5959
     60RTEMS_INLINE_ROUTINE Scheduler_priority_Per_thread *
     61_Scheduler_priority_Get_scheduler_info( Thread_Control *thread )
     62{
     63  return ( Scheduler_priority_Per_thread * ) thread->scheduler_info;
     64}
     65
    6066/**
    6167 * @brief Put a thread to the ready queue.
     
    6975)
    7076{
    71   Scheduler_priority_Per_thread *sched_info;
    72   Chain_Control                 *ready;
    73 
    74   sched_info = (Scheduler_priority_Per_thread *) the_thread->scheduler_info;
    75   ready      = sched_info->ready_chain;
    76 
    77   _Priority_bit_map_Add( &sched_info->Priority_map );
    78 
    79   _Chain_Append_unprotected( ready, &the_thread->Object.Node );
     77  Scheduler_priority_Per_thread *sched_info_of_thread =
     78    _Scheduler_priority_Get_scheduler_info( the_thread );
     79  Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     80
     81  _Chain_Append_unprotected( ready_chain, &the_thread->Object.Node );
     82  _Priority_bit_map_Add( &sched_info_of_thread->Priority_map );
    8083}
    8184
     
    9396)
    9497{
    95   Scheduler_priority_Per_thread *sched_info;
    96 
    97   sched_info = (Scheduler_priority_Per_thread *) the_thread->scheduler_info;
    98 
    99   _Priority_bit_map_Add( &sched_info->Priority_map );
    100 
    101   _Chain_Prepend_unprotected(
    102     sched_info->ready_chain,
    103     &the_thread->Object.Node
    104   );
     98  Scheduler_priority_Per_thread *sched_info_of_thread =
     99    _Scheduler_priority_Get_scheduler_info( the_thread );
     100  Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     101
     102  _Chain_Prepend_unprotected( ready_chain, &the_thread->Object.Node );
     103  _Priority_bit_map_Add( &sched_info_of_thread->Priority_map );
    105104}
    106105
     
    117116)
    118117{
    119   Scheduler_priority_Per_thread *sched_info;
    120   Chain_Control                 *ready;
    121 
    122   sched_info = (Scheduler_priority_Per_thread *) the_thread->scheduler_info;
    123   ready      = sched_info->ready_chain;
    124 
    125   if ( _Chain_Has_only_one_node( ready ) ) {
    126     _Chain_Initialize_empty( ready );
    127     _Priority_bit_map_Remove( &sched_info->Priority_map );
     118  Scheduler_priority_Per_thread *sched_info_of_thread =
     119    _Scheduler_priority_Get_scheduler_info( the_thread );
     120  Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     121
     122  if ( _Chain_Has_only_one_node( ready_chain ) ) {
     123    _Chain_Initialize_empty( ready_chain );
     124    _Priority_bit_map_Remove( &sched_info_of_thread->Priority_map );
    128125  } else {
    129126    _Chain_Extract_unprotected( &the_thread->Object.Node );
     
    164161)
    165162{
    166   Scheduler_priority_Per_thread *sched_info;
    167 
    168   sched_info = (Scheduler_priority_Per_thread *) the_thread->scheduler_info;
    169 
    170   if ( !_Chain_Has_only_one_node( sched_info->ready_chain ) ) {
     163  Scheduler_priority_Per_thread *sched_info_of_thread =
     164    _Scheduler_priority_Get_scheduler_info( the_thread );
     165  Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     166
     167  if ( !_Chain_Has_only_one_node( ready_chain ) ) {
    171168    _Chain_Extract_unprotected( &the_thread->Object.Node );
    172 
    173     _Chain_Append_unprotected(
    174       sched_info->ready_chain,
    175       &the_thread->Object.Node
    176     );
     169    _Chain_Append_unprotected( ready_chain, &the_thread->Object.Node );
    177170  }
    178171}
  • cpukit/score/src/schedulerpriorityallocate.c

    re5ca54c9 r0c551f7  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/config.h>
    23 #include <rtems/score/scheduler.h>
    2421#include <rtems/score/schedulerpriority.h>
    2522#include <rtems/score/wkspace.h>
    2623
    27 void* _Scheduler_priority_Allocate (
     24void *_Scheduler_priority_Allocate (
    2825  Thread_Control        *the_thread
    2926)
    3027{
    31   void *sched;
     28  Scheduler_priority_Per_thread *sched_info_of_thread =
     29    _Workspace_Allocate( sizeof( *sched_info_of_thread ) );
    3230
    33   sched = _Workspace_Allocate( sizeof(Scheduler_priority_Per_thread) );
     31  the_thread->scheduler_info = sched_info_of_thread;
    3432
    35   the_thread->scheduler_info = (Scheduler_priority_Per_thread*) sched;
    36 
    37   return sched;
     33  return sched_info_of_thread;
    3834}
  • cpukit/score/src/schedulerpriorityupdate.c

    re5ca54c9 r0c551f7  
    2626)
    2727{
    28   Scheduler_priority_Per_thread *sched_info;
     28  Scheduler_priority_Per_thread *sched_info_of_thread =
     29    _Scheduler_priority_Get_scheduler_info( the_thread );
    2930  Chain_Control                 *rq;
    3031
    31   sched_info = (Scheduler_priority_Per_thread *) the_thread->scheduler_info;
    32   rq         = (Chain_Control *) _Scheduler.information;
     32  rq                   = (Chain_Control *) _Scheduler.information;
    3333
    34   sched_info->ready_chain = &rq[ the_thread->current_priority ];
     34  sched_info_of_thread->ready_chain = &rq[ the_thread->current_priority ];
    3535
    3636  _Priority_bit_map_Initialize_information(
    37     &sched_info->Priority_map,
     37    &sched_info_of_thread->Priority_map,
    3838    the_thread->current_priority
    3939  );
  • cpukit/score/src/schedulerpriorityyield.c

    re5ca54c9 r0c551f7  
    2525void _Scheduler_priority_Yield( Thread_Control *thread )
    2626{
    27   Scheduler_priority_Per_thread *sched_info;
    28   ISR_Level                      level;
    29   Chain_Control                 *ready;
     27  Scheduler_priority_Per_thread *sched_info_of_thread =
     28    _Scheduler_priority_Get_scheduler_info( thread );
     29  Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     30  ISR_Level level;
    3031
    31   sched_info = (Scheduler_priority_Per_thread *) thread->scheduler_info;
    32   ready      = sched_info->ready_chain;
    3332  _ISR_Disable( level );
    34     if ( !_Chain_Has_only_one_node( ready ) ) {
     33    if ( !_Chain_Has_only_one_node( ready_chain ) ) {
    3534      _Chain_Extract_unprotected( &thread->Object.Node );
    36       _Chain_Append_unprotected( ready, &thread->Object.Node );
     35      _Chain_Append_unprotected( ready_chain, &thread->Object.Node );
    3736
    3837      _ISR_Flash( level );
    3938
    4039      if ( _Thread_Is_heir( thread ) )
    41         _Thread_Heir = (Thread_Control *) _Chain_First( ready );
     40        _Thread_Heir = (Thread_Control *) _Chain_First( ready_chain );
    4241      _Thread_Dispatch_necessary = true;
    4342    }
Note: See TracChangeset for help on using the changeset viewer.