summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/src/objectinitializeinformation.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-02 19:43:52 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-02 19:43:52 +0000
commit317a5b52b5060ef98ffe2b3bb3f980165fea8e81 (patch)
treed9a0c0a0aeaad1553008465e15c71c54e0393008 /c/src/exec/score/src/objectinitializeinformation.c
parentSplit types.s into individual files. (diff)
downloadrtems-317a5b52b5060ef98ffe2b3bb3f980165fea8e81.tar.bz2
Split object.c into multiple files.
Diffstat (limited to 'c/src/exec/score/src/objectinitializeinformation.c')
-rw-r--r--c/src/exec/score/src/objectinitializeinformation.c169
1 files changed, 169 insertions, 0 deletions
diff --git a/c/src/exec/score/src/objectinitializeinformation.c b/c/src/exec/score/src/objectinitializeinformation.c
new file mode 100644
index 0000000000..22c5cc0ccb
--- /dev/null
+++ b/c/src/exec/score/src/objectinitializeinformation.c
@@ -0,0 +1,169 @@
+/*
+ * Object Handler
+ *
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/object.h>
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/score/objectmp.h>
+#endif
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/isr.h>
+
+/*PAGE
+ *
+ * _Objects_Initialize_information
+ *
+ * This routine initializes all object information related data structures.
+ *
+ * Input parameters:
+ * information - object information table
+ * the_class - object class
+ * supports_global - TRUE if this is a global object class
+ * maximum - maximum objects of this class
+ * size - size of this object's control block
+ * is_string - TRUE if names for this object are strings
+ * maximum_name_length - maximum length of each object's name
+ * is_thread - TRUE if this class is threads
+ *
+ * Output parameters: NONE
+ */
+
+void _Objects_Initialize_information(
+ Objects_Information *information,
+ Objects_Classes the_class,
+ boolean supports_global,
+ unsigned32 maximum,
+ unsigned32 size,
+ boolean is_string,
+ unsigned32 maximum_name_length,
+ boolean is_thread
+)
+{
+ static Objects_Control *null_local_table = NULL;
+
+ unsigned32 minimum_index;
+ unsigned32 index;
+ unsigned32 name_length;
+
+ information->the_class = the_class;
+ information->is_string = is_string;
+ information->is_thread = is_thread;
+
+ information->local_table = 0;
+ information->name_table = 0;
+ information->inactive_per_block = 0;
+ information->object_blocks = 0;
+
+ information->inactive = 0;
+
+ /*
+ * Set the entry in the object information table.
+ */
+
+ _Objects_Information_table[ the_class ] = information;
+
+ /*
+ * Set the size of the object
+ */
+
+ information->size = size;
+
+ /*
+ * Are we operating in unlimited, or auto-extend mode
+ */
+
+ information->auto_extend = (maximum & OBJECTS_UNLIMITED_OBJECTS) ? TRUE : FALSE;
+ maximum &= ~OBJECTS_UNLIMITED_OBJECTS;
+
+ /*
+ * The allocation unit is the maximum value
+ */
+
+ information->allocation_size = maximum;
+
+ /*
+ * Provide a null local table entry for the case of any empty table.
+ */
+
+ information->local_table = &null_local_table;
+
+ /*
+ * Calculate minimum and maximum Id's
+ */
+
+ if ( maximum == 0 ) minimum_index = 0;
+ else minimum_index = 1;
+
+ information->minimum_id =
+ _Objects_Build_id( the_class, _Objects_Local_node, minimum_index );
+
+ /*
+ * Calculate the maximum name length
+ */
+
+ name_length = maximum_name_length;
+
+ if ( name_length & (OBJECTS_NAME_ALIGNMENT-1) )
+ name_length = (name_length + OBJECTS_NAME_ALIGNMENT) &
+ ~(OBJECTS_NAME_ALIGNMENT-1);
+
+ information->name_length = name_length;
+
+ _Chain_Initialize_empty( &information->Inactive );
+
+ /*
+ * Initialize objects .. if there are any
+ */
+
+ if ( maximum ) {
+
+ /*
+ * Reset the maximum value. It will be updated when the information is
+ * extended.
+ */
+
+ information->maximum = 0;
+
+ /*
+ * Always have the maximum size available so the current performance
+ * figures are create are met. If the user moves past the maximum
+ * number then a performance hit is taken.
+ */
+
+ _Objects_Extend_information( information );
+
+ }
+
+ /*
+ * Take care of multiprocessing
+ */
+
+ if ( supports_global == TRUE && _System_state_Is_multiprocessing ) {
+
+ information->global_table =
+ (Chain_Control *) _Workspace_Allocate_or_fatal_error(
+ (_Objects_Maximum_nodes + 1) * sizeof(Chain_Control)
+ );
+
+ for ( index=1; index <= _Objects_Maximum_nodes ; index++ )
+ _Chain_Initialize_empty( &information->global_table[ index ] );
+ }
+ else
+ information->global_table = NULL;
+}