source: rtems/cpukit/score/src/objectallocatebyindex.c @ bd029d87

4.8
Last change on this file since bd029d87 was bd029d87, checked in by Joel Sherrill <joel.sherrill@…>, on 08/04/08 at 19:49:33

2008-08-04 Joel Sherrill <joel.sherrill@…>

PR 1265/cpukit

  • score/include/rtems/score/object.h, score/src/objectallocatebyindex.c: Rename index argument to avoid warning when rtems.h and string.h are included at the same time by user code.
  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[317a5b5]1/*
2 *  Object Handler
3 *
4 *
[08311cc3]5 *  COPYRIGHT (c) 1989-1999.
[317a5b5]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
[dd687d97]10 *  http://www.rtems.com/license/LICENSE.
[317a5b5]11 *
12 *  $Id$
13 */
14
[a8eed23]15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
[317a5b5]19#include <rtems/system.h>
20#include <rtems/score/address.h>
21#include <rtems/score/chain.h>
22#include <rtems/score/object.h>
23#if defined(RTEMS_MULTIPROCESSING)
24#include <rtems/score/objectmp.h>
25#endif
26#include <rtems/score/thread.h>
27#include <rtems/score/wkspace.h>
28#include <rtems/score/sysstate.h>
29#include <rtems/score/isr.h>
30
31/*PAGE
32 *
33 *  _Objects_Allocate_by_index
34 *
35 *  DESCRIPTION:
36 *
[a0ed4ed]37 *  This function allocates the object control block
38 *  specified by the index from the inactive chain of
[317a5b5]39 *  free object control blocks.
40 */
41
42Objects_Control *_Objects_Allocate_by_index(
43  Objects_Information *information,
[bd029d87]44  uint16_t             the_index,
[c7b7f38]45  uint16_t             sizeof_control
[317a5b5]46)
47{
48  Objects_Control *the_object;
49
[bd029d87]50  if ( the_index && information->maximum >= the_index ) {
51    the_object = information->local_table[ the_index ];
[317a5b5]52    if ( the_object )
53      return NULL;
54
55    /* XXX
56     *  This whole section of code needs to be addressed.
[6af81435]57     *    +  The 0 should be dealt with more properly so we can autoextend.
58     *    +  The pointer arithmetic is probably too expensive.
[317a5b5]59     *    +  etc.
60     */
[05279b84]61
[6af81435]62    the_object = (Objects_Control *) _Addresses_Add_offset(
63      information->object_blocks[ 0 ],
[bd029d87]64      (sizeof_control * (the_index - 1))
[6af81435]65    );
[317a5b5]66    _Chain_Extract( &the_object->Node );
[05279b84]67
[a0ed4ed]68    return the_object;
69  }
[317a5b5]70
71  /*
72   *  Autoextend will have to be thought out as it applies
73   *  to user assigned indices.
74   */
75
76  return NULL;
77}
Note: See TracBrowser for help on using the repository browser.