source: rtems/cpukit/score/src/objectinitializeinformation.c @ a6eef8b

Last change on this file since a6eef8b was a6eef8b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:52:48

2003-09-04 Joel Sherrill <joel@…>

  • apiext.c, chain.c, coremsg.c, coremsgbroadcast.c, coremsgclose.c, coremsgflush.c, coremsgflushsupp.c, coremsgflushwait.c, coremsginsert.c, coremsgseize.c, coremsgsubmit.c, coremutex.c, coremutexflush.c, coremutexseize.c, coremutexsurrender.c, coresem.c, coresemflush.c, coresemseize.c, coresemsurrender.c, coretod.c, coretodset.c, coretodtickle.c, coretodtoseconds.c, coretodvalidate.c, heap.c, heapallocate.c, heapextend.c, heapfree.c, heapgetinfo.c, heapsizeofuserarea.c, heapwalk.c, interr.c, isr.c, mpci.c, object.c, objectallocate.c, objectallocatebyindex.c, objectclearname.c, objectcomparenameraw.c, objectcomparenamestring.c, objectcopynameraw.c, objectcopynamestring.c, objectextendinformation.c, objectfree.c, objectget.c, objectgetbyindex.c, objectgetisr.c, objectgetnext.c, objectgetnoprotection.c, objectinitializeinformation.c, objectmp.c, objectnametoid.c, objectshrinkinformation.c, thread.c, threadchangepriority.c, threadclearstate.c, threadclose.c, threadcreateidle.c, threaddelayended.c, threaddispatch.c, threadevaluatemode.c, threadget.c, threadhandler.c, threadidlebody.c, threadinitialize.c, threadloadenv.c, threadmp.c, threadq.c, threadqdequeue.c, threadqdequeuefifo.c, threadqdequeuepriority.c, threadqenqueue.c, threadqenqueuefifo.c, threadqenqueuepriority.c, threadqextract.c, threadqextractfifo.c, threadqextractpriority.c, threadqextractwithproxy.c, threadqfirst.c, threadqfirstfifo.c, threadqfirstpriority.c, threadqflush.c, threadqtimeout.c, threadready.c, threadreset.c, threadresettimeslice.c, threadrestart.c, threadresume.c, threadrotatequeue.c, threadsetpriority.c, threadsetstate.c, threadsettransient.c, threadstackallocate.c, threadstackfree.c, threadstart.c, threadstartmultitasking.c, threadsuspend.c, threadtickletimeslice.c, threadyieldprocessor.c, userext.c, watchdog.c, watchdogadjust.c, watchdoginsert.c, watchdogremove.c, watchdogtickle.c, wkspace.c: URL for license changed.
  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*
2 *  Object Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/score/address.h>
17#include <rtems/score/chain.h>
18#include <rtems/score/object.h>
19#if defined(RTEMS_MULTIPROCESSING)
20#include <rtems/score/objectmp.h>
21#endif
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24#include <rtems/score/sysstate.h>
25#include <rtems/score/isr.h>
26
27/*PAGE
28 *
29 *  _Objects_Initialize_information
30 *
31 *  This routine initializes all object information related data structures.
32 *
33 *  Input parameters:
34 *    information         - object information table
35 *    maximum             - maximum objects of this class
36 *    size                - size of this object's control block
37 *    is_string           - TRUE if names for this object are strings
38 *    maximum_name_length - maximum length of each object's name
39 *    When multiprocessing is configured,
40 *      supports_global     - TRUE if this is a global object class
41 *      extract_callout     - pointer to threadq extract callout if MP
42 *
43 *  Output parameters:  NONE
44 */
45
46void _Objects_Initialize_information(
47  Objects_Information *information,
48  Objects_APIs         the_api,
49  unsigned32           the_class,
50  unsigned32           maximum,
51  unsigned32           size,
52  boolean              is_string,
53  unsigned32           maximum_name_length
54#if defined(RTEMS_MULTIPROCESSING)
55  ,
56  boolean              supports_global,
57  Objects_Thread_queue_Extract_callout *extract
58#endif
59)
60{
61  static Objects_Control *null_local_table = NULL;
62  unsigned32       minimum_index;
63  unsigned32       name_length;
64#if defined(RTEMS_MULTIPROCESSING)
65  unsigned32       index;
66#endif
67
68  information->the_api            = the_api;
69  information->the_class          = the_class;
70  information->is_string          = is_string;
71 
72  information->local_table        = 0;
73  information->name_table         = 0;
74  information->inactive_per_block = 0;
75  information->object_blocks      = 0;
76 
77  information->inactive           = 0;
78 
79  /*
80   *  Set the entry in the object information table.
81   */
82
83  _Objects_Information_table[ the_api ][ the_class ] = information;
84
85  /*
86   *  Set the size of the object
87   */
88
89  information->size = size;
90 
91  /*
92   *  Are we operating in unlimited, or auto-extend mode
93   */
94
95  information->auto_extend = (maximum & OBJECTS_UNLIMITED_OBJECTS) ? TRUE : FALSE;
96  maximum                 &= ~OBJECTS_UNLIMITED_OBJECTS;
97 
98  /*
99   *  The allocation unit is the maximum value
100   */
101
102  information->allocation_size = maximum;
103
104  /*
105   *  Provide a null local table entry for the case of any empty table.
106   */
107
108  information->local_table = &null_local_table;
109
110  /*
111   *  Calculate minimum and maximum Id's
112   */
113
114  if ( maximum == 0 ) minimum_index = 0;
115  else                minimum_index = 1;
116
117  information->minimum_id =
118    _Objects_Build_id( the_api, the_class, _Objects_Local_node, minimum_index );
119
120  /*
121   *  Calculate the maximum name length
122   */
123
124  name_length = maximum_name_length;
125
126  if ( name_length & (OBJECTS_NAME_ALIGNMENT-1) )
127    name_length = (name_length + OBJECTS_NAME_ALIGNMENT) &
128                  ~(OBJECTS_NAME_ALIGNMENT-1);
129
130  information->name_length = name_length;
131
132  _Chain_Initialize_empty( &information->Inactive );
133   
134  /*
135   *  Initialize objects .. if there are any
136   */
137
138  if ( maximum ) {
139
140    /*
141     *  Reset the maximum value. It will be updated when the information is
142     *  extended.
143     */
144   
145    information->maximum = 0;
146   
147    /*
148     *  Always have the maximum size available so the current performance
149     *  figures are create are met.  If the user moves past the maximum
150     *  number then a performance hit is taken.
151     */
152   
153    _Objects_Extend_information( information );
154   
155  }
156
157  /*
158   *  Take care of multiprocessing
159   */
160
161#if defined(RTEMS_MULTIPROCESSING)
162  information->extract = extract;
163
164  if ( supports_global == TRUE && _System_state_Is_multiprocessing ) {
165
166    information->global_table =
167      (Chain_Control *) _Workspace_Allocate_or_fatal_error(
168        (_Objects_Maximum_nodes + 1) * sizeof(Chain_Control)
169      );
170
171    for ( index=1; index <= _Objects_Maximum_nodes ; index++ )
172      _Chain_Initialize_empty( &information->global_table[ index ] );
173   }
174   else
175     information->global_table = NULL;
176#endif
177}
Note: See TracBrowser for help on using the repository browser.