summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp36
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-07-24 22:10:20 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-07-24 22:10:20 +0000
commit9e15e9bfbaf0947442289a2d422d95b71db36f58 (patch)
tree6a35849de7fa9a7671e76d396157457799abfa79 /testsuites/sptests/sp36
parentRegenerate. (diff)
downloadrtems-9e15e9bfbaf0947442289a2d422d95b71db36f58.tar.bz2
2011-07-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* sp04/tswitch.c, sp07/task1.c, sp07/task2.c, sp09/screen07.c, sp11/task1.c, sp11/task2.c, sp12/pridrv.c, sp12/pritask.c, sp13/task1.c, sp14/asr.c, sp14/task1.c, sp19/first.c, sp19/fptask.c, sp19/inttest.h, sp19/task1.c, sp20/task1.c, sp25/task1.c, sp26/task1.c, sp28/init.c, sp29/init.c, sp31/task1.c, sp32/init.c, sp33/init.c, sp34/changepri.c, sp36/strict_order_mut.c, sp37/init.c, sp43/init.c, sp44/init.c, sp48/init.c, sp54/init.c, sp59/init.c, sp65/init.c, sp68/init.c, spchain/init.c, spclockget/init.c, spfatal03/testcase.h, spfatal07/testcase.h, spfatal_support/init.c: Do not line length exceed 80 columns.
Diffstat (limited to 'testsuites/sptests/sp36')
-rw-r--r--testsuites/sptests/sp36/strict_order_mut.c125
1 files changed, 43 insertions, 82 deletions
diff --git a/testsuites/sptests/sp36/strict_order_mut.c b/testsuites/sptests/sp36/strict_order_mut.c
index 6a545623bd..e5f7a4e330 100644
--- a/testsuites/sptests/sp36/strict_order_mut.c
+++ b/testsuites/sptests/sp36/strict_order_mut.c
@@ -1,5 +1,7 @@
/*
- * Simple test program to demonstrate strict order mutex
+ * 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$
*/
@@ -15,8 +17,9 @@
#include "tmacros.h"
#include <rtems/score/coremutex.h>
-#define BACK_TYPE(_type_in_ptr,_type_out,_type_in_name) \
- ((_type_out *)((unsigned int)_type_in_ptr - (unsigned int)(&((_type_out *)0)->_type_in_name)))
+#define BACK_TYPE(_type_in_ptr,_type_out,_type_in_name) \
+ ((_type_out *)((unsigned int)_type_in_ptr - \
+ (unsigned int)(&((_type_out *)0)->_type_in_name)))
/* configuration information */
@@ -31,22 +34,17 @@
#define CONFIGURE_MAXIMUM_TASKS 10
#define CONFIGURE_MAXIMUM_SEMAPHORES 10
-
-void p_mutex_chain(Thread_Control *the_thread);
rtems_task Task0(rtems_task_argument ignored);
rtems_task Task1(rtems_task_argument ignored);
rtems_task Init(rtems_task_argument ignored);
rtems_task_priority Get_current_pri(void);
-
#include <rtems/confdefs.h>
-
-
-rtems_id Task_id[4];
+rtems_id Task_id[4];
rtems_name Task_name[4];
-rtems_id Mutex_id[4];
+rtems_id Mutex_id[4];
rtems_name Mutex_name[4];
rtems_task Init(rtems_task_argument ignored)
@@ -56,25 +54,27 @@ rtems_task Init(rtems_task_argument ignored)
Mutex_name[0] = rtems_build_name( 'S','0',' ',' ');
status = rtems_semaphore_create(
- Mutex_name[0],
- 1,
- RTEMS_LOCAL|
- RTEMS_SIMPLE_BINARY_SEMAPHORE|
- RTEMS_PRIORITY,
- 0,
- &Mutex_id[0]);
+ Mutex_name[0],
+ 1,
+ RTEMS_LOCAL|
+ RTEMS_SIMPLE_BINARY_SEMAPHORE|
+ RTEMS_PRIORITY,
+ 0,
+ &Mutex_id[0]
+ );
directive_failed( status, "rtems_semaphore_create of S0");
printf("Create S0, Inherit_priority\n");
Mutex_name[1] = rtems_build_name( 'S','1',' ',' ');
status = rtems_semaphore_create(
- Mutex_name[1],
- 1,
- RTEMS_LOCAL|
- RTEMS_SIMPLE_BINARY_SEMAPHORE|
- RTEMS_PRIORITY,
- 1,
- &Mutex_id[1]);
+ Mutex_name[1],
+ 1,
+ RTEMS_LOCAL|
+ RTEMS_SIMPLE_BINARY_SEMAPHORE|
+ RTEMS_PRIORITY,
+ 1,
+ &Mutex_id[1]
+ );
directive_failed( status, "rtems_semaphore_create of S1");
printf("Create S1, Priority_celling is 1\n");
@@ -83,18 +83,16 @@ rtems_task Init(rtems_task_argument ignored)
Task_name[0] = rtems_build_name( 'T','0',' ',' ');
status = rtems_task_create(
- Task_name[0],
- 4,
- RTEMS_MINIMUM_STACK_SIZE *2,
- RTEMS_DEFAULT_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
- &Task_id[0]
- );
+ Task_name[0],
+ 4,
+ RTEMS_MINIMUM_STACK_SIZE *2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[0]
+ );
directive_failed( status,"rtems_task_create of T0");
printf("Create T0,priority is 4\n");
-
-
status = rtems_task_start( Task_id[0],Task0, 0);
directive_failed( status,"rtems_task_start of T0");
@@ -107,19 +105,12 @@ rtems_task Task0(rtems_task_argument ignored)
{
rtems_status_code status;
-
- status = rtems_semaphore_obtain(
- Mutex_id[0],
- RTEMS_WAIT,
- 0);
+ status = rtems_semaphore_obtain( Mutex_id[0], RTEMS_WAIT, 0 );
printf("T0 rtems_semaphore_obtain - S0\n");
directive_failed( status,"rtems_semaphore_obtain of S0\n");
printf("The current priority of T0 is %d\n",Get_current_pri());
- status = rtems_semaphore_obtain(
- Mutex_id[1],
- RTEMS_WAIT,
- 0);
+ status = rtems_semaphore_obtain( Mutex_id[1], RTEMS_WAIT, 0 );
printf("T0 rtems_semaphore_obtain - S1\n");
directive_failed( status,"rtems_semaphore_obtain of S1");
printf("The current priority of T0 is %d\n",Get_current_pri());
@@ -136,20 +127,18 @@ rtems_task Task0(rtems_task_argument ignored)
directive_failed( status,"rtems_semaphore_release of S1\n");
printf("The current priority of T0 is %d\n",Get_current_pri());
-
Task_name[1] = rtems_build_name( 'T','1',' ',' ');
status = rtems_task_create(
- Task_name[1],
- 1,
- RTEMS_MINIMUM_STACK_SIZE *2,
- RTEMS_DEFAULT_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
- &Task_id[1]
- );
+ Task_name[1],
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE *2,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[1]
+ );
directive_failed( status , "rtems_task_create of T1\n");
printf("Create S1,priority is 1\n");
-
status = rtems_task_start( Task_id[1],Task1, 0);
directive_failed( status, "rtems_task_start of T1\n");
@@ -158,50 +147,22 @@ rtems_task Task0(rtems_task_argument ignored)
status = rtems_semaphore_release(Mutex_id[0]);
printf("T0 - rtems_semaphore_release - S0\n");
directive_failed( status, "rtems_semaphore_release of S0\n");
-
}
-
rtems_task Task1(rtems_task_argument ignored)
{
-
rtems_status_code status;
- status = rtems_semaphore_obtain(
- Mutex_id[0],
- RTEMS_WAIT,
- 0);
+ status = rtems_semaphore_obtain( Mutex_id[0], RTEMS_WAIT, 0 );
printf("T1 - rtems_semaphore_obtain - S0");
directive_failed( status," rtems_semaphore_obtain S0");
}
-
rtems_task_priority Get_current_pri(void)
{
rtems_status_code status;
rtems_task_priority pri;
- status = rtems_task_set_priority(RTEMS_SELF,
- RTEMS_CURRENT_PRIORITY,
- &pri);
+
+ status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &pri);
directive_failed( status, " rtems_task_set_priority ");
return pri;
}
-
-/*void p_mutex_chain(Thread_Control *the_thread)
-{
- Chain_Control *con = &the_thread->lock_mutex;
- Chain_Node * node = con->first;
- CORE_mutex_Control * p_mutex ;
-
- if(!_Chain_Is_empty(&the_thread->lock_mutex)){
- while(node != _Chain_Tail(con)){
- p_mutex = BACK_TYPE(node,CORE_mutex_Control,queue);
- printf("node:Id=%p,priority_before=%d,"
- "holder_id=%d,holder's current priority=%d\n",node,
- ((CORE_mutex_order_list *)node)->priority_before,p_mutex->holder_id,p_mutex->holder->current_priority);
- node = node->next;
- }
- }
- else
- printf("the Chain is empty\n");
-}
-*/