summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-04-11 15:04:22 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-04-11 15:24:39 +0200
commit5eb434e67ed31111eb90b92cf75248f2ff9d1086 (patch)
tree4e4493d101058953149da482fb8344cb240721a2
parentnios2: New functions (diff)
downloadrtems-5eb434e67ed31111eb90b92cf75248f2ff9d1086.tar.bz2
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().
-rw-r--r--cpukit/sapi/include/confdefs.h2
-rw-r--r--cpukit/sapi/include/rtems/config.h6
-rw-r--r--cpukit/score/inline/rtems/score/object.inl20
-rw-r--r--cpukit/score/src/objectinitializeinformation.c7
4 files changed, 30 insertions, 5 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index ab8e473789..d896c59e82 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 25ddfda421..407b19e825 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 ac07e68235..6a4fe21037 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 01e1f96d46..4ddb11b2cb 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.