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-2006. |
---|
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 | /** @brief Objects MP Handler initialization |
---|
50 | * |
---|
51 | * This routine intializes the inactive global object chain |
---|
52 | * based on the maximum number of global objects configured. |
---|
53 | */ |
---|
54 | void _Objects_MP_Handler_initialization(void); |
---|
55 | |
---|
56 | /** @brief Objects MP Open |
---|
57 | * |
---|
58 | * This routine place the specified global object in the |
---|
59 | * specified information table. |
---|
60 | * |
---|
61 | * @param[in] information points to the object information table for this |
---|
62 | * object class. |
---|
63 | * @param[in] the_global_object points to the object being opened. |
---|
64 | * @param[in] the_name is the name of the object being opened. |
---|
65 | * @param[in] the_id is the Id of the object being opened. |
---|
66 | * |
---|
67 | * @todo This method only works for object types with 4 byte object names. |
---|
68 | * It does not support variable length object names. |
---|
69 | */ |
---|
70 | void _Objects_MP_Open ( |
---|
71 | Objects_Information *information, |
---|
72 | Objects_MP_Control *the_global_object, |
---|
73 | uint32_t the_name, |
---|
74 | Objects_Id the_id |
---|
75 | ); |
---|
76 | |
---|
77 | /** @brief Objects MP Allocate and open |
---|
78 | * |
---|
79 | * This routine allocates a global object control block |
---|
80 | * and places it in the specified information table. If the |
---|
81 | * allocation fails, then is_fatal_error determines the |
---|
82 | * error processing actions taken. |
---|
83 | * |
---|
84 | * @param[in] information points to the object information table for this |
---|
85 | * object class. |
---|
86 | * @param[in] the_name is the name of the object being opened. |
---|
87 | * @param[in] the_id is the Id of the object being opened. |
---|
88 | * @param[in] is_fatal_error is TRUE if not being able to allocate the |
---|
89 | * object is considered a fatal error. |
---|
90 | * |
---|
91 | * @todo This method only works for object types with 4 byte object names. |
---|
92 | * It does not support variable length object names. |
---|
93 | */ |
---|
94 | bool _Objects_MP_Allocate_and_open ( |
---|
95 | Objects_Information *information, |
---|
96 | uint32_t the_name, |
---|
97 | Objects_Id the_id, |
---|
98 | bool is_fatal_error |
---|
99 | ); |
---|
100 | |
---|
101 | /** @brief Objects MP Close |
---|
102 | * |
---|
103 | * This routine removes a global object from the specified |
---|
104 | * information table and deallocates the global object control block. |
---|
105 | */ |
---|
106 | void _Objects_MP_Close ( |
---|
107 | Objects_Information *information, |
---|
108 | Objects_Id the_id |
---|
109 | ); |
---|
110 | |
---|
111 | /** @brief Objects MP Global name search |
---|
112 | * |
---|
113 | * This routine looks for the object with the_name in the global |
---|
114 | * object tables indicated by information. It returns the ID of the |
---|
115 | * object with that name if one is found. |
---|
116 | * |
---|
117 | * @param[in] information points to the object information table for this |
---|
118 | * object class. |
---|
119 | * @param[in] the_name is the name of the object being searched for. |
---|
120 | * @param[in] nodes_to_search indicates the set of nodes to search. |
---|
121 | * @param[in] the_id will contain the Id of the object if found. |
---|
122 | * |
---|
123 | * @return This method returns one of the |
---|
124 | * @ref Objects_Name_or_id_lookup_errors. If successful, @a the_id |
---|
125 | * will contain the Id of the object. |
---|
126 | */ |
---|
127 | Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search ( |
---|
128 | Objects_Information *information, |
---|
129 | Objects_Name the_name, |
---|
130 | uint32_t nodes_to_search, |
---|
131 | Objects_Id *the_id |
---|
132 | ); |
---|
133 | |
---|
134 | /** @brief Objects MP Is remote |
---|
135 | * |
---|
136 | * This function searches the Global Object Table managed |
---|
137 | * by information for the object indicated by ID. If the object |
---|
138 | * is found, then location is set to objects_remote, otherwise |
---|
139 | * location is set to objects_error. In both cases, the_object |
---|
140 | * is undefined. |
---|
141 | * |
---|
142 | * @param[in] information points to the object information table for this |
---|
143 | * object class. |
---|
144 | * @param[in] the_id is the Id of the object being opened. |
---|
145 | * @param[in] location will contain the location of the object. |
---|
146 | * @param[in] the_object will contain a pointer to the object. |
---|
147 | * |
---|
148 | * @return This method fills in @a location to indicate successful location |
---|
149 | * of the object or error. On success, @a the_object will be |
---|
150 | * filled in. |
---|
151 | */ |
---|
152 | void _Objects_MP_Is_remote ( |
---|
153 | Objects_Information *information, |
---|
154 | Objects_Id the_id, |
---|
155 | Objects_Locations *location, |
---|
156 | Objects_Control **the_object |
---|
157 | ); |
---|
158 | |
---|
159 | /** |
---|
160 | * This is the maximum number of global objects configured. |
---|
161 | */ |
---|
162 | SCORE_EXTERN uint32_t _Objects_MP_Maximum_global_objects; |
---|
163 | |
---|
164 | /** |
---|
165 | * The following chain header is used to manage the set of |
---|
166 | * inactive global object control blocks. |
---|
167 | */ |
---|
168 | SCORE_EXTERN Chain_Control _Objects_MP_Inactive_global_objects; |
---|
169 | |
---|
170 | #ifndef __RTEMS_APPLICATION__ |
---|
171 | #include <rtems/score/objectmp.inl> |
---|
172 | #endif |
---|
173 | |
---|
174 | #ifdef __cplusplus |
---|
175 | } |
---|
176 | #endif |
---|
177 | |
---|
178 | /**@}*/ |
---|
179 | |
---|
180 | #endif |
---|
181 | /* end of include file */ |
---|