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

4.104.114.84.95
Last change on this file since a85d8ec was ef9505a9, checked in by Joel Sherrill <joel.sherrill@…>, on 07/01/02 at 22:30:12

2002-07-01 Joel Sherrill <joel@…>

  • Mega patch merge to change the format of the object IDs to loosen the dependency between the SCORE and the various APIs. There was considerable work to simplify the object name management and it appears that the name_table field is no longer needed. This patch also includes the addition of the internal mutex which is currently only used to protect some types of allocation and deallocation. This significantly can reduce context switch latency under certain circumstances. In particular, some heap/region operations were O(n) and had dispatching disabled. This should help enormously. With this merge, the patch is not as clean as it should be. In particular, the documentation has not been modified to reflect the new object ID layout, the IDs in the test screens are not updated, and _Objects_Get_information needs to be a real routine not inlined. As part of this patch a lot of MP code for thread/proxy blocking was made conditional and cleaned up.
  • include/Makefile.am, include/rtems/score/coremsg.h, include/rtems/score/coremutex.h, include/rtems/score/coresem.h, include/rtems/score/object.h, include/rtems/score/threadq.h, inline/rtems/score/object.inl, inline/rtems/score/thread.inl, macros/rtems/score/object.inl, src/Makefile.am, src/coremsg.c, src/coremutex.c, src/coresem.c, src/mpci.c, src/objectcomparenameraw.c, src/objectextendinformation.c, src/objectinitializeinformation.c, src/objectnametoid.c, src/thread.c, src/threadclose.c, src/threadget.c, src/threadq.c, src/threadqextractwithproxy.c: Modified as part of above.
  • include/rtems/score/apimutex.h, src/objectgetnoprotection.c: New files.
  • 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.OARcorp.com/rtems/license.html.
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.