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 | |
---|
39 | Objects_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 ) { |
---|
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 | |
---|
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. |
---|
60 | * + The use of the index 0 for object_blocks should be dealt |
---|
61 | * with more properly so we can autoextend. |
---|
62 | * + etc. |
---|
63 | */ |
---|
64 | |
---|
65 | the_object = (Objects_Control *) information->object_blocks[ 0 ]; |
---|
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 | } |
---|