From 8a95e6f820f066451e1325592c9c0f18fa205c17 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 2 Feb 2021 14:23:52 +0100 Subject: rtems: Rework object services API Add a "Constraints" paragraph to the documentation. Provide prototypes for programming language bindings. Use the macro implementation to implement the corresponding functions. Update #3993. --- cpukit/rtems/src/rtemsbuildid.c | 19 +++++++++-------- cpukit/rtems/src/rtemsbuildname.c | 33 ++++++++---------------------- cpukit/rtems/src/rtemsobjectidapimaximum.c | 17 +++++++-------- cpukit/rtems/src/rtemsobjectidapiminimum.c | 17 +++++++-------- cpukit/rtems/src/rtemsobjectidgetapi.c | 21 ++++++++----------- cpukit/rtems/src/rtemsobjectidgetclass.c | 21 ++++++++----------- cpukit/rtems/src/rtemsobjectidgetindex.c | 21 ++++++++----------- cpukit/rtems/src/rtemsobjectidgetnode.c | 21 ++++++++----------- 8 files changed, 72 insertions(+), 98 deletions(-) (limited to 'cpukit/rtems') diff --git a/cpukit/rtems/src/rtemsbuildid.c b/cpukit/rtems/src/rtemsbuildid.c index ec3a715473..069812a3d5 100644 --- a/cpukit/rtems/src/rtemsbuildid.c +++ b/cpukit/rtems/src/rtemsbuildid.c @@ -20,25 +20,26 @@ #include "config.h" #endif -#include +#include -/* - * This is implemented as a macro. This body is provided to support - * bindings from non-C based languages. - */ -Objects_Id rtems_build_id( +static rtems_id _RTEMS_Build_id( uint32_t api, uint32_t class, uint32_t node, uint32_t index -); +) +{ + return rtems_build_id( api, class, node, index ); +} + +#undef rtems_build_id -Objects_Id rtems_build_id( +rtems_id rtems_build_id( uint32_t api, uint32_t class, uint32_t node, uint32_t index ) { - return _Objects_Build_id( api, class, node, index ); + return _RTEMS_Build_id( api, class, node, index ); } diff --git a/cpukit/rtems/src/rtemsbuildname.c b/cpukit/rtems/src/rtemsbuildname.c index 42c8c46fd3..300c3638f9 100644 --- a/cpukit/rtems/src/rtemsbuildname.c +++ b/cpukit/rtems/src/rtemsbuildname.c @@ -20,33 +20,16 @@ #include "config.h" #endif -#include +#include -/* - * Undefine since this is normally a macro and we want a real body in - * the library for other language bindings. - */ -#undef rtems_build_name +static rtems_name _RTEMS_Build_name( char c1, char c2, char c3, char c4 ) +{ + return rtems_build_name( c1, c2, c3, c4 ); +} -/* - * Prototype it to avoid warnings - */ -rtems_name rtems_build_name( - char C1, - char C2, - char C3, - char C4 -); +#undef rtems_build_name -/* - * Now define a real body - */ -rtems_name rtems_build_name( - char C1, - char C2, - char C3, - char C4 -) +rtems_id rtems_build_name( char c1, char c2, char c3, char c4 ) { - return _Objects_Build_name( C1, C2, C3, C4 ); + return _RTEMS_Build_name( c1, c2, c3, c4 ); } diff --git a/cpukit/rtems/src/rtemsobjectidapimaximum.c b/cpukit/rtems/src/rtemsobjectidapimaximum.c index 3d624b0b5a..d432647bd3 100644 --- a/cpukit/rtems/src/rtemsobjectidapimaximum.c +++ b/cpukit/rtems/src/rtemsobjectidapimaximum.c @@ -20,15 +20,16 @@ #include "config.h" #endif -#include +#include -/* - * This is implemented as a macro. This body is provided to support - * bindings from non-C based languages. - */ -int rtems_object_id_api_maximum(void); +static int _RTEMS_Object_id_api_maximum( void ) +{ + return rtems_object_id_api_maximum(); +} + +#undef rtems_object_id_api_maximum -int rtems_object_id_api_maximum(void) +int rtems_object_id_api_maximum( void ) { - return OBJECTS_APIS_LAST; + return _RTEMS_Object_id_api_maximum(); } diff --git a/cpukit/rtems/src/rtemsobjectidapiminimum.c b/cpukit/rtems/src/rtemsobjectidapiminimum.c index f9af3914a6..55bb014136 100644 --- a/cpukit/rtems/src/rtemsobjectidapiminimum.c +++ b/cpukit/rtems/src/rtemsobjectidapiminimum.c @@ -20,15 +20,16 @@ #include "config.h" #endif -#include +#include -/* - * This is implemented as a macro. This body is provided to support - * bindings from non-C based languages. - */ -int rtems_object_id_api_minimum(void); +static int _RTEMS_Object_id_api_minimum( void ) +{ + return rtems_object_id_api_minimum(); +} + +#undef rtems_object_id_api_minimum -int rtems_object_id_api_minimum(void) +int rtems_object_id_api_minimum( void ) { - return OBJECTS_INTERNAL_API; + return _RTEMS_Object_id_api_minimum(); } diff --git a/cpukit/rtems/src/rtemsobjectidgetapi.c b/cpukit/rtems/src/rtemsobjectidgetapi.c index 087402a911..a5efeb3290 100644 --- a/cpukit/rtems/src/rtemsobjectidgetapi.c +++ b/cpukit/rtems/src/rtemsobjectidgetapi.c @@ -20,19 +20,16 @@ #include "config.h" #endif -#include +#include -/* - * This is implemented as a macro. This body is provided to support - * bindings from non-C based languages. - */ -int rtems_object_id_get_api( - Objects_Id id -); +static int _RTEMS_Object_id_get_api( rtems_id id ) +{ + return rtems_object_id_get_api( id ); +} + +#undef rtems_object_id_get_api -int rtems_object_id_get_api( - Objects_Id id -) +int rtems_object_id_get_api( rtems_id id ) { - return _Objects_Get_API( id ); + return _RTEMS_Object_id_get_api( id ); } diff --git a/cpukit/rtems/src/rtemsobjectidgetclass.c b/cpukit/rtems/src/rtemsobjectidgetclass.c index bc2d11a5ea..6b817e55fe 100644 --- a/cpukit/rtems/src/rtemsobjectidgetclass.c +++ b/cpukit/rtems/src/rtemsobjectidgetclass.c @@ -20,19 +20,16 @@ #include "config.h" #endif -#include +#include -/* - * This is implemented as a macro. This body is provided to support - * bindings from non-C based languages. - */ -int rtems_object_id_get_class( - Objects_Id id -); +static int _RTEMS_Object_id_get_class( rtems_id id ) +{ + return rtems_object_id_get_class( id ); +} + +#undef rtems_object_id_get_class -int rtems_object_id_get_class( - Objects_Id id -) +int rtems_object_id_get_class( rtems_id id ) { - return _Objects_Get_class( id ); + return _RTEMS_Object_id_get_class( id ); } diff --git a/cpukit/rtems/src/rtemsobjectidgetindex.c b/cpukit/rtems/src/rtemsobjectidgetindex.c index cdcbd2f609..48e2f5ad95 100644 --- a/cpukit/rtems/src/rtemsobjectidgetindex.c +++ b/cpukit/rtems/src/rtemsobjectidgetindex.c @@ -20,19 +20,16 @@ #include "config.h" #endif -#include +#include -/* - * This is implemented as a macro. This body is provided to support - * bindings from non-C based languages. - */ -int rtems_object_id_get_index( - Objects_Id id -); +static int _RTEMS_Object_id_get_index( rtems_id id ) +{ + return rtems_object_id_get_index( id ); +} + +#undef rtems_object_id_get_index -int rtems_object_id_get_index( - Objects_Id id -) +int rtems_object_id_get_index( rtems_id id ) { - return _Objects_Get_index( id ); + return _RTEMS_Object_id_get_index( id ); } diff --git a/cpukit/rtems/src/rtemsobjectidgetnode.c b/cpukit/rtems/src/rtemsobjectidgetnode.c index 4d8a4288d1..6d26f4caea 100644 --- a/cpukit/rtems/src/rtemsobjectidgetnode.c +++ b/cpukit/rtems/src/rtemsobjectidgetnode.c @@ -20,19 +20,16 @@ #include "config.h" #endif -#include +#include -/* - * This is implemented as a macro. This body is provided to support - * bindings from non-C based languages. - */ -int rtems_object_id_get_node( - Objects_Id id -); +static int _RTEMS_Object_id_get_node( rtems_id id ) +{ + return rtems_object_id_get_node( id ); +} + +#undef rtems_object_id_get_node -int rtems_object_id_get_node( - Objects_Id id -) +int rtems_object_id_get_node( rtems_id id ) { - return _Objects_Get_node( id ); + return _RTEMS_Object_id_get_node( id ); } -- cgit v1.2.3