Ticket #1743: Simple.diff

File Simple.diff, 31.7 KB (added by Jennifer Averett, on 02/24/11 at 17:31:48)

Simple Priority Scheduler

  • cpukit/sapi/include/confdefs.h

    ? Removeme.txt
    ? contrib/crossrpms/config.sub
    ? cpukit/score/include/rtems/score/.schedulersimple.h.swp
    ? cpukit/score/include/rtems/score/RemoveME
    ? cpukit/score/src/RemoveME
    ? testsuites/libtests/config.h.in
    ? testsuites/mptests/config.h.in
    ? testsuites/psxtests/config.h.in
    ? testsuites/psxtmtests/config.h.in
    ? testsuites/samples/config.h.in
    ? testsuites/sptests/config.h.in
    ? testsuites/tmtests/config.h.in
    RCS file: /usr1/CVS/rtems/cpukit/sapi/include/confdefs.h,v
    retrieving revision 1.158
    diff -u -r1.158 confdefs.h
     
    556556 * scheduling policy to use.  The supported configurations are:
    557557 *  CONFIGURE_SCHEDULER_USER     - user provided scheduler
    558558 *  CONFIGURE_SCHEDULER_PRIORITY - Deterministic Priority Scheduler
     559 *  CONFIGURE_SCHEDULER_SIMPLE   - Light-weight Priority Scheduler
    559560 *
    560561 * If no configuration is specified by the application, then
    561562 * CONFIGURE_SCHEDULER_PRIORITY is assumed to be the default.
     
    575576
    576577/* If no scheduler is specified, the priority scheduler is default. */
    577578#if !defined(CONFIGURE_SCHEDULER_USER) && \
    578     !defined(CONFIGURE_SCHEDULER_PRIORITY)
     579    !defined(CONFIGURE_SCHEDULER_PRIORITY) && \
     580    !defined(CONFIGURE_SCHEDULER_SIMPLE)
    579581  #define CONFIGURE_SCHEDULER_PRIORITY
    580582#endif
    581583
    582584/*
    583  * Is the Priority Scheduler is selected, then configure for it.
     585 * If the Priority Scheduler is selected, then configure for it.
    584586 */
    585587#if defined(CONFIGURE_SCHEDULER_PRIORITY)
    586588  #include <rtems/score/schedulerpriority.h>
     
    598600#endif
    599601
    600602/*
     603 * If the Simple Priority Scheduler is selected, then configure for it.
     604 */
     605#if defined(CONFIGURE_SCHEDULER_SIMPLE)
     606  #include <rtems/score/schedulersimple.h>
     607  #define SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
     608
     609  /**
     610   * define the memory used by the simple scheduler
     611   */
     612  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
     613    _Configure_From_workspace( sizeof(Chain_Control) ) \
     614  )
     615  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
     616#endif
     617
     618/*
    601619 * Set up the scheduler entry points table.  The scheduling code uses
    602620 * this code to know which scheduler is configured by the user.
    603621 */
  • cpukit/score/Makefile.am

    RCS file: /usr1/CVS/rtems/cpukit/score/Makefile.am,v
    retrieving revision 1.91
    diff -u -r1.91 Makefile.am
     
    2727    include/rtems/score/object.h include/rtems/score/percpu.h \
    2828    include/rtems/score/priority.h include/rtems/score/prioritybitmap.h \
    2929    include/rtems/score/scheduler.h include/rtems/score/schedulerpriority.h \
     30    include/rtems/score/schedulersimple.h \
    3031    include/rtems/score/stack.h include/rtems/score/states.h \
    3132    include/rtems/score/sysstate.h include/rtems/score/thread.h \
    3233    include/rtems/score/threadq.h include/rtems/score/threadsync.h \
     
    5657    inline/rtems/score/isr.inl inline/rtems/score/object.inl \
    5758    inline/rtems/score/priority.inl inline/rtems/score/prioritybitmap.inl \
    5859    inline/rtems/score/scheduler.inl inline/rtems/score/schedulerpriority.inl \
     60    inline/rtems/score/schedulersimple.inl \
    5961    inline/rtems/score/stack.inl inline/rtems/score/states.inl \
    6062    inline/rtems/score/sysstate.inl inline/rtems/score/thread.inl \
    6163    inline/rtems/score/threadq.inl inline/rtems/score/tod.inl \
     
    155157    src/schedulerpriorityupdate.c \
    156158    src/schedulerpriorityyield.c
    157159
     160## SCHEDULERSIMPLE_C_FILES
     161libscore_a_SOURCES += src/schedulersimple.c \
     162    src/schedulersimpleblock.c \
     163    src/schedulersimpleenqueue.c \
     164    src/schedulersimpleenqueuefirst.c \
     165    src/schedulersimpleextract.c \
     166    src/schedulersimpleschedule.c \
     167    src/schedulersimpleunblock.c \
     168    src/schedulersimpleyield.c
     169
    158170## PROTECTED_HEAP_C_FILES
    159171libscore_a_SOURCES += src/pheapallocate.c \
    160172    src/pheapextend.c src/pheapfree.c src/pheapgetsize.c \
  • cpukit/score/preinstall.am

    RCS file: /usr1/CVS/rtems/cpukit/score/preinstall.am,v
    retrieving revision 1.25
    diff -u -r1.25 preinstall.am
     
    119119        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h
    120120PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h
    121121
     122$(PROJECT_INCLUDE)/rtems/score/schedulersimple.h: include/rtems/score/schedulersimple.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     123        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimple.h
     124PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimple.h
     125
    122126$(PROJECT_INCLUDE)/rtems/score/stack.h: include/rtems/score/stack.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
    123127        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.h
    124128PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.h
     
    261265        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.inl
    262266PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.inl
    263267
     268$(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl: inline/rtems/score/schedulersimple.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     269        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl
     270PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl
     271
    264272$(PROJECT_INCLUDE)/rtems/score/stack.inl: inline/rtems/score/stack.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
    265273        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.inl
    266274PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.inl
  • cpukit/score/include/rtems/score/schedulerpriority.h

    RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/schedulerpriority.h,v
    retrieving revision 1.6
    diff -u -r1.6 schedulerpriority.h
     
    170170  Thread_Control     *the_thread
    171171);
    172172
     173/**
     174 *  This is the major bit map.
     175 */
     176extern volatile Priority_bit_map_Control _Priority_Major_bit_map;
     177
     178/**
     179 *  This is the minor bit map.
     180 */
     181extern Priority_bit_map_Control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
     182
    173183#ifndef __RTEMS_APPLICATION__
    174184#include <rtems/score/schedulerpriority.inl>
    175185#endif
  • new file cpukit/score/include/rtems/score/schedulersimple.h

    RCS file: cpukit/score/include/rtems/score/schedulersimple.h
    diff -N cpukit/score/include/rtems/score/schedulersimple.h
    - +  
     1/**
     2 *  @file  rtems/score/schedulersimple.h
     3 *
     4 *  This include file contains all the constants and structures associated
     5 *  with the manipulation of threads on a simple-priority-based ready queue.
     6 */
     7
     8#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H
     9#define _RTEMS_SCORE_SCHEDULERSIMPLE_H
     10
     11/**
     12 *  @addtogroup ScoreScheduler
     13 *
     14 */
     15/**@{*/
     16
     17#ifdef __cplusplus
     18extern "C" {
     19#endif
     20
     21#include <rtems/score/scheduler.h>
     22
     23/**
     24 *  Entry points for Scheduler Simple
     25 */
     26#define SCHEDULER_SIMPLE_ENTRY_POINTS \
     27  { \
     28    _Scheduler_simple_Initialize,    /* initialize entry point */ \
     29    _Scheduler_simple_Schedule,      /* schedule entry point */ \
     30    _Scheduler_simple_Yield,         /* yield entry point */ \
     31    _Scheduler_simple_Block,         /* block entry point */ \
     32    _Scheduler_simple_Unblock,       /* unblock entry point */ \
     33    _Scheduler_simple_Allocate,      /* allocate entry point */ \
     34    _Scheduler_simple_Free,          /* free entry point */ \
     35    _Scheduler_simple_Update,        /* update entry point */ \
     36    _Scheduler_simple_Enqueue,       /* enqueue entry point */ \
     37    _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
     38    _Scheduler_priorisimple_t        /* extract entry point */ \
     39  }
     40
     41/**
     42 * This routine initializes the simple scheduler.
     43 */
     44void _Scheduler_simple_Initialize( void );
     45
     46/**
     47 *  This routine sets the heir thread to be the next ready thread
     48 *  on the ready queue by getting the first node in the scheduler
     49 *  information.
     50 */
     51void _Scheduler_simple_Schedule( void );
     52
     53/**
     54 *  This routine is invoked when a thread wishes to voluntarily
     55 *  transfer control of the processor to another thread in the queue.
     56 *  It will remove the running THREAD from the scheduler.informaiton
     57 *  (where the ready queue is stored) and place it immediately at the
     58 *  between the last entry of its priority and the next priority thread. 
     59 *  Reset timeslice and yield the processor functions both use this routine,
     60 *  therefore if reset is true and this is the only thread on the queue then
     61 *  the timeslice counter is reset.  The heir THREAD will be updated if the
     62 *  running is also the currently the heir.
     63*/
     64void _Scheduler_simple_Yield( void );
     65
     66/**
     67 *  This routine removes @a the_thread from the scheduling decision,
     68 *  that is, removes it from the ready queue.  It performs
     69 *  any necessary scheduling operations including the selection of
     70 *  a new heir thread.
     71 *
     72 *  XXX
     73 */
     74void _Scheduler_simple_Block(
     75  Thread_Control *the_thread
     76);
     77
     78/**
     79 *  This routine adds @a the_thread to the scheduling decision,
     80 *  that is, adds it to the ready queue and
     81 *  updates any appropriate scheduling variables, for example the heir thread.
     82 *
     83 *  XXX
     84 */
     85void _Scheduler_simple_Unblock(
     86  Thread_Control *the_thread
     87);
     88
     89/**
     90 *  This routine removes a specific thread from the specified
     91 *  simple-based ready queue.
     92 *
     93 *  @param[in] the_thread is the thread to be blocked
     94 */
     95void _Scheduler_simple_Extract(
     96  Thread_Control    *the_thread
     97);
     98
     99/**
     100 *  This routine puts @a the_thread on to the ready queue.
     101 *
     102 *  @param[in] the_thread is the thread to be blocked
     103 */
     104void _Scheduler_simple_Enqueue(
     105  Thread_Control            *the_thread
     106);
     107
     108/**
     109 *  This routine puts @a the_thread to the head of the ready queue.
     110 *  The thread will be the first thread at its priority level.
     111 *
     112 *  @param[in] the_thread is the thread to be blocked
     113 */
     114void _Scheduler_simple_Enqueue_first(
     115  Thread_Control            *the_thread
     116);
     117
     118/**
     119 * This routine allocates the ready queue information.
     120 *
     121 *  @param[in] the_thread is the thread to be blocked
     122 */
     123void * _Scheduler_simple_Allocate(
     124  Thread_Control *the_thread
     125);
     126
     127/**
     128 * This routine does nothing, and is used as a stub for Sched_update
     129 *
     130 * The overhead of a function call will still be imposed. :(
     131 *
     132 *  @param[in] the_thread is the thread to be blocked
     133 */
     134void _Scheduler_simple_Update(
     135  Thread_Control *the_thread
     136);
     137
     138/**
     139 * This routine does nothing, and is used as a stub for Sched_free
     140 *
     141 * The overhead of a function call will still be imposed. :(
     142 *
     143 *  @param[in] the_thread is the thread to be blocked
     144 */
     145void _Scheduler_simple_Free(
     146  Thread_Control *the_thread
     147);
     148
     149#ifndef __RTEMS_APPLICATION__
     150#include <rtems/score/schedulersimple.inl>
     151#endif
     152
     153#ifdef __cplusplus
     154}
     155#endif
     156
     157/**@}*/
     158
     159#endif
     160/* end of include file */
  • new file cpukit/score/inline/rtems/score/schedulersimple.inl

    RCS file: cpukit/score/inline/rtems/score/schedulersimple.inl
    diff -N cpukit/score/inline/rtems/score/schedulersimple.inl
    - +  
     1/**
     2 *  @file  rtems/score/schedulersimple.inl
     3 *
     4 *  This inline file contains all of the inlined routines associated with
     5 *  the manipulation of the priority-based scheduling structures.
     6 */
     7
     8/*
     9 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
     10 *
     11 *  The license and distribution terms for this file may be
     12 *  found in the file LICENSE in this distribution or at
     13 *  http://www.rtems.com/license/LICENSE.
     14 *
     15 *  $Id$
     16 */
     17
     18#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H
     19# error "Never use <rtems/score/schedulersimple.inl> directly; include <rtems/score/schedulersimple.h> instead."
     20#endif
     21
     22#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_INL
     23#define _RTEMS_SCORE_SCHEDULERSIMPLE_INL
     24
     25#include <rtems/score/thread.h>
     26
     27/**
     28 *  @addtogroup ScoreScheduler
     29 * @{
     30 */
     31
     32/**
     33 *  _Scheduler_simple_Ready_queue_Enqueue
     34 *
     35 *  This routine puts @a the_thread on the ready queue
     36 *  at the end of its priority group.
     37 * 
     38 *  @param[in] the_thread - pointer to a thread control block
     39 */
     40RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_Enqueue(
     41  Thread_Control    *the_thread
     42)
     43{
     44  Chain_Control    *ready;
     45  Chain_Node       *the_node;
     46  Thread_Control   *current;
     47
     48  ready    = (Chain_Control *)_Scheduler.information;
     49  the_node = _Chain_First( ready );
     50  current  = (Thread_Control *)ready;
     51
     52  for ( ; !_Chain_Is_tail( ready, the_node ) ; the_node = the_node->next ) {
     53    current = (Thread_Control *) the_node;
     54
     55    /* break when AT END OR PAST our priority */
     56    if ( the_thread->current_priority < current->current_priority ) {
     57      current = (Thread_Control *)current->Object.Node.previous;
     58      break;
     59    }
     60  }
     61
     62  /* enqueue */
     63  _Chain_Insert_unprotected( (Chain_Node *)current, &the_thread->Object.Node );
     64}
     65
     66/**
     67 *  _Scheduler_simple_Ready_queue_Enqueue_first
     68 *
     69 *  This routine puts @a the_thread on to the ready queue
     70 *  at the beginning of its priority group.
     71 * 
     72 *  @param[in] the_thread - pointer to a thread control block
     73 */
     74RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_Enqueue_first(
     75  Thread_Control    *the_thread
     76)
     77{
     78  Chain_Control    *ready;
     79  Chain_Node       *the_node;
     80  Thread_Control   *current;
     81
     82  ready    = (Chain_Control *)_Scheduler.information;
     83  the_node = _Chain_First( ready );
     84  current  = (Thread_Control *)ready;
     85
     86  for ( ; !_Chain_Is_tail( ready, the_node ) ; the_node = the_node->next ) {
     87    current = (Thread_Control *) the_node;
     88
     89    /* break when AT HEAD OF (or PAST) our priority */
     90    if ( the_thread->current_priority <= current->current_priority ) {
     91      current = (Thread_Control *)current->Object.Node.previous;
     92      break;
     93    }
     94  }
     95
     96  /* enqueue */
     97  _Chain_Insert_unprotected( (Chain_Node *)current, &the_thread->Object.Node );
     98}
     99
     100
     101/*
     102 *  _Scheduler_simple_Ready_queue_Requeue
     103 *
     104 *  This routine puts @a the_thread on to the priority-based ready queue.
     105 * 
     106 *  Input parameters:
     107 *    the_ready_queue - pointer to a readyq header
     108 *    the_thread       - pointer to a thread control block
     109 *
     110 *  Output parameters: NONE
     111 *
     112 *  INTERRUPT LATENCY: NONE
     113 */
     114RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_Requeue(
     115  Scheduler_Control *the_ready_queue,
     116  Thread_Control    *the_thread
     117)
     118{
     119  /* extract */
     120  _Chain_Extract_unprotected( &the_thread->Object.Node );
     121
     122  /* enqueue */
     123  _Scheduler_simple_Ready_queue_Enqueue( the_thread );
     124}
     125
     126/**@}*/
     127
     128#endif
     129/* end of include file */
  • cpukit/score/src/schedulerpriority.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/schedulerpriority.c,v
    retrieving revision 1.4
    diff -u -r1.4 schedulerpriority.c
     
    2929void _Scheduler_priority_Initialize(void)
    3030{
    3131  _Scheduler_priority_Ready_queue_initialize();
    32   _Priority_bit_map_Handler_initialization( );
     32  _Priority_bit_map_Handler_initialization();
    3333}
  • cpukit/score/src/schedulerpriorityextract.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/schedulerpriorityextract.c,v
    retrieving revision 1.1
    diff -u -r1.1 schedulerpriorityextract.c
     
    1 /*
     1/*  Scheduler Simple Handler / Extract
     2 *
    23 *  COPYRIGHT (c) 2011.
    34 *  On-Line Applications Research Corporation (OAR).
    45 *
     
    2223  Thread_Control      *the_thread
    2324)
    2425{
    25    _Scheduler_priority_Ready_queue_extract( the_thread );
     26  _Scheduler_priority_Ready_queue_extract( the_thread );
    2627}
  • cpukit/score/src/schedulerpriorityupdate.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/schedulerpriorityupdate.c,v
    retrieving revision 1.1
    diff -u -r1.1 schedulerpriorityupdate.c
     
    3333  sched_info = (Scheduler_priority_Per_thread *) the_thread->scheduler_info;
    3434  rq         = (Chain_Control *) _Scheduler.information;
    3535
    36 
    3736  sched_info->ready_chain = &rq[ the_thread->current_priority ];
    3837
    3938  _Priority_bit_map_Initialize_information(
  • new file cpukit/score/src/schedulersimple.c

    RCS file: cpukit/score/src/schedulersimple.c
    diff -N cpukit/score/src/schedulersimple.c
    - +  
     1/*
     2 *  Scheduler Simple Handler / Initialize
     3 *  Scheduler Simple Handler / Allocate (Empty Routine)
     4 *  Scheduler Simple Handler / Update (Empty Routine)
     5 *  Scheduler Simple Handler / Free (Empty Routine)
     6 *
     7 *  COPYRIGHT (c) 2011.
     8 *  On-Line Applications Research Corporation (OAR).
     9 *
     10 *  The license and distribution terms for this file may be
     11 *  found in the file LICENSE in this distribution or at
     12 *  http://www.rtems.com/license/LICENSE.
     13 *
     14 *  $Id$
     15 */
     16
     17#if HAVE_CONFIG_H
     18#include "config.h"
     19#endif
     20
     21#include <rtems/system.h>
     22#include <rtems/config.h>
     23#include <rtems/score/chain.h>
     24#include <rtems/score/scheduler.h>
     25#include <rtems/score/schedulersimple.h>
     26#include <rtems/score/thread.h>
     27#include <rtems/score/wkspace.h>
     28
     29/**
     30 * This routine does nothing, and is used as a stub for Sched_allocate
     31 *
     32 * Note: returns a non-zero value, or else thread initialize thinks the
     33 * allocation failed.
     34 *
     35 * The overhead of a function call will still be imposed. :(
     36 */
     37void * _Scheduler_simple_Allocate(
     38  Thread_Control *the_thread
     39)
     40{
     41  return (void*)-1; /* maybe pick an appropriate poison value */
     42}
     43
     44
     45/**
     46 * This routine does nothing, and is used as a stub for Sched_update
     47 *
     48 * The overhead of a function call will still be imposed. :(
     49 */
     50void _Scheduler_simple_Update(
     51  Thread_Control *the_thread
     52)
     53{
     54}
     55
     56/**
     57 * This routine does nothing, and is used as a stub for Sched_free
     58 *
     59 * The overhead of a function call will still be imposed. :(
     60 */
     61void _Scheduler_simple_Free(
     62  Thread_Control *the_thread
     63)
     64{
     65}
     66
     67/*
     68 *  _Scheduler_simple_Initialize
     69 *
     70 *  Initializes the scheduler for simple scheduling.
     71 *
     72 *  Input parameters:  NONE
     73 *
     74 *  Output parameters: NONE
     75 */
     76void _Scheduler_simple_Initialize ( void )
     77{
     78  void *f;
     79
     80  /*
     81   * Initialize Ready Queue
     82   */
     83
     84  /* allocate ready queue structures */
     85  f = _Workspace_Allocate_or_fatal_error( sizeof(Chain_Control) );
     86  _Scheduler.information = f;
     87
     88  /* initialize ready queue structure */
     89  _Chain_Initialize_empty( (Chain_Control *)f );
     90}
  • new file cpukit/score/src/schedulersimpleblock.c

    RCS file: cpukit/score/src/schedulersimpleblock.c
    diff -N cpukit/score/src/schedulersimpleblock.c
    - +  
     1/*
     2 *  Scheduler Simple Handler / Block
     3 *
     4 *  COPYRIGHT (c) 2011.
     5 *  On-Line Applications Research Corporation (OAR).
     6 *
     7 *  The license and distribution terms for this file may be
     8 *  found in found in the file LICENSE in this distribution or at
     9 *  http://www.rtems.com/license/LICENSE.
     10 *
     11 *  $Id$
     12 */
     13
     14#if HAVE_CONFIG_H
     15#include "config.h"
     16#endif
     17
     18#include <rtems/system.h>
     19#include <rtems/score/context.h>
     20#include <rtems/score/interr.h>
     21#include <rtems/score/isr.h>
     22#include <rtems/score/object.h>
     23#include <rtems/score/priority.h>
     24#include <rtems/score/scheduler.h>
     25#include <rtems/score/thread.h>
     26#include <rtems/score/schedulersimple.h>
     27
     28void _Scheduler_simple_Block(
     29  Thread_Control   *the_thread
     30)
     31{
     32  _Scheduler_simple_Extract(the_thread);
     33
     34  /* TODO: flash critical section */
     35  /* XXX */
     36
     37  /* TODO: Is this robust? */
     38  if ( _Thread_Is_heir( the_thread ) )
     39    _Scheduler_simple_Schedule();
     40
     41  if ( _Thread_Is_executing( the_thread ) )
     42    _Thread_Dispatch_necessary = true;
     43}
  • new file cpukit/score/src/schedulersimpleenqueue.c

    RCS file: cpukit/score/src/schedulersimpleenqueue.c
    diff -N cpukit/score/src/schedulersimpleenqueue.c
    - +  
     1/*
     2 *  Schedule Simple Handler / Enqueue
     3 *
     4 *  COPYRIGHT (c) 2011.
     5 *  On-Line Applications Research Corporation (OAR).
     6 *
     7 *  The license and distribution terms for this file may be
     8 *  found in the file LICENSE in this distribution or at
     9 *  http://www.rtems.com/license/LICENSE.
     10 *
     11 *  $Id$
     12 */
     13
     14#if HAVE_CONFIG_H
     15#include "config.h"
     16#endif
     17
     18#include <rtems/system.h>
     19#include <rtems/score/chain.h>
     20#include <rtems/score/isr.h>
     21#include <rtems/score/thread.h>
     22#include <rtems/score/schedulersimple.h>
     23
     24void _Scheduler_simple_Enqueue(
     25  Thread_Control            *the_thread
     26)
     27{
     28  _Scheduler_simple_Ready_queue_Enqueue( the_thread );
     29}
  • new file cpukit/score/src/schedulersimpleenqueuefirst.c

    RCS file: cpukit/score/src/schedulersimpleenqueuefirst.c
    diff -N cpukit/score/src/schedulersimpleenqueuefirst.c
    - +  
     1/*
     2 *  Schedule Simple Handler / Enqueue First
     3 *
     4 *  COPYRIGHT (c) 2011.
     5 *  On-Line Applications Research Corporation (OAR).
     6 *
     7 *  The license and distribution terms for this file may be
     8 *  found in the file LICENSE in this distribution or at
     9 *  http://www.rtems.com/license/LICENSE.
     10 *
     11 *  $Id$
     12 */
     13
     14#if HAVE_CONFIG_H
     15#include "config.h"
     16#endif
     17
     18#include <rtems/system.h>
     19#include <rtems/score/chain.h>
     20#include <rtems/score/thread.h>
     21#include <rtems/score/schedulersimple.h>
     22
     23void _Scheduler_simple_Enqueue_first(
     24  Thread_Control            *the_thread
     25)
     26{
     27  _Scheduler_simple_Ready_queue_Enqueue_first( the_thread );
     28}
  • new file cpukit/score/src/schedulersimpleextract.c

    RCS file: cpukit/score/src/schedulersimpleextract.c
    diff -N cpukit/score/src/schedulersimpleextract.c
    - +  
     1/*
     2 *  Schedule Simple Handler / Extract
     3 *
     4 *  COPYRIGHT (c) 2011.
     5 *  On-Line Applications Research Corporation (OAR).
     6 *
     7 *  The license and distribution terms for this file may be
     8 *  found in the file LICENSE in this distribution or at
     9 *  http://www.rtems.com/license/LICENSE.
     10 *
     11 *  $Id$
     12 */
     13
     14#if HAVE_CONFIG_H
     15#include "config.h"
     16#endif
     17
     18#include <rtems/system.h>
     19#include <rtems/score/chain.h>
     20#include <rtems/score/thread.h>
     21#include <rtems/score/schedulersimple.h>
     22
     23void _Scheduler_simple_Extract(
     24  Thread_Control    *the_thread
     25)
     26{
     27  _Chain_Extract_unprotected( &the_thread->Object.Node );
     28}
  • new file cpukit/score/src/schedulersimpleschedule.c

    RCS file: cpukit/score/src/schedulersimpleschedule.c
    diff -N cpukit/score/src/schedulersimpleschedule.c
    - +  
     1/*
     2 *  Scheduler Simple Handler / Schedule
     3 *
     4 *  COPYRIGHT (c) 2011.
     5 *  On-Line Applications Research Corporation (OAR).
     6 *
     7 *  The license and distribution terms for this file may be
     8 *  found in found in the file LICENSE in this distribution or at
     9 *  http://www.rtems.com/license/LICENSE.
     10 *
     11 *  $Id$
     12 */
     13
     14#if HAVE_CONFIG_H
     15#include "config.h"
     16#endif
     17
     18#include <rtems/system.h>
     19#include <rtems/score/context.h>
     20#include <rtems/score/interr.h>
     21#include <rtems/score/isr.h>
     22#include <rtems/score/object.h>
     23#include <rtems/score/priority.h>
     24#include <rtems/score/percpu.h>
     25#include <rtems/score/scheduler.h>
     26#include <rtems/score/thread.h>
     27#include <rtems/score/schedulersimple.h>
     28
     29void _Scheduler_simple_Schedule(void)
     30{
     31  _Thread_Heir = (Thread_Control *) _Chain_First(
     32    (Chain_Control *) _Scheduler.information
     33  );
     34}
  • new file cpukit/score/src/schedulersimpleunblock.c

    RCS file: cpukit/score/src/schedulersimpleunblock.c
    diff -N cpukit/score/src/schedulersimpleunblock.c
    - +  
     1/*
     2 *  Scheduler Simple Handler / Unblock
     3 *
     4 *  COPYRIGHT (c) 2011.
     5 *  On-Line Applications Research Corporation (OAR).
     6 *
     7 *  The license and distribution terms for this file may be
     8 *  found in found in the file LICENSE in this distribution or at
     9 *  http://www.rtems.com/license/LICENSE.
     10 *
     11 *  $Id$
     12 */
     13
     14#if HAVE_CONFIG_H
     15#include "config.h"
     16#endif
     17
     18#include <rtems/system.h>
     19#include <rtems/score/isr.h>
     20#include <rtems/score/schedulersimple.h>
     21#include <rtems/score/thread.h>
     22
     23void _Scheduler_simple_Unblock(
     24  Thread_Control    *the_thread
     25)
     26{
     27  _Scheduler_simple_Ready_queue_Enqueue(the_thread);
     28
     29  /* TODO: flash critical section? */
     30
     31  /*
     32   *  If the thread that was unblocked is more important than the heir,
     33   *  then we have a new heir.  This may or may not result in a
     34   *  context switch.
     35   *
     36   *  Normal case:
     37   *    If the current thread is preemptible, then we need to do
     38   *    a context switch.
     39   *  Pseudo-ISR case:
     40   *    Even if the thread isn't preemptible, if the new heir is
     41   *    a pseudo-ISR system task, we need to do a context switch.
     42   */
     43  if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
     44    _Thread_Heir = the_thread;
     45    if ( _Thread_Executing->is_preemptible ||
     46        the_thread->current_priority == 0 )
     47      _Thread_Dispatch_necessary = true;
     48  }
     49}
  • new file cpukit/score/src/schedulersimpleyield.c

    RCS file: cpukit/score/src/schedulersimpleyield.c
    diff -N cpukit/score/src/schedulersimpleyield.c
    - +  
     1/*
     2 *  Scheduler Simple Handler / Yield
     3 *
     4 *  COPYRIGHT (c) 2011.
     5 *  On-Line Applications Research Corporation (OAR).
     6 *
     7 *  The license and distribution terms for this file may be
     8 *  found in found in the file LICENSE in this distribution or at
     9 *  http://www.rtems.com/license/LICENSE.
     10 *
     11 *  $Id$
     12 */
     13
     14#if HAVE_CONFIG_H
     15#include "config.h"
     16#endif
     17
     18#include <rtems/system.h>
     19#include <rtems/score/isr.h>
     20#include <rtems/score/scheduler.h>
     21#include <rtems/score/thread.h>
     22#include <rtems/score/schedulersimple.h>
     23
     24void _Scheduler_simple_Yield( void )
     25{
     26  ISR_Level       level;
     27  Thread_Control *executing;
     28
     29  executing = _Thread_Executing;
     30  _ISR_Disable( level );
     31     
     32    _Scheduler_simple_Ready_queue_Requeue(&_Scheduler, executing);
     33
     34    _ISR_Flash( level );
     35
     36    _Scheduler_simple_Schedule();
     37   
     38    if ( !_Thread_Is_heir( executing ) )
     39      _Thread_Dispatch_necessary = true;
     40
     41  _ISR_Enable( level );
     42}
  • testsuites/sptests/spsize/size.c

    RCS file: /usr1/CVS/rtems/testsuites/sptests/spsize/size.c,v
    retrieving revision 1.70
    diff -u -r1.70 size.c
     
    7272#define  HEAP_OVHD        16    /* wasted heap space per task stack */
    7373#define  NAME_PTR_SIZE     8    /* size of name and pointer table entries */
    7474
    75 #if CONFIGURE_SCHEDULER_POLICY == _Scheduler_PRIORITY
    76   #include <rtems/score/prioritybitmap.h>
     75/*
     76 *  This assumes the default Priority Scheduler
     77 */
     78#include <rtems/score/prioritybitmap.h>
     79#include <rtems/score/schedulerpriority.h>
     80
     81/* Priority scheduling uninitialized (globals) consumption */
     82#define SCHEDULER_OVHD     ((sizeof _Scheduler)              + \
     83                           (sizeof _Priority_Major_bit_map) + \
     84                           (sizeof _Priority_Bit_map))
     85
     86/* Priority scheduling per-thread consumption. Gets
     87 * included in the PER_TASK consumption.
     88 */
     89#define SCHEDULER_TASK_WKSP     (sizeof(Scheduler_priority_Per_thread))
    7790
    78   /* Priority scheduling uninitialized (globals) consumption */
    79   #define SCHEDULER_OVHD          ((sizeof _Scheduler)              + \
    80                                    (sizeof _Priority_Major_bit_map) + \
    81                                    (sizeof _Priority_Bit_map))
    82 
    83   /* Priority scheduling per-thread consumption. Gets
    84    * included in the PER_TASK consumption. */
    85   #define SCHEDULER_TASK_WKSP     (sizeof(Scheduler_priority_Per_thread))
    86 
    87   /* Priority scheduling workspace consumption
    88    *
    89    * Include allocation of ready queue.  Pointers are already counted by
    90    * including _Scheduler in SCHEDULER_OVHD.
    91    */
    92   #define  SCHEDULER_WKSP_SIZE  \
     91/* Priority scheduling workspace consumption
     92 *
     93 * Include allocation of ready queue.  Pointers are already counted by
     94 * including _Scheduler in SCHEDULER_OVHD.
     95 */
     96#define SCHEDULER_WKSP_SIZE  \
    9397    ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control ))
    94 #endif
     98/****** END OF MEMORY USAGE OF DEFAULT PRIORITY SCHEDULER ******/
    9599
    96100#define PER_TASK      \
    97101     (long) (sizeof (Thread_Control) + \
  • testsuites/tmtests/tm26/task1.c

    RCS file: /usr1/CVS/rtems/testsuites/tmtests/tm26/task1.c,v
    retrieving revision 1.36
    diff -u -r1.36 task1.c
     
    102102
    103103  puts( "\n\n*** TIME TEST 26 ***" );
    104104
     105  if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
     106    puts("     Error ==> Test only supported for deterministic priority scheduler\n" );
     107    puts( "*** END OF TEST 26 ***" );
     108    rtems_test_exit( 0 );
     109  }
     110
    105111#define FP1_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 3u)      /* 201, */
    106112  status = rtems_task_create(
    107113    rtems_build_name( 'F', 'P', '1', ' ' ),
  • testsuites/tmtests/tm27/task1.c

    RCS file: /usr1/CVS/rtems/testsuites/tmtests/tm27/task1.c,v
    retrieving revision 1.33
    diff -u -r1.33 task1.c
     
    5454  Print_Warning();
    5555
    5656  puts( "\n\n*** TIME TEST 27 ***" );
     57  if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
     58    puts("     Error ==> Test only supported for deterministic priority scheduler\n" );
     59    puts( "*** END OF TEST 26 ***" );
     60    rtems_test_exit( 0 );
     61  }
    5762
    5863#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
    5964  status = rtems_task_create(