Index: testsuites/psxtmtests/ChangeLog
===================================================================
--- testsuites/psxtmtests/ChangeLog	(revision fbf7e5878ab44e9cf42d409b77b80620a1bf8105)
+++ testsuites/psxtmtests/ChangeLog	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
@@ -1,2 +1,8 @@
+2011-07-12	Ricardo Aguirre <el.mastin@ymail.com>
+
+	* Makefile.am, configure.ac, psxtmtests_plan.csv: Add psxtmmutex03.
+	* psxtmmutex03/.cvsignore, psxtmmutex03/Makefile.am,
+	psxtmmutex03/init.c, psxtmmutex03/psxtmmutex03.doc: New files.
+
 2011-06-29	Ricardo Aguirre <el.mastin@ymail.com>
 
Index: testsuites/psxtmtests/Makefile.am
===================================================================
--- testsuites/psxtmtests/Makefile.am	(revision fbf7e5878ab44e9cf42d409b77b80620a1bf8105)
+++ testsuites/psxtmtests/Makefile.am	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
@@ -13,4 +13,5 @@
 SUBDIRS += psxtmnanosleep01
 SUBDIRS += psxtmnanosleep02
+SUBDIRS += psxtmmutex03
 endif
 
Index: testsuites/psxtmtests/configure.ac
===================================================================
--- testsuites/psxtmtests/configure.ac	(revision fbf7e5878ab44e9cf42d409b77b80620a1bf8105)
+++ testsuites/psxtmtests/configure.ac	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
@@ -81,4 +81,5 @@
 AC_CONFIG_FILES([Makefile
 psxtmmutex02/Makefile
+psxtmmutex03/Makefile
 psxtmsleep01/Makefile
 psxtmsleep02/Makefile
Index: testsuites/psxtmtests/psxtmmutex03/.cvsignore
===================================================================
--- testsuites/psxtmtests/psxtmmutex03/.cvsignore	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
+++ testsuites/psxtmtests/psxtmmutex03/.cvsignore	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
Index: testsuites/psxtmtests/psxtmmutex03/Makefile.am
===================================================================
--- testsuites/psxtmtests/psxtmmutex03/Makefile.am	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
+++ testsuites/psxtmtests/psxtmmutex03/Makefile.am	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
@@ -0,0 +1,30 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxtmmutex03
+psxtmmutex03_SOURCES = init.c ../../tmtests/include/timesys.h \
+    ../../support/src/tmtests_empty_function.c \
+    ../../support/src/tmtests_support.c
+
+dist_rtems_tests_DATA = psxtmmutex03.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.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 = $(psxtmmutex03_OBJECTS) $(psxtmmutex03_LDADD)
+LINK_LIBS = $(psxtmmutex03_LDLIBS)
+
+psxtmmutex03$(EXEEXT): $(psxtmmutex03_OBJECTS) $(psxtmmutex03_DEPENDENCIES)
+	@rm -f psxtmmutex03$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/psxtmtests/psxtmmutex03/init.c
===================================================================
--- testsuites/psxtmtests/psxtmmutex03/init.c	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
+++ testsuites/psxtmtests/psxtmmutex03/init.c	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
@@ -0,0 +1,175 @@
+/*
+ *  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 <timesys.h>
+#include <rtems/timerdrv.h>
+#include <errno.h>
+#include <pthread.h>
+#include "test_support.h"
+
+pthread_mutex_t MutexId;
+
+void benchmark_mutex_lock_available(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_mutex_lock( &MutexId );
+  end_time = benchmark_timer_read();
+  rtems_test_assert( !status );
+
+  put_time(
+    "pthread_mutex_lock - available",
+    end_time,
+    1,
+    0,
+    0
+  );
+}
+
+void benchmark_mutex_unlock_no_threads_waiting(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_mutex_unlock( &MutexId );
+  end_time = benchmark_timer_read();
+  rtems_test_assert( !status );
+
+  put_time(
+    "pthread_mutex_unlock - no threads waiting",
+    end_time,
+    1,
+    0,
+    0
+  );
+}
+
+void benchmark_mutex_trylock_available(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_mutex_trylock( &MutexId );
+  end_time = benchmark_timer_read();
+  rtems_test_assert( !status );
+
+  put_time(
+    "pthread_mutex_trylock - available",
+    end_time,
+    1,
+    0,
+    0
+  );
+}
+
+
+void benchmark_mutex_trylock_not_available(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_mutex_trylock( &MutexId );
+    /* 
+     * it has to return a negative value 
+     * because it try to lock a not available mutex    
+     * so the assert call is make with status instead !status 
+     */
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status );
+
+  put_time(
+    "pthread_mutex_trylock - not available",
+    end_time,
+    1,
+    0,
+    0
+  );
+}
+
+void benchmark_mutex_timedlock_available(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+    status = pthread_mutex_timedlock( &MutexId, 0 );
+  end_time = benchmark_timer_read();
+  rtems_test_assert( !status );
+
+  put_time(
+    "pthread_mutex_timedlock - available",
+    end_time,
+    1,
+    0,
+    0
+  );
+}
+
+void *POSIX_Init(
+  void *argument
+)
+{
+  int  status;
+
+  puts( "\n\n*** POSIX TIME TEST PSXTMMUTEX03 ***" );
+  
+  /*
+   * Create the single Mutex used in all the test case
+   */
+  status = pthread_mutex_init( &MutexId, NULL );
+  rtems_test_assert( !status );
+
+  /*
+   * Now invoke subroutines to time each test case 
+   * get the goal depends of its order
+   */
+  benchmark_mutex_lock_available();
+  benchmark_mutex_unlock_no_threads_waiting();
+  benchmark_mutex_trylock_available();
+  benchmark_mutex_trylock_not_available();
+  benchmark_mutex_unlock_no_threads_waiting();
+  benchmark_mutex_timedlock_available();
+  benchmark_mutex_unlock_no_threads_waiting();
+  
+
+  /*
+   *  Destroy the mutex used in the tests
+   */
+  status = pthread_mutex_destroy( &MutexId );
+  rtems_test_assert( !status );
+
+  puts( "*** END OF POSIX TIME TEST PSXTMMUTEX03 ***" );
+
+  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_MUTEXES     1
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
Index: testsuites/psxtmtests/psxtmtests_plan.csv
===================================================================
--- testsuites/psxtmtests/psxtmtests_plan.csv	(revision fbf7e5878ab44e9cf42d409b77b80620a1bf8105)
+++ testsuites/psxtmtests/psxtmtests_plan.csv	(revision 91b38c632a097596bf0fb7c58b4a5a28bee84236)
@@ -3,11 +3,11 @@
 "pthread_mutex_destroy","psxtmmutex01","psxtmtest_init_destroy",
 "pthread_mutex_lock - not available, block","psxtmmutex02","psxtmtest_blocking","Yes"
-"pthread_mutex_lock - available","psxtmmutex03","psxtmtest_single",
-"pthread_mutex_trylock - available","psxtmmutex04","psxtmtest_single",
-"pthread_mutex_trylock - not available","psxtmmutex05","psxtmtest_single",
-"pthread_mutex_unlock - no threads waiting","psxtmmutex06","psxtmtest_single",
+"pthread_mutex_lock - available","psxtmmutex03","psxtmtest_single","Yes"
+"pthread_mutex_trylock - available","psxtmmutex03","psxtmtest_single","Yes"
+"pthread_mutex_trylock - not available","psxtmmutex03","psxtmtest_single","Yes"
+"pthread_mutex_unlock - no threads waiting","psxtmmutex03","psxtmtest_single","Yes"
 "pthread_mutex_unlock - thread waiting, no preempt","psxtmmutex07","psxtmtest_unblocking_nopreempt",
 "pthread_mutex_unlock - thread waiting, preempt","psxtmmutex08","psxtmtest_unblocking_preempt",
-"pthread_mutex_timedlock - available","psxtmmutex09","psxtmtest_single",
+"pthread_mutex_timedlock - available","psxtmmutex03","psxtmtest_single","Yes"
 "pthread_mutex_timedlock - not available, block","psxtmmutex10","psxtmtest_blocking",
 "pthread_mutex_setprioceiling","psxtmmutex11","psxtmtest_single",
