diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-12-10 11:26:20 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-12 09:08:41 +0100 |
commit | dd9e50102b6829c018b6ea24e925cf26e924273f (patch) | |
tree | 023b589ff6baecafcb7f2160b9c8931966dff1d1 | |
parent | 8a43adbe47454689149bac27adc45439eab44965 (diff) |
score: Add _Objects_Activate_unlimited()
Update #3835.
-rw-r--r-- | cpukit/include/rtems/score/objectimpl.h | 30 | ||||
-rw-r--r-- | cpukit/score/src/objectallocateunlimited.c | 13 |
2 files changed, 31 insertions, 12 deletions
diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h index d4d6347ea8..e0fd7882c2 100644 --- a/cpukit/include/rtems/score/objectimpl.h +++ b/cpukit/include/rtems/score/objectimpl.h @@ -937,6 +937,36 @@ RTEMS_INLINE_ROUTINE void _Objects_Free( ( *information->free )( information, the_object ); } +/** + * @brief Activate the object. + * + * This function must be only used in case this objects information supports + * unlimited objects. + * + * @param information The object information block. + * @param the_object The object to activate. + */ +RTEMS_INLINE_ROUTINE void _Objects_Activate_unlimited( + Objects_Information *information, + Objects_Control *the_object +) +{ + Objects_Maximum objects_per_block; + Objects_Maximum block; + + _Assert( _Objects_Is_auto_extend( information ) ); + + objects_per_block = information->objects_per_block; + block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; + + if ( block > objects_per_block ) { + block /= objects_per_block; + + information->inactive_per_block[ block ]--; + information->inactive--; + } +} + /** @} */ #ifdef __cplusplus diff --git a/cpukit/score/src/objectallocateunlimited.c b/cpukit/score/src/objectallocateunlimited.c index 92727e1411..6ec4a7950b 100644 --- a/cpukit/score/src/objectallocateunlimited.c +++ b/cpukit/score/src/objectallocateunlimited.c @@ -61,18 +61,7 @@ Objects_Control *_Objects_Allocate_unlimited( Objects_Information *information ) } if ( the_object != NULL ) { - Objects_Maximum objects_per_block; - Objects_Maximum block; - - objects_per_block = information->objects_per_block; - block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; - - if ( block > objects_per_block ) { - block /= objects_per_block; - - information->inactive_per_block[ block ]--; - information->inactive--; - } + _Objects_Activate_unlimited( information, the_object ); } return the_object; |