mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-26 21:33:15 +08:00
score: New macros and functions
New macros o _Objects_Maximum_per_allocation(), o rtems_resource_is_unlimited(), and o rtems_resource_maximum_per_allocation(). New function o _Objects_Is_unlimited().
This commit is contained in:
@@ -954,7 +954,7 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
|
||||
* for memory usage.
|
||||
*/
|
||||
#define _Configure_Max_Objects(_max) \
|
||||
((_max) & ~RTEMS_UNLIMITED_OBJECTS)
|
||||
rtems_resource_maximum_per_allocation(_max)
|
||||
|
||||
/**
|
||||
* This macro accounts for how memory for a set of configured objects is
|
||||
|
||||
@@ -37,6 +37,12 @@ extern "C" {
|
||||
#define rtems_resource_unlimited(resource) \
|
||||
( resource | RTEMS_UNLIMITED_OBJECTS )
|
||||
|
||||
#define rtems_resource_is_unlimited(resource) \
|
||||
_Objects_Is_unlimited(resource)
|
||||
|
||||
#define rtems_resource_maximum_per_allocation(resource) \
|
||||
_Objects_Maximum_per_allocation(resource)
|
||||
|
||||
/*
|
||||
* This is kind of kludgy but it allows targets to totally ignore the
|
||||
* optional APIs like POSIX safely.
|
||||
|
||||
@@ -352,5 +352,25 @@ RTEMS_INLINE_ROUTINE void _Objects_Open_string(
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the object maximum specifies unlimited objects.
|
||||
*
|
||||
* @param[in] maximum The object maximum specification.
|
||||
*
|
||||
* @retval true Unlimited objects are available.
|
||||
* @retval false The object count is fixed.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE bool _Objects_Is_unlimited( uint32_t maximum )
|
||||
{
|
||||
return (maximum & OBJECTS_UNLIMITED_OBJECTS) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* We cannot use an inline function for this since it may be evaluated at
|
||||
* compile time.
|
||||
*/
|
||||
#define _Objects_Maximum_per_allocation( maximum ) \
|
||||
((Objects_Maximum) ((maximum) & ~OBJECTS_UNLIMITED_OBJECTS))
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -62,7 +62,7 @@ void _Objects_Initialize_information(
|
||||
{
|
||||
static Objects_Control *null_local_table = NULL;
|
||||
uint32_t minimum_index;
|
||||
uint32_t maximum_per_allocation;
|
||||
Objects_Maximum maximum_per_allocation;
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
uint32_t index;
|
||||
#endif
|
||||
@@ -92,9 +92,8 @@ void _Objects_Initialize_information(
|
||||
/*
|
||||
* Are we operating in limited or unlimited (e.g. auto-extend) mode.
|
||||
*/
|
||||
information->auto_extend =
|
||||
(maximum & OBJECTS_UNLIMITED_OBJECTS) ? true : false;
|
||||
maximum_per_allocation = maximum & ~OBJECTS_UNLIMITED_OBJECTS;
|
||||
information->auto_extend = _Objects_Is_unlimited( maximum );
|
||||
maximum_per_allocation = _Objects_Maximum_per_allocation( maximum );
|
||||
|
||||
/*
|
||||
* Unlimited and maximum of zero is illogical.
|
||||
|
||||
Reference in New Issue
Block a user