Changeset ac9d2ecc in rtems


Ignore:
Timestamp:
Sep 1, 2011, 6:13:54 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 5, master
Children:
cae389ba
Parents:
900d9e66
Message:

2011-09-01 Petr Benes <benesp16@…>

PR 1895/cpukit

  • rtems/src/ratemoncancel.c, rtems/src/ratemondelete.c, rtems/src/ratemonperiod.c, sapi/include/confdefs.h, score/Makefile.am, score/include/rtems/score/scheduler.h, score/include/rtems/score/schedulerpriority.h, score/include/rtems/score/schedulersimple.h, score/include/rtems/score/schedulersimplesmp.h, score/inline/rtems/score/scheduler.inl, score/inline/rtems/score/schedulerpriority.inl, score/src/coremutexseize.c: Add priority_compare and release_job hooks interfaces to scheduler interface.
  • score/src/schedulerpriorityprioritycompare.c, score/src/schedulerpriorityreleasejob.c: New files.
Location:
cpukit
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r900d9e66 rac9d2ecc  
     12011-09-01      Petr Benes <benesp16@fel.cvut.cz>
     2
     3        PR 1895/cpukit
     4        * rtems/src/ratemoncancel.c, rtems/src/ratemondelete.c,
     5        rtems/src/ratemonperiod.c, sapi/include/confdefs.h,
     6        score/Makefile.am, score/include/rtems/score/scheduler.h,
     7        score/include/rtems/score/schedulerpriority.h,
     8        score/include/rtems/score/schedulersimple.h,
     9        score/include/rtems/score/schedulersimplesmp.h,
     10        score/inline/rtems/score/scheduler.inl,
     11        score/inline/rtems/score/schedulerpriority.inl,
     12        score/src/coremutexseize.c: Add priority_compare and release_job
     13        hooks interfaces to scheduler interface.
     14        * score/src/schedulerpriorityprioritycompare.c,
     15        score/src/schedulerpriorityreleasejob.c: New files.
     16
    1172011-08-29      Joel Sherrill <joel.sherrilL@OARcorp.com>
    218
  • cpukit/rtems/src/ratemoncancel.c

    r900d9e66 rac9d2ecc  
    5454      (void) _Watchdog_Remove( &the_period->Timer );
    5555      the_period->state = RATE_MONOTONIC_INACTIVE;
     56      _Scheduler_Release_job(the_period->owner, 0);
    5657      _Thread_Enable_dispatch();
    5758      return RTEMS_SUCCESSFUL;
  • cpukit/rtems/src/ratemondelete.c

    r900d9e66 rac9d2ecc  
    5252      the_period->state = RATE_MONOTONIC_INACTIVE;
    5353      _Rate_monotonic_Free( the_period );
     54      _Scheduler_Release_job(the_period->owner, 0);
    5455      _Thread_Enable_dispatch();
    5556      return RTEMS_SUCCESSFUL;
  • cpukit/rtems/src/ratemonperiod.c

    r900d9e66 rac9d2ecc  
    144144    }
    145145  #endif
     146
     147  _Scheduler_Release_job(the_period->owner, the_period->next_length);
    146148}
    147149
     
    283285        _ISR_Enable( level );
    284286
     287        the_period->next_length = length;
     288
    285289        /*
    286290         *  Baseline statistics information for the beginning of a period.
     
    296300        );
    297301
    298         the_period->next_length = length;
    299 
    300302        _Watchdog_Insert_ticks( &the_period->Timer, length );
    301303        _Thread_Enable_dispatch();
     
    354356
    355357        _Watchdog_Insert_ticks( &the_period->Timer, length );
     358        _Scheduler_Release_job(the_period->owner, the_period->next_length);
    356359        _Thread_Enable_dispatch();
    357360        return RTEMS_TIMEOUT;
  • cpukit/sapi/include/confdefs.h

    r900d9e66 rac9d2ecc  
    662662  #define CONFIGURE_SCHEDULER_ENTRY_POINTS \
    663663          CONFIGURE_SCHEDULER_USER_ENTRY_POINTS
     664
     665  #define CONFIGURE_SCHEDULER_MEMORY_FOR_SCHEDULER \
     666          CONFIGURE_SCHEDULER_USER_MEMORY_FOR_SCHEDULER
    664667#endif
    665668
  • cpukit/score/Makefile.am

    r900d9e66 rac9d2ecc  
    204204    src/schedulerpriorityextract.c \
    205205    src/schedulerpriorityfree.c \
     206    src/schedulerpriorityprioritycompare.c \
     207    src/schedulerpriorityreleasejob.c \
    206208    src/schedulerpriorityschedule.c \
    207209    src/schedulerpriorityunblock.c \
  • cpukit/score/include/rtems/score/scheduler.h

    r900d9e66 rac9d2ecc  
    7878  void ( *extract )(Thread_Control *);
    7979
     80  /**
     81   * Compares two priorities (returns >0 for higher priority, 0 for equal
     82   * and <0 for lower priority).
     83   */
     84  int ( *priority_compare )(Priority_Control, Priority_Control);
     85
     86  /** This routine is called upon release of a new job. */
     87  void ( *release_job ) (Thread_Control *, uint32_t);
     88
    8089  /** perform scheduler update actions required at each clock tick */
    8190  void ( *tick )(void);
     91
    8292} Scheduler_Operations;
    8393
     
    108118
    109119/**
     120 * Macro testing whether @a p1 has lower priority than @a p2
     121 * in the intuitive sense of priority.
     122 */
     123#define _Scheduler_Is_priority_lower_than( _p1, _p2 ) \
     124  (_Scheduler_Priority_compare(_p1,_p2) < 0)
     125
     126/**
     127 * Macro testing whether @a p1 has higher priority than @a p2
     128 * in the intuitive sense of priority.
     129 */
     130#define _Scheduler_Is_priority_higher_than( _p1, _p2 ) \
     131  (_Scheduler_Priority_compare(_p1,_p2) > 0)
     132
     133/**
    110134 *  This routine initializes the scheduler to the policy chosen by the user
    111135 *  through confdefs, or to the priority scheduler with ready chains by
  • cpukit/score/include/rtems/score/schedulerpriority.h

    r900d9e66 rac9d2ecc  
    3939#define SCHEDULER_PRIORITY_ENTRY_POINTS \
    4040  { \
    41     _Scheduler_priority_Initialize,    /* initialize entry point */ \
    42     _Scheduler_priority_Schedule,      /* schedule entry point */ \
    43     _Scheduler_priority_Yield,         /* yield entry point */ \
    44     _Scheduler_priority_Block,         /* block entry point */ \
    45     _Scheduler_priority_Unblock,       /* unblock entry point */ \
    46     _Scheduler_priority_Allocate,      /* allocate entry point */ \
    47     _Scheduler_priority_Free,          /* free entry point */ \
    48     _Scheduler_priority_Update,        /* update entry point */ \
    49     _Scheduler_priority_Enqueue,       /* enqueue entry point */ \
    50     _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \
    51     _Scheduler_priority_Extract,       /* extract entry point */ \
    52     _Scheduler_priority_Tick           /* tick entry point */ \
     41    _Scheduler_priority_Initialize,       /* initialize entry point */ \
     42    _Scheduler_priority_Schedule,         /* schedule entry point */ \
     43    _Scheduler_priority_Yield,            /* yield entry point */ \
     44    _Scheduler_priority_Block,            /* block entry point */ \
     45    _Scheduler_priority_Unblock,          /* unblock entry point */ \
     46    _Scheduler_priority_Allocate,         /* allocate entry point */ \
     47    _Scheduler_priority_Free,             /* free entry point */ \
     48    _Scheduler_priority_Update,           /* update entry point */ \
     49    _Scheduler_priority_Enqueue,          /* enqueue entry point */ \
     50    _Scheduler_priority_Enqueue_first,    /* enqueue_first entry point */ \
     51    _Scheduler_priority_Extract,          /* extract entry point */ \
     52    _Scheduler_priority_Priority_compare, /* compares two priorities */ \
     53    _Scheduler_priority_Release_job,      /* new period of task */ \
     54    _Scheduler_priority_Tick              /* tick entry point */ \
    5355  }
    5456
     
    173175
    174176/**
     177 *  @brief Scheduler priority Priority compare
     178 *
     179 *  This routine compares two priorities.
     180 */
     181int _Scheduler_priority_Priority_compare(
     182  Priority_Control      p1,
     183  Priority_Control      p2
     184);
     185
     186/**
     187 *  @brief Scheduler priority Release job
     188 *
     189 *  This routine is called when a new job of task is released.
     190 *
     191 *  @param[in] the_thread is the owner of the job.
     192 *  @param[in] deadline of the new job from now. If equal to 0,
     193 *             the job was cancelled or deleted.
     194 */
     195void _Scheduler_priority_Release_job (
     196  Thread_Control  *the_thread,
     197  uint32_t         deadline
     198);
     199
     200/**
    175201 *  @brief Deterministic Priority Scheduler Tick Method
    176202 *
  • cpukit/score/include/rtems/score/schedulersimple.h

    r900d9e66 rac9d2ecc  
    3636#define SCHEDULER_SIMPLE_ENTRY_POINTS \
    3737  { \
    38     _Scheduler_simple_Initialize,    /* initialize entry point */ \
    39     _Scheduler_simple_Schedule,      /* schedule entry point */ \
    40     _Scheduler_simple_Yield,         /* yield entry point */ \
    41     _Scheduler_simple_Block,         /* block entry point */ \
    42     _Scheduler_simple_Unblock,       /* unblock entry point */ \
    43     _Scheduler_simple_Allocate,      /* allocate entry point */ \
    44     _Scheduler_simple_Free,          /* free entry point */ \
    45     _Scheduler_simple_Update,        /* update entry point */ \
    46     _Scheduler_simple_Enqueue,       /* enqueue entry point */ \
    47     _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
    48     _Scheduler_simple_Extract,       /* extract entry point */ \
    49     _Scheduler_priority_Tick         /* tick entry point */ \
     38    _Scheduler_simple_Initialize,         /* initialize entry point */ \
     39    _Scheduler_simple_Schedule,           /* schedule entry point */ \
     40    _Scheduler_simple_Yield,              /* yield entry point */ \
     41    _Scheduler_simple_Block,              /* block entry point */ \
     42    _Scheduler_simple_Unblock,            /* unblock entry point */ \
     43    _Scheduler_simple_Allocate,           /* allocate entry point */ \
     44    _Scheduler_simple_Free,               /* free entry point */ \
     45    _Scheduler_simple_Update,             /* update entry point */ \
     46    _Scheduler_simple_Enqueue,            /* enqueue entry point */ \
     47    _Scheduler_simple_Enqueue_first,      /* enqueue_first entry point */ \
     48    _Scheduler_simple_Extract,            /* extract entry point */ \
     49    _Scheduler_priority_Priority_compare, /* compares two priorities */ \
     50    _Scheduler_priority_Release_job,      /* new period of task */ \
     51    _Scheduler_priority_Tick              /* tick entry point */ \
    5052  }
    5153
  • cpukit/score/include/rtems/score/schedulersimplesmp.h

    r900d9e66 rac9d2ecc  
    4141#include <rtems/score/scheduler.h>
    4242#include <rtems/score/schedulersimple.h>
     43#include <rtems/score/schedulerpriority.h>
    4344
    4445/**
     
    4748#define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \
    4849  { \
    49     _Scheduler_simple_Initialize,    /* initialize entry point */ \
    50     _Scheduler_simple_smp_Schedule,  /* schedule entry point */ \
    51     _Scheduler_simple_Yield,         /* yield entry point */ \
    52     _Scheduler_simple_smp_Block,     /* block entry point */ \
    53     _Scheduler_simple_smp_Unblock,   /* unblock entry point */ \
    54     _Scheduler_simple_Allocate,      /* allocate entry point */ \
    55     _Scheduler_simple_Free,          /* free entry point */ \
    56     _Scheduler_simple_Update,        /* update entry point */ \
    57     _Scheduler_simple_Enqueue,       /* enqueue entry point */ \
    58     _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
    59     _Scheduler_simple_Extract,       /* extract entry point */ \
    60     _Scheduler_simple_smp_Tick       /* tick entry point */ \
     50    _Scheduler_simple_Initialize,         /* initialize entry point */ \
     51    _Scheduler_simple_smp_Schedule,       /* schedule entry point */ \
     52    _Scheduler_simple_Yield,              /* yield entry point */ \
     53    _Scheduler_simple_smp_Block,          /* block entry point */ \
     54    _Scheduler_simple_smp_Unblock,        /* unblock entry point */ \
     55    _Scheduler_simple_Allocate,           /* allocate entry point */ \
     56    _Scheduler_simple_Free,               /* free entry point */ \
     57    _Scheduler_simple_Update,             /* update entry point */ \
     58    _Scheduler_simple_Enqueue,            /* enqueue entry point */ \
     59    _Scheduler_simple_Enqueue_first,      /* enqueue_first entry point */ \
     60    _Scheduler_simple_Extract,            /* extract entry point */ \
     61    _Scheduler_priority_Priority_compare, /* compares two priorities */ \
     62    _Scheduler_priority_Release_job,      /* new period of task */ \
     63    _Scheduler_simple_smp_Tick            /* tick entry point */ \
    6164  }
    6265
  • cpukit/score/inline/rtems/score/scheduler.inl

    r900d9e66 rac9d2ecc  
    160160}
    161161
     162/**
     163 * @brief Scheduler Priority compare
     164 *
     165 * This routine compares two priorities.
     166 */
     167RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
     168  Priority_Control p1,
     169  Priority_Control p2
     170)
     171{
     172  return _Scheduler.Operations.priority_compare(p1, p2);
     173}
     174
     175/**
     176 * @brief Scheduler Release job
     177 *
     178 * This routine is called when a new period of task is issued.
     179 */
     180RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
     181  Thread_Control *the_thread,
     182  uint32_t       length
     183)
     184{
     185  _Scheduler.Operations.release_job(the_thread, length);
     186}
     187
    162188/** @brief Scheduler Method Invoked at Each Clock Tick
    163189 *
  • cpukit/score/inline/rtems/score/schedulerpriority.inl

    r900d9e66 rac9d2ecc  
    186186}
    187187
     188/**
     189 *  @brief Scheduler priority Priority compare body
     190 *
     191 *  This routine implements priority comparison for priority-based
     192 *  scheduling.
     193 *
     194 *  @return >0 for higher priority, 0 for equal and <0 for lower priority.
     195 */
     196RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body(
     197  Priority_Control      p1,
     198  Priority_Control      p2
     199)
     200{
     201  /* High priority in priority scheduler is represented by low numbers. */
     202  return ( p2 - p1 );
     203}
     204
    188205/**@}*/
    189206
  • cpukit/score/src/coremutexseize.c

    r900d9e66 rac9d2ecc  
    6161  executing = _Thread_Executing;
    6262  if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
    63     if ( the_mutex->holder->current_priority > executing->current_priority ) {
     63    if ( _Scheduler_Is_priority_higher_than(
     64         executing->current_priority,
     65         the_mutex->holder->current_priority)) {
    6466      _Thread_Change_priority(
    6567        the_mutex->holder,
Note: See TracChangeset for help on using the changeset viewer.