source: rtems/cpukit/score/src/objectinitializeinformation.c @ 21275b58

Last change on this file since 21275b58 was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 22, 2018 at 6:14:51 PM

score: Static Objects_Information initialization

Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/**
2 * @file
3 *
4 * @brief Initialize Object Information
5 * @ingroup ScoreObject
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2011.
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
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/objectimpl.h>
22#include <rtems/score/chainimpl.h>
23#include <rtems/score/interr.h>
24#include <rtems/score/sysstate.h>
25#include <rtems/score/wkspace.h>
26
27void _Objects_Initialize_information(
28  Objects_Information *information
29)
30{
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;
39
40  maximum_id = information->maximum_id;
41
42#if defined(RTEMS_MULTIPROCESSING)
43  maximum_id |= _Objects_Local_node << OBJECTS_NODE_START_BIT;
44  information->maximum_id = maximum_id;
45#endif
46
47  maximum = _Objects_Get_index( maximum_id );
48  api_class_and_node = maximum_id & ~OBJECTS_INDEX_MASK;
49
50  /*
51   *  Register this Object Class in the Object Information Table.
52   */
53  _Objects_Information_table[ _Objects_Get_API( maximum_id ) ]
54    [ _Objects_Get_class( maximum_id ) ] = information;
55
56  head = _Chain_Head( &information->Inactive );
57  tail = _Chain_Tail( &information->Inactive );
58  current = head;
59  next = information->initial_objects;
60
61  head->previous = NULL;
62
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 );
69  }
70
71  current->next = tail;
72  tail->previous = current;
73}
Note: See TracBrowser for help on using the repository browser.