change log for rtems (2011-03-16)

rtems-vc at rtems.org rtems-vc at rtems.org
Wed Mar 16 17:10:17 UTC 2011


 *joel*:
2011-03-16	Jennifer Averett <jennifer.averett at OARcorp.com>

	PR 1743/cpu
	* sapi/include/confdefs.h, score/Makefile.am, score/preinstall.am: Add
	Simple Priority Scheduler as complement to existing Deterministic
	Priority Scheduler. This scheduler serves both as an example and as a
	lighter weight implementation for smaller systems.
	* score/include/rtems/score/schedulersimple.h,
	score/inline/rtems/score/schedulersimple.inl,
	score/src/schedulersimple.c, score/src/schedulersimpleblock.c,
	score/src/schedulersimpleenqueue.c,
	score/src/schedulersimpleenqueuefirst.c,
	score/src/schedulersimpleextract.c,
	score/src/schedulersimplereadyqueueenqueue.c,
	score/src/schedulersimplereadyqueueenqueuefirst.c,
	score/src/schedulersimpleschedule.c,
	score/src/schedulersimpleunblock.c, score/src/schedulersimpleyield.c:
	New files.

M 1.2784  cpukit/ChangeLog
M  1.160  cpukit/sapi/include/confdefs.h
M   1.93  cpukit/score/Makefile.am
A    1.1  cpukit/score/include/rtems/score/schedulersimple.h
A    1.1  cpukit/score/inline/rtems/score/schedulersimple.inl
M   1.26  cpukit/score/preinstall.am
A    1.1  cpukit/score/src/schedulersimple.c
A    1.1  cpukit/score/src/schedulersimpleblock.c
A    1.1  cpukit/score/src/schedulersimpleenqueue.c
A    1.1  cpukit/score/src/schedulersimpleenqueuefirst.c
A    1.1  cpukit/score/src/schedulersimpleextract.c
A    1.1  cpukit/score/src/schedulersimplereadyqueueenqueue.c
A    1.1  cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
A    1.1  cpukit/score/src/schedulersimpleschedule.c
A    1.1  cpukit/score/src/schedulersimpleunblock.c
A    1.1  cpukit/score/src/schedulersimpleyield.c

diff -u rtems/cpukit/ChangeLog:1.2783 rtems/cpukit/ChangeLog:1.2784
--- rtems/cpukit/ChangeLog:1.2783	Wed Mar 16 08:26:32 2011
+++ rtems/cpukit/ChangeLog	Wed Mar 16 11:31:51 2011
@@ -1,3 +1,22 @@
+2011-03-16	Jennifer Averett <jennifer.averett at OARcorp.com>
+
+	PR 1743/cpu
+	* sapi/include/confdefs.h, score/Makefile.am, score/preinstall.am: Add
+	Simple Priority Scheduler as complement to existing Deterministic
+	Priority Scheduler. This scheduler serves both as an example and as a
+	lighter weight implementation for smaller systems.
+	* score/include/rtems/score/schedulersimple.h,
+	score/inline/rtems/score/schedulersimple.inl,
+	score/src/schedulersimple.c, score/src/schedulersimpleblock.c,
+	score/src/schedulersimpleenqueue.c,
+	score/src/schedulersimpleenqueuefirst.c,
+	score/src/schedulersimpleextract.c,
+	score/src/schedulersimplereadyqueueenqueue.c,
+	score/src/schedulersimplereadyqueueenqueuefirst.c,
+	score/src/schedulersimpleschedule.c,
+	score/src/schedulersimpleunblock.c, score/src/schedulersimpleyield.c:
+	New files.
+
 2011-03-16	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* score/src/threadyieldprocessor.c: Removed.  File is no longer

diff -u rtems/cpukit/sapi/include/confdefs.h:1.159 rtems/cpukit/sapi/include/confdefs.h:1.160
--- rtems/cpukit/sapi/include/confdefs.h:1.159	Thu Mar  3 10:01:35 2011
+++ rtems/cpukit/sapi/include/confdefs.h	Wed Mar 16 11:31:51 2011
@@ -556,6 +556,7 @@
  * scheduling policy to use.  The supported configurations are:
  *  CONFIGURE_SCHEDULER_USER     - user provided scheduler
  *  CONFIGURE_SCHEDULER_PRIORITY - Deterministic Priority Scheduler
+ *  CONFIGURE_SCHEDULER_SIMPLE   - Light-weight Priority Scheduler
  * 
  * If no configuration is specified by the application, then 
  * CONFIGURE_SCHEDULER_PRIORITY is assumed to be the default.
@@ -575,7 +576,8 @@
 
 /* If no scheduler is specified, the priority scheduler is default. */
 #if !defined(CONFIGURE_SCHEDULER_USER) && \
-    !defined(CONFIGURE_SCHEDULER_PRIORITY)
+    !defined(CONFIGURE_SCHEDULER_PRIORITY) && \
+    !defined(CONFIGURE_SCHEDULER_SIMPLE)
   #define CONFIGURE_SCHEDULER_PRIORITY
 #endif
 
@@ -598,6 +600,22 @@
 #endif
 
 /* 
+ * If the Simple Priority Scheduler is selected, then configure for it.
+ */
+#if defined(CONFIGURE_SCHEDULER_SIMPLE)
+  #include <rtems/score/schedulersimple.h>
+  #define SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
+
+  /**
+   * define the memory used by the simple scheduler
+   */
+  #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
+    _Configure_From_workspace( sizeof(Chain_Control) ) \
+  )
+  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
+#endif
+
+/* 
  * Set up the scheduler entry points table.  The scheduling code uses
  * this code to know which scheduler is configured by the user.
  */

diff -u rtems/cpukit/score/Makefile.am:1.92 rtems/cpukit/score/Makefile.am:1.93
--- rtems/cpukit/score/Makefile.am:1.92	Tue Mar 15 14:27:46 2011
+++ rtems/cpukit/score/Makefile.am	Wed Mar 16 11:32:21 2011
@@ -27,6 +27,7 @@
     include/rtems/score/object.h include/rtems/score/percpu.h \
     include/rtems/score/priority.h include/rtems/score/prioritybitmap.h \
     include/rtems/score/scheduler.h include/rtems/score/schedulerpriority.h \
+    include/rtems/score/schedulersimple.h \
     include/rtems/score/stack.h include/rtems/score/states.h \
     include/rtems/score/sysstate.h include/rtems/score/thread.h \
     include/rtems/score/threadq.h include/rtems/score/threadsync.h \
@@ -56,6 +57,7 @@
     inline/rtems/score/isr.inl inline/rtems/score/object.inl \
     inline/rtems/score/priority.inl inline/rtems/score/prioritybitmap.inl \
     inline/rtems/score/scheduler.inl inline/rtems/score/schedulerpriority.inl \
+    inline/rtems/score/schedulersimple.inl \
     inline/rtems/score/stack.inl inline/rtems/score/states.inl \
     inline/rtems/score/sysstate.inl inline/rtems/score/thread.inl \
     inline/rtems/score/threadq.inl inline/rtems/score/tod.inl \
@@ -155,6 +157,18 @@
     src/schedulerpriorityupdate.c \
     src/schedulerpriorityyield.c
 
+## SCHEDULERSIMPLE_C_FILES
+libscore_a_SOURCES += src/schedulersimple.c \
+    src/schedulersimpleblock.c \
+    src/schedulersimpleenqueue.c \
+    src/schedulersimpleenqueuefirst.c \
+    src/schedulersimpleextract.c \
+    src/schedulersimplereadyqueueenqueue.c \
+    src/schedulersimplereadyqueueenqueuefirst.c \
+    src/schedulersimpleschedule.c \
+    src/schedulersimpleunblock.c \
+    src/schedulersimpleyield.c 
+
 ## PROTECTED_HEAP_C_FILES
 libscore_a_SOURCES += src/pheapallocate.c \
     src/pheapextend.c src/pheapfree.c src/pheapgetsize.c \

diff -u /dev/null rtems/cpukit/score/include/rtems/score/schedulersimple.h:1.1
--- /dev/null	Wed Mar 16 12:10:13 2011
+++ rtems/cpukit/score/include/rtems/score/schedulersimple.h	Wed Mar 16 11:32:21 2011
@@ -0,0 +1,199 @@
+/**
+ *  @file  rtems/score/schedulersimple.h
+ *
+ *  This include file contains all the constants and structures associated
+ *  with the manipulation of threads on a simple-priority-based ready queue.
+ *
+ *
+ *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H
+#define _RTEMS_SCORE_SCHEDULERSIMPLE_H
+
+/**
+ *  @addtogroup ScoreScheduler
+ *
+ */
+/**@{*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/scheduler.h>
+
+/**
+ *  Entry points for Scheduler Simple
+ */
+#define SCHEDULER_SIMPLE_ENTRY_POINTS \
+  { \
+    _Scheduler_simple_Initialize,    /* initialize entry point */ \
+    _Scheduler_simple_Schedule,      /* schedule entry point */ \
+    _Scheduler_simple_Yield,         /* yield entry point */ \
+    _Scheduler_simple_Block,         /* block entry point */ \
+    _Scheduler_simple_Unblock,       /* unblock entry point */ \
+    _Scheduler_simple_Allocate,      /* allocate entry point */ \
+    _Scheduler_simple_Free,          /* free entry point */ \
+    _Scheduler_simple_Update,        /* update entry point */ \
+    _Scheduler_simple_Enqueue,       /* enqueue entry point */ \
+    _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
+    _Scheduler_simple_Extract        /* extract entry point */ \
+  }
+
+/**
+ * This routine initializes the simple scheduler.
+ */
+void _Scheduler_simple_Initialize( void );
+
+/**
+ *  This routine sets the heir thread to be the next ready thread 
+ *  on the ready queue by getting the first node in the scheduler
+ *  information.
+ */
+void _Scheduler_simple_Schedule( void );
+
+/**
+ *  This routine is invoked when a thread wishes to voluntarily
+ *  transfer control of the processor to another thread in the queue.
+ *  It will remove the running THREAD from the scheduler.informaiton 
+ *  (where the ready queue is stored) and place it immediately at the 
+ *  between the last entry of its priority and the next priority thread.  
+ *  Reset timeslice and yield the processor functions both use this routine, 
+ *  therefore if reset is true and this is the only thread on the queue then 
+ *  the timeslice counter is reset.  The heir THREAD will be updated if the
+ *  running is also the currently the heir.
+*/
+void _Scheduler_simple_Yield( void );
+
+/**
+ *  This routine removes @a the_thread from the scheduling decision, 
+ *  that is, removes it from the ready queue.  It performs
+ *  any necessary scheduling operations including the selection of
+ *  a new heir thread.
+ *
+ *  @param[in] the_thread is the thread that is to be blocked
+ */
+void _Scheduler_simple_Block( 
+  Thread_Control *the_thread 
+);
+
+/**
+ *  This routine adds @a the_thread to the scheduling decision, 
+ *  that is, adds it to the ready queue and 
+ *  updates any appropriate scheduling variables, for example the heir thread.
+ *
+ *  @param[in] the_thread is the thread that is to be unblocked
+ */
+void _Scheduler_simple_Unblock(
+  Thread_Control *the_thread 
+);
+
+/**
+ *  This routine removes a specific thread from the specified 
+ *  simple-based ready queue.
+ *
+ *  @param[in] the_thread is the thread to be blocked
+ */
+void _Scheduler_simple_Extract(
+  Thread_Control *the_thread
+);
+
+/**
+ *  This routine puts @a the_thread on to the ready queue.
+ *
+ *  @param[in] the_thread is the thread to be blocked
+ */
+void _Scheduler_simple_Enqueue(
+  Thread_Control *the_thread
+);
+
+/**
+ *  This routine puts @a the_thread to the head of the ready queue. 
+ *  The thread will be the first thread at its priority level.
+ *
+ *  @param[in] the_thread is the thread to be blocked
+ */
+void _Scheduler_simple_Enqueue_first(
+  Thread_Control *the_thread
+);
+
+/**
+ *  This routine is a place holder for any memeory allocation needed
+ *  by the scheduler.  For the simple scheduler the routine is an empty
+ *  place holder.
+ *
+ *  @param[in] the_thread is the thread the scheduler is allocating
+ *             management memory for
+ *
+ *  @return this routine returns -1 since this is just an empty placeholder
+ *  and the return value may be defined differently by each scheduler.
+ */
+void *_Scheduler_simple_Allocate( 
+  Thread_Control *the_thread
+);
+
+/**
+ * This routine does nothing, and is used as a stub for Schedule update
+ *
+ * The overhead of a function call will still be imposed.
+ *
+ *  @param[in] the_thread is the thread to be blocked
+ */
+void _Scheduler_simple_Update( 
+  Thread_Control *the_thread
+);
+
+/**
+ * This routine does nothing, and is used as a stub for Schedule free
+ *
+ * The overhead of a function call will still be imposed.
+ *
+ *  @param[in] the_thread is the thread to be blocked
+ */
+void _Scheduler_simple_Free( 
+  Thread_Control *the_thread
+);
+
+/**
+ *  _Scheduler_simple_Ready_queue_Enqueue
+ *
+ *  This routine puts @a the_thread on the ready queue
+ *  at the end of its priority group.
+ *  
+ *  @param[in] the_thread - pointer to a thread control block
+ */
+void _Scheduler_simple_Ready_queue_Enqueue(
+  Thread_Control    *the_thread
+);
+
+/**
+ *  _Scheduler_simple_Ready_queue_Enqueue_first
+ *
+ *  This routine puts @a the_thread on to the ready queue
+ *  at the beginning of its priority group.
+ *  
+ *  @param[in] the_thread - pointer to a thread control block
+ */
+void _Scheduler_simple_Ready_queue_Enqueue_first(
+  Thread_Control    *the_thread
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/schedulersimple.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/**@}*/
+
+#endif
+/* end of include file */

diff -u /dev/null rtems/cpukit/score/inline/rtems/score/schedulersimple.inl:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/inline/rtems/score/schedulersimple.inl	Wed Mar 16 11:32:21 2011
@@ -0,0 +1,53 @@
+/** 
+ *  @file  rtems/score/schedulersimple.inl
+ *
+ *  This inline file contains all of the inlined routines associated with
+ *  the manipulation of the priority-based scheduling structures.
+ */
+
+/*
+ *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_H
+# error "Never use <rtems/score/schedulersimple.inl> directly; include <rtems/score/schedulersimple.h> instead."
+#endif
+
+#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_INL
+#define _RTEMS_SCORE_SCHEDULERSIMPLE_INL
+
+#include <rtems/score/thread.h>
+
+/**
+ *  @addtogroup ScoreScheduler
+ * @{
+ */
+
+/**
+ *  This routine puts @a the_thread on to the ready queue.
+ *
+ *  @param[in] the_ready_queue is a pointer to the ready queue head
+ *  @param[in] the_thread is the thread to be blocked
+ */
+RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_Requeue(
+  Scheduler_Control *the_ready_queue,
+  Thread_Control    *the_thread
+)
+{
+  /* extract */
+  _Chain_Extract_unprotected( &the_thread->Object.Node );
+
+  /* enqueue */
+  _Scheduler_simple_Ready_queue_Enqueue( the_thread );
+}
+
+/**@}*/
+
+#endif
+/* end of include file */

diff -u rtems/cpukit/score/preinstall.am:1.25 rtems/cpukit/score/preinstall.am:1.26
--- rtems/cpukit/score/preinstall.am:1.25	Wed Nov 24 09:51:27 2010
+++ rtems/cpukit/score/preinstall.am	Wed Mar 16 11:32:21 2011
@@ -119,6 +119,10 @@
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h
 
+$(PROJECT_INCLUDE)/rtems/score/schedulersimple.h: include/rtems/score/schedulersimple.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimple.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimple.h
+
 $(PROJECT_INCLUDE)/rtems/score/stack.h: include/rtems/score/stack.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.h
@@ -261,6 +265,10 @@
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.inl
 
+$(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl: inline/rtems/score/schedulersimple.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimple.inl
+
 $(PROJECT_INCLUDE)/rtems/score/stack.inl: inline/rtems/score/stack.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.inl

diff -u /dev/null rtems/cpukit/score/src/schedulersimple.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimple.c	Wed Mar 16 11:32:21 2011
@@ -0,0 +1,84 @@
+/*
+ *  Scheduler Simple Handler / Initialize
+ *  Scheduler Simple Handler / Allocate (Empty Routine)
+ *  Scheduler Simple Handler / Update (Empty Routine)
+ *  Scheduler Simple Handler / Free (Empty Routine)
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/scheduler.h>
+#include <rtems/score/schedulersimple.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+
+/**
+ * This routine does nothing, and is used as a stub for Schedule allocate
+ *
+ * Note: returns a non-zero value, or else thread initialize thinks the 
+ * allocation failed.
+ *
+ * The overhead of a function call will still be imposed.
+ */
+void * _Scheduler_simple_Allocate( 
+  Thread_Control *the_thread
+)
+{
+  return (void*)-1; /* maybe pick an appropriate poison value */
+}
+
+
+/**
+ * This routine does nothing, and is used as a stub for Schedule update
+ *
+ * The overhead of a function call will still be imposed.
+ */
+void _Scheduler_simple_Update( 
+  Thread_Control *the_thread
+)
+{
+}
+
+/**
+ * This routine does nothing, and is used as a stub for Schedule free
+ *
+ * The overhead of a function call will still be imposed.
+ */
+void _Scheduler_simple_Free( 
+  Thread_Control *the_thread
+)
+{
+}
+
+/**
+ * This routine initializes the simple scheduler.
+ */
+void _Scheduler_simple_Initialize ( void )
+{
+  void *f;
+
+  /* 
+   * Initialize Ready Queue
+   */
+
+  /* allocate ready queue structures */
+  f = _Workspace_Allocate_or_fatal_error( sizeof(Chain_Control) );
+  _Scheduler.information = f;
+
+  /* initialize ready queue structure */
+  _Chain_Initialize_empty( (Chain_Control *)f );
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimpleblock.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimpleblock.c	Wed Mar 16 11:32:21 2011
@@ -0,0 +1,39 @@
+/*
+ *  Scheduler Simple Handler / Block
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/context.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/scheduler.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimple.h>
+
+void _Scheduler_simple_Block(
+  Thread_Control   *the_thread
+)
+{
+  _Scheduler_simple_Extract(the_thread);
+
+  if ( _Thread_Is_heir( the_thread ) )
+    _Scheduler_simple_Schedule();
+
+  if ( _Thread_Is_executing( the_thread ) )
+    _Thread_Dispatch_necessary = true;
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimpleenqueue.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimpleenqueue.c	Wed Mar 16 11:32:22 2011
@@ -0,0 +1,29 @@
+/*
+ *  Schedule Simple Handler / Enqueue
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimple.h>
+
+void _Scheduler_simple_Enqueue(
+  Thread_Control            *the_thread
+)
+{
+  _Scheduler_simple_Ready_queue_Enqueue( the_thread );
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimpleenqueuefirst.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimpleenqueuefirst.c	Wed Mar 16 11:32:22 2011
@@ -0,0 +1,28 @@
+/*
+ *  Schedule Simple Handler / Enqueue First
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimple.h>
+
+void _Scheduler_simple_Enqueue_first(
+  Thread_Control            *the_thread
+)
+{
+  _Scheduler_simple_Ready_queue_Enqueue_first( the_thread );
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimpleextract.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimpleextract.c	Wed Mar 16 11:32:22 2011
@@ -0,0 +1,28 @@
+/*
+ *  Schedule Simple Handler / Extract 
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimple.h>
+
+void _Scheduler_simple_Extract(
+  Thread_Control    *the_thread
+)
+{
+  _Chain_Extract_unprotected( &the_thread->Object.Node );
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimplereadyqueueenqueue.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimplereadyqueueenqueue.c	Wed Mar 16 11:32:22 2011
@@ -0,0 +1,48 @@
+/*
+ *  Schedule Simple Handler / Ready Queue Enqueue
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimple.h>
+
+void _Scheduler_simple_Ready_queue_Enqueue(
+  Thread_Control    *the_thread
+)
+{
+  Chain_Control    *ready;
+  Chain_Node       *the_node;
+  Thread_Control   *current;
+
+  ready    = (Chain_Control *)_Scheduler.information;
+  the_node = _Chain_First( ready );
+  current  = (Thread_Control *)ready;
+
+  for ( ; !_Chain_Is_tail( ready, the_node ) ; the_node = the_node->next ) {
+    current = (Thread_Control *) the_node;
+
+    /* break when AT END OR PAST our priority */
+    if ( the_thread->current_priority < current->current_priority ) {
+      current = (Thread_Control *)current->Object.Node.previous;
+      break;
+    }
+  }
+
+  /* enqueue */
+  _Chain_Insert_unprotected( (Chain_Node *)current, &the_thread->Object.Node );
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c	Wed Mar 16 11:32:22 2011
@@ -0,0 +1,52 @@
+/*
+ *  Schedule Simple Handler / Ready Queue Enqueue First
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimple.h>
+
+void _Scheduler_simple_Ready_queue_Enqueue_first(
+  Thread_Control    *the_thread
+)
+{
+  Chain_Control    *ready;
+  Chain_Node       *the_node;
+  Thread_Control   *current;
+
+  ready    = (Chain_Control *)_Scheduler.information;
+  current  = (Thread_Control *)ready;
+
+  /*
+   * Do NOT need to check for end of chain because there is always
+   * at least one task on the ready chain -- the IDLE task.  It can
+   * never block, should never attempt to obtain a semaphore or mutex,
+   * and thus will always be there.
+   */
+  for ( the_node = _Chain_First(ready) ; ; the_node = the_node->next ) {
+    current = (Thread_Control *) the_node;
+
+    /* break when AT HEAD OF (or PAST) our priority */
+    if ( the_thread->current_priority <= current->current_priority ) {
+      current = (Thread_Control *)current->Object.Node.previous;
+      break;
+    }
+  }
+
+  /* enqueue */
+  _Chain_Insert_unprotected( (Chain_Node *)current, &the_thread->Object.Node );
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimpleschedule.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimpleschedule.c	Wed Mar 16 11:32:22 2011
@@ -0,0 +1,34 @@
+/*
+ *  Scheduler Simple Handler / Schedule
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/context.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/scheduler.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimple.h>
+
+void _Scheduler_simple_Schedule(void)
+{
+  _Thread_Heir = (Thread_Control *) _Chain_First( 
+    (Chain_Control *) _Scheduler.information 
+  );
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimpleunblock.c:1.1
--- /dev/null	Wed Mar 16 12:10:14 2011
+++ rtems/cpukit/score/src/schedulersimpleunblock.c	Wed Mar 16 11:32:22 2011
@@ -0,0 +1,47 @@
+/*
+ *  Scheduler Simple Handler / Unblock
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/schedulersimple.h>
+#include <rtems/score/thread.h>
+
+void _Scheduler_simple_Unblock(
+  Thread_Control    *the_thread
+)
+{
+  _Scheduler_simple_Ready_queue_Enqueue(the_thread);
+
+  /*
+   *  If the thread that was unblocked is more important than the heir,
+   *  then we have a new heir.  This may or may not result in a
+   *  context switch.
+   *
+   *  Normal case:
+   *    If the current thread is preemptible, then we need to do
+   *    a context switch.
+   *  Pseudo-ISR case:
+   *    Even if the thread isn't preemptible, if the new heir is
+   *    a pseudo-ISR system task, we need to do a context switch.
+   */
+  if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
+    _Thread_Heir = the_thread;
+    if ( _Thread_Executing->is_preemptible ||
+        the_thread->current_priority == 0 )
+      _Thread_Dispatch_necessary = true;
+  }
+}

diff -u /dev/null rtems/cpukit/score/src/schedulersimpleyield.c:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/cpukit/score/src/schedulersimpleyield.c	Wed Mar 16 11:32:22 2011
@@ -0,0 +1,42 @@
+/*
+ *  Scheduler Simple Handler / Yield
+ *
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/scheduler.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/schedulersimple.h>
+
+void _Scheduler_simple_Yield( void )
+{
+  ISR_Level       level;
+  Thread_Control *executing;
+
+  executing = _Thread_Executing;
+  _ISR_Disable( level );
+      
+    _Scheduler_simple_Ready_queue_Requeue(&_Scheduler, executing);
+
+    _ISR_Flash( level );
+
+    _Scheduler_simple_Schedule();
+    
+    if ( !_Thread_Is_heir( executing ) )
+      _Thread_Dispatch_necessary = true;
+
+  _ISR_Enable( level );
+}


 *joel*:
2011-03-16	Jennifer Averett <jennifer.averett at OARcorp.com>

	PR 1743/cpu
	* Makefile.am, configure.ac, spsize/size.c: Add Simple Priority
	Scheduler as complement to existing Deterministic Priority Scheduler.
	This scheduler serves both as an example and as a lighter weight
	implementation for smaller systems.
	* spsimplesched01/.cvsignore, spsimplesched01/Makefile.am,
	spsimplesched01/init.c, spsimplesched01/spsimplesched01.doc,
	spsimplesched01/spsimplesched01.scn, spsimplesched02/.cvsignore,
	spsimplesched02/Makefile.am, spsimplesched02/init.c,
	spsimplesched02/spsimplesched02.doc,
	spsimplesched02/spsimplesched02.scn, spsimplesched03/.cvsignore,
	spsimplesched03/Makefile.am, spsimplesched03/init.c,
	spsimplesched03/spsimplesched03.doc,
	spsimplesched03/spsimplesched03.scn: New files.

M  1.443  testsuites/sptests/ChangeLog
M  1.108  testsuites/sptests/Makefile.am
M  1.115  testsuites/sptests/configure.ac
A    1.1  testsuites/sptests/spsimplesched01/.cvsignore
A    1.1  testsuites/sptests/spsimplesched01/Makefile.am
A    1.1  testsuites/sptests/spsimplesched01/init.c
A    1.1  testsuites/sptests/spsimplesched01/spsimplesched01.doc
A    1.1  testsuites/sptests/spsimplesched01/spsimplesched01.scn
A    1.1  testsuites/sptests/spsimplesched02/.cvsignore
A    1.1  testsuites/sptests/spsimplesched02/Makefile.am
A    1.1  testsuites/sptests/spsimplesched02/init.c
A    1.1  testsuites/sptests/spsimplesched02/spsimplesched02.doc
A    1.1  testsuites/sptests/spsimplesched02/spsimplesched02.scn
A    1.1  testsuites/sptests/spsimplesched03/.cvsignore
A    1.1  testsuites/sptests/spsimplesched03/Makefile.am
A    1.1  testsuites/sptests/spsimplesched03/init.c
A    1.1  testsuites/sptests/spsimplesched03/spsimplesched03.doc
A    1.1  testsuites/sptests/spsimplesched03/spsimplesched03.scn
M   1.71  testsuites/sptests/spsize/size.c

diff -u rtems/testsuites/sptests/ChangeLog:1.442 rtems/testsuites/sptests/ChangeLog:1.443
--- rtems/testsuites/sptests/ChangeLog:1.442	Fri Mar 11 14:36:45 2011
+++ rtems/testsuites/sptests/ChangeLog	Wed Mar 16 11:33:04 2011
@@ -1,3 +1,20 @@
+2011-03-16	Jennifer Averett <jennifer.averett at OARcorp.com>
+
+	PR 1743/cpu
+	* Makefile.am, configure.ac, spsize/size.c: Add Simple Priority
+	Scheduler as complement to existing Deterministic Priority Scheduler.
+	This scheduler serves both as an example and as a lighter weight
+	implementation for smaller systems.
+	* spsimplesched01/.cvsignore, spsimplesched01/Makefile.am,
+	spsimplesched01/init.c, spsimplesched01/spsimplesched01.doc,
+	spsimplesched01/spsimplesched01.scn, spsimplesched02/.cvsignore,
+	spsimplesched02/Makefile.am, spsimplesched02/init.c,
+	spsimplesched02/spsimplesched02.doc,
+	spsimplesched02/spsimplesched02.scn, spsimplesched03/.cvsignore,
+	spsimplesched03/Makefile.am, spsimplesched03/init.c,
+	spsimplesched03/spsimplesched03.doc,
+	spsimplesched03/spsimplesched03.scn: New files.
+
 2011-03-11	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	* sp58/init.c, sp58/sp58.scn: Account for case where left hand side

diff -u rtems/testsuites/sptests/Makefile.am:1.107 rtems/testsuites/sptests/Makefile.am:1.108
--- rtems/testsuites/sptests/Makefile.am:1.107	Fri Mar 11 10:39:27 2011
+++ rtems/testsuites/sptests/Makefile.am	Wed Mar 16 11:33:04 2011
@@ -28,7 +28,8 @@
     spintrcritical05 spintrcritical06 spintrcritical07 spintrcritical08 \
     spintrcritical09 spintrcritical10 spintrcritical11 spintrcritical12 \
     spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \
-    spintrcritical17 spmkdir spmountmgr01 spheapprot
+    spintrcritical17 spmkdir spmountmgr01 spheapprot \
+    spsimplesched01 spsimplesched02 spsimplesched03
 
 DIST_SUBDIRS = $(SUBDIRS) spfatal_support spintrcritical_support
 EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h

diff -u rtems/testsuites/sptests/configure.ac:1.114 rtems/testsuites/sptests/configure.ac:1.115
--- rtems/testsuites/sptests/configure.ac:1.114	Fri Mar 11 10:39:27 2011
+++ rtems/testsuites/sptests/configure.ac	Wed Mar 16 11:33:04 2011
@@ -160,6 +160,9 @@
 spobjgetnext/Makefile
 spprintk/Makefile
 spprivenv01/Makefile
+spsimplesched01/Makefile
+spsimplesched02/Makefile
+spsimplesched03/Makefile
 spsize/Makefile
 spstkalloc/Makefile
 spthreadq01/Makefile

diff -u /dev/null rtems/testsuites/sptests/spsimplesched01/.cvsignore:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/testsuites/sptests/spsimplesched01/.cvsignore	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/sptests/spsimplesched01/Makefile.am:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/testsuites/sptests/spsimplesched01/Makefile.am	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,28 @@
+##
+##  $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = spsimplesched01 
+spsimplesched01_SOURCES = init.c
+
+dist_rtems_tests_DATA = spsimplesched01.scn
+dist_rtems_tests_DATA += spsimplesched01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+spsimplesched01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spsimplesched01_OBJECTS) $(spsimplesched01_LDADD)
+LINK_LIBS = $(spsimplesched01_LDLIBS)
+
+spsimplesched01$(EXEEXT): $(spsimplesched01_OBJECTS) $(spsimplesched01_DEPENDENCIES)
+	@rm -f spsimplesched01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/sptests/spsimplesched01/init.c:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/testsuites/sptests/spsimplesched01/init.c	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,115 @@
+/* 
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+
+/*
+ *  Keep the names and IDs in global variables so another task can use them.
+ */
+rtems_id   Task_id[ 4 ];         /* array of task ids */
+rtems_name Task_name[ 4 ];       /* array of task names */
+
+rtems_task Test_task(
+  rtems_task_argument unused
+)
+{
+  rtems_id          tid;
+  rtems_time_of_day time;
+  uint32_t    task_index;
+  rtems_status_code status;
+
+  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  task_index = task_number( tid );
+  for ( ; ; ) {
+    status = rtems_clock_get_tod( &time );
+    if ( time.second >= 35 ) {
+      puts( "*** END OF SIMPLE01 TEST ***" );
+      rtems_test_exit( 0 );
+    }
+    put_name( Task_name[ task_index ], FALSE );
+    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
+    status = rtems_task_wake_after(
+      task_index * 5 * rtems_clock_get_ticks_per_second() );
+  }
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code   status;
+  rtems_time_of_day   time;
+  rtems_task_priority old;
+
+  puts( "\n\n*** SIMPLE01 TEST ***" );
+
+  time.year   = 1988;
+  time.month  = 12;
+  time.day    = 31;
+  time.hour   = 9;
+  time.minute = 0;
+  time.second = 0;
+  time.ticks  = 0;
+
+  status = rtems_clock_set( &time );
+
+  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+
+  status = rtems_task_create(
+    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
+  );
+  status = rtems_task_create(
+    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
+  );
+  status = rtems_task_create(
+    Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
+  );
+
+  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
+  rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+  status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
+  rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+  status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
+
+  rtems_task_set_priority(Task_id[1], 2, &old);
+  rtems_task_set_priority(Task_id[2], 2, &old);
+  rtems_task_set_priority(Task_id[3], 2, &old);
+
+  rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+
+  status = rtems_task_delete( RTEMS_SELF );
+}
+
+/* configuration information */
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_SCHEDULER_SIMPLE
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS             4
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+/* end of file */

diff -u /dev/null rtems/testsuites/sptests/spsimplesched01/spsimplesched01.doc:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/testsuites/sptests/spsimplesched01/spsimplesched01.doc	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,23 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 2011.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  spsimplesched01
+
+directives:
+  + rtems_task_wake_after - yield case
+  + rtems_task_set_priority - preempt and no preempt case
+
+concepts:
+
++ The purpose of this test is to exercise paths in the Simple Scheduler.
+  It exercises Initialization, Allocate, Free, Block, Unblock, and Yield.

diff -u /dev/null rtems/testsuites/sptests/spsimplesched01/spsimplesched01.scn:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/testsuites/sptests/spsimplesched01/spsimplesched01.scn	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,16 @@
+*** SIMPLE01 TEST ***
+TA1 - clock_get_tod - 09:00:00   12/31/1988
+TA2 - clock_get_tod - 09:00:00   12/31/1988
+TA3 - clock_get_tod - 09:00:00   12/31/1988
+TA1 - clock_get_tod - 09:00:05   12/31/1988
+TA1 - clock_get_tod - 09:00:10   12/31/1988
+TA2 - clock_get_tod - 09:00:10   12/31/1988
+TA1 - clock_get_tod - 09:00:15   12/31/1988
+TA3 - clock_get_tod - 09:00:15   12/31/1988
+TA1 - clock_get_tod - 09:00:20   12/31/1988
+TA2 - clock_get_tod - 09:00:20   12/31/1988
+TA1 - clock_get_tod - 09:00:25   12/31/1988
+TA1 - clock_get_tod - 09:00:30   12/31/1988
+TA2 - clock_get_tod - 09:00:30   12/31/1988
+TA3 - clock_get_tod - 09:00:30   12/31/1988
+*** END OF SIMPLE01 TEST ***

diff -u /dev/null rtems/testsuites/sptests/spsimplesched02/.cvsignore:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/testsuites/sptests/spsimplesched02/.cvsignore	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/sptests/spsimplesched02/Makefile.am:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/testsuites/sptests/spsimplesched02/Makefile.am	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,28 @@
+##
+##  $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = spsimplesched02 
+spsimplesched02_SOURCES = init.c
+
+dist_rtems_tests_DATA = spsimplesched02.scn
+dist_rtems_tests_DATA += spsimplesched02.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+spsimplesched02_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spsimplesched02_OBJECTS) $(spsimplesched02_LDADD)
+LINK_LIBS = $(spsimplesched02_LDLIBS)
+
+spsimplesched02$(EXEEXT): $(spsimplesched02_OBJECTS) $(spsimplesched02_DEPENDENCIES)
+	@rm -f spsimplesched02$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/sptests/spsimplesched02/init.c:1.1
--- /dev/null	Wed Mar 16 12:10:15 2011
+++ rtems/testsuites/sptests/spsimplesched02/init.c	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,143 @@
+/* 
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+
+/*
+ *  Keep the names and IDs in global variables so another task can use them.
+ */
+rtems_id   Task_id[ 3 ];         /* array of task ids */
+rtems_name Task_name[ 3 ];       /* array of task names */
+rtems_name Semaphore_name[ 2 ];
+rtems_id   Semaphore_id[ 2 ];
+
+rtems_task Test_task(
+  rtems_task_argument unused
+)
+{
+  rtems_id          tid;
+  uint32_t    task_index;
+  rtems_status_code status;
+
+  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  task_index = task_number( tid );
+
+  for ( ; ; ) {
+    rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+  }
+}
+
+void ObtainRelease( bool suspendIdle ) 
+{
+  rtems_status_code   status;
+
+  if (suspendIdle) {
+    puts( "INIT - Suspend Idle Task");
+    status = rtems_task_suspend( _Thread_Idle->Object.id );
+    directive_failed( status, "rtems_task_suspend idle" );
+  }
+
+  puts( "INIT - Obtain priority ceiling semaphore - priority increases" );
+  status= rtems_semaphore_obtain( Semaphore_id[1], RTEMS_DEFAULT_OPTIONS, 0 );
+  directive_failed( status, "rtems_semaphore_obtain" );
+
+  puts( "INIT - Obtain priority ceiling semaphore - priority decreases" );
+  status = rtems_semaphore_release( Semaphore_id[1] );
+  directive_failed( status, "rtems_semaphore_release" );
+
+  if (suspendIdle) {
+    puts( "INIT - Resume Idle Task");
+    status = rtems_task_resume( _Thread_Idle->Object.id );
+    directive_failed( status, "rtems_task_resume idle" );
+  }
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code   status;
+
+  puts( "\n\n*** SIMPLE SCHEDULER 02 TEST ***" );
+
+  /*
+   * Create the semaphore. Then obtain and release the
+   * semaphore with no other tasks running.
+   */
+  puts( "INIT - Create priority ceiling semaphore" );
+  Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' );
+  status = rtems_semaphore_create(
+    Semaphore_name[ 1 ],
+    1,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | RTEMS_PRIORITY,
+    2,
+    &Semaphore_id[ 1 ]
+  );
+  directive_failed( status, "rtems_semaphore_create of SM1" );
+  ObtainRelease( false );
+
+  /*
+   * Create test task and obtain release the semaphore with
+   * one other task running.
+   */
+  puts( "INIT - create task 1" );
+  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+  status = rtems_task_create(
+    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
+  );
+  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
+  ObtainRelease( false );
+
+  /*
+   * Create a a second test task and obtain release the semaphore
+   * with both tasks running.
+   */
+  puts( "INIT - create task 2" );
+  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+  status = rtems_task_create(
+    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
+  );
+  status = rtems_task_start( Task_id[ 2 ], Test_task, 1 );
+  ObtainRelease( false );
+
+  /*
+   * Obtain and release the semaphore with the idle task suspended.
+   */
+  ObtainRelease( true );
+
+  /*  End the Test */
+  puts( "*** END OF SIMPLE SCHEDULER 02 TEST ***" );
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_SCHEDULER_SIMPLE
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS             3 
+#define CONFIGURE_MAXIMUM_SEMAPHORES        2
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)
+#define CONFIGURE_INIT_TASK_PRIORITY        4
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+/* end of include file */

diff -u /dev/null rtems/testsuites/sptests/spsimplesched02/spsimplesched02.doc:1.1
--- /dev/null	Wed Mar 16 12:10:16 2011
+++ rtems/testsuites/sptests/spsimplesched02/spsimplesched02.doc	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,24 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 2011.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  spsimplesched02
+
+directives:
+  + rtems_semaphore_create
+  + rtems_semaphore_obtain
+  + rtems_semaphore_release
+
+concepts:
+
++ The purpose of this test is to exercise paths in the Simple Scheduler.
+  It exercises logic required to inherit and restore priority.

diff -u /dev/null rtems/testsuites/sptests/spsimplesched02/spsimplesched02.scn:1.1
--- /dev/null	Wed Mar 16 12:10:16 2011
+++ rtems/testsuites/sptests/spsimplesched02/spsimplesched02.scn	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,15 @@
+*** SIMPLE SCHEDULER 02 TEST ***
+INIT - Create priority ceiling semaphore
+INIT - Obtain priority ceiling semaphore - priority increases
+INIT - Obtain priority ceiling semaphore - priority decreases
+INIT - create task 1
+INIT - Obtain priority ceiling semaphore - priority increases
+INIT - Obtain priority ceiling semaphore - priority decreases
+INIT - create task 2
+INIT - Obtain priority ceiling semaphore - priority increases
+INIT - Obtain priority ceiling semaphore - priority decreases
+INIT - Suspend Idle Task
+INIT - Obtain priority ceiling semaphore - priority increases
+INIT - Obtain priority ceiling semaphore - priority decreases
+INIT - Resume Idle Task
+*** END OF SIMPLE SCHEDULER 02 TEST ***

diff -u /dev/null rtems/testsuites/sptests/spsimplesched03/.cvsignore:1.1
--- /dev/null	Wed Mar 16 12:10:16 2011
+++ rtems/testsuites/sptests/spsimplesched03/.cvsignore	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/sptests/spsimplesched03/Makefile.am:1.1
--- /dev/null	Wed Mar 16 12:10:16 2011
+++ rtems/testsuites/sptests/spsimplesched03/Makefile.am	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,28 @@
+##
+##  $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = spsimplesched03 
+spsimplesched03_SOURCES = init.c
+
+dist_rtems_tests_DATA = spsimplesched03.scn
+dist_rtems_tests_DATA += spsimplesched03.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+spsimplesched03_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spsimplesched03_OBJECTS) $(spsimplesched03_LDADD)
+LINK_LIBS = $(spsimplesched03_LDLIBS)
+
+spsimplesched03$(EXEEXT): $(spsimplesched03_OBJECTS) $(spsimplesched03_DEPENDENCIES)
+	@rm -f spsimplesched03$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/sptests/spsimplesched03/init.c:1.1
--- /dev/null	Wed Mar 16 12:10:16 2011
+++ rtems/testsuites/sptests/spsimplesched03/init.c	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,50 @@
+/*
+ *  COPYRIGHT (c) 2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code   status;
+
+  puts( "\n\n*** SIMPLE SCHEDULER 03 TEST ***" );
+
+  puts( "INIT - rtems timer initiate server");
+  status = rtems_timer_initiate_server( 
+    RTEMS_TIMER_SERVER_DEFAULT_PRIORITY,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_ATTRIBUTES
+  );
+  directive_failed( status, "Timer Initiate Server" );
+
+  /*  End the Test */
+  puts( "*** END OF SIMPLE SCHEDULER 03 TEST ***" );
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+#define CONFIGURE_SCHEDULER_SIMPLE
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS             2
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_PRIORITY        2
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+/* end of include file */

diff -u /dev/null rtems/testsuites/sptests/spsimplesched03/spsimplesched03.doc:1.1
--- /dev/null	Wed Mar 16 12:10:16 2011
+++ rtems/testsuites/sptests/spsimplesched03/spsimplesched03.doc	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,22 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 2011.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  spsimplesched03
+
+directives:
+  + rtems_timer_initiate_server
+
+concepts:
+
++ The purpose of this test is to exercise paths in the Simple Scheduler.
+  It exercises the preemption of the zero priority Timer Server.

diff -u /dev/null rtems/testsuites/sptests/spsimplesched03/spsimplesched03.scn:1.1
--- /dev/null	Wed Mar 16 12:10:16 2011
+++ rtems/testsuites/sptests/spsimplesched03/spsimplesched03.scn	Wed Mar 16 11:33:04 2011
@@ -0,0 +1,3 @@
+*** SIMPLE SCHEDULER 03 TEST ***
+INIT - rtems timer initiate server
+*** END OF SIMPLE SCHEDULER 03 TEST ***

diff -u rtems/testsuites/sptests/spsize/size.c:1.70 rtems/testsuites/sptests/spsize/size.c:1.71
--- rtems/testsuites/sptests/spsize/size.c:1.70	Tue Feb 22 01:37:03 2011
+++ rtems/testsuites/sptests/spsize/size.c	Wed Mar 16 11:33:04 2011
@@ -72,26 +72,30 @@
 #define  HEAP_OVHD        16    /* wasted heap space per task stack */
 #define  NAME_PTR_SIZE     8    /* size of name and pointer table entries */
 
-#if CONFIGURE_SCHEDULER_POLICY == _Scheduler_PRIORITY
-  #include <rtems/score/prioritybitmap.h>
+/*
+ *  This assumes the default Priority Scheduler
+ */
+#include <rtems/score/prioritybitmap.h>
+#include <rtems/score/schedulerpriority.h>
+
+/* Priority scheduling uninitialized (globals) consumption */
+#define SCHEDULER_OVHD     ((sizeof _Scheduler)              + \
+                           (sizeof _Priority_Major_bit_map) + \
+                           (sizeof _Priority_Bit_map))
+
+/* Priority scheduling per-thread consumption. Gets 
+ * included in the PER_TASK consumption.
+ */
+#define SCHEDULER_TASK_WKSP     (sizeof(Scheduler_priority_Per_thread))
 
-  /* Priority scheduling uninitialized (globals) consumption */
-  #define SCHEDULER_OVHD          ((sizeof _Scheduler)              + \
-                                   (sizeof _Priority_Major_bit_map) + \
-                                   (sizeof _Priority_Bit_map))
-
-  /* Priority scheduling per-thread consumption. Gets 
-   * included in the PER_TASK consumption. */
-  #define SCHEDULER_TASK_WKSP     (sizeof(Scheduler_priority_Per_thread))
-
-  /* Priority scheduling workspace consumption 
-   *
-   * Include allocation of ready queue.  Pointers are already counted by 
-   * including _Scheduler in SCHEDULER_OVHD.
-   */
-  #define  SCHEDULER_WKSP_SIZE  \
+/* Priority scheduling workspace consumption 
+ *
+ * Include allocation of ready queue.  Pointers are already counted by 
+ * including _Scheduler in SCHEDULER_OVHD.
+ */
+#define SCHEDULER_WKSP_SIZE  \
     ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control ))
-#endif
+/****** END OF MEMORY USAGE OF DEFAULT PRIORITY SCHEDULER ******/
 
 #define PER_TASK      \
      (long) (sizeof (Thread_Control) + \


 *joel*:
2011-03-16	Jennifer Averett <jennifer.averett at OARcorp.com>

	PR 1743/cpu
	* user/conf.t: Add Simple Priority Scheduler as complement to existing
	Deterministic Priority Scheduler. This scheduler serves both as an
	example and as a lighter weight implementation for smaller systems.

M  1.303  doc/ChangeLog
M   1.68  doc/user/conf.t

diff -u rtems/doc/ChangeLog:1.302 rtems/doc/ChangeLog:1.303
--- rtems/doc/ChangeLog:1.302	Fri Mar  4 12:47:52 2011
+++ rtems/doc/ChangeLog	Wed Mar 16 11:39:16 2011
@@ -1,3 +1,10 @@
+2011-03-16	Jennifer Averett <jennifer.averett at OARcorp.com>
+
+	PR 1743/cpu
+	* user/conf.t: Add Simple Priority Scheduler as complement to existing
+	Deterministic Priority Scheduler. This scheduler serves both as an
+	example and as a lighter weight implementation for smaller systems.
+
 2011-03-04	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	PR 1752/doc

diff -u rtems/doc/user/conf.t:1.67 rtems/doc/user/conf.t:1.68
--- rtems/doc/user/conf.t:1.67	Thu Feb 17 16:37:06 2011
+++ rtems/doc/user/conf.t	Wed Mar 16 11:39:16 2011
@@ -408,6 +408,16 @@
 of priorities configured in the system.  This scheduler may be explicitly
 selected by defining @code{CONFIGURE_SCHEDULER_PRIORITY}.
 
+ at findex CONFIGURE_SCHEDULER_SIMPLE
+ at item Simple Priority Scheduler - This is an alternative scheduler
+in RTEMS.  It is designed to provide the same task scheduling behaviour
+as the Deterministic Priority Scheduler while being simpler in implementation
+and uses less memory for data management.  It maintains a single sorted list
+of all ready threads.  Thus blocking or unblocking a thread is not a
+constant time operation with this scheduler.  This scheduler is appropriate
+for use in small systems where RAM is limited.  This scheduler may be explicitly
+selected by defining @code{CONFIGURE_SCHEDULER_SIMPLE}.
+
 @end itemize
 
 The pluggable scheduler interface was added after the 4.10 release series



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110316/7ff8b864/attachment-0001.html>


More information about the vc mailing list