summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psx05/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-14 18:41:18 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-14 18:41:18 +0000
commit5abf63d983adbbd1c53e85f54123e99a57f86306 (patch)
treeb5f0fe51adc49833c05743699fd23fe5a1af7ccb /testsuites/psxtests/psx05/init.c
parent2008-12-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-5abf63d983adbbd1c53e85f54123e99a57f86306.tar.bz2
2008-12-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* psx05/init.c, psx07/init.c, psx09/init.c, psx11/init.c, psx12/init.c: Run all tests successfully with maxixum number of priorities as 16 instead of 256. This was done by temporarily modifying the score priority.h maximum. This allowed testing of all API code to ensure that it worked properly with a reduced number of priorities. Most modifications were to switch from hard-coded maximum to using the API provided methods to determine maximum number of priority levels.
Diffstat (limited to 'testsuites/psxtests/psx05/init.c')
-rw-r--r--testsuites/psxtests/psx05/init.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c
index 24936898f7..5923abe5f2 100644
--- a/testsuites/psxtests/psx05/init.c
+++ b/testsuites/psxtests/psx05/init.c
@@ -12,6 +12,7 @@
#define CONFIGURE_INIT
#include "system.h"
#include <errno.h>
+#include <rtems/posix/priority.h>
#define MUTEX_BAD_ID 0xfffffffe
@@ -107,6 +108,7 @@ void *POSIX_Init(
int protocol;
int ceiling;
int old_ceiling;
+ int priority;
assert( MUTEX_BAD_ID != PTHREAD_MUTEX_INITIALIZER );
Mutex_bad_id = MUTEX_BAD_ID;
@@ -277,7 +279,10 @@ void *POSIX_Init(
status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT );
assert( !status );
- status = pthread_mutexattr_setprioceiling( &attr, 128 );
+ status = pthread_mutexattr_setprioceiling(
+ &attr,
+ (sched_get_priority_max(SCHED_FIFO) / 2) + 1
+ );
assert( !status );
status = pthread_mutexattr_setpshared( &attr, PTHREAD_PROCESS_SHARED );
@@ -463,7 +468,7 @@ void *POSIX_Init(
/* set priority of Task2 to highest priority */
- param.sched_priority = 254;
+ param.sched_priority = sched_get_priority_max();
puts( "Init: pthread_setschedparam - Setting Task2 priority to highest" );
status = pthread_setschedparam( Task2_id, SCHED_FIFO, &param );
@@ -531,8 +536,11 @@ void *POSIX_Init(
/* normal cases of set priority ceiling */
- puts( "Init: pthread_mutex_setprioceiling - new ceiling = 200" );
- status = pthread_mutex_setprioceiling( &Mutex2_id, 200, &old_ceiling );
+ priority = sched_get_priority_max( SCHED_FIFO );
+ priority = (priority == 254) ? 200 : 13;
+
+ printf( "Init: pthread_mutex_setprioceiling - new ceiling = %d", priority );
+ status = pthread_mutex_setprioceiling( &Mutex2_id, priority, &old_ceiling );
assert( !status );
printf(
"Init: pthread_mutex_setprioceiling - old ceiling = %d\n",old_ceiling
@@ -561,7 +569,7 @@ void *POSIX_Init(
/* set priority of Task3 to highest priority */
- param.sched_priority = 199;
+ param.sched_priority = --priority;
status = pthread_setschedparam( Task3_id, SCHED_FIFO, &param );
assert( !status );
@@ -585,7 +593,7 @@ void *POSIX_Init(
/* set priority of Init to highest priority */
- param.sched_priority = 254;
+ param.sched_priority = sched_get_priority_max(SCHED_FIFO);
status = pthread_setschedparam( Init_id, SCHED_FIFO, &param );
assert( !status );