1 | /* object.inl |
---|
2 | * |
---|
3 | * This include file contains the macro implementation of all |
---|
4 | * of the inlined routines in the Object Handler. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * object.inl,v 1.2 1995/05/31 16:49:20 joel Exp |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __OBJECTS_inl |
---|
18 | #define __OBJECTS_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Objects_Is_name_valid |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
26 | #define _Objects_Is_name_valid( _name ) \ |
---|
27 | ( (_name) != 0 ) |
---|
28 | |
---|
29 | /* |
---|
30 | * rtems_name_to_characters |
---|
31 | * |
---|
32 | */ |
---|
33 | |
---|
34 | #define rtems_name_to_characters( _name, _c1, _c2, _c3, _c4 ) \ |
---|
35 | { \ |
---|
36 | (*(_c1) = ((_name) >> 24) & 0xff; \ |
---|
37 | (*(_c2) = ((_name) >> 16) & 0xff; \ |
---|
38 | (*(_c3) = ((_name) >> 8) & 0xff; \ |
---|
39 | (*(_c4) = ((_name)) & 0xff; \ |
---|
40 | } |
---|
41 | |
---|
42 | /*PAGE |
---|
43 | * |
---|
44 | * _Objects_Build_id |
---|
45 | * |
---|
46 | */ |
---|
47 | |
---|
48 | #define _Objects_Build_id( _node, _index ) \ |
---|
49 | ( ((_node) << 16) | (_index) ) |
---|
50 | |
---|
51 | /*PAGE |
---|
52 | * |
---|
53 | * rtems_get_node |
---|
54 | * |
---|
55 | */ |
---|
56 | |
---|
57 | #define rtems_get_node( _id ) \ |
---|
58 | ((_id) >> 16) |
---|
59 | |
---|
60 | /*PAGE |
---|
61 | * |
---|
62 | * rtems_get_index |
---|
63 | * |
---|
64 | */ |
---|
65 | |
---|
66 | #define rtems_get_index( _id ) \ |
---|
67 | ((_id) & 0xFFFF) |
---|
68 | |
---|
69 | /*PAGE |
---|
70 | * |
---|
71 | * _Objects_Is_local_node |
---|
72 | * |
---|
73 | */ |
---|
74 | |
---|
75 | #define _Objects_Is_local_node( _node ) \ |
---|
76 | ( (_node) == _Objects_Local_node ) |
---|
77 | |
---|
78 | /*PAGE |
---|
79 | * |
---|
80 | * _Objects_Is_local_id |
---|
81 | * |
---|
82 | */ |
---|
83 | |
---|
84 | #define _Objects_Is_local_id( _id ) \ |
---|
85 | _Objects_Is_local_node( rtems_get_node(_id) ) |
---|
86 | |
---|
87 | /*PAGE |
---|
88 | * |
---|
89 | * _Objects_Are_ids_equal |
---|
90 | * |
---|
91 | */ |
---|
92 | |
---|
93 | #define _Objects_Are_ids_equal( _left, _right ) \ |
---|
94 | ( (_left) == (_right) ) |
---|
95 | |
---|
96 | /*PAGE |
---|
97 | * |
---|
98 | * _Objects_Allocate |
---|
99 | * |
---|
100 | */ |
---|
101 | |
---|
102 | #define _Objects_Allocate( _information ) \ |
---|
103 | (Objects_Control *) _Chain_Get( &(_information)->Inactive ) |
---|
104 | |
---|
105 | /*PAGE |
---|
106 | * |
---|
107 | * _Objects_Free |
---|
108 | * |
---|
109 | */ |
---|
110 | |
---|
111 | #define _Objects_Free( _information, _the_object ) \ |
---|
112 | _Chain_Append( &(_information)->Inactive, &(_the_object)->Node ) |
---|
113 | |
---|
114 | /*PAGE |
---|
115 | * |
---|
116 | * _Objects_Open |
---|
117 | * |
---|
118 | */ |
---|
119 | |
---|
120 | #define _Objects_Open( _information, _the_object, _name ) \ |
---|
121 | { \ |
---|
122 | unsigned32 _index; \ |
---|
123 | \ |
---|
124 | _index = rtems_get_index( (_the_object)->id ); \ |
---|
125 | (_information)->local_table[ _index ] = (_the_object); \ |
---|
126 | (_information)->name_table[ _index ] = (_name); \ |
---|
127 | } |
---|
128 | |
---|
129 | /*PAGE |
---|
130 | * |
---|
131 | * _Objects_Close |
---|
132 | * |
---|
133 | */ |
---|
134 | |
---|
135 | #define _Objects_Close( _information, _the_object ) \ |
---|
136 | { \ |
---|
137 | unsigned32 _index; \ |
---|
138 | \ |
---|
139 | _index = rtems_get_index( (_the_object)->id ); \ |
---|
140 | (_information)->local_table[ _index ] = NULL; \ |
---|
141 | (_information)->name_table[ _index ] = 0; \ |
---|
142 | } |
---|
143 | |
---|
144 | #endif |
---|
145 | /* end of include file */ |
---|