[rtems commit] score: New macros and functions

Joel Sherrill joel.sherrill at OARcorp.com
Wed Apr 11 14:03:36 UTC 2012


Can the rtems_ methods be at least referenced in the
configuring a system chapter with index entries?

I know that many aren't but there is no point adding
more to the "undocumented but intended to be public"
set.

--joel
On 04/11/2012 08:24 AM, Sebastian Huber wrote:
> Module:    rtems
> Branch:    master
> Commit:    5eb434e67ed31111eb90b92cf75248f2ff9d1086
> Changeset: http://git.rtems.org/rtems/commit/?id=5eb434e67ed31111eb90b92cf75248f2ff9d1086
>
> Author:    Sebastian Huber<sebastian.huber at embedded-brains.de>
> Date:      Wed Apr 11 15:04:22 2012 +0200
>
> 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().
>
> ---
>
>   cpukit/sapi/include/confdefs.h                 |    2 +-
>   cpukit/sapi/include/rtems/config.h             |    6 ++++++
>   cpukit/score/inline/rtems/score/object.inl     |   20 ++++++++++++++++++++
>   cpukit/score/src/objectinitializeinformation.c |    7 +++----
>   4 files changed, 30 insertions(+), 5 deletions(-)
>
> diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
> index ab8e473..d896c59 100644
> --- a/cpukit/sapi/include/confdefs.h
> +++ b/cpukit/sapi/include/confdefs.h
> @@ -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
> diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h
> index 25ddfda..407b19e 100644
> --- a/cpukit/sapi/include/rtems/config.h
> +++ b/cpukit/sapi/include/rtems/config.h
> @@ -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.
> diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl
> index ac07e68..6a4fe21 100644
> --- a/cpukit/score/inline/rtems/score/object.inl
> +++ b/cpukit/score/inline/rtems/score/object.inl
> @@ -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 */
> diff --git a/cpukit/score/src/objectinitializeinformation.c b/cpukit/score/src/objectinitializeinformation.c
> index 01e1f96..4ddb11b 100644
> --- a/cpukit/score/src/objectinitializeinformation.c
> +++ b/cpukit/score/src/objectinitializeinformation.c
> @@ -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.
>
> _______________________________________________
> rtems-vc mailing list
> rtems-vc at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-vc


-- 
Joel Sherrill, Ph.D.             Director of Research&   Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
     Support Available             (256) 722-9985





More information about the devel mailing list