change log for rtems (2011-08-02)

rtems-vc at rtems.org rtems-vc at rtems.org
Tue Aug 2 14:11:50 UTC 2011


 *jennifer*:
2011-08-02	Jennifer.Averett <Jennifer.Averett at OARcorp.com>

	PR 1872
	* score/src/apimutexlock.c, score/src/apimutexunlock.c: Added smp
	support to apimutex.

M 1.2899  cpukit/ChangeLog
M    1.5  cpukit/score/src/apimutexlock.c
M    1.3  cpukit/score/src/apimutexunlock.c

diff -u rtems/cpukit/ChangeLog:1.2898 rtems/cpukit/ChangeLog:1.2899
--- rtems/cpukit/ChangeLog:1.2898	Tue Aug  2 08:37:20 2011
+++ rtems/cpukit/ChangeLog	Tue Aug  2 08:38:24 2011
@@ -1,3 +1,9 @@
+2011-08-02	Jennifer.Averett <Jennifer.Averett at OARcorp.com>
+
+	PR 1872
+	* score/src/apimutexlock.c, score/src/apimutexunlock.c: Added smp
+	support to apimutex.
+
 2011-08-02	Petr Benes <benesp16 at fel.cvut.cz>
 
 	PR 1861/cpukit

diff -u rtems/cpukit/score/src/apimutexlock.c:1.4 rtems/cpukit/score/src/apimutexlock.c:1.5
--- rtems/cpukit/score/src/apimutexlock.c:1.4	Sun Nov 29 07:51:52 2009
+++ rtems/cpukit/score/src/apimutexlock.c	Tue Aug  2 08:38:25 2011
@@ -22,6 +22,10 @@
 {
   ISR_Level level;
 
+  #if defined(RTEMS_SMP)
+    _Thread_Disable_dispatch();
+  #endif
+
   _ISR_Disable( level );
 
   _CORE_mutex_Seize(

diff -u rtems/cpukit/score/src/apimutexunlock.c:1.2 rtems/cpukit/score/src/apimutexunlock.c:1.3
--- rtems/cpukit/score/src/apimutexunlock.c:1.2	Fri Nov  9 15:52:09 2007
+++ rtems/cpukit/score/src/apimutexunlock.c	Tue Aug  2 08:38:25 2011
@@ -20,7 +20,10 @@
   API_Mutex_Control *the_mutex
 )
 {
-  _Thread_Disable_dispatch();
+   /* Dispatch is already disabled in SMP while lock is held. */
+   #if !defined(RTEMS_SMP)
+     _Thread_Disable_dispatch();
+   #endif
     _CORE_mutex_Surrender(
       &the_mutex->Mutex,
       the_mutex->Object.id,


 *jennifer*:
2011-08-02	Jennifer Averett <Jennifer.Averett at OARcorp.com>

	* score/include/rtems/score/coremutex.h: Move check dispatch for seize
	into its own macro and add smp support.

M 1.2900  cpukit/ChangeLog
M   1.45  cpukit/score/include/rtems/score/coremutex.h

diff -u rtems/cpukit/ChangeLog:1.2899 rtems/cpukit/ChangeLog:1.2900
--- rtems/cpukit/ChangeLog:1.2899	Tue Aug  2 08:38:24 2011
+++ rtems/cpukit/ChangeLog	Tue Aug  2 08:59:48 2011
@@ -1,3 +1,8 @@
+2011-08-02	Jennifer Averett <Jennifer.Averett at OARcorp.com>
+
+	* score/include/rtems/score/coremutex.h: Move check dispatch for seize
+	into its own macro and add smp support.
+
 2011-08-02	Jennifer.Averett <Jennifer.Averett at OARcorp.com>
 
 	PR 1872

diff -u rtems/cpukit/score/include/rtems/score/coremutex.h:1.44 rtems/cpukit/score/include/rtems/score/coremutex.h:1.45
--- rtems/cpukit/score/include/rtems/score/coremutex.h:1.44	Fri Jun 17 10:40:08 2011
+++ rtems/cpukit/score/include/rtems/score/coremutex.h	Tue Aug  2 08:59:48 2011
@@ -8,7 +8,7 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-2009.
+ *  COPYRIGHT (c) 1989-2011.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -339,6 +339,25 @@
   Watchdog_Interval    timeout
 );
 
+
+/**
+ *  @brief Sieze Interrupt Wrapper
+ *
+ *  This macro is to verify that a mutex blocking seize is
+ *  performed from a safe system state.  For example, one 
+ *  cannot block inside an isr.
+ *
+ *  @return this method returns true if dispatch is in an unsafe state.
+ */
+#ifdef RTEMS_SMP
+  #define _CORE_mutex_Check_dispatch_for_seize(_wait) 0
+#else
+  #define _CORE_mutex_Check_dispatch_for_seize(_wait) \
+      (_Thread_Dispatch_in_critical_section() \
+        && (_wait) \
+        && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING))
+#endif
+
 /**
  *  @brief Sieze Interrupt Wrapper
  *
@@ -366,14 +385,10 @@
  *  * If the caller is willing to wait
  *      then they are blocked.
  */
-
 #define _CORE_mutex_Seize_body( \
   _the_mutex, _id, _wait, _timeout, _level ) \
   do { \
-    if ( _Thread_Dispatch_in_critical_section() \
-        && (_wait) \
-        && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING ) \
-       ) { \
+    if ( _CORE_mutex_Check_dispatch_for_seize(_wait) ) { \
         _Internal_error_Occurred( \
            INTERNAL_ERROR_CORE, \
            false, \


 *joel*:
2011-08-02	Ricardo Aguirre <el.mastin at ymail.com>

	PR 1874/tests
	* Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of
	multiple pthread_rwlock operations that can be done as single shot
	times.
	* psxtmrwlock01/.cvsignore, psxtmrwlock01/Makefile.am,
	psxtmrwlock01/init.c, psxtmrwlock01/psxtmrwlock01.doc: New files.

M   1.38  testsuites/psxtmtests/ChangeLog
M   1.21  testsuites/psxtmtests/Makefile.am
M   1.24  testsuites/psxtmtests/configure.ac
A    1.1  testsuites/psxtmtests/psxtmrwlock01/.cvsignore
A    1.1  testsuites/psxtmtests/psxtmrwlock01/Makefile.am
A    1.1  testsuites/psxtmtests/psxtmrwlock01/init.c
A    1.1  testsuites/psxtmtests/psxtmrwlock01/psxtmrwlock01.doc
M   1.23  testsuites/psxtmtests/psxtmtests_plan.csv

diff -u rtems/testsuites/psxtmtests/ChangeLog:1.37 rtems/testsuites/psxtmtests/ChangeLog:1.38
--- rtems/testsuites/psxtmtests/ChangeLog:1.37	Fri Jul 29 11:54:32 2011
+++ rtems/testsuites/psxtmtests/ChangeLog	Tue Aug  2 08:23:32 2011
@@ -1,3 +1,12 @@
+2011-08-02	Ricardo Aguirre <el.mastin at ymail.com>
+
+	PR 1874/tests
+	* Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of
+	multiple pthread_rwlock operations that can be done as single shot
+	times.
+	* psxtmrwlock01/.cvsignore, psxtmrwlock01/Makefile.am,
+	psxtmrwlock01/init.c, psxtmrwlock01/psxtmrwlock01.doc: New files.
+
 2011-07-29	Ricardo Aguirre <el.mastin at ymail.com>
 
 	PR 1863/tests

diff -u rtems/testsuites/psxtmtests/Makefile.am:1.20 rtems/testsuites/psxtmtests/Makefile.am:1.21
--- rtems/testsuites/psxtmtests/Makefile.am:1.20	Fri Jul 29 11:54:32 2011
+++ rtems/testsuites/psxtmtests/Makefile.am	Tue Aug  2 08:23:33 2011
@@ -21,6 +21,7 @@
 SUBDIRS += psxtmmutex07
 SUBDIRS += psxtmnanosleep01
 SUBDIRS += psxtmnanosleep02
+SUBDIRS += psxtmrwlock01
 SUBDIRS += psxtmsem01
 SUBDIRS += psxtmsem02
 SUBDIRS += psxtmsem03

diff -u rtems/testsuites/psxtmtests/configure.ac:1.23 rtems/testsuites/psxtmtests/configure.ac:1.24
--- rtems/testsuites/psxtmtests/configure.ac:1.23	Fri Jul 29 11:54:32 2011
+++ rtems/testsuites/psxtmtests/configure.ac	Tue Aug  2 08:23:33 2011
@@ -93,6 +93,7 @@
 psxtmmutex07/Makefile
 psxtmnanosleep01/Makefile
 psxtmnanosleep02/Makefile
+psxtmrwlock01//Makefile
 psxtmsem01/Makefile
 psxtmsem02/Makefile
 psxtmsem03/Makefile

diff -u /dev/null rtems/testsuites/psxtmtests/psxtmrwlock01/.cvsignore:1.1
--- /dev/null	Tue Aug  2 09:11:49 2011
+++ rtems/testsuites/psxtmtests/psxtmrwlock01/.cvsignore	Tue Aug  2 08:23:33 2011
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/psxtmtests/psxtmrwlock01/Makefile.am:1.1
--- /dev/null	Tue Aug  2 09:11:49 2011
+++ rtems/testsuites/psxtmtests/psxtmrwlock01/Makefile.am	Tue Aug  2 08:23:33 2011
@@ -0,0 +1,30 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxtmrwlock01
+psxtmrwlock01_SOURCES = init.c ../../tmtests/include/timesys.h \
+    ../../support/src/tmtests_empty_function.c \
+    ../../support/src/tmtests_support.c
+
+dist_rtems_tests_DATA = psxtmrwlock01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+OPERATION_COUNT = @OPERATION_COUNT@
+AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include
+AM_CPPFLAGS += -DOPERATION_COUNT=$(OPERATION_COUNT)
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxtmrwlock01_OBJECTS) $(psxtmrwlock01_LDADD)
+LINK_LIBS = $(psxtmrwlock01_LDLIBS)
+
+psxtmrwlock01$(EXEEXT): $(psxtmrwlock01_OBJECTS) $(psxtmrwlock01_DEPENDENCIES)
+	@rm -f psxtmrwlock01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/psxtmtests/psxtmrwlock01/init.c:1.1
--- /dev/null	Tue Aug  2 09:11:49 2011
+++ rtems/testsuites/psxtmtests/psxtmrwlock01/init.c	Tue Aug  2 08:23:33 2011
@@ -0,0 +1,254 @@
+/*
+ *  COPYRIGHT (c) 1989-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 <errno.h>
+#include <timesys.h>
+#include <rtems/timerdrv.h>
+#include <pthread.h>
+#include "test_support.h"
+
+pthread_rwlock_t     rwlock;
+
+void benchmark_pthread_rwlock_init(void)
+{
+  long end_time;
+  int  status;
+  pthread_rwlockattr_t attr;
+
+  pthread_rwlockattr_init( &attr );
+  benchmark_timer_initialize();
+    status = pthread_rwlock_init( &rwlock, &attr );
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_rwlock_init",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+}
+
+void benchmark_pthread_rwlock_rdlock(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_rwlock_rdlock(&rwlock);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_rwlock_rdlock - available",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+}
+
+void benchmark_pthread_rwlock_unlock(bool do_print)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_rwlock_unlock(&rwlock);
+  end_time = benchmark_timer_read();
+  if ( status == EPERM )
+    puts( "The current thread does not own the read-write lock");
+  else
+    rtems_test_assert( status == 0 );
+
+  if ( do_print ) {
+    put_time(
+      "pthread_rwlock_unlock - available",
+      end_time,
+      1,        /* Only executed once */
+      0,
+      0
+    );
+  }
+}
+
+void benchmark_pthread_rwlock_tryrdlock(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_rwlock_tryrdlock(&rwlock);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_rwlock_tryrdlock - available",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+}
+
+void benchmark_pthread_rwlock_timedrdlock(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_rwlock_timedrdlock(&rwlock, 0);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_rwlock_timedrdlock - available",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+}
+
+void benchmark_pthread_rwlock_wrlock(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_rwlock_wrlock(&rwlock);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_rwlock_wrlock - available",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+}
+
+void benchmark_pthread_rwlock_trywrlock(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_rwlock_trywrlock(&rwlock);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_rwlock_trywrlock - available",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+}
+
+void benchmark_pthread_rwlock_timedwrlock(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_rwlock_timedwrlock(&rwlock,0);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_rwlock_timedwrlock - available",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+}
+
+void benchmark_pthread_rwlock_destroy(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_rwlock_destroy(&rwlock);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_rwlock_destroy",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+}
+
+void *POSIX_Init(
+  void *argument
+)
+{
+
+  puts( "\n\n*** POSIX TIME PSXTMRWLOCK 01  ***" );
+
+  /* initializing rwlock */
+  benchmark_pthread_rwlock_init();
+  /* applying a read lock */
+  benchmark_pthread_rwlock_rdlock();
+  /* unlocking rwlock */
+  benchmark_pthread_rwlock_unlock( true );
+  /* trying to apply a read lock when it is available */
+  benchmark_pthread_rwlock_tryrdlock();
+  /* unlocking rwlock */
+  benchmark_pthread_rwlock_unlock( false );
+  /* applying a timed read lock */
+  benchmark_pthread_rwlock_timedrdlock();
+  /* unlocking rwlock */
+  benchmark_pthread_rwlock_unlock( false );
+  /* applying a write lock */
+  benchmark_pthread_rwlock_wrlock();
+  /* unlocking rwlock */
+  benchmark_pthread_rwlock_unlock( false );
+  /* trying to apply a write lock, when it is available */
+  benchmark_pthread_rwlock_trywrlock();
+  /* unlocking rwlock */
+  benchmark_pthread_rwlock_unlock( false );
+  /* applying a timed write lock */
+  benchmark_pthread_rwlock_timedwrlock();
+  /* unlocking rwlock */
+  benchmark_pthread_rwlock_unlock( false );
+  /* destroying rwlock */
+  benchmark_pthread_rwlock_destroy();
+
+  puts( "*** END OF POSIX TIME PSXTMRWLOCK 01 ***" );
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
+#define CONFIGURE_MAXIMUM_POSIX_RWLOCKS     1
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */

diff -u /dev/null rtems/testsuites/psxtmtests/psxtmrwlock01/psxtmrwlock01.doc:1.1
--- /dev/null	Tue Aug  2 09:11:49 2011
+++ rtems/testsuites/psxtmtests/psxtmrwlock01/psxtmrwlock01.doc	Tue Aug  2 08:23:33 2011
@@ -0,0 +1,23 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-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 test benchmarks the following operations:
+
++ pthread_rwlock_init 
++ pthread_rwlock_rdlock - available 
++ pthread_rwlock_unlock
++ pthread_rwlock_tryrdlock - available 
++ pthread_rwlock_timedrdlock - available 
++ pthread_rwlock_wrlock - available 
++ pthread_rwlock_trywrlock - available 
++ pthread_rwlock_timedwrlock - available 
++ pthread_rwlock_destroy 
+

diff -u rtems/testsuites/psxtmtests/psxtmtests_plan.csv:1.22 rtems/testsuites/psxtmtests/psxtmtests_plan.csv:1.23
--- rtems/testsuites/psxtmtests/psxtmtests_plan.csv:1.22	Fri Jul 29 11:54:32 2011
+++ rtems/testsuites/psxtmtests/psxtmtests_plan.csv	Tue Aug  2 08:23:33 2011
@@ -63,22 +63,22 @@
 "pthread_spin_trylock - not available",,"psxtmtest_single",
 "pthread_spin_unlock",,,
 ,,,
-"pthread_rwlock_init",,"psxtmtest_init_destroy",
-"pthread_rwlock_destroy",,"psxtmtest_init_destroy",
-"pthread_rwlock_rdlock - available",,"psxtmtest_single",
+"pthread_rwlock_init","psxtmrwlock01","psxtmtest_init_destroy","Yes"
+"pthread_rwlock_destroy","psxtmrwlock01","psxtmtest_init_destroy","Yes"
+"pthread_rwlock_rdlock - available","psxtmrwlock01","psxtmtest_single","Yes"
 "pthread_rwlock_rdlock - not available, blocks",,"psxtmtest_blocking",
-"pthread_rwlock_tryrdlock - available",,"psxtmtest_single",
+"pthread_rwlock_tryrdlock - available","psxtmrwlock01","psxtmtest_single","Yes"
 "pthread_rwlock_tryrdlock - not available",,"psxtmtest_single",
-"pthread_rwlock_timedrdlock - available",,"psxtmtest_single",
+"pthread_rwlock_timedrdlock - available","psxtmrwlock01","psxtmtest_single","Yes"
 "pthread_rwlock_timedrdlock - not available, blocks",,"psxtmtest_blocking",
-"pthread_rwlock_unlock - no threads waiting",,,
+"pthread_rwlock_unlock - no threads waiting","psxtmrwlock01","psxtmtest_single","Yes"
 "pthread_rwlock_unlock - thread waiting, no preempt",,,
 "pthread_rwlock_unlock - thread waiting, preempt",,,
-"pthread_rwlock_wrlock - available",,"psxtmtest_single",
+"pthread_rwlock_wrlock - available","psxtmrwlock01","psxtmtest_single","Yes"
 "pthread_rwlock_wrlock - not available, blocks",,"psxtmtest_blocking",
-"pthread_rwlock_trywrlock - available",,"psxtmtest_single",
+"pthread_rwlock_trywrlock - available","psxtmrwlock01","psxtmtest_single","Yes"
 "pthread_rwlock_trywrlock - not available",,"psxtmtest_single",
-"pthread_rwlock_timedwrlock - available",,"psxtmtest_single",
+"pthread_rwlock_timedwrlock - available","psxtmrwlock01","psxtmtest_single","Yes"
 "pthread_rwlock_timedwrlock - not available, blocks",,"psxtmtest_blocking",
 ,,,
 "mq_open (first open)","psxtmmq01","psxtmtest_init_destroy",


 *joel*:
2011-08-02	Petr Benes <benesp16 at fel.cvut.cz>

	PR 1861/cpukit
	* score/src/rbtreeextract.c: Remove redundant code.

M 1.2898  cpukit/ChangeLog
M    1.4  cpukit/score/src/rbtreeextract.c

diff -u rtems/cpukit/ChangeLog:1.2897 rtems/cpukit/ChangeLog:1.2898
--- rtems/cpukit/ChangeLog:1.2897	Mon Aug  1 14:21:46 2011
+++ rtems/cpukit/ChangeLog	Tue Aug  2 08:37:20 2011
@@ -1,3 +1,8 @@
+2011-08-02	Petr Benes <benesp16 at fel.cvut.cz>
+
+	PR 1861/cpukit
+	* score/src/rbtreeextract.c: Remove redundant code.
+
 2011-08-01	Jennifer Averett <Jennifer.Averett at OARcorp.com>
 
 	* score/include/rtems/score/isr.h: Cleaned up comments.

diff -u rtems/cpukit/score/src/rbtreeextract.c:1.3 rtems/cpukit/score/src/rbtreeextract.c:1.4
--- rtems/cpukit/score/src/rbtreeextract.c:1.3	Wed Jul 27 08:27:48 2011
+++ rtems/cpukit/score/src/rbtreeextract.c	Tue Aug  2 08:37:21 2011
@@ -54,8 +54,7 @@
     }
 
     /* sibling is black, see if both of its children are also black. */
-    if (sibling &&
-        !_RBTree_Is_red(sibling->child[RBT_RIGHT]) &&
+    if (!_RBTree_Is_red(sibling->child[RBT_RIGHT]) &&
         !_RBTree_Is_red(sibling->child[RBT_LEFT])) {
         sibling->color = RBT_RED;
         if (_RBTree_Is_red(parent)) {
@@ -65,7 +64,7 @@
         the_node = parent; /* done if parent is red */
         parent = the_node->parent;
         sibling = _RBTree_Sibling(the_node);
-    } else if(sibling) {
+    } else {
       /* at least one of sibling's children is red. we now proceed in two
        * cases, either the_node is to the left or the right of the parent.
        * In both cases, first check if one of sibling's children is black,
@@ -105,7 +104,7 @@
   RBTree_Color victim_color;
   RBTree_Direction dir;
 
-  if(!the_node) return;
+  if (!the_node) return;
 
   /* check if min needs to be updated */
   if (the_node == the_rbtree->first[RBT_LEFT]) {
@@ -147,7 +146,7 @@
      * should become NULL. This may cause the coloring to be violated.
      * For now we store the color of the node being deleted in victim_color.
      */
-     leaf = target->child[RBT_LEFT];
+    leaf = target->child[RBT_LEFT];
     if(leaf) {
       leaf->parent = target->parent;
     } else {
@@ -199,17 +198,14 @@
   }
 
   /* fix coloring. leaf has moved up the tree. The color of the deleted
-   * node is in victim_color. There are three cases:
+   * node is in victim_color. There are two cases:
    *   1. Deleted a red node, its child must be black. Nothing must be done.
-   *   2. Deleted a black node and the child is red. Paint child black.
-   *   3. Deleted a black node and its child is black. This requires some
-   *      care and rotations.
+   *   2. Deleted a black node, its child must be red. Paint child black.
    */
   if (victim_color == RBT_BLACK) { /* eliminate case 1 */
-    if (_RBTree_Is_red(leaf))
+    if (leaf) {
       leaf->color = RBT_BLACK; /* case 2 */
-    else if(leaf)
-      _RBTree_Extract_validate_unprotected(leaf); /* case 3 */
+    }
   }
 
   /* Wipe the_node */


 *joel*:
2011-08-02	Petr Benes <benesp16 at fel.cvut.cz>

	PR 1862/testing
	* sprbtree01/init.c, sprbtree01/sprbtree01.scn: Improve test coverage.

M  1.470  testsuites/sptests/ChangeLog
M    1.3  testsuites/sptests/sprbtree01/init.c
M    1.3  testsuites/sptests/sprbtree01/sprbtree01.scn

diff -u rtems/testsuites/sptests/ChangeLog:1.469 rtems/testsuites/sptests/ChangeLog:1.470
--- rtems/testsuites/sptests/ChangeLog:1.469	Mon Aug  1 11:15:45 2011
+++ rtems/testsuites/sptests/ChangeLog	Tue Aug  2 08:38:40 2011
@@ -1,3 +1,8 @@
+2011-08-02	Petr Benes <benesp16 at fel.cvut.cz>
+
+	PR 1862/testing
+	* sprbtree01/init.c, sprbtree01/sprbtree01.scn: Improve test coverage.
+
 2011-08-01	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* sp75/init.c, sp75/sp75.doc, sp75/sp75.scn: Correct test and

diff -u rtems/testsuites/sptests/sprbtree01/init.c:1.2 rtems/testsuites/sptests/sprbtree01/init.c:1.3
--- rtems/testsuites/sptests/sprbtree01/init.c:1.2	Wed Jul 27 08:35:11 2011
+++ rtems/testsuites/sptests/sprbtree01/init.c	Tue Aug  2 08:38:41 2011
@@ -96,6 +96,18 @@
   rtems_rbtree_insert( &rbtree1, &node1.Node );
   rtems_rbtree_insert( &rbtree1, &node2.Node );
 
+  p = _RBTree_Insert_unprotected( &rbtree1, NULL );
+  if (p != (void *)(-1))
+    puts( "INIT - FAILED NULL NODE INSERT" );
+
+  _RBTree_Rotate(NULL, RBT_LEFT);
+  i = (node1.Node.parent == &node2.Node);
+  _RBTree_Rotate( &node1.Node,
+                  !node1.Node.child[RBT_LEFT] ? RBT_RIGHT : RBT_LEFT
+                );
+  if ( (node1.Node.parent == &node2.Node) != i )
+    puts( "INIT - FAILED FALSE ROTATION" );
+
   if (!rb_assert(rbtree1.root) )
     puts( "INIT - FAILED TREE CHECK" );
 
@@ -324,6 +336,27 @@
     rtems_test_exit(0);
   }
 
+  /* Additional rtems_rbtree_extract test which removes a node
+   * with two children while target node has a left child only. */
+  for ( i = 0; i < 7; i++ ) {
+    node_array[i].id = i;
+    node_array[i].Node.value = i;
+  }
+  rtems_rbtree_insert( &rbtree1, &node_array[3].Node );
+  rtems_rbtree_insert( &rbtree1, &node_array[1].Node );
+  rtems_rbtree_insert( &rbtree1, &node_array[5].Node );
+  rtems_rbtree_insert( &rbtree1, &node_array[0].Node );
+  rtems_rbtree_insert( &rbtree1, &node_array[2].Node );
+  rtems_rbtree_insert( &rbtree1, &node_array[4].Node );
+  rtems_rbtree_insert( &rbtree1, &node_array[6].Node );
+  rtems_rbtree_extract( &rbtree1, &node_array[2].Node );
+  /* node_array[1] has now only a left child. */
+  if ( !node_array[1].Node.child[RBT_LEFT] ||
+        node_array[1].Node.child[RBT_RIGHT] )
+     puts( "INIT - LEFT CHILD ONLY NOT FOUND" );
+  rtems_rbtree_extract( &rbtree1, &node_array[3].Node );
+  while( (p = rtems_rbtree_get_max(&rbtree1)) );
+
   puts( "INIT - Verify rtems_rbtree_get_max with 100 nodes value [99,0]" );
   for (i = 0; i < 100; i++) {
     node_array[i].id = 99-i;
@@ -368,32 +401,39 @@
   }
 
   puts( "INIT - Verify rtems_rbtree_find" );
-  p = rtems_rbtree_find(&rbtree1, 50);
-  if(rtems_rbtree_container_of(p,test_node,Node)->id != 50) {
+  p = rtems_rbtree_find(&rbtree1, 30);
+  if(rtems_rbtree_container_of(p,test_node,Node)->id != 30) {
     puts ("INIT - ERROR ON RBTREE ID MISMATCH");
     rtems_test_exit(0);
   }
 
   puts( "INIT - Verify rtems_rbtree_predecessor/successor");
   p = rtems_rbtree_predecessor(p);
-  if(p && rtems_rbtree_container_of(p,test_node,Node)->id > 50) {
+  if(p && rtems_rbtree_container_of(p,test_node,Node)->id > 30) {
     puts ("INIT - ERROR ON RBTREE ID MISMATCH");
     rtems_test_exit(0);
   }
-  p = rtems_rbtree_find(&rbtree1, 50);
+  p = rtems_rbtree_find(&rbtree1, 30);
   p = rtems_rbtree_successor(p);
-  if(p && rtems_rbtree_container_of(p,test_node,Node)->id < 50) {
+  if(p && rtems_rbtree_container_of(p,test_node,Node)->id < 30) {
     puts ("INIT - ERROR ON RBTREE ID MISMATCH");
     rtems_test_exit(0);
   }
 
-  p = rtems_rbtree_find(&rbtree1, 50);
+  p = rtems_rbtree_find(&rbtree1, 30);
   puts( "INIT - Verify rtems_rbtree_find_header" );
   if (rtems_rbtree_find_header(p) != &rbtree1) {
     puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
     rtems_test_exit(0);
   }
 
+  if ( _RBTree_Sibling( NULL ) != NULL )
+    puts ( "INIT - ERROR ON RBTREE NULL SIBLING MISMATCH" );
+  if ( _RBTree_Sibling( rbtree1.root ) != NULL )
+    puts ( "INIT - ERROR ON RBTREE NULL SIBLING MISMATCH" );
+  if ( _RBTree_Grandparent( NULL ) != NULL )
+    puts ( "INIT - ERROR ON RBTREE NULL GRANDPARENT MISMATCH" );
+
   puts( "INIT - Removing 100 nodes" );
 
   for ( p = rtems_rbtree_get_max(&rbtree1), id = 99 ; p ;
@@ -417,6 +457,15 @@
     rtems_test_exit(0);
   }
 
+  if (rtems_rbtree_find_header(p) != NULL) {
+    puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
+    rtems_test_exit(0);
+  }
+  if (rtems_rbtree_find_header(NULL) != NULL) {
+    puts ("INIT - ERROR ON RBTREE HEADER MISMATCH");
+    rtems_test_exit(0);
+  }
+
   puts("INIT - Insert 20 random numbers");
   for (i = 0; i < 20; i++) {
     node_array[i].id = numbers[i];
@@ -450,6 +499,38 @@
     rtems_test_exit(0);
   }
 
+  puts( "INIT - Verify rtems_rbtree_initialize with 100 nodes value [0,99]" );
+  for (i = 0; i < 100; i++) {
+    node_array[i].id = i;
+    node_array[i].Node.value = i;
+  }
+  rtems_rbtree_initialize( &rbtree1, &node_array[0].Node, 100,
+                           sizeof(test_node));
+
+  puts( "INIT - Removing 100 nodes" );
+
+  for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ;
+      p = rtems_rbtree_get_min(&rbtree1) , id++ ) {
+    test_node *t = rtems_rbtree_container_of(p,test_node,Node);
+    if ( id > 99 ) {
+      puts( "INIT - TOO MANY NODES ON RBTREE" );
+      rtems_test_exit(0);
+    }
+
+    if ( t->id != id ) {
+      puts( "INIT - ERROR ON RBTREE ID MISMATCH" );
+      rtems_test_exit(0);
+    }
+
+    if (!rb_assert(rbtree1.root) )
+      puts( "INIT - FAILED TREE CHECK" );
+  }
+
+  if(!rtems_rbtree_is_empty(&rbtree1)) {
+    puts( "INIT - TREE NOT EMPTY" );
+    rtems_test_exit(0);
+  }
+
   puts( "*** END OF RTEMS RBTREE API TEST ***" );
   rtems_test_exit(0);
 }

diff -u rtems/testsuites/sptests/sprbtree01/sprbtree01.scn:1.2 rtems/testsuites/sptests/sprbtree01/sprbtree01.scn:1.3
--- rtems/testsuites/sptests/sprbtree01/sprbtree01.scn:1.2	Wed Jul 27 08:35:11 2011
+++ rtems/testsuites/sptests/sprbtree01/sprbtree01.scn	Tue Aug  2 08:38:41 2011
@@ -17,6 +17,11 @@
 INIT - Removing 100 nodes
 INIT - Verify rtems_rbtree_get_max with 100 nodes value [0,99]
 INIT - Verify rtems_rbtree_find
+INIT - Verify rtems_rbtree_predecessor/successor
 INIT - Verify rtems_rbtree_find_header
 INIT - Removing 100 nodes
+INIT - Insert 20 random numbers
+INIT - Removing 20 nodes
+INIT - Verify rtems_rbtree_initialize with 100 nodes value [0,99]
+INIT - Removing 100 nodes
 *** END OF RTEMS RBTREE API TEST ***


 *joel*:
2011-08-02	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>

	PR 1869/bsps
	* README: Merge content from lm32/README which was specific to
	this BSP.

M   1.20  c/src/lib/libbsp/lm32/lm32_evr/ChangeLog
M    1.3  c/src/lib/libbsp/lm32/lm32_evr/README

diff -u rtems/c/src/lib/libbsp/lm32/lm32_evr/ChangeLog:1.19 rtems/c/src/lib/libbsp/lm32/lm32_evr/ChangeLog:1.20
--- rtems/c/src/lib/libbsp/lm32/lm32_evr/ChangeLog:1.19	Wed Feb  2 08:58:26 2011
+++ rtems/c/src/lib/libbsp/lm32/lm32_evr/ChangeLog	Tue Aug  2 09:04:27 2011
@@ -1,3 +1,9 @@
+2011-08-02	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>
+
+	PR 1869/bsps
+	* README: Merge content from lm32/README which was specific to
+	this BSP.
+
 2011-02-02	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* configure.ac: Require autoconf-2.68, automake-1.11.1.

diff -u rtems/c/src/lib/libbsp/lm32/lm32_evr/README:1.2 rtems/c/src/lib/libbsp/lm32/lm32_evr/README:1.3
--- rtems/c/src/lib/libbsp/lm32/lm32_evr/README:1.2	Wed Feb 25 15:32:22 2009
+++ rtems/c/src/lib/libbsp/lm32/lm32_evr/README	Tue Aug  2 09:04:27 2011
@@ -1,6 +1,41 @@
 #
 #  $Id$
 #
+#  The Lattice Mico32 port uses the system_config.h generated by the Mico
+#  System Builder to retrieve the properties of the peripherals.
+#
+#   Implemented (in shared/ subdirectory)
+#     Polled console driver (uart)
+#     Clock interrupt with 10 ms tick
+#     Networking using Lattice tri-speed ethernet MAC
+#
+#   Todo
+#     Support more peripherals:
+#       - uart driver using interrupts
+#
+#  jukka.pietarinen at mrf.fi, 3.12.2008
+#    
+
+BSP NAME:           lm32_evr
+BOARD:              cRIO-EVR, Micro-Research Finland Oy
+BUS:                wishbone
+CPU FAMILY:         lm32 (Lattice Mico32)
+CPU:                small
+COPROCESSORS:       none
+MODE:               32 bit mode
+
+DEBUG MONITOR:      none
+
+PERIPHERALS
+===========
+TIMERS:             clock
+  RESOLUTION:       10 ms
+SERIAL PORTS:       uart
+REAL-TIME CLOCK:    none
+DMA:                none
+VIDEO:              none
+SCSI:               none
+NETWORKING:         tsmac
 
 To on the simulator included in lm32-gdb use these commands:
 


 *joel*:
2011-08-02	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>

	PR 1869/bsps
	* milkymist_networking/mm_crc32.c: Removed.

M    1.2  c/src/lib/libbsp/lm32/shared/ChangeLog
R    1.1  c/src/lib/libbsp/lm32/shared/milkymist_networking/mm_crc32.c

diff -u rtems/c/src/lib/libbsp/lm32/shared/ChangeLog:1.1 rtems/c/src/lib/libbsp/lm32/shared/ChangeLog:1.2
--- rtems/c/src/lib/libbsp/lm32/shared/ChangeLog:1.1	Mon Aug  1 08:48:39 2011
+++ rtems/c/src/lib/libbsp/lm32/shared/ChangeLog	Tue Aug  2 09:04:31 2011
@@ -1,3 +1,8 @@
+2011-08-02	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>
+
+	PR 1869/bsps
+	* milkymist_networking/mm_crc32.c: Removed.
+
 2011-08-01	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>
 
 	PR 1869/bsps


 *joel*:
2011-08-02	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>

	PR 1869/bsps
	* ChangeLog: Spacing.
	* README: Removed.

M   1.20  c/src/lib/libbsp/lm32/ChangeLog
R    1.1  c/src/lib/libbsp/lm32/README

diff -u rtems/c/src/lib/libbsp/lm32/ChangeLog:1.19 rtems/c/src/lib/libbsp/lm32/ChangeLog:1.20
--- rtems/c/src/lib/libbsp/lm32/ChangeLog:1.19	Fri Feb 11 06:13:12 2011
+++ rtems/c/src/lib/libbsp/lm32/ChangeLog	Tue Aug  2 09:04:40 2011
@@ -1,3 +1,79 @@
+2011-08-02	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>
+
+	PR 1869/bsps
+	* ChangeLog: Spacing.
+	* README: Removed.
+
+2011-08-01	Sébastien Bourdeauducq <sebastien at milkymist.org>
+
+	* c/src/lib/libbsp/lm32/README,
+	c/src/lib/libbsp/lm32/lm32_evr/README,
+	c/src/lib/libbsp/lm32/milkymist/Makefile.am,
+	c/src/lib/libbsp/lm32/milkymist/README,
+	c/src/lib/libbsp/lm32/milkymist/include/bsp.h,
+	c/src/lib/libbsp/lm32/milkymist/include/system_conf.h,
+	c/src/lib/libbsp/lm32/milkymist/include/tm27.h,
+	c/src/lib/libbsp/lm32/milkymist/make/custom/milkymist.cfg,
+	c/src/lib/libbsp/lm32/milkymist/preinstall.am,
+	c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c,
+	c/src/lib/libbsp/lm32/milkymist/startup/linkcmds,
+	c/src/lib/libbsp/lm32/shared/include/irq.h,
+	c/src/lib/libbsp/lm32/shared/irq/irq.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_ac97/ac97.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_ac97/milkymist_ac97.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_buttons/buttons.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_buttons/milkymist_buttons.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_clock/clock.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_console/console.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_console/uart.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_dmx/dmx.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_dmx/milkymist_dmx.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_flash/flash.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_flash/milkymist_flash.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_framebuffer/framebuffer.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_gpio/gpio.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_gpio/milkymist_gpio.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_ir/ir.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_ir/milkymist_ir.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_memcard/memcard.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_memcard/milkymist_memcard.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_midi/midi.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_midi/milkymist_midi.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_networking/mm_crc32.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_networking/network.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_networking/network.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_pfpu/milkymist_pfpu.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_pfpu/pfpu.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_tmu/milkymist_tmu.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_tmu/tmu.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_usbinput/comloc.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_usbinput/milkymist_usbinput.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_usbinput/softusb-input.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_usbinput/usbinput.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_versions/milkymist_versions.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_versions/versions.c,
+	c/src/lib/libbsp/lm32/shared/milkymist_video/milkymist_video.h,
+	c/src/lib/libbsp/lm32/shared/milkymist_video/video.c,
+	c/src/lib/libbsp/lm32/shared/start/start.S,
+	c/src/lib/libbsp/lm32/shared/startup/bspstart.c,
+	c/src/lib/libbsp/lm32/shared/startup/setvec.c:
+	Full port to the Milkymist One. Supports Milkymist SoC 1.0.x.
+	Includes new or updated drivers for:
+	- Multi-standard video input (PAL/SECAM/NTSC)
+	- Two DMX512 (RS485) ports
+	- MIDI IN and MIDI OUT ports
+	- VGA output
+	- AC'97 audio
+	- NOR flash
+	- 10/100 Ethernet
+	- Memory card (experimental and incomplete)
+	- USB host connectors (input devices only)
+	- RC5 infrared receiver
+	- RS232 debug port
+
 2011-02-11	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* shared/milkymist_networking/network.c:



--

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/20110802/4517e5e7/attachment-0001.html>


More information about the vc mailing list