summaryrefslogtreecommitdiffstats
path: root/cpukit/score/macros/rtems/score/object.inl
blob: ddd311689b5be205c4efc9da91c32f85d8af714f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*  object.inl
 *
 *  This include file contains the macro implementation of all
 *  of the inlined routines in the Object Handler.
 *
 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
 *  On-Line Applications Research Corporation (OAR).
 *  All rights assigned to U.S. Government, 1994.
 *
 *  This material may be reproduced by or for the U.S. Government pursuant
 *  to the copyright license under the clause at DFARS 252.227-7013.  This
 *  notice must appear in all copies of this file and its derivatives.
 *
 *  object.inl,v 1.2 1995/05/31 16:49:20 joel Exp
 */

#ifndef __OBJECTS_inl
#define __OBJECTS_inl

/*PAGE
 *
 *  _Objects_Is_name_valid
 *
 */

#define _Objects_Is_name_valid( _name ) \
  ( (_name) != 0 )

/*
 *  rtems_name_to_characters
 *
 */

#define rtems_name_to_characters( _name, _c1, _c2, _c3, _c4 ) \
  { \
    (*(_c1) = ((_name) >> 24) & 0xff; \
    (*(_c2) = ((_name) >> 16) & 0xff; \
    (*(_c3) = ((_name) >> 8) & 0xff; \
    (*(_c4) = ((_name)) & 0xff; \
  }

/*PAGE
 *
 *  _Objects_Build_id
 *
 */

#define _Objects_Build_id( _node, _index ) \
  ( ((_node) << 16) | (_index) )

/*PAGE
 *
 *  rtems_get_node
 *
 */

#define rtems_get_node( _id ) \
  ((_id) >> 16)

/*PAGE
 *
 *  rtems_get_index
 *
 */

#define rtems_get_index( _id ) \
  ((_id) & 0xFFFF)

/*PAGE
 *
 *  _Objects_Is_local_node
 *
 */

#define _Objects_Is_local_node( _node ) \
  ( (_node) == _Objects_Local_node )

/*PAGE
 *
 *  _Objects_Is_local_id
 *
 */

#define _Objects_Is_local_id( _id ) \
  _Objects_Is_local_node( rtems_get_node(_id) )

/*PAGE
 *
 *  _Objects_Are_ids_equal
 *
 */

#define _Objects_Are_ids_equal( _left, _right ) \
  ( (_left) == (_right) )

/*PAGE
 *
 *  _Objects_Allocate
 *
 */

#define _Objects_Allocate( _information )  \
  (Objects_Control *) _Chain_Get( &(_information)->Inactive )

/*PAGE
 *
 *  _Objects_Free
 *
 */

#define _Objects_Free( _information, _the_object )  \
  _Chain_Append( &(_information)->Inactive, &(_the_object)->Node )

/*PAGE
 *
 *  _Objects_Open
 *
 */

#define _Objects_Open( _information, _the_object, _name ) \
  { \
    unsigned32 _index; \
    \
    _index = rtems_get_index( (_the_object)->id ); \
    (_information)->local_table[ _index ] = (_the_object); \
    (_information)->name_table[ _index ]  = (_name); \
  }

/*PAGE
 *
 *  _Objects_Close
 *
 */

#define _Objects_Close( _information, _the_object ) \
  { \
    unsigned32 _index; \
    \
    _index = rtems_get_index( (_the_object)->id ); \
    (_information)->local_table[ _index ] = NULL; \
    (_information)->name_table[ _index ]  = 0; \
  }

#endif
/* end of include file */