source: rtems/c/src/exec/score/macros/rtems/score/object.inl @ b804d632

4.104.114.84.95
Last change on this file since b804d632 was b804d632, checked in by Joel Sherrill <joel.sherrill@…>, on 12/20/01 at 17:30:18

2001-12-19 Ralf Corsepius <corsepiu@…>

  • inline/rtems/score/object.inl, macros/rtems/score/object.inl: Add add casts to Objects_Id in _Objects_Build_ids to avoid implicit typecasts from enum to int16 on bit16 targets (here: h8300).
  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[ac7d5ef0]1/*  object.inl
2 *
3 *  This include file contains the macro implementation of all
4 *  of the inlined routines in the Object Handler.
5 *
[08311cc3]6 *  COPYRIGHT (c) 1989-1999.
[ac7d5ef0]7 *  On-Line Applications Research Corporation (OAR).
8 *
[98e4ebf5]9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
[03f2154e]11 *  http://www.OARcorp.com/rtems/license.html.
[ac7d5ef0]12 *
[6b45e470]13 *  $Id$
[ac7d5ef0]14 */
15
16#ifndef __OBJECTS_inl
17#define __OBJECTS_inl
18
19/*PAGE
20 *
21 *  _Objects_Build_id
22 *
23 */
24
[95fbca1]25#define _Objects_Build_id( _the_class, _node, _index ) \
[b804d632]26  ( (( (Objects_Id) the_class ) << OBJECTS_CLASS_START_BIT) | \
27    (( (Objects_Id) node ) << OBJECTS_NODE_START_BIT)       | \
28    (( (Objects_Id) index ) << OBJECTS_INDEX_START_BIT) )
[95fbca1]29
30/*PAGE
31 *
[3a4ae6c]32 *  _Objects_Get_class
[95fbca1]33 */
34 
[3a4ae6c]35#define _Objects_Get_class( _id ) \
[95fbca1]36  (Objects_Classes) \
37    (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS)
[ac7d5ef0]38
39/*PAGE
40 *
[3a4ae6c]41 *  _Objects_Get_node
[ac7d5ef0]42 *
43 */
44
[3a4ae6c]45#define _Objects_Get_node( _id ) \
[95fbca1]46  (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS)
[ac7d5ef0]47
48/*PAGE
49 *
[3a4ae6c]50 *  _Objects_Get_index
[ac7d5ef0]51 *
52 */
53
[3a4ae6c]54#define _Objects_Get_index( _id ) \
[95fbca1]55  (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
[ac7d5ef0]56
[7f6a24ab]57/*PAGE
58 *
59 *  _Objects_Is_class_valid
60 *
61 */
62 
63#define _Objects_Is_class_valid( _the_class ) \
[7e4c3d8b]64  ( (_the_class) && (_the_class) <= OBJECTS_CLASSES_LAST )
[7f6a24ab]65
[ac7d5ef0]66/*PAGE
67 *
68 *  _Objects_Is_local_node
69 *
70 */
71
72#define _Objects_Is_local_node( _node ) \
73  ( (_node) == _Objects_Local_node )
74
75/*PAGE
76 *
77 *  _Objects_Is_local_id
78 *
79 */
80
81#define _Objects_Is_local_id( _id ) \
[3a4ae6c]82  _Objects_Is_local_node( _Objects_Get_node(_id) )
[ac7d5ef0]83
84/*PAGE
85 *
86 *  _Objects_Are_ids_equal
87 *
88 */
89
90#define _Objects_Are_ids_equal( _left, _right ) \
91  ( (_left) == (_right) )
92
93/*PAGE
94 *
[f4a8ee1]95 *  _Objects_Get_local_object
[ac7d5ef0]96 *
97 */
98
[c9fd602]99#define _Objects_Get_local_object( _information, _index ) \
100  ( ( (_index) > (_information)->maximum) ?  NULL : \
101                       (_information)->local_table[ (_index) ] )
[ac7d5ef0]102
103/*PAGE
104 *
[f4a8ee1]105 *  _Objects_Set_local_object
[ac7d5ef0]106 *
107 */
108
[f4a8ee1]109#define _Objects_Set_local_object( information, index, the_object ) \
110  { \
111    if ( index <= information->maximum) \
112      information->local_table[ index ] = the_object; \
113  }
114
115
116/*PAGE
117 *
118 *  _Objects_Get_information
119 *
120 */
121 
122#define _Objects_Get_information( id ) \
123 ( \
124   ( !_Objects_Is_class_valid( _Objects_Get_class( id ) ) ) ? \
125     NULL : \
126     _Objects_Information_table[ _Objects_Get_class( id ) ] \
127 )
[ac7d5ef0]128
129/*PAGE
130 *
131 *  _Objects_Open
132 *
133 */
134
135#define _Objects_Open( _information, _the_object, _name ) \
136  { \
137    unsigned32 _index; \
138    \
[3a4ae6c]139    _index = _Objects_Get_index( (_the_object)->id ); \
[ac7d5ef0]140    (_information)->local_table[ _index ] = (_the_object); \
[3235ad9]141    \
142    if ( (_information)->is_string ) \
143      _Objects_Copy_name_string( (_name), (_the_object)->name ); \
144    else \
145      _Objects_Copy_name_raw( \
146        (_name), (_the_object)->name, (_information)->name_length ); \
[ac7d5ef0]147  }
148
149/*PAGE
150 *
151 *  _Objects_Close
152 *
153 */
154
155#define _Objects_Close( _information, _the_object ) \
156  { \
157    unsigned32 _index; \
158    \
[3a4ae6c]159    _index = _Objects_Get_index( (_the_object)->id ); \
[6ab91d9]160    (_information)->local_table[ _index ] = (Objects_Control *) NULL; \
[3235ad9]161    _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \
[ac7d5ef0]162  }
163
[c9fd602]164/*PAGE
165 *
166 *  _Objects_Namespace_remove
167 */
168
169#define _Objects_Namespace_remove( _information, _the_object ) \
170  _Objects_Clear_name( (_the_object)->name, (_information)->name_length )
171
[ac7d5ef0]172#endif
173/* end of include file */
Note: See TracBrowser for help on using the repository browser.