<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-12-14)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-12-14 Sebastian Huber <sebastian.huber@embedded-brains.de>

        PR 1924/cpukit
        * sapi/include/rtems/config.h: Added stack_allocate_init_hook to
        rtems_configuration_table.
        * sapi/include/confdefs.h: Added CONFIGURE_TASK_STACK_FROM_ALLOCATOR
        and CONFIGURE_TASK_STACK_ALLOCATOR_INIT defines.  Set default stack
        allocator and free hook to _Workspace_Allocate() and _Workspace_Free()
        respectively.
        * score/src/thread.c, score/src/threadstackallocate.c,
        score/src/threadstackfree.c: Update due to API changes.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.3093&r2=text&tr2=1.3094&diff_format=h">M</a></td><td width='1%'>1.3094</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/sapi/include/confdefs.h.diff?r1=text&tr1=1.178&r2=text&tr2=1.179&diff_format=h">M</a></td><td width='1%'>1.179</td><td width='100%'>cpukit/sapi/include/confdefs.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/sapi/include/rtems/config.h.diff?r1=text&tr1=1.57&r2=text&tr2=1.58&diff_format=h">M</a></td><td width='1%'>1.58</td><td width='100%'>cpukit/sapi/include/rtems/config.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/src/thread.c.diff?r1=text&tr1=1.68&r2=text&tr2=1.69&diff_format=h">M</a></td><td width='1%'>1.69</td><td width='100%'>cpukit/score/src/thread.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/src/threadstackallocate.c.diff?r1=text&tr1=1.15&r2=text&tr2=1.16&diff_format=h">M</a></td><td width='1%'>1.16</td><td width='100%'>cpukit/score/src/threadstackallocate.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/src/threadstackfree.c.diff?r1=text&tr1=1.8&r2=text&tr2=1.9&diff_format=h">M</a></td><td width='1%'>1.9</td><td width='100%'>cpukit/score/src/threadstackfree.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.3093 rtems/cpukit/ChangeLog:1.3094
--- rtems/cpukit/ChangeLog:1.3093       Wed Dec 14 03:22:42 2011
+++ rtems/cpukit/ChangeLog      Wed Dec 14 07:17:18 2011
</font><font color='#997700'>@@ -1,5 +1,17 @@
</font> 2011-12-14        Sebastian Huber <sebastian.huber@embedded-brains.de>
 
<font color='#000088'>+   PR 1924/cpukit
+       * sapi/include/rtems/config.h: Added stack_allocate_init_hook to
+       rtems_configuration_table.
+       * sapi/include/confdefs.h: Added CONFIGURE_TASK_STACK_FROM_ALLOCATOR
+       and CONFIGURE_TASK_STACK_ALLOCATOR_INIT defines.  Set default stack
+       allocator and free hook to _Workspace_Allocate() and _Workspace_Free()
+       respectively.
+       * score/src/thread.c, score/src/threadstackallocate.c,
+       score/src/threadstackfree.c: Update due to API changes.
+
+2011-12-14     Sebastian Huber <sebastian.huber@embedded-brains.de>
+
</font>   * libcsupport/src/termios_setinitialbaud.c: Fixed typo.
 
 2011-12-14     Sebastian Huber <sebastian.huber@embedded-brains.de>

<font color='#006600'>diff -u rtems/cpukit/sapi/include/confdefs.h:1.178 rtems/cpukit/sapi/include/confdefs.h:1.179
--- rtems/cpukit/sapi/include/confdefs.h:1.178  Tue Dec 13 08:37:03 2011
+++ rtems/cpukit/sapi/include/confdefs.h        Wed Dec 14 07:17:19 2011
</font><font color='#997700'>@@ -44,6 +44,7 @@
</font>  */
 #include <rtems.h>
 #include <rtems/score/apimutex.h>
<font color='#000088'>+#include <rtems/score/wkspace.h>
</font> 
 #ifdef __cplusplus
 extern "C" {
<font color='#997700'>@@ -823,17 +824,24 @@
</font> #endif
 
 /**
<font color='#880000'>- *  Configure the very much optional task stack allocator
</font><font color='#000088'>+ *  Configure the very much optional task stack allocator initialization
</font>  */
<font color='#880000'>-#ifndef CONFIGURE_TASK_STACK_ALLOCATOR
-  #define CONFIGURE_TASK_STACK_ALLOCATOR NULL
</font><font color='#000088'>+#ifndef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
+  #define CONFIGURE_TASK_STACK_ALLOCATOR_INIT NULL
</font> #endif
 
<font color='#880000'>-/**
- *  Configure the very much optional task stack deallocator
</font><font color='#000088'>+/*
+ *  Configure the very much optional task stack allocator and deallocator.
</font>  */
<font color='#880000'>-#ifndef CONFIGURE_TASK_STACK_DEALLOCATOR
-  #define CONFIGURE_TASK_STACK_DEALLOCATOR NULL
</font><font color='#000088'>+#if !defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
+  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
+  #define CONFIGURE_TASK_STACK_ALLOCATOR _Workspace_Allocate
+  #define CONFIGURE_TASK_STACK_DEALLOCATOR _Workspace_Free
+#elif (defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
+  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)) \
+    || (!defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
+      && defined(CONFIGURE_TASK_STACK_DEALLOCATOR))
+  #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
</font> #endif
 
 /**
<font color='#997700'>@@ -869,7 +877,6 @@
</font>   #endif
   
   #ifdef CONFIGURE_UNIFIED_WORK_AREAS
<font color='#880000'>-    #include <rtems/score/wkspace.h>
</font>     Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
   #else
     Heap_Control   RTEMS_Malloc_Area;
<font color='#997700'>@@ -929,6 +936,19 @@
</font>   (ssize_t)((_size) + HEAP_BLOCK_HEADER_SIZE + CPU_HEAP_ALIGNMENT - 1)
 
 /**
<font color='#000088'>+ *  This is a helper macro used in stack space calculations in this file.  It
+ *  may be provided by the application in case a special task stack allocator
+ *  is used.  The default is allocation from the RTEMS Workspace.
+ */
+#ifdef CONFIGURE_TASK_STACK_FROM_ALLOCATOR
+  #define _Configure_From_stackspace(_stack_size) \
+    CONFIGURE_TASK_STACK_FROM_ALLOCATOR(_stack_size)
+#else
+  #define _Configure_From_stackspace(_stack_size) \
+    _Configure_From_workspace(_stack_size)
+#endif
+
+/**
</font>  *  Do not use the unlimited bit as part of the multiplication
  *  for memory usage.
  */
<font color='#997700'>@@ -2051,23 +2071,23 @@
</font> 
 #define CONFIGURE_IDLE_TASKS_STACK \
   (CONFIGURE_IDLE_TASKS_COUNT * \
<font color='#880000'>-    _Configure_From_workspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
</font><font color='#000088'>+    _Configure_From_stackspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
</font> 
 #define CONFIGURE_TASKS_STACK \
   (_Configure_Max_Objects( CONFIGURE_MAXIMUM_TASKS ) * \
<font color='#880000'>-    _Configure_From_workspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
</font><font color='#000088'>+    _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
</font> 
 #define CONFIGURE_POSIX_THREADS_STACK \
   (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
<font color='#880000'>-    _Configure_From_workspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
</font><font color='#000088'>+    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
</font> 
 #define CONFIGURE_GOROUTINES_STACK \
   (_Configure_Max_Objects( CONFIGURE_MAXIMUM_GOROUTINES ) * \
<font color='#880000'>-    _Configure_From_workspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
</font><font color='#000088'>+    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
</font> 
 #define CONFIGURE_ADA_TASKS_STACK \
   (_Configure_Max_Objects( CONFIGURE_MAXIMUM_ADA_TASKS ) * \
<font color='#880000'>-    _Configure_From_workspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
</font><font color='#000088'>+    _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
</font> 
 #else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
 
<font color='#997700'>@@ -2180,6 +2200,7 @@
</font>     CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
     CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
     CONFIGURE_INTERRUPT_STACK_SIZE,           /* interrupt stack size */
<font color='#000088'>+    CONFIGURE_TASK_STACK_ALLOCATOR_INIT,      /* stack allocator init */
</font>     CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
     CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
     CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */

<font color='#006600'>diff -u rtems/cpukit/sapi/include/rtems/config.h:1.57 rtems/cpukit/sapi/include/rtems/config.h:1.58
--- rtems/cpukit/sapi/include/rtems/config.h:1.57       Thu Nov 10 08:40:13 2011
+++ rtems/cpukit/sapi/include/rtems/config.h    Wed Dec 14 07:17:19 2011
</font><font color='#997700'>@@ -84,6 +84,30 @@
</font> } rtems_multiprocessing_table;
 #endif
 
<font color='#000088'>+/**
+ * @brief Task stack allocator initialization hook.
+ *
+ * @param[in] stack_space_size Size of the stack space in bytes.
+ */
+typedef void (*rtems_stack_allocate_init_hook)( size_t stack_space_size );
+
+/**
+ * @brief Task stack allocator hook.
+ *
+ * @param[in] stack_size Size of the task stack in bytes.
+ *
+ * @retval NULL Not enough memory.
+ * @retval other Pointer to task stack.
+ */
+typedef void *(*rtems_stack_allocate_hook)( size_t stack_size );
+
+/**
+ * @brief Task stack deallocator hook.
+ *
+ * @param[in] addr Pointer to previously allocated task stack.
+ */
+typedef void (*rtems_stack_free_hook)( void *addr );
+
</font> /*
  *  The following records define the Configuration Table.  The
  *  information contained in this table is required in all
<font color='#997700'>@@ -139,15 +163,20 @@
</font>    */
   uint32_t                       interrupt_stack_size;
 
<font color='#880000'>-  /** The BSP may want to provide it's own stack allocation routines.
-   *  In this case, the BSP will provide this stack allocation hook.
</font><font color='#000088'>+  /**
+   * @brief Optional task stack allocator initialization hook.
</font>    */
<font color='#880000'>-  void *                       (*stack_allocate_hook)( size_t );
</font><font color='#000088'>+  rtems_stack_allocate_init_hook stack_allocate_init_hook;
</font> 
<font color='#880000'>-  /** The BSP may want to provide it's own stack free routines.
-   *  In this case, the BSP will provide this stack free hook.
</font><font color='#000088'>+  /**
+   * @brief Optional task stack allocator hook.
</font>    */
<font color='#880000'>-  void                         (*stack_free_hook)( void *);
</font><font color='#000088'>+  rtems_stack_allocate_hook      stack_allocate_hook;
+
+  /**
+   * @brief Optional task stack free hook.
+   */
+  rtems_stack_free_hook          stack_free_hook;
</font> 
   /** If this element is TRUE, then RTEMS will zero the Executive Workspace.
    *  When this element is FALSE, it is assumed that the BSP or invoking
<font color='#997700'>@@ -268,6 +297,9 @@
</font> #define rtems_configuration_get_interrupt_stack_size() \
         (Configuration.interrupt_stack_size)
 
<font color='#000088'>+#define rtems_configuration_get_stack_allocate_init_hook() \
+        (Configuration.stack_allocate_init_hook)
+
</font> #define rtems_configuration_get_stack_allocate_hook() \
         (Configuration.stack_allocate_hook)
 

<font color='#006600'>diff -u rtems/cpukit/score/src/thread.c:1.68 rtems/cpukit/score/src/thread.c:1.69
--- rtems/cpukit/score/src/thread.c:1.68        Mon Apr  4 11:40:00 2011
+++ rtems/cpukit/score/src/thread.c     Wed Dec 14 07:17:19 2011
</font><font color='#997700'>@@ -49,30 +49,29 @@
</font> 
 void _Thread_Handler_initialization(void)
 {
<font color='#880000'>-  uint32_t     ticks_per_timeslice;
-  uint32_t     maximum_extensions;
</font><font color='#000088'>+  uint32_t ticks_per_timeslice =
+    rtems_configuration_get_ticks_per_timeslice();
+  uint32_t maximum_extensions =
+    rtems_configuration_get_maximum_extensions();
+  rtems_stack_allocate_init_hook stack_allocate_init_hook =
+    rtems_configuration_get_stack_allocate_init_hook();
</font>   uint32_t     maximum_internal_threads;
   #if defined(RTEMS_MULTIPROCESSING)
<font color='#880000'>-    uint32_t   maximum_proxies;
</font><font color='#000088'>+    uint32_t maximum_proxies =
+      _Configuration_MP_table->maximum_proxies;
</font>   #endif
 
<font color='#880000'>-  ticks_per_timeslice = Configuration.ticks_per_timeslice;
-  maximum_extensions  = Configuration.maximum_extensions;
-  #if defined(RTEMS_MULTIPROCESSING)
-    maximum_proxies   =  _Configuration_MP_table->maximum_proxies;
-  #endif
-  /*
-   * BOTH stacks hooks must be set or both must be NULL.
-   * Do not allow mixture.
-   */
-    if ( !( (!Configuration.stack_allocate_hook)
-            == (!Configuration.stack_free_hook) ) )
</font><font color='#000088'>+  if ( rtems_configuration_get_stack_allocate_hook() == NULL ||
+       rtems_configuration_get_stack_free_hook() == NULL)
</font>     _Internal_error_Occurred(
       INTERNAL_ERROR_CORE,
       true,
       INTERNAL_ERROR_BAD_STACK_HOOK
     );
 
<font color='#000088'>+  if ( stack_allocate_init_hook != NULL )
+    (*stack_allocate_init_hook)( rtems_configuration_get_stack_space_size() );
+
</font>   _Thread_Dispatch_necessary = false;
   _Thread_Executing         = NULL;
   _Thread_Heir              = NULL;

<font color='#006600'>diff -u rtems/cpukit/score/src/threadstackallocate.c:1.15 rtems/cpukit/score/src/threadstackallocate.c:1.16
--- rtems/cpukit/score/src/threadstackallocate.c:1.15   Sun Jul 24 18:55:14 2011
+++ rtems/cpukit/score/src/threadstackallocate.c        Wed Dec 14 07:17:19 2011
</font><font color='#997700'>@@ -46,33 +46,24 @@
</font> {
   void *stack_addr = 0;
   size_t the_stack_size;
<font color='#000088'>+  rtems_stack_allocate_hook stack_allocate_hook =
+    rtems_configuration_get_stack_allocate_hook();
</font> 
   the_stack_size = _Stack_Ensure_minimum( stack_size );
 
   /*
<font color='#880000'>-   * Call ONLY the CPU table stack allocate hook, _or_ the
-   * the RTEMS workspace allocate.  This is so the stack free
-   * routine can call the correct deallocation routine.
</font><font color='#000088'>+   *  Pad the requested size so we allocate enough memory
+   *  so the context initialization can align it properly.  The address
+   *  returned the workspace allocate must be directly stored in the
+   *  stack control block because it is later used in the free sequence.
+   *
+   *  Thus it is the responsibility of the CPU dependent code to
+   *  get and keep the stack adjust factor, the stack alignment, and
+   *  the context initialization sequence in sync.
</font>    */
<font color='#000088'>+  the_stack_size = _Stack_Adjust_size( the_stack_size );
</font> 
<font color='#880000'>-  if ( Configuration.stack_allocate_hook ) {
-    stack_addr = (*Configuration.stack_allocate_hook)( the_stack_size );
-  } else {
-
-    /*
-     *  First pad the requested size so we allocate enough memory
-     *  so the context initialization can align it properly.  The address
-     *  returned the workspace allocate must be directly stored in the
-     *  stack control block because it is later used in the free sequence.
-     *
-     *  Thus it is the responsibility of the CPU dependent code to
-     *  get and keep the stack adjust factor, the stack alignment, and
-     *  the context initialization sequence in sync.
-     */
-
-    the_stack_size = _Stack_Adjust_size( the_stack_size );
-    stack_addr = _Workspace_Allocate( the_stack_size );
-  }
</font><font color='#000088'>+  stack_addr = (*stack_allocate_hook)( the_stack_size );
</font> 
   if ( !stack_addr )
     the_stack_size = 0;

<font color='#006600'>diff -u rtems/cpukit/score/src/threadstackfree.c:1.8 rtems/cpukit/score/src/threadstackfree.c:1.9
--- rtems/cpukit/score/src/threadstackfree.c:1.8        Fri Jan 28 14:24:54 2011
+++ rtems/cpukit/score/src/threadstackfree.c    Wed Dec 14 07:17:19 2011
</font><font color='#997700'>@@ -41,6 +41,9 @@
</font>   Thread_Control *the_thread
 )
 {
<font color='#000088'>+  rtems_stack_free_hook stack_free_hook =
+    rtems_configuration_get_stack_free_hook();
+
</font>   #if defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API)
     /*
      *  If the API provided the stack space, then don't free it.
<font color='#997700'>@@ -55,8 +58,5 @@
</font>    * routine properly matches the allocation of the stack.
    */
 
<font color='#880000'>-  if ( Configuration.stack_free_hook )
-    (*Configuration.stack_free_hook)( the_thread->Start.Initial_stack.area );
-  else
-    _Workspace_Free( the_thread->Start.Initial_stack.area );
</font><font color='#000088'>+  (*stack_free_hook)( the_thread->Start.Initial_stack.area );
</font> }
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-12-14 Sebastian Huber <sebastian.huber@embedded-brains.de>

        PR 1924/cpukit
        * spstkalloc02/.cvsignore, spstkalloc02/Makefile.am,
        spstkalloc02/init.c, spstkalloc02/spstkalloc02.doc,
        spstkalloc02/spstkalloc02.scn: New files.
        * Makefile.am, configure.ac: Reflect changes above.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/ChangeLog.diff?r1=text&tr1=1.503&r2=text&tr2=1.504&diff_format=h">M</a></td><td width='1%'>1.504</td><td width='100%'>testsuites/sptests/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/Makefile.am.diff?r1=text&tr1=1.117&r2=text&tr2=1.118&diff_format=h">M</a></td><td width='1%'>1.118</td><td width='100%'>testsuites/sptests/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/configure.ac.diff?r1=text&tr1=1.124&r2=text&tr2=1.125&diff_format=h">M</a></td><td width='1%'>1.125</td><td width='100%'>testsuites/sptests/configure.ac</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spstkalloc02/.cvsignore?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spstkalloc02/.cvsignore</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spstkalloc02/Makefile.am?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spstkalloc02/Makefile.am</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spstkalloc02/init.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spstkalloc02/init.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spstkalloc02/spstkalloc02.doc?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spstkalloc02/spstkalloc02.doc</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spstkalloc02/spstkalloc02.scn?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spstkalloc02/spstkalloc02.scn</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/testsuites/sptests/ChangeLog:1.503 rtems/testsuites/sptests/ChangeLog:1.504
--- rtems/testsuites/sptests/ChangeLog:1.503    Tue Dec 13 04:02:30 2011
+++ rtems/testsuites/sptests/ChangeLog  Wed Dec 14 07:18:01 2011
</font><font color='#997700'>@@ -1,3 +1,11 @@
</font><font color='#000088'>+2011-12-14    Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+       PR 1924/cpukit
+       * spstkalloc02/.cvsignore, spstkalloc02/Makefile.am,
+       spstkalloc02/init.c, spstkalloc02/spstkalloc02.doc,
+       spstkalloc02/spstkalloc02.scn: New files.
+       * Makefile.am, configure.ac: Reflect changes above.
+
</font> 2011-12-13        Ralf Corsépius <ralf.corsepius@rtems.org>
 
        * sp31/task1.c: Make Do_nothing static.

<font color='#006600'>diff -u rtems/testsuites/sptests/Makefile.am:1.117 rtems/testsuites/sptests/Makefile.am:1.118
--- rtems/testsuites/sptests/Makefile.am:1.117  Wed Sep 28 11:01:53 2011
+++ rtems/testsuites/sptests/Makefile.am        Wed Dec 14 07:18:01 2011
</font><font color='#997700'>@@ -17,7 +17,7 @@
</font>     sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp2038 \
     spassoc01 spchain spclockget spcoverage spobjgetnext \
     spnotepad01 spprintk spprivenv01 sprbtree01 spsize spstkalloc \
<font color='#880000'>-           spthreadq01 spwatchdog spwkspace \
</font><font color='#000088'>+    spstkalloc02 spthreadq01 spwatchdog spwkspace \
</font>     sperror01 sperror02 sperror03 \
     spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \
     spfatal08 spfatal09 spfatal10 spfatal11 spfatal12 spfatal13 spfatal14 \

<font color='#006600'>diff -u rtems/testsuites/sptests/configure.ac:1.124 rtems/testsuites/sptests/configure.ac:1.125
--- rtems/testsuites/sptests/configure.ac:1.124 Thu Sep 29 20:55:27 2011
+++ rtems/testsuites/sptests/configure.ac       Wed Dec 14 07:18:01 2011
</font><font color='#997700'>@@ -180,6 +180,7 @@
</font> spsimplesched03/Makefile
 spsize/Makefile
 spstkalloc/Makefile
<font color='#000088'>+spstkalloc02/Makefile
</font> spthreadq01/Makefile
 spwatchdog/Makefile
 spwkspace/Makefile

<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spstkalloc02/.cvsignore:1.1
--- /dev/null   Wed Dec 14 07:31:33 2011
+++ rtems/testsuites/sptests/spstkalloc02/.cvsignore    Wed Dec 14 07:18:01 2011
</font><font color='#997700'>@@ -0,0 +1,2 @@
</font><font color='#000088'>+Makefile
+Makefile.in
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spstkalloc02/Makefile.am:1.1
--- /dev/null   Wed Dec 14 07:31:33 2011
+++ rtems/testsuites/sptests/spstkalloc02/Makefile.am   Wed Dec 14 07:18:01 2011
</font><font color='#997700'>@@ -0,0 +1,26 @@
</font><font color='#000088'>+##
+## $Id$
+##
+
+
+rtems_tests_PROGRAMS = spstkalloc02
+spstkalloc02_SOURCES = init.c
+
+dist_rtems_tests_DATA = spstkalloc02.scn
+dist_rtems_tests_DATA += spstkalloc02.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spstkalloc02_OBJECTS)
+LINK_LIBS = $(spstkalloc02_LDLIBS)
+
+spstkalloc02$(EXEEXT): $(spstkalloc02_OBJECTS) $(spstkalloc02_DEPENDENCIES)
+       @rm -f spstkalloc02$(EXEEXT)
+       $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spstkalloc02/init.c:1.1
--- /dev/null   Wed Dec 14 07:31:33 2011
+++ rtems/testsuites/sptests/spstkalloc02/init.c        Wed Dec 14 07:18:01 2011
</font><font color='#997700'>@@ -0,0 +1,162 @@
</font><font color='#000088'>+/**
+ * @file
+ *
+ * @ingroup sptests
+ *
+ * @brief Test that the task stack allocator works.
+ */
+
+/*
+ * Copyright (c) 2011 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems@embedded-brains.de>
+ *
+ * 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>
+
+#include <stdio.h>
+#include <inttypes.h>
+
+#include <rtems/score/heap.h>
+
+#define TASK_COUNT 5
+
+#define PAGE_SIZE 1024
+
+static Heap_Control task_stack_heap;
+
+static void task_stack_init(size_t stack_space_size);
+
+static void *task_stack_allocate(size_t stack_size);
+
+static void task_stack_free(void *addr);
+
+static void print_info(void)
+{
+  Heap_Information_block info;
+
+  _Heap_Get_information(&task_stack_heap, &info);
+
+  printf(
+    "used blocks = %" PRIu32 ", "
+    "largest used block = %" PRIu32 ", "
+    "used space = %" PRIu32 "\n"
+    "free blocks = %" PRIu32 ", "
+    "largest free block = %" PRIu32 ", "
+    "free space = %" PRIu32 "\n",
+    info.Used.number,
+    info.Used.largest,
+    info.Used.total,
+    info.Free.number,
+    info.Free.largest,
+    info.Free.total
+  );
+}
+
+static rtems_task Init(rtems_task_argument argument)
+{
+  rtems_status_code sc = RTEMS_SUCCESSFUL;
+  rtems_name name = rtems_build_name('S', 'T', 'K', 'A');
+  rtems_id id = RTEMS_ID_NONE;
+  int i = 0;
+
+  puts("\n\n*** POSIX TEST STKALLOC 02 ***");
+
+  print_info();
+
+  for (i = 2; i < TASK_COUNT; ++i) {
+    sc = rtems_task_create(
+      name,
+      RTEMS_MINIMUM_PRIORITY,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+    directive_failed(sc, "rtems_task_create");
+  }
+
+  sc = rtems_task_create(
+    name,
+    RTEMS_MINIMUM_PRIORITY,
+    2 * RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &id
+  );
+  fatal_directive_status(sc, RTEMS_UNSATISFIED, "rtems_task_create");
+
+  sc = rtems_task_create(
+    name,
+    RTEMS_MINIMUM_PRIORITY,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &id
+  );
+  directive_failed(sc, "rtems_task_create");
+
+  print_info();
+
+  puts("*** END OF POSIX TEST STKALLOC 02 ***");
+
+  rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS TASK_COUNT
+
+#define CONFIGURE_TASK_STACK_ALLOCATOR_INIT task_stack_init
+#define CONFIGURE_TASK_STACK_ALLOCATOR task_stack_allocate
+#define CONFIGURE_TASK_STACK_DEALLOCATOR task_stack_free
+#define CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
+#define CONFIGURE_TASK_STACK_FROM_ALLOCATOR(stack_size) \
+  ((stack_size) + HEAP_BLOCK_HEADER_SIZE + PAGE_SIZE - 1)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+
+static char task_stack_space
+  [CONFIGURE_TASK_STACK_FROM_ALLOCATOR(CONFIGURE_STACK_SPACE_SIZE)];
+
+static void task_stack_init(size_t stack_space_size)
+{
+  bool ok = _Heap_Initialize(
+    &task_stack_heap,
+    task_stack_space,
+    sizeof(task_stack_space),
+    PAGE_SIZE
+  );
+
+  rtems_test_assert(stack_space_size == CONFIGURE_STACK_SPACE_SIZE);
+  rtems_test_assert(ok);
+}
+
+static void *task_stack_allocate(size_t stack_size)
+{
+  return _Heap_Allocate(&task_stack_heap, stack_size);
+}
+
+static void task_stack_free(void *addr)
+{
+  _Heap_Free(&task_stack_heap, addr);
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spstkalloc02/spstkalloc02.doc:1.1
--- /dev/null   Wed Dec 14 07:31:33 2011
+++ rtems/testsuites/sptests/spstkalloc02/spstkalloc02.doc      Wed Dec 14 07:18:01 2011
</font><font color='#997700'>@@ -0,0 +1,19 @@
</font><font color='#000088'>+#
+#  $Id$
+#
+#  Copyright (c) 2011 embedded brains GmbH.
+#
+#  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:  spstkalloc01
+
+directives:
+
+concepts:
+
++ Ensure that the task stack allocator works.
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spstkalloc02/spstkalloc02.scn:1.1
--- /dev/null   Wed Dec 14 07:31:33 2011
+++ rtems/testsuites/sptests/spstkalloc02/spstkalloc02.scn      Wed Dec 14 07:18:01 2011
</font><font color='#997700'>@@ -0,0 +1,6 @@
</font><font color='#000088'>+*** POSIX TEST STKALLOC 02 ***
+used blocks = 2, largest used block = 5120, used space = 10240
+free blocks = 1, largest free block = 20480, free space = 20480
+used blocks = 6, largest used block = 5120, used space = 30720
+free blocks = 0, largest free block = 0, free space = 0
+*** END OF POSIX TEST STKALLOC 02 ***
</font></pre>
<p> </p>
<a name='cs3'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>Typo.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spstkalloc02/init.c.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>testsuites/sptests/spstkalloc02/init.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spstkalloc02/spstkalloc02.scn.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>testsuites/sptests/spstkalloc02/spstkalloc02.scn</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/testsuites/sptests/spstkalloc02/init.c:1.1 rtems/testsuites/sptests/spstkalloc02/init.c:1.2
--- rtems/testsuites/sptests/spstkalloc02/init.c:1.1    Wed Dec 14 07:18:01 2011
+++ rtems/testsuites/sptests/spstkalloc02/init.c        Wed Dec 14 07:19:52 2011
</font><font color='#997700'>@@ -74,7 +74,7 @@
</font>   rtems_id id = RTEMS_ID_NONE;
   int i = 0;
 
<font color='#880000'>-  puts("\n\n*** POSIX TEST STKALLOC 02 ***");
</font><font color='#000088'>+  puts("\n\n*** TEST STKALLOC 02 ***");
</font> 
   print_info();
 
<font color='#997700'>@@ -112,7 +112,7 @@
</font> 
   print_info();
 
<font color='#880000'>-  puts("*** END OF POSIX TEST STKALLOC 02 ***");
</font><font color='#000088'>+  puts("*** END OF TEST STKALLOC 02 ***");
</font> 
   rtems_test_exit(0);
 }

<font color='#006600'>diff -u rtems/testsuites/sptests/spstkalloc02/spstkalloc02.scn:1.1 rtems/testsuites/sptests/spstkalloc02/spstkalloc02.scn:1.2
--- rtems/testsuites/sptests/spstkalloc02/spstkalloc02.scn:1.1  Wed Dec 14 07:18:01 2011
+++ rtems/testsuites/sptests/spstkalloc02/spstkalloc02.scn      Wed Dec 14 07:19:52 2011
</font><font color='#997700'>@@ -1,6 +1,6 @@
</font><font color='#880000'>-*** POSIX TEST STKALLOC 02 ***
</font><font color='#000088'>+*** TEST STKALLOC 02 ***
</font> used blocks = 2, largest used block = 5120, used space = 10240
 free blocks = 1, largest free block = 20480, free space = 20480
 used blocks = 6, largest used block = 5120, used space = 30720
 free blocks = 0, largest free block = 0, free space = 0
<font color='#880000'>-*** END OF POSIX TEST STKALLOC 02 ***
</font><font color='#000088'>+*** END OF TEST STKALLOC 02 ***
</font></pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>