summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-29 21:52:21 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-29 21:52:21 +0000
commit6c06288f6452da96fa630f1482aeaaba5d217531 (patch)
treeb12309ae199663c23f0ba74a71fdba4f32fb1036 /cpukit/score
parent2008-01-29 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-6c06288f6452da96fa630f1482aeaaba5d217531.tar.bz2
2008-01-29 Joel Sherrill <joel.sherrill@oarcorp.com>
* itron/src/exd_tsk.c, itron/src/task.c, libmisc/capture/capture.c, libmisc/monitor/mon-config.c, libmisc/monitor/mon-driver.c, libmisc/monitor/mon-itask.c, libmisc/monitor/mon-monitor.c, libmisc/monitor/mon-mpci.c, libmisc/monitor/mon-object.c, libmisc/monitor/mon-symbols.c, posix/src/cancelrun.c, posix/src/pthreadexit.c, rtems/Makefile.am, rtems/preinstall.am, rtems/include/rtems.h, rtems/include/rtems/rtems/support.h, rtems/inline/rtems/rtems/tasks.inl, rtems/src/eventmp.c, rtems/src/msgmp.c, rtems/src/partmp.c, rtems/src/regionmp.c, rtems/src/rtemsobjectgetname.c, rtems/src/semmp.c, rtems/src/signalmp.c, rtems/src/taskdelete.c, rtems/src/taskmp.c, rtems/src/timerserver.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl, score/src/Unlimited.txt, score/src/objectgetnameasstring.c, score/src/threadqextractwithproxy.c: Add new Object Services collection. This changed the name of a few previously public but undocumented services and added a some new services. * rtems/include/rtems/rtems/object.h, rtems/src/rtemsbuildid.c, rtems/src/rtemsbuildname.c, rtems/src/rtemsobjectapimaximumclass.c, rtems/src/rtemsobjectapiminimumclass.c, rtems/src/rtemsobjectgetapiclassname.c, rtems/src/rtemsobjectgetapiname.c, rtems/src/rtemsobjectgetclassicname.c, rtems/src/rtemsobjectgetclassinfo.c, rtems/src/rtemsobjectidapimaximum.c, rtems/src/rtemsobjectidapiminimum.c, rtems/src/rtemsobjectidgetapi.c, rtems/src/rtemsobjectidgetclass.c, rtems/src/rtemsobjectidgetindex.c, rtems/src/rtemsobjectidgetnode.c, rtems/src/rtemsobjectsetname.c, score/src/objectapimaximumclass.c, score/src/objectgetinfo.c, score/src/objectgetinfoid.c, score/src/objectsetname.c: New files. * rtems/src/rtemsidtoname.c: Removed.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/Makefile.am3
-rw-r--r--cpukit/score/include/rtems/score/object.h81
-rw-r--r--cpukit/score/inline/rtems/score/object.inl29
-rw-r--r--cpukit/score/src/Unlimited.txt23
-rw-r--r--cpukit/score/src/objectapimaximumclass.c38
-rw-r--r--cpukit/score/src/objectgetinfo.c43
-rw-r--r--cpukit/score/src/objectgetinfoid.c27
-rw-r--r--cpukit/score/src/objectgetnameasstring.c4
-rw-r--r--cpukit/score/src/objectsetname.c73
-rw-r--r--cpukit/score/src/threadqextractwithproxy.c2
10 files changed, 265 insertions, 58 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index f5aae2d610..bb3c7bfcd6 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -117,7 +117,8 @@ libscore_a_SOURCES += src/object.c src/objectallocate.c \
src/objectgetisr.c src/objectgetnext.c src/objectinitializeinformation.c \
src/objectnametoid.c src/objectnametoidstring.c \
src/objectshrinkinformation.c src/objectgetnoprotection.c \
- src/objectidtoname.c src/objectgetnameasstring.c
+ src/objectidtoname.c src/objectgetnameasstring.c src/objectsetname.c \
+ src/objectgetinfo.c src/objectgetinfoid.c src/objectapimaximumclass.c
## OBJECT_C_FILES only used by ITRON API
if LIBITRON
diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h
index c1a9c040db..ffc34a46a0 100644
--- a/cpukit/score/include/rtems/score/object.h
+++ b/cpukit/score/include/rtems/score/object.h
@@ -9,7 +9,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -498,6 +498,18 @@ void _Objects_Initialize_information (
);
/**
+ * This function returns the highest numeric value of a valid
+ * API for the specified @code{api}.
+ *
+ * @param[in] api is the API of interest
+ *
+ * @return A positive integer on success and -1 otherwise.
+ */
+int _Objects_API_maximum_class(
+ uint32_t api
+);
+
+/**
* This function allocates a object control block from
* the inactive chain of free object control blocks.
*
@@ -536,6 +548,22 @@ void _Objects_Free(
);
/**
+ * This macro is used to build a thirty-two bit style name from
+ * four characters. The most significant byte will be the
+ * character @code{_C1}.
+ *
+ * @param[in] _C1 is the first character of the name
+ * @param[in] _C2 is the second character of the name
+ * @param[in] _C3 is the third character of the name
+ * @param[in] _C4 is the fourth character of the name
+ */
+#define _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
+ ( (uint32_t)(_C1) << 24 | \
+ (uint32_t)(_C2) << 16 | \
+ (uint32_t)(_C3) << 8 | \
+ (uint32_t)(_C4) )
+
+/**
* This function implements the common portion of the object
* identification directives. This directive returns the object
* id associated with name. If more than one object of this class
@@ -677,7 +705,7 @@ Objects_Control *_Objects_Get (
*
* @note _Objects_Get returns with dispatching disabled for
* local and remote objects. _Objects_Get_isr_disable returns with
- * dispatching disabled for remote objects and interrupts for local
+ * dispatchng disabled for remote objects and interrupts for local
* objects.
*/
Objects_Control *_Objects_Get_isr_disable(
@@ -764,6 +792,37 @@ Objects_Control *_Objects_Get_next(
);
/**
+ * This function return the information structure given
+ * an the API and Class. This can be done independent of
+ * the existence of any objects created by the API.
+ *
+ * @param[in] api indicates the API for the information we want
+ * @param[in] api indicates the Class for the information we want
+ *
+ *
+ * @return This method returns a pointer to the Object Information Table
+ * for the class of objects which corresponds to this object ID.
+ */
+Objects_Information *_Objects_Get_information(
+ Objects_APIs api,
+ uint32_t class
+);
+
+/**
+ * This function return the information structure given
+ * an id of an object.
+ *
+ * @param[in] id is an object ID
+ *
+ *
+ * @return This method returns a pointer to the Object Information Table
+ * for the class of objects which corresponds to this object ID.
+ */
+Objects_Information *_Objects_Get_information_id(
+ Objects_Id id
+);
+
+/**
* This method objects the name of an object and returns its name
* in the form of a C string. It attempts to be careful about
* overflowing the user's string and about returning unprintable characters.
@@ -774,13 +833,29 @@ Objects_Control *_Objects_Get_next(
*
* @return This method returns @a name or NULL on error.
*/
-
char *_Objects_Get_name_as_string(
Objects_Id id,
size_t length,
char *name
);
+/**
+ * This method sets the object name to either a copy of a string
+ * or up to the first four characters of the string based upon
+ * whether this object class uses strings for names.
+ *
+ * @param[in] information points to the object information structure
+ * @param[in] the_object is the object to operate upon
+ * @param[in] name is a pointer to the name to use
+ *
+ * @return If successful, TRUE is returned. Otherwise FALSE is returned.
+ */
+boolean _Objects_Set_name(
+ Objects_Information *information,
+ Objects_Control *the_object,
+ const char *name
+);
+
/*
* Pieces of object.inl are promoted out to the user
*/
diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl
index f541220270..e5f30d5c5e 100644
--- a/cpukit/score/inline/rtems/score/object.inl
+++ b/cpukit/score/inline/rtems/score/object.inl
@@ -7,7 +7,7 @@
* This include file contains the static inline implementation of all
* of the inlined routines in the Object Handler.
*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -244,33 +244,6 @@ RTEMS_INLINE_ROUTINE void _Objects_Set_local_object(
}
/**
- * This function return the information structure given
- * an id of an object.
- *
- * @param[in] id is an object ID
- *
- *
- * @return This method returns a pointer to the Object Information Table
- * for the class of objects which corresponds to this object ID.
- */
-RTEMS_INLINE_ROUTINE Objects_Information *_Objects_Get_information(
- Objects_Id id
-)
-{
- Objects_APIs the_api;
- uint16_t the_class;
-
-
- the_class = _Objects_Get_class( id );
-
- if ( !_Objects_Is_class_valid( the_class ) )
- return NULL;
-
- the_api = _Objects_Get_API( id );
- return _Objects_Information_table[ the_api ][ the_class ];
-}
-
-/**
* This function places the_object control pointer and object name
* in the Local Pointer and Local Name Tables, respectively.
*
diff --git a/cpukit/score/src/Unlimited.txt b/cpukit/score/src/Unlimited.txt
index be777d338a..47309c361c 100644
--- a/cpukit/score/src/Unlimited.txt
+++ b/cpukit/score/src/Unlimited.txt
@@ -231,29 +231,6 @@ o Changes to Existing Object Functions
The last were inlined, how-ever now they are not as they are too
complex to implement as macros now.
-o Object Inline and Macro Changes
-
- The functions :
-
- _Object_Allocate, and
- _Object_Free
-
- are now not inlined. The function :
-
- _Objects_Get_local_object, and
- _Objects_Set_local_object
-
- have been added. There was no provided interface to allow an API to
- get/set an objects local pointer given an index. The POSIX code
- should be updated to use this interface.
-
- The function :
-
- _Objects_Get_information
-
- has been moved to be an inline function. It is used in the get
- object call which the API uses for every object reference.
-
o Object Initialisation
The function _Objects_Initialize_information has been changed to
diff --git a/cpukit/score/src/objectapimaximumclass.c b/cpukit/score/src/objectapimaximumclass.c
new file mode 100644
index 0000000000..f156f8c7dd
--- /dev/null
+++ b/cpukit/score/src/objectapimaximumclass.c
@@ -0,0 +1,38 @@
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * 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 <rtems/system.h>
+#include <rtems/score/object.h>
+
+int _Objects_API_maximum_class(
+ uint32_t api
+)
+{
+ switch (api) {
+ case OBJECTS_INTERNAL_API:
+ return OBJECTS_INTERNAL_CLASSES_LAST;
+ case OBJECTS_CLASSIC_API:
+ return OBJECTS_RTEMS_CLASSES_LAST;
+ case OBJECTS_POSIX_API:
+ return OBJECTS_POSIX_CLASSES_LAST;
+ case OBJECTS_ITRON_API:
+ return OBJECTS_ITRON_CLASSES_LAST;
+ case OBJECTS_NO_API:
+ default:
+ break;
+ }
+ return -1;
+}
+
diff --git a/cpukit/score/src/objectgetinfo.c b/cpukit/score/src/objectgetinfo.c
new file mode 100644
index 0000000000..4deb7b995e
--- /dev/null
+++ b/cpukit/score/src/objectgetinfo.c
@@ -0,0 +1,43 @@
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * 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 <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+
+Objects_Information *_Objects_Get_information(
+ Objects_APIs api,
+ uint32_t class
+)
+{
+ Objects_Information *info;
+
+ if ( !_Objects_Is_api_valid( api ) )
+ return NULL;
+
+ if ( !class || class > _Objects_API_maximum_class(api) )
+ return NULL;
+
+ info = _Objects_Information_table[ api ][ class ];
+ if ( !info )
+ return NULL;
+
+ if ( info->maximum == 0 )
+ return NULL;
+
+ return info;
+}
+
diff --git a/cpukit/score/src/objectgetinfoid.c b/cpukit/score/src/objectgetinfoid.c
new file mode 100644
index 0000000000..7211066d1a
--- /dev/null
+++ b/cpukit/score/src/objectgetinfoid.c
@@ -0,0 +1,27 @@
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * 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 <rtems/system.h>
+#include <rtems/score/object.h>
+
+Objects_Information *_Objects_Get_information_id(
+ Objects_Id id
+)
+{
+ return _Objects_Get_information(
+ _Objects_Get_API( id ),
+ _Objects_Get_class( id )
+ );
+}
diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c
index e19059ffd8..71c10370f0 100644
--- a/cpukit/score/src/objectgetnameasstring.c
+++ b/cpukit/score/src/objectgetnameasstring.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -48,7 +48,7 @@ char *_Objects_Get_name_as_string(
if ( name == NULL )
return NULL;
- information = _Objects_Get_information( id );
+ information = _Objects_Get_information_id( id );
if ( !information )
return NULL;
diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c
new file mode 100644
index 0000000000..455b4b51c3
--- /dev/null
+++ b/cpukit/score/src/objectsetname.c
@@ -0,0 +1,73 @@
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * 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 <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <inttypes.h>
+#include <string.h>
+
+
+/*
+ * This method sets the name of an object based upon a C string.
+ */
+
+boolean _Objects_Set_name(
+ Objects_Information *information,
+ Objects_Control *the_object,
+ const char *name
+)
+{
+ size_t length;
+ const char *s;
+
+ s = name;
+ length = strnlen( name, information->name_length ) + 1;
+
+ if ( information->is_string ) {
+ char *d;
+
+ d = _Workspace_Allocate( length );
+ if ( !d )
+ return FALSE;
+
+ if ( the_object->name.name_p )
+ _Workspace_Free( (void *)the_object->name.name_p );
+
+ the_object->name.name_p = NULL;
+
+ strncpy( d, name, length );
+ the_object->name.name_p = d;
+ } else {
+ uint32_t name_u32 = 0;
+ char lname[5] = " ";
+ int i;
+
+ for ( i=0 ; i<4 && i<length ; i++ )
+ lname[ i ] = s[ i ];
+
+ name_u32 |= ((uint32_t)lname[ 0 ] << 24);
+ name_u32 |= ((uint32_t)lname[ 1 ] << 16);
+ name_u32 |= ((uint32_t)lname[ 2 ] << 8);
+ name_u32 |= (uint32_t)lname[ 3 ];
+ the_object->name.name_u32 = name_u32;
+ }
+
+ return TRUE;
+}
diff --git a/cpukit/score/src/threadqextractwithproxy.c b/cpukit/score/src/threadqextractwithproxy.c
index 5c24431ab5..16461a2dec 100644
--- a/cpukit/score/src/threadqextractwithproxy.c
+++ b/cpukit/score/src/threadqextractwithproxy.c
@@ -51,7 +51,7 @@ boolean _Thread_queue_Extract_with_proxy(
Objects_Information *the_information;
Objects_Thread_queue_Extract_callout proxy_extract_callout;
- the_information = _Objects_Get_information( the_thread->Wait.id );
+ the_information = _Objects_Get_information_id( the_thread->Wait.id );
proxy_extract_callout =
(Objects_Thread_queue_Extract_callout) the_information->extract;