OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [score/] [src/] [objectinitializeinformation.c] - Blame information for rev 449

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: objectinitializeinformation.c,v 1.2 2001-09-27 11:59:34 chris Exp $
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
 *    the_class           - object class
36
 *    supports_global     - TRUE if this is a global object class
37
 *    maximum             - maximum objects of this class
38
 *    size                - size of this object's control block
39
 *    is_string           - TRUE if names for this object are strings
40
 *    maximum_name_length - maximum length of each object's name
41
 *    is_thread           - TRUE if this class is threads
42
 *
43
 *  Output parameters:  NONE
44
 */
45
 
46
void _Objects_Initialize_information(
47
  Objects_Information *information,
48
  Objects_Classes      the_class,
49
  boolean              supports_global,
50
  unsigned32           maximum,
51
  unsigned32           size,
52
  boolean              is_string,
53
  unsigned32           maximum_name_length,
54
  boolean              is_thread
55
)
56
{
57
  static Objects_Control *null_local_table = NULL;
58
 
59
  unsigned32       minimum_index;
60
  unsigned32       index;
61
  unsigned32       name_length;
62
 
63
  information->the_class          = the_class;
64
  information->is_string          = is_string;
65
  information->is_thread          = is_thread;
66
 
67
  information->local_table        = 0;
68
  information->name_table         = 0;
69
  information->inactive_per_block = 0;
70
  information->object_blocks      = 0;
71
 
72
  information->inactive           = 0;
73
 
74
  /*
75
   *  Set the entry in the object information table.
76
   */
77
 
78
  _Objects_Information_table[ the_class ] = information;
79
 
80
  /*
81
   *  Set the size of the object
82
   */
83
 
84
  information->size = size;
85
 
86
  /*
87
   *  Are we operating in unlimited, or auto-extend mode
88
   */
89
 
90
  information->auto_extend = (maximum & OBJECTS_UNLIMITED_OBJECTS) ? TRUE : FALSE;
91
  maximum                 &= ~OBJECTS_UNLIMITED_OBJECTS;
92
 
93
  /*
94
   *  The allocation unit is the maximum value
95
   */
96
 
97
  information->allocation_size = maximum;
98
 
99
  /*
100
   *  Provide a null local table entry for the case of any empty table.
101
   */
102
 
103
  information->local_table = &null_local_table;
104
 
105
  /*
106
   *  Calculate minimum and maximum Id's
107
   */
108
 
109
  if ( maximum == 0 ) minimum_index = 0;
110
  else                minimum_index = 1;
111
 
112
  information->minimum_id =
113
    _Objects_Build_id( the_class, _Objects_Local_node, minimum_index );
114
 
115
  /*
116
   *  Calculate the maximum name length
117
   */
118
 
119
  name_length = maximum_name_length;
120
 
121
  if ( name_length & (OBJECTS_NAME_ALIGNMENT-1) )
122
    name_length = (name_length + OBJECTS_NAME_ALIGNMENT) &
123
                  ~(OBJECTS_NAME_ALIGNMENT-1);
124
 
125
  information->name_length = name_length;
126
 
127
  _Chain_Initialize_empty( &information->Inactive );
128
 
129
  /*
130
   *  Initialize objects .. if there are any
131
   */
132
 
133
  if ( maximum ) {
134
 
135
    /*
136
     *  Reset the maximum value. It will be updated when the information is
137
     *  extended.
138
     */
139
 
140
    information->maximum = 0;
141
 
142
    /*
143
     *  Always have the maximum size available so the current performance
144
     *  figures are create are met.  If the user moves past the maximum
145
     *  number then a performance hit is taken.
146
     */
147
 
148
    _Objects_Extend_information( information );
149
 
150
  }
151
 
152
  /*
153
   *  Take care of multiprocessing
154
   */
155
 
156
  if ( supports_global == TRUE && _System_state_Is_multiprocessing ) {
157
 
158
    information->global_table =
159
      (Chain_Control *) _Workspace_Allocate_or_fatal_error(
160
        (_Objects_Maximum_nodes + 1) * sizeof(Chain_Control)
161
      );
162
 
163
    for ( index=1; index <= _Objects_Maximum_nodes ; index++ )
164
      _Chain_Initialize_empty( &information->global_table[ index ] );
165
   }
166
   else
167
     information->global_table = NULL;
168
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.