source: rtems/cpukit/score/src/objectallocatebyindex.c @ 713b2ea

4.104.114.84.95
Last change on this file since 713b2ea was 59d1127, checked in by Joel Sherrill <joel.sherrill@…>, on 11/10/99 at 22:14:26

Corrected to account for the way memory is divided up in
_Object_Extend_information. This change is a side-effect of the
change made to that file to fix an alignment problem.

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[317a5b5]1/*
2 *  Object Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/score/address.h>
18#include <rtems/score/chain.h>
19#include <rtems/score/object.h>
20#if defined(RTEMS_MULTIPROCESSING)
21#include <rtems/score/objectmp.h>
22#endif
23#include <rtems/score/thread.h>
24#include <rtems/score/wkspace.h>
25#include <rtems/score/sysstate.h>
26#include <rtems/score/isr.h>
27
28/*PAGE
29 *
30 *  _Objects_Allocate_by_index
31 *
32 *  DESCRIPTION:
33 *
34 *  This function allocates the object control block
35 *  specified by the index from the inactive chain of
36 *  free object control blocks.
37 */
38
39Objects_Control *_Objects_Allocate_by_index(
40  Objects_Information *information,
41  unsigned32           index,
42  unsigned32           sizeof_control
43)
44{
45  Objects_Control *the_object;
46
47  if ( index && information->maximum >= index ) {
[59d1127]48    /*
49     *  If the object is already in the local table, then
50     *  it has already been allocated/created by a previous
51     *  create call.
52     */
53
[317a5b5]54    the_object = _Objects_Get_local_object( information, index );
55    if ( the_object )
56      return NULL;
57
58    /* XXX
59     *  This whole section of code needs to be addressed.
[59d1127]60     *    +  The use of the index 0 for object_blocks should be dealt
61     *       with more properly so we can autoextend.
[317a5b5]62     *    +  etc.
63     */
64   
[59d1127]65    the_object = (Objects_Control *) information->object_blocks[ 0 ];
[317a5b5]66
67    _Chain_Extract( &the_object->Node );
68 
69    return the_object;   
70  }   
71
72  /*
73   *  Autoextend will have to be thought out as it applies
74   *  to user assigned indices.
75   */
76
77  return NULL;
78}
Note: See TracBrowser for help on using the repository browser.