[f7f1d77] | 1 | /** |
---|
| 2 | * @file |
---|
[317a5b5] | 3 | * |
---|
[f7f1d77] | 4 | * @brief Initialize Object Information |
---|
| 5 | * @ingroup ScoreObject |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | /* |
---|
[8b53dee] | 9 | * COPYRIGHT (c) 1989-2011. |
---|
[317a5b5] | 10 | * On-Line Applications Research Corporation (OAR). |
---|
| 11 | * |
---|
| 12 | * The license and distribution terms for this file may be |
---|
| 13 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
---|
[317a5b5] | 15 | */ |
---|
| 16 | |
---|
[a8eed23] | 17 | #if HAVE_CONFIG_H |
---|
| 18 | #include "config.h" |
---|
| 19 | #endif |
---|
| 20 | |
---|
[a2e3f33] | 21 | #include <rtems/score/objectimpl.h> |
---|
[6e93dc4a] | 22 | #include <rtems/score/chainimpl.h> |
---|
[a2e3f33] | 23 | #include <rtems/score/interr.h> |
---|
[317a5b5] | 24 | #include <rtems/score/sysstate.h> |
---|
[a2e3f33] | 25 | #include <rtems/score/wkspace.h> |
---|
[317a5b5] | 26 | |
---|
[21275b58] | 27 | void _Objects_Initialize_information( |
---|
| 28 | Objects_Information *information |
---|
[317a5b5] | 29 | ) |
---|
| 30 | { |
---|
[21275b58] | 31 | Objects_Id maximum_id; |
---|
| 32 | Objects_Id api_class_and_node; |
---|
| 33 | Objects_Maximum maximum; |
---|
| 34 | Objects_Maximum index; |
---|
| 35 | Chain_Node *head; |
---|
| 36 | Chain_Node *tail; |
---|
| 37 | Chain_Node *current; |
---|
| 38 | Objects_Control *next; |
---|
[317a5b5] | 39 | |
---|
[21275b58] | 40 | maximum_id = information->maximum_id; |
---|
[05279b84] | 41 | |
---|
[21275b58] | 42 | #if defined(RTEMS_MULTIPROCESSING) |
---|
| 43 | maximum_id |= _Objects_Local_node << OBJECTS_NODE_START_BIT; |
---|
| 44 | information->maximum_id = maximum_id; |
---|
| 45 | #endif |
---|
[eabaf58] | 46 | |
---|
[21275b58] | 47 | maximum = _Objects_Get_index( maximum_id ); |
---|
| 48 | api_class_and_node = maximum_id & ~OBJECTS_INDEX_MASK; |
---|
[317a5b5] | 49 | |
---|
| 50 | /* |
---|
[21275b58] | 51 | * Register this Object Class in the Object Information Table. |
---|
[317a5b5] | 52 | */ |
---|
[21275b58] | 53 | _Objects_Information_table[ _Objects_Get_API( maximum_id ) ] |
---|
| 54 | [ _Objects_Get_class( maximum_id ) ] = information; |
---|
[317a5b5] | 55 | |
---|
[21275b58] | 56 | head = _Chain_Head( &information->Inactive ); |
---|
| 57 | tail = _Chain_Tail( &information->Inactive ); |
---|
| 58 | current = head; |
---|
| 59 | next = information->initial_objects; |
---|
[317a5b5] | 60 | |
---|
[21275b58] | 61 | head->previous = NULL; |
---|
[05279b84] | 62 | |
---|
[21275b58] | 63 | for ( index = OBJECTS_INDEX_MINIMUM; index <= maximum ; ++index ) { |
---|
| 64 | current->next = &next->Node; |
---|
| 65 | next->Node.previous = current; |
---|
| 66 | current = &next->Node; |
---|
| 67 | next->id = api_class_and_node | ( index << OBJECTS_INDEX_START_BIT ); |
---|
| 68 | next = _Addresses_Add_offset( next, information->object_size ); |
---|
[317a5b5] | 69 | } |
---|
| 70 | |
---|
[21275b58] | 71 | current->next = tail; |
---|
| 72 | tail->previous = current; |
---|
[317a5b5] | 73 | } |
---|