1 | /** |
---|
2 | * @file rtems/score/objectmp.h |
---|
3 | * |
---|
4 | * @brief Data Associated with the Manipulation of Global RTEMS Objects |
---|
5 | * |
---|
6 | * This include file contains all the constants and structures associated |
---|
7 | * with the manipulation of Global RTEMS Objects. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2009. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.com/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_SCORE_OBJECTMP_H |
---|
20 | #define _RTEMS_SCORE_OBJECTMP_H |
---|
21 | |
---|
22 | #ifndef _RTEMS_SCORE_OBJECTIMPL_H |
---|
23 | # error "Never use <rtems/rtems/objectmp.h> directly; include <rtems/rtems/objectimpl.h> instead." |
---|
24 | #endif |
---|
25 | |
---|
26 | #include <rtems/score/chainimpl.h> |
---|
27 | |
---|
28 | #ifdef __cplusplus |
---|
29 | extern "C" { |
---|
30 | #endif |
---|
31 | |
---|
32 | /** |
---|
33 | * @defgroup ScoreObjectMP Object Handler Multiprocessing Support |
---|
34 | * |
---|
35 | * @ingroup Score |
---|
36 | * |
---|
37 | * This handler encapsulates functionality which is used to manage |
---|
38 | * objects which have been declared to be globally visible. This handler |
---|
39 | * knows objects from all of the nodes in the system. |
---|
40 | */ |
---|
41 | /**@{*/ |
---|
42 | |
---|
43 | /** |
---|
44 | * @brief Intializes the inactive global object chain |
---|
45 | * based on the maximum number of global objects configured. |
---|
46 | * |
---|
47 | * This routine intializes the inactive global object chain |
---|
48 | * based on the maximum number of global objects configured. |
---|
49 | */ |
---|
50 | void _Objects_MP_Handler_initialization(void); |
---|
51 | |
---|
52 | /** |
---|
53 | * @brief Intializes the global object node number |
---|
54 | * used in the ID field of all objects. |
---|
55 | * |
---|
56 | * This routine intializes the global object node number |
---|
57 | * used in the ID field of all objects. |
---|
58 | */ |
---|
59 | void _Objects_MP_Handler_early_initialization(void); |
---|
60 | |
---|
61 | /** |
---|
62 | * @brief Place the specified global object in the |
---|
63 | * specified information table. |
---|
64 | * |
---|
65 | * This routine place the specified global object in the |
---|
66 | * specified information table. |
---|
67 | * |
---|
68 | * @param[in] information points to the object information table for this |
---|
69 | * object class. |
---|
70 | * @param[in] the_global_object points to the object being opened. |
---|
71 | * @param[in] the_name is the name of the object being opened. |
---|
72 | * @param[in] the_id is the Id of the object being opened. |
---|
73 | * |
---|
74 | * @todo This method only works for object types with 4 byte object names. |
---|
75 | * It does not support variable length object names. |
---|
76 | */ |
---|
77 | void _Objects_MP_Open ( |
---|
78 | Objects_Information *information, |
---|
79 | Objects_MP_Control *the_global_object, |
---|
80 | uint32_t the_name, |
---|
81 | Objects_Id the_id |
---|
82 | ); |
---|
83 | |
---|
84 | /** |
---|
85 | * @brief Allocates a global object control block |
---|
86 | * and places it in the specified information table. |
---|
87 | * |
---|
88 | * This routine allocates a global object control block |
---|
89 | * and places it in the specified information table. If the |
---|
90 | * allocation fails, then is_fatal_error determines the |
---|
91 | * error processing actions taken. |
---|
92 | * |
---|
93 | * @param[in] information points to the object information table for this |
---|
94 | * object class. |
---|
95 | * @param[in] the_name is the name of the object being opened. |
---|
96 | * @param[in] the_id is the Id of the object being opened. |
---|
97 | * @param[in] is_fatal_error is true if not being able to allocate the |
---|
98 | * object is considered a fatal error. |
---|
99 | * |
---|
100 | * @todo This method only works for object types with 4 byte object names. |
---|
101 | * It does not support variable length object names. |
---|
102 | */ |
---|
103 | bool _Objects_MP_Allocate_and_open ( |
---|
104 | Objects_Information *information, |
---|
105 | uint32_t the_name, |
---|
106 | Objects_Id the_id, |
---|
107 | bool is_fatal_error |
---|
108 | ); |
---|
109 | |
---|
110 | /** |
---|
111 | * @brief Removes a global object from the specified information table. |
---|
112 | * |
---|
113 | * This routine removes a global object from the specified |
---|
114 | * information table and deallocates the global object control block. |
---|
115 | */ |
---|
116 | void _Objects_MP_Close ( |
---|
117 | Objects_Information *information, |
---|
118 | Objects_Id the_id |
---|
119 | ); |
---|
120 | |
---|
121 | /** |
---|
122 | * @brief Look for the object with the_name in the global |
---|
123 | * object tables indicated by information. |
---|
124 | * |
---|
125 | * This routine looks for the object with the_name in the global |
---|
126 | * object tables indicated by information. It returns the ID of the |
---|
127 | * object with that name if one is found. |
---|
128 | * |
---|
129 | * @param[in] information points to the object information table for this |
---|
130 | * object class. |
---|
131 | * @param[in] the_name is the name of the object being searched for. |
---|
132 | * @param[in] nodes_to_search indicates the set of nodes to search. |
---|
133 | * @param[in] the_id will contain the Id of the object if found. |
---|
134 | * |
---|
135 | * @retval This method returns one of the |
---|
136 | * @ref Objects_Name_or_id_lookup_errors. If successful, @a the_id |
---|
137 | * will contain the Id of the object. |
---|
138 | */ |
---|
139 | Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search ( |
---|
140 | Objects_Information *information, |
---|
141 | Objects_Name the_name, |
---|
142 | uint32_t nodes_to_search, |
---|
143 | Objects_Id *the_id |
---|
144 | ); |
---|
145 | |
---|
146 | /** |
---|
147 | * @brief Searches the Global Object Table managed |
---|
148 | * by information for the object indicated by ID. |
---|
149 | * |
---|
150 | * This function searches the Global Object Table managed |
---|
151 | * by information for the object indicated by ID. If the object |
---|
152 | * is found, then location is set to objects_remote, otherwise |
---|
153 | * location is set to objects_error. In both cases, the_object |
---|
154 | * is undefined. |
---|
155 | * |
---|
156 | * @param[in] information points to the object information table for this |
---|
157 | * object class. |
---|
158 | * @param[in] the_id is the Id of the object being opened. |
---|
159 | * @param[in] location will contain the location of the object. |
---|
160 | * @param[in] the_object will contain a pointer to the object. |
---|
161 | * |
---|
162 | * @retval This method fills in @a location to indicate successful location |
---|
163 | * of the object or error. On success, @a the_object will be |
---|
164 | * filled in. |
---|
165 | */ |
---|
166 | void _Objects_MP_Is_remote ( |
---|
167 | Objects_Information *information, |
---|
168 | Objects_Id the_id, |
---|
169 | Objects_Locations *location, |
---|
170 | Objects_Control **the_object |
---|
171 | ); |
---|
172 | |
---|
173 | /** |
---|
174 | * This is the maximum number of global objects configured. |
---|
175 | */ |
---|
176 | SCORE_EXTERN uint32_t _Objects_MP_Maximum_global_objects; |
---|
177 | |
---|
178 | /** |
---|
179 | * The following chain header is used to manage the set of |
---|
180 | * inactive global object control blocks. |
---|
181 | */ |
---|
182 | SCORE_EXTERN Chain_Control _Objects_MP_Inactive_global_objects; |
---|
183 | |
---|
184 | /** |
---|
185 | * This function allocates a Global Object control block. |
---|
186 | */ |
---|
187 | |
---|
188 | RTEMS_INLINE_ROUTINE Objects_MP_Control *_Objects_MP_Allocate_global_object ( |
---|
189 | void |
---|
190 | ) |
---|
191 | { |
---|
192 | return (Objects_MP_Control *) |
---|
193 | _Chain_Get( &_Objects_MP_Inactive_global_objects ); |
---|
194 | } |
---|
195 | |
---|
196 | /** |
---|
197 | * This routine deallocates a Global Object control block. |
---|
198 | */ |
---|
199 | |
---|
200 | RTEMS_INLINE_ROUTINE void _Objects_MP_Free_global_object ( |
---|
201 | Objects_MP_Control *the_object |
---|
202 | ) |
---|
203 | { |
---|
204 | _Chain_Append( |
---|
205 | &_Objects_MP_Inactive_global_objects, |
---|
206 | &the_object->Object.Node |
---|
207 | ); |
---|
208 | } |
---|
209 | |
---|
210 | /** |
---|
211 | * This function returns whether the global object is NULL or not. |
---|
212 | */ |
---|
213 | |
---|
214 | RTEMS_INLINE_ROUTINE bool _Objects_MP_Is_null_global_object ( |
---|
215 | Objects_MP_Control *the_object |
---|
216 | ) |
---|
217 | { |
---|
218 | return( the_object == NULL ); |
---|
219 | } |
---|
220 | |
---|
221 | /**@}*/ |
---|
222 | |
---|
223 | #ifdef __cplusplus |
---|
224 | } |
---|
225 | #endif |
---|
226 | |
---|
227 | #endif |
---|
228 | /* end of include file */ |
---|