source: rtems/cpukit/score/include/rtems/score/mpciimpl.h @ 885c342e

Last change on this file since 885c342e was 885c342e, checked in by Sebastian Huber <sebastian.huber@…>, on Jan 26, 2016 at 9:23:22 AM

mpci: Update due to API changes

Update due to API changes introduced by
ccd54344d904b657123e4e4ba795a32212382be2.

Update #2514.

  • Property mode set to 100644
File size: 9.4 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreMPCI
5 *
6 * @brief MPCI Layer Implementation
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2009.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_SCORE_MPCIIMPL_H
19#define _RTEMS_SCORE_MPCIIMPL_H
20
21#include <rtems/score/mpci.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/**
28 * @addtogroup ScoreMPCI
29 *
30 * @{
31 */
32
33/**
34 *  For packets associated with requests that don't already have a timeout,
35 *  use the one specified by this MPCI driver.  The value specified by
36 *   the MPCI driver sets an upper limit on how long a remote request
37 *   should take to complete.
38 */
39#define MPCI_DEFAULT_TIMEOUT    0xFFFFFFFF
40
41/**
42 *  The following defines the type for packet processing routines
43 *  invoked by the MPCI Receive server.
44 */
45typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * );
46
47/**
48 *  The following enumerated type defines the list of
49 *  internal MP operations.
50 */
51typedef enum {
52  MPCI_PACKETS_SYSTEM_VERIFY  =  0
53}   MPCI_Internal_Remote_operations;
54
55/**
56 *  The following data structure defines the packet used to perform
57 *  remote event operations.
58 */
59typedef struct {
60  /** This field is the general header for all packets. */
61  MP_packet_Prefix                 Prefix;
62  /** This value specifies the operation. */
63  MPCI_Internal_Remote_operations  operation;
64  /** This is the maximum number of nodes in the system. It must agree
65   *  on all nodes.
66   */
67  uint32_t                         maximum_nodes;
68  /** This field is the maximum number of concurrently existent
69   *  globally offered objects.
70   */
71  uint32_t                         maximum_global_objects;
72}    MPCI_Internal_packet;
73
74/**
75 *  The following thread queue is used to maintain a list of tasks
76 *  which currently have outstanding remote requests.
77 */
78SCORE_EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads;
79
80/**
81 *  The following define the internal pointers to the user's
82 *  configuration information.
83 */
84SCORE_EXTERN MPCI_Control *_MPCI_table;
85
86/**
87 *  @brief Pointer to MP thread control block.
88 *
89 *  The following is used to determine when the multiprocessing receive
90 *  thread is executing so that a proxy can be allocated instead of
91 *  blocking the multiprocessing receive thread.
92 */
93SCORE_EXTERN Thread_Control *_MPCI_Receive_server_tcb;
94
95/**
96 *  The following table contains the process packet routines provided
97 *  by each object that supports MP operations.
98 */
99SCORE_EXTERN MPCI_Packet_processor
100               _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1];
101
102/**
103 *  @brief Initialize the MPCI handler.
104 *
105 *  This routine performs the initialization necessary for this handler.
106 *
107 *  @param[in] timeout_status is the value which should be returned to
108 *             blocking threads when they timeout on a remote operation.
109 */
110void _MPCI_Handler_initialization(
111  uint32_t   timeout_status
112);
113
114/**
115 *  @brief Create the MPCI server thread.
116 *
117 *  This routine creates the packet receive server used in MP systems.
118 */
119void _MPCI_Create_server( void );
120
121/**
122 *  @brief Initialize the MPCI driver.
123 *
124 *  This routine initializes the MPCI driver by
125 *  invoking the user provided MPCI initialization callout.
126 */
127void _MPCI_Initialization ( void );
128
129/**
130 *  This routine registers the MPCI packet processor for the
131 *  designated object class.
132 *
133 *  @param[in] the_class is the class indicator for packets which will
134 *             be processed by @a the_packet_processor method.
135 *  @param[in] the_packet_processor is a pointer to a method which is
136 *             invoked when packets with @a the_class are received.
137 */
138void _MPCI_Register_packet_processor(
139  MP_packet_Classes      the_class,
140  MPCI_Packet_processor  the_packet_processor
141
142);
143
144/**
145 *  This function obtains a packet by invoking the user provided
146 *  MPCI get packet callout.
147 *
148 *  @retval This method returns a pointer to a MPCI packet which can be
149 *          filled in by the caller and used to perform a subsequent
150 *          remote operation.
151 */
152MP_packet_Prefix *_MPCI_Get_packet ( void );
153
154/**
155 *  @brief Deallocate a packet.
156 *
157 *  This routine deallocates a packet by invoking the user provided
158 *  MPCI return packet callout.
159 *
160 *  @param[in] the_packet is the MP packet to deallocate.
161 */
162void _MPCI_Return_packet (
163  MP_packet_Prefix *the_packet
164);
165
166/**
167 *  @brief Send a process packet.
168 *
169 *  This routine sends a process packet by invoking the user provided
170 *  MPCI send callout.
171 *
172 *  @param[in] destination is the node which should receive this packet.
173 *  @param[in] the_packet is the packet to be sent.
174 */
175void _MPCI_Send_process_packet (
176  uint32_t          destination,
177  MP_packet_Prefix *the_packet
178);
179
180/**
181 *  @brief Send a request packet.
182 *
183 *  This routine sends a request packet by invoking the user provided
184 *  MPCI send callout.
185 *
186 *  @param[in] destination is the node which should receive this packet.
187 *  @param[in] the_packet is the packet to be sent.
188 *  @param[in] extra_state is the extra thread state bits which should be
189 *             set in addition to the remote operation pending state.  It
190 *             may indicate the caller is blocking on a message queue
191 *             operation.
192 *  @param[in] timeout_code is the timeout code
193 *
194 *  @retval This method returns the operation status from the remote node.
195 */
196uint32_t _MPCI_Send_request_packet (
197  uint32_t           destination,
198  MP_packet_Prefix  *the_packet,
199  States_Control     extra_state,
200  uint32_t           timeout_code
201);
202
203/**
204 *  @brief Send a response packet.
205 *
206 *  This routine sends a response packet by invoking the user provided
207 *  MPCI send callout.
208 *
209 *  @param[in] destination is the node which should receive this packet.
210 *  @param[in] the_packet is the packet to be sent.
211 */
212void _MPCI_Send_response_packet (
213  uint32_t          destination,
214  MP_packet_Prefix *the_packet
215);
216
217/**
218 *  @brief Receive a packet.
219 *
220 *  This routine receives a packet by invoking the user provided
221 *  MPCI receive callout.
222 *
223 *  @retval This method returns the packet received.
224 */
225MP_packet_Prefix  *_MPCI_Receive_packet ( void );
226
227/**
228 *  @brief Pass a packet to the thread.
229 *
230 *  This routine is responsible for passing @a the_packet to the thread
231 *  waiting on the remote operation to complete.  The unblocked thread is
232 *  responsible for eventually freeing @a the_packet.
233 *
234 *  @param[in] the_packet is the response packet to be processed.
235 *
236 *  @retval This method returns a pointer to the thread which was if unblocked
237 *          or NULL if the waiting thread no longer exists.
238 */
239Thread_Control *_MPCI_Process_response (
240  MP_packet_Prefix *the_packet
241);
242
243/**
244 *  @brief Receive and process all packets.
245 *
246 *  This is the server thread which receives and processes all MCPI packets.
247 *
248 *  @param[in] ignored is the thread argument.  It is not used.
249 */
250void _MPCI_Receive_server(
251  Thread_Entry_numeric_type ignored
252);
253
254/**
255 *  @brief Announce the availability of a packet.
256 *
257 *  This routine informs RTEMS of the availability of an MPCI packet.
258 */
259void _MPCI_Announce ( void );
260
261/**
262 *  @brief Perform a process on another node.
263 *
264 *  This routine performs a remote procedure call so that a
265 *  process operation can be performed on another node.
266 *
267 *  @param[in] operation is the remote operation to perform.
268 */
269void _MPCI_Internal_packets_Send_process_packet (
270   MPCI_Internal_Remote_operations operation
271);
272
273/**
274 *  _MPCI_Internal_packets_Send_request_packet
275 *
276 *  This routine performs a remote procedure call so that a
277 *  directive operation can be initiated on another node.
278 *
279 *  This routine is not needed since there are no request
280 *  packets to be sent by this manager.
281 */
282
283/**
284 *  _MPCI_Internal_packets_Send_response_packet
285 *
286 *  This routine performs a remote procedure call so that a
287 *  directive can be performed on another node.
288 *
289 *  This routine is not needed since there are no response
290 *  packets to be sent by this manager.
291 */
292
293/**
294 *  @brief Perform requested action from another node.
295 *
296 *  This routine performs the actions specific to this package for
297 *  the request from another node.
298 */
299void _MPCI_Internal_packets_Process_packet (
300  MP_packet_Prefix *the_packet_prefix
301);
302
303/**
304 *  _MPCI_Internal_packets_Send_object_was_deleted
305 *
306 *  This routine is invoked indirectly by the thread queue
307 *  when a proxy has been removed from the thread queue and
308 *  the remote node must be informed of this.
309 *
310 *  This routine is not needed since there are no objects
311 *  deleted by this manager.
312 */
313
314/**
315 *  _MPCI_Internal_packets_Send_extract_proxy
316 *
317 *  This routine is invoked when a task is deleted and it
318 *  has a proxy which must be removed from a thread queue and
319 *  the remote node must be informed of this.
320 *
321 *  This routine is not needed since there are no objects
322 *  deleted by this manager.
323 */
324
325/**
326 *  @brief Obtain an internal thread.
327 *
328 *  This routine is used to obtain an internal threads MP packet.
329 */
330MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void );
331
332/**
333 * This function returns true if the the_packet_class is valid,
334 * and false otherwise.
335 *
336 * @note Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
337 *       because this enum starts at lower bound of zero.
338 */
339
340RTEMS_INLINE_ROUTINE bool _Mp_packet_Is_valid_packet_class (
341  MP_packet_Classes the_packet_class
342)
343{
344  return ( the_packet_class <= MP_PACKET_CLASSES_LAST );
345}
346
347/**@}*/
348
349#ifdef __cplusplus
350}
351#endif
352
353#endif
354/* end of include file */
Note: See TracBrowser for help on using the repository browser.