diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-12-10 10:41:48 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-12 09:08:37 +0100 |
commit | 24851567c38f573e9176529e9ca431fbf80c6cef (patch) | |
tree | bd75506122c9a310228d1c58fba7544a5e05dd65 /cpukit/include/rtems/score/objectimpl.h | |
parent | score: Add _Objects_Free_objects_block() (diff) | |
download | rtems-24851567c38f573e9176529e9ca431fbf80c6cef.tar.bz2 |
score: Split up objects allocation
Split up the different objects allocation methods into separate
functions. This helps to avoid a dependency on the workspace in case no
objects or a static set of objects is configured.
Change license to BSD-2-Clause according to file histories.
Update #3053.
Update #3835.
Diffstat (limited to 'cpukit/include/rtems/score/objectimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/objectimpl.h | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h index 83e93a2b12..a2548dd980 100644 --- a/cpukit/include/rtems/score/objectimpl.h +++ b/cpukit/include/rtems/score/objectimpl.h @@ -23,7 +23,9 @@ #include <rtems/score/objectdata.h> #include <rtems/score/apimutex.h> +#include <rtems/score/assert.h> #include <rtems/score/isrlock.h> +#include <rtems/score/sysstate.h> #include <rtems/score/threaddispatch.h> #ifdef __cplusplus @@ -145,25 +147,6 @@ unsigned int _Objects_API_maximum_class( ); /** - * @brief Allocates an object without locking the allocator mutex. - * - * This function can be called in two contexts - * - the executing thread is the owner of the object allocator mutex, or - * - in case the system state is not up, e.g. during sequential system - * initialization. - * - * @param[in, out] information The object information block. - * - * @retval object The allocated object. - * @retval NULL No object available. - * - * @see _Objects_Allocate() and _Objects_Free(). - */ -Objects_Control *_Objects_Allocate_unprotected( - Objects_Information *information -); - -/** * @brief Allocates an object. * * This function locks the object allocator mutex via @@ -703,6 +686,19 @@ RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_maximum_index( } /** + * @brief Get an inactive object or NULL. + * + * @retval NULL No inactive object is available. + * @retval object An inactive object. + */ +RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Get_inactive( + Objects_Information *information +) +{ + return (Objects_Control *) _Chain_Get_unprotected( &information->Inactive ); +} + +/** * @brief Checks if the automatic object extension (unlimited objects) is * enabled. * @@ -902,6 +898,33 @@ RTEMS_INLINE_ROUTINE bool _Objects_Allocator_is_owner( void ) return _RTEMS_Allocator_is_owner(); } +/** + * @brief Allocates an object without locking the allocator mutex. + * + * This function can be called in two contexts + * - the executing thread is the owner of the object allocator mutex, or + * - in case the system state is not up, e.g. during sequential system + * initialization. + * + * @param[in, out] information The object information block. + * + * @retval object The allocated object. + * @retval NULL No object available. + * + * @see _Objects_Allocate() and _Objects_Free(). + */ +RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Allocate_unprotected( + Objects_Information *information +) +{ + _Assert( + _Objects_Allocator_is_owner() + || !_System_state_Is_up( _System_state_Get() ) + ); + + return ( *information->allocate )( information ); +} + /** @} */ #ifdef __cplusplus |