1 | /** |
---|
2 | * @file rtems/score/objectmp.h |
---|
3 | * |
---|
4 | * This include file contains all the constants and structures associated |
---|
5 | * with the manipulation of Global RTEMS Objects. |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2009. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_SCORE_OBJECTMP_H |
---|
20 | #define _RTEMS_SCORE_OBJECTMP_H |
---|
21 | |
---|
22 | /** |
---|
23 | * @defgroup ScoreObjectMP Object Handler Multiprocessing Support |
---|
24 | * |
---|
25 | * This handler encapsulates functionality which is used to manage |
---|
26 | * objects which have been declared to be globally visible. This handler |
---|
27 | * knows objects from all of the nodes in the system. |
---|
28 | */ |
---|
29 | /**@{*/ |
---|
30 | |
---|
31 | #ifdef __cplusplus |
---|
32 | extern "C" { |
---|
33 | #endif |
---|
34 | |
---|
35 | /** |
---|
36 | * This defines the Global Object Control Block used to manage |
---|
37 | * objects resident on other nodes. It is derived from Object. |
---|
38 | */ |
---|
39 | typedef struct { |
---|
40 | /** This is an object control structure. */ |
---|
41 | Objects_Control Object; |
---|
42 | /** This is the name of the object. Using an unsigned thirty two |
---|
43 | * bit value is broken but works. If any API is MP with variable |
---|
44 | * length names .. BOOM!!!! |
---|
45 | */ |
---|
46 | uint32_t name; |
---|
47 | } Objects_MP_Control; |
---|
48 | |
---|
49 | /** |
---|
50 | * @brief Objects MP Handler initialization |
---|
51 | * |
---|
52 | * This routine intializes the inactive global object chain |
---|
53 | * based on the maximum number of global objects configured. |
---|
54 | */ |
---|
55 | void _Objects_MP_Handler_initialization(void); |
---|
56 | |
---|
57 | /** |
---|
58 | * @brief Objects MP Handler Early initialization |
---|
59 | * |
---|
60 | * This routine intializes the global object node number |
---|
61 | * used in the ID field of all objects. |
---|
62 | */ |
---|
63 | void _Objects_MP_Handler_early_initialization(void); |
---|
64 | |
---|
65 | /** |
---|
66 | * @brief Objects MP Open |
---|
67 | * |
---|
68 | * This routine place the specified global object in the |
---|
69 | * specified information table. |
---|
70 | * |
---|
71 | * @param[in] information points to the object information table for this |
---|
72 | * object class. |
---|
73 | * @param[in] the_global_object points to the object being opened. |
---|
74 | * @param[in] the_name is the name of the object being opened. |
---|
75 | * @param[in] the_id is the Id of the object being opened. |
---|
76 | * |
---|
77 | * @todo This method only works for object types with 4 byte object names. |
---|
78 | * It does not support variable length object names. |
---|
79 | */ |
---|
80 | void _Objects_MP_Open ( |
---|
81 | Objects_Information *information, |
---|
82 | Objects_MP_Control *the_global_object, |
---|
83 | uint32_t the_name, |
---|
84 | Objects_Id the_id |
---|
85 | ); |
---|
86 | |
---|
87 | /** |
---|
88 | * @brief Objects MP Allocate and open |
---|
89 | * |
---|
90 | * This routine allocates a global object control block |
---|
91 | * and places it in the specified information table. If the |
---|
92 | * allocation fails, then is_fatal_error determines the |
---|
93 | * error processing actions taken. |
---|
94 | * |
---|
95 | * @param[in] information points to the object information table for this |
---|
96 | * object class. |
---|
97 | * @param[in] the_name is the name of the object being opened. |
---|
98 | * @param[in] the_id is the Id of the object being opened. |
---|
99 | * @param[in] is_fatal_error is true if not being able to allocate the |
---|
100 | * object is considered a fatal error. |
---|
101 | * |
---|
102 | * @todo This method only works for object types with 4 byte object names. |
---|
103 | * It does not support variable length object names. |
---|
104 | */ |
---|
105 | bool _Objects_MP_Allocate_and_open ( |
---|
106 | Objects_Information *information, |
---|
107 | uint32_t the_name, |
---|
108 | Objects_Id the_id, |
---|
109 | bool is_fatal_error |
---|
110 | ); |
---|
111 | |
---|
112 | /** |
---|
113 | * @brief Objects MP Close |
---|
114 | * |
---|
115 | * This routine removes a global object from the specified |
---|
116 | * information table and deallocates the global object control block. |
---|
117 | */ |
---|
118 | void _Objects_MP_Close ( |
---|
119 | Objects_Information *information, |
---|
120 | Objects_Id the_id |
---|
121 | ); |
---|
122 | |
---|
123 | /** |
---|
124 | * @brief Objects MP Global name search |
---|
125 | * |
---|
126 | * This routine looks for the object with the_name in the global |
---|
127 | * object tables indicated by information. It returns the ID of the |
---|
128 | * object with that name if one is found. |
---|
129 | * |
---|
130 | * @param[in] information points to the object information table for this |
---|
131 | * object class. |
---|
132 | * @param[in] the_name is the name of the object being searched for. |
---|
133 | * @param[in] nodes_to_search indicates the set of nodes to search. |
---|
134 | * @param[in] the_id will contain the Id of the object if found. |
---|
135 | * |
---|
136 | * @return This method returns one of the |
---|
137 | * @ref Objects_Name_or_id_lookup_errors. If successful, @a the_id |
---|
138 | * will contain the Id of the object. |
---|
139 | */ |
---|
140 | Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search ( |
---|
141 | Objects_Information *information, |
---|
142 | Objects_Name the_name, |
---|
143 | uint32_t nodes_to_search, |
---|
144 | Objects_Id *the_id |
---|
145 | ); |
---|
146 | |
---|
147 | /** |
---|
148 | * @brief Objects MP Is remote |
---|
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 | * @return 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 | #ifndef __RTEMS_APPLICATION__ |
---|
185 | #include <rtems/score/objectmp.inl> |
---|
186 | #endif |
---|
187 | |
---|
188 | #ifdef __cplusplus |
---|
189 | } |
---|
190 | #endif |
---|
191 | |
---|
192 | /**@}*/ |
---|
193 | |
---|
194 | #endif |
---|
195 | /* end of include file */ |
---|