summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-14 18:31:43 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-14 18:31:43 +0000
commita6608123c0952979821bbfe4bf58713403c2f9cb (patch)
tree6f3206c34b4f75b3bc5146d9527f165cbc3c9205
parent2008-12-12 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-a6608123c0952979821bbfe4bf58713403c2f9cb.tar.bz2
2008-12-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* itron/src/chg_pri.c, itron/src/cre_tsk.c, itron/src/rot_rdq.c, posix/Makefile.am, posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/priority.h, posix/src/mutex.c, score/include/rtems/score/priority.h: 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 SuperCore variable based upon configured number. * posix/src/mutexdefaultattributes.c: Removed.
-rw-r--r--cpukit/ChangeLog14
-rw-r--r--cpukit/itron/src/chg_pri.c2
-rw-r--r--cpukit/itron/src/cre_tsk.c2
-rw-r--r--cpukit/itron/src/rot_rdq.c2
-rw-r--r--cpukit/posix/Makefile.am10
-rw-r--r--cpukit/posix/include/rtems/posix/mutex.h2
-rw-r--r--cpukit/posix/include/rtems/posix/priority.h7
-rw-r--r--cpukit/posix/src/mutex.c15
-rw-r--r--cpukit/posix/src/mutexdefaultattributes.c37
-rw-r--r--cpukit/score/include/rtems/score/priority.h4
10 files changed, 43 insertions, 52 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index b031d7bd79..49bb8f643d 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,17 @@
+2008-12-14 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * itron/src/chg_pri.c, itron/src/cre_tsk.c, itron/src/rot_rdq.c,
+ posix/Makefile.am, posix/include/rtems/posix/mutex.h,
+ posix/include/rtems/posix/priority.h, posix/src/mutex.c,
+ score/include/rtems/score/priority.h: 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 SuperCore variable based upon
+ configured number.
+ * posix/src/mutexdefaultattributes.c: Removed.
+
2008-12-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/inline/rtems/score/address.inl: Make offset arguments intptr_t
diff --git a/cpukit/itron/src/chg_pri.c b/cpukit/itron/src/chg_pri.c
index 2bb4a25090..d47d17cafc 100644
--- a/cpukit/itron/src/chg_pri.c
+++ b/cpukit/itron/src/chg_pri.c
@@ -48,7 +48,7 @@ ER chg_pri(
if (_States_Is_dormant( the_thread->current_state ))
_ITRON_return_errorno( E_OBJ );
- if (( tskpri <= 0 ) || ( tskpri >= 256 ))
+ if (( tskpri <= 0 ) || ( tskpri >= PRIORITY_MAXIMUM-1 ))
_ITRON_return_errorno( E_PAR );
new_priority = _ITRON_Task_Priority_to_Core( tskpri );
diff --git a/cpukit/itron/src/cre_tsk.c b/cpukit/itron/src/cre_tsk.c
index a0939ee785..fb8164423f 100644
--- a/cpukit/itron/src/cre_tsk.c
+++ b/cpukit/itron/src/cre_tsk.c
@@ -58,7 +58,7 @@ ER cre_tsk(
(pk_ctsk->tskatr != TA_COP7))
return E_RSATR;
- if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= 256 ))
+ if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= PRIORITY_MAXIMUM-1 ))
return E_PAR;
if ( pk_ctsk->task == NULL )
return E_PAR;
diff --git a/cpukit/itron/src/rot_rdq.c b/cpukit/itron/src/rot_rdq.c
index 80e9e5c95e..9f57321dc9 100644
--- a/cpukit/itron/src/rot_rdq.c
+++ b/cpukit/itron/src/rot_rdq.c
@@ -34,7 +34,7 @@ ER rot_rdq(
PRI priority;
- if (( tskpri <= 0 ) || ( tskpri >= 256 ))
+ if (( tskpri <= 0 ) || ( tskpri >= PRIORITY_MAXIMUM-1 ))
return E_PAR;
_Thread_Disable_dispatch();
diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
index 205f32835e..8d10e3495f 100644
--- a/cpukit/posix/Makefile.am
+++ b/cpukit/posix/Makefile.am
@@ -101,11 +101,11 @@ libposix_a_SOURCES += src/mutex.c src/mutexattrdestroy.c \
src/mutexattrgetprioceiling.c src/mutexattrgetprotocol.c \
src/mutexattrgetpshared.c src/mutexattrinit.c \
src/mutexattrsetprioceiling.c src/mutexattrsetprotocol.c \
- src/mutexattrsetpshared.c src/mutexdefaultattributes.c \
- src/mutexdestroy.c src/mutexgetprioceiling.c src/mutexinit.c \
- src/mutexlock.c src/mutexlocksupp.c src/mutexsetprioceiling.c \
- src/mutextimedlock.c src/mutextranslatereturncode.c src/mutextrylock.c \
- src/mutexunlock.c src/mutexget.c
+ src/mutexattrsetpshared.c src/mutexdestroy.c \
+ src/mutexgetprioceiling.c src/mutexinit.c src/mutexlock.c \
+ src/mutexlocksupp.c src/mutexsetprioceiling.c src/mutextimedlock.c \
+ src/mutextranslatereturncode.c src/mutextrylock.c src/mutexunlock.c \
+ src/mutexget.c
## PTHREAD_C_FILES
libposix_a_SOURCES += src/pthread.c src/pthreadsetcputime.c \
diff --git a/cpukit/posix/include/rtems/posix/mutex.h b/cpukit/posix/include/rtems/posix/mutex.h
index 4594610b4e..1f12f1336f 100644
--- a/cpukit/posix/include/rtems/posix/mutex.h
+++ b/cpukit/posix/include/rtems/posix/mutex.h
@@ -47,7 +47,7 @@ POSIX_EXTERN Objects_Information _POSIX_Mutex_Information;
* The default mutex attributes structure.
*/
-extern const pthread_mutexattr_t _POSIX_Mutex_Default_attributes;
+POSIX_EXTERN pthread_mutexattr_t _POSIX_Mutex_Default_attributes;
/*
* _POSIX_Mutex_Manager_initialization
diff --git a/cpukit/posix/include/rtems/posix/priority.h b/cpukit/posix/include/rtems/posix/priority.h
index 14eb959950..2111bd3118 100644
--- a/cpukit/posix/include/rtems/posix/priority.h
+++ b/cpukit/posix/include/rtems/posix/priority.h
@@ -21,7 +21,7 @@
/*
* 1003.1b-1993,2.2.2.80 definition of priority, p. 19
*
- * "Numericallly higher values represent higher priorities."
+ * "Numerically higher values represent higher priorities."
*
* Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API.
*
@@ -30,9 +30,12 @@
* because GNAT maps the lowest Ada task priority to the lowest thread
* priority. The lowest priority Ada task should get to run, so there is
* a fundamental conflict with having 255 priorities.
+ *
+ * But since RTEMS can be configured with fewer than 256 priorities,
+ * we use the internal constant.
*/
-#define POSIX_SCHEDULER_MAXIMUM_PRIORITY (254)
+#define POSIX_SCHEDULER_MAXIMUM_PRIORITY (PRIORITY_MAXIMUM - 1)
#define POSIX_SCHEDULER_MINIMUM_PRIORITY (1)
diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c
index c42ad88780..9ba8356223 100644
--- a/cpukit/posix/src/mutex.c
+++ b/cpukit/posix/src/mutex.c
@@ -43,6 +43,21 @@ void _POSIX_Mutex_Manager_initialization(
uint32_t maximum_mutexes
)
{
+ pthread_mutexattr_t *default_attr = &_POSIX_Mutex_Default_attributes;
+
+ /*
+ * Since the maximum priority is run-time configured, this
+ * structure cannot be initialized statically.
+ */
+ default_attr->is_initialized = TRUE;
+ default_attr->process_shared = PTHREAD_PROCESS_PRIVATE;
+ default_attr->prio_ceiling = POSIX_SCHEDULER_MAXIMUM_PRIORITY;
+ default_attr->protocol = PTHREAD_PRIO_NONE;
+ default_attr->recursive = FALSE;
+
+ /*
+ * Initialize the POSIX mutex object class information structure.
+ */
_Objects_Initialize_information(
&_POSIX_Mutex_Information, /* object information table */
OBJECTS_POSIX_API, /* object API */
diff --git a/cpukit/posix/src/mutexdefaultattributes.c b/cpukit/posix/src/mutexdefaultattributes.c
deleted file mode 100644
index 3e3c00c3e8..0000000000
--- a/cpukit/posix/src/mutexdefaultattributes.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * COPYRIGHT (c) 1989-2007.
- * 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$
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <errno.h>
-#include <pthread.h>
-
-#include <rtems/system.h>
-#include <rtems/score/coremutex.h>
-#include <rtems/score/watchdog.h>
-#include <rtems/posix/mutex.h>
-#include <rtems/posix/priority.h>
-#include <rtems/posix/time.h>
-
-/*PAGE
- *
- * The default mutex attributes structure.
- */
-
-const pthread_mutexattr_t _POSIX_Mutex_Default_attributes = {
- TRUE, /* is_initialized */
- PTHREAD_PROCESS_PRIVATE, /* process_shared */
- POSIX_SCHEDULER_MAXIMUM_PRIORITY, /* prio_ceiling */
- PTHREAD_PRIO_NONE, /* protocol */
- FALSE /* recursive */
-};
diff --git a/cpukit/score/include/rtems/score/priority.h b/cpukit/score/include/rtems/score/priority.h
index 42f09c3755..31beb6fc2c 100644
--- a/cpukit/score/include/rtems/score/priority.h
+++ b/cpukit/score/include/rtems/score/priority.h
@@ -54,11 +54,7 @@ extern "C" {
typedef uint32_t Priority_Control;
/** This defines the highest (most important) thread priority. */
-#if defined (CPU_PRIORITY_MINIMUM)
-#define PRIORITY_MINIMUM CPU_PRIORITY_MINIMUM
-#else
#define PRIORITY_MINIMUM 0
-#endif
/** This defines the default lowest (least important) thread priority. */
#if defined (CPU_PRIORITY_MAXIMUM)