RTEMS
objectinitializeinformation.c
Go to the documentation of this file.
1 
9 /*
10  * COPYRIGHT (c) 1989-2011.
11  * On-Line Applications Research Corporation (OAR).
12  *
13  * The license and distribution terms for this file may be
14  * found in the file LICENSE in this distribution or at
15  * http://www.rtems.org/license/LICENSE.
16  */
17 
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
22 #include <rtems/score/objectimpl.h>
23 #include <rtems/score/address.h>
24 #include <rtems/score/chainimpl.h>
25 #include <rtems/score/interr.h>
26 #include <rtems/score/sysstate.h>
27 #include <rtems/score/wkspace.h>
28 
30  Objects_Information *information
31 )
32 {
33  Objects_Id maximum_id;
34  Objects_Id api_class_and_node;
35  Objects_Maximum maximum;
36  Objects_Maximum index;
37  Chain_Node *head;
38  Chain_Node *tail;
39  Chain_Node *current;
40  Objects_Control *next;
41 
42  maximum_id = information->maximum_id;
43 
44 #if defined(RTEMS_MULTIPROCESSING)
45  maximum_id &= ~OBJECTS_NODE_MASK;
47  information->maximum_id = maximum_id;
48 #endif
49 
50  maximum = _Objects_Get_index( maximum_id );
51  api_class_and_node = maximum_id & ~OBJECTS_INDEX_MASK;
52 
53  /*
54  * Register this Object Class in the Object Information Table.
55  */
57  [ _Objects_Get_class( maximum_id ) ] = information;
58 
59  head = _Chain_Head( &information->Inactive );
60  tail = _Chain_Tail( &information->Inactive );
61  current = head;
62  next = information->initial_objects;
63 
64  head->previous = NULL;
65 
66  for ( index = OBJECTS_INDEX_MINIMUM; index <= maximum ; ++index ) {
67  current->next = &next->Node;
68  next->Node.previous = current;
69  current = &next->Node;
70  next->id = api_class_and_node | ( index << OBJECTS_INDEX_START_BIT );
71  next = _Addresses_Add_offset( next, information->object_size );
72  }
73 
74  current->next = tail;
75  tail->previous = current;
76 }
Constants and Prototypes Related to the Internal Error Handler.
Chain_Node * previous
Definition: chain.h:72
#define OBJECTS_INDEX_START_BIT
Definition: object.h:92
#define OBJECTS_NODE_START_BIT
Definition: object.h:97
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
void _Objects_Initialize_information(Objects_Information *information)
Initializes the specified objects information.
#define OBJECTS_INDEX_MINIMUM
Definition: objectimpl.h:80
Chain_Control Inactive
This is the chain of inactive object control blocks.
Definition: objectdata.h:256
uint16_t Objects_Maximum
Definition: object.h:86
static __inline__ Objects_Maximum _Objects_Get_index(Objects_Id id)
Returns the index portion of the ID.
Definition: object.h:298
Objects_Control * initial_objects
This points to the object control blocks initially available.
Definition: objectdata.h:282
Inlined Routines in the Object Handler.
Objects_Id maximum_id
This is the maximum valid ID of this object API class.
Definition: objectdata.h:185
Chain_Node * next
Definition: chain.h:70
Information Required to Manipulate Physical Addresses.
Chain_Node Node
Definition: objectdata.h:41
static __inline__ Chain_Node * _Chain_Head(Chain_Control *the_chain)
Returns pointer to chain head.
Definition: chainimpl.h:195
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
static __inline__ uint32_t _Objects_Get_class(Objects_Id id)
Returns the class portion of the ID.
Definition: object.h:269
Chain Handler API.
#define _Objects_Local_node
The local MPCI node number.
Definition: object.h:347
#define OBJECTS_INDEX_MASK
Definition: object.h:114
System State Handler API.
uint32_t Objects_Id
Definition: object.h:80
#define OBJECTS_NODE_MASK
Definition: object.h:119
Information Related to the RAM Workspace.
static __inline__ Objects_APIs _Objects_Get_API(Objects_Id id)
Returns the API portion of the ID.
Definition: object.h:255
static __inline__ Chain_Node * _Chain_Tail(Chain_Control *the_chain)
Returns pointer to chain tail.
Definition: chainimpl.h:227
RTEMS_INLINE_ROUTINE void * _Addresses_Add_offset(const void *base, uintptr_t offset)
Adds offset to an address.
Definition: address.h:55
uint16_t object_size
This is the size in bytes of each object control block.
Definition: objectdata.h:238
Objects_Id id
Definition: objectdata.h:43