diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-29 21:52:21 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-29 21:52:21 +0000 |
commit | 6c06288f6452da96fa630f1482aeaaba5d217531 (patch) | |
tree | b12309ae199663c23f0ba74a71fdba4f32fb1036 /cpukit/score/src | |
parent | 2008-01-29 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-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/src')
-rw-r--r-- | cpukit/score/src/Unlimited.txt | 23 | ||||
-rw-r--r-- | cpukit/score/src/objectapimaximumclass.c | 38 | ||||
-rw-r--r-- | cpukit/score/src/objectgetinfo.c | 43 | ||||
-rw-r--r-- | cpukit/score/src/objectgetinfoid.c | 27 | ||||
-rw-r--r-- | cpukit/score/src/objectgetnameasstring.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/objectsetname.c | 73 | ||||
-rw-r--r-- | cpukit/score/src/threadqextractwithproxy.c | 2 |
7 files changed, 184 insertions, 26 deletions
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; |