source: rtems/cpukit/score/include/rtems/score/mpciimpl.h @ 864d3475

4.115
Last change on this file since 864d3475 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 9.3 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 *
193 *  @retval This method returns the operation status from the remote node.
194 */
195uint32_t _MPCI_Send_request_packet (
196  uint32_t           destination,
197  MP_packet_Prefix  *the_packet,
198  States_Control     extra_state
199);
200
201/**
202 *  @brief Send a response packet.
203 *
204 *  This routine sends a response packet by invoking the user provided
205 *  MPCI send callout.
206 *
207 *  @param[in] destination is the node which should receive this packet.
208 *  @param[in] the_packet is the packet to be sent.
209 */
210void _MPCI_Send_response_packet (
211  uint32_t          destination,
212  MP_packet_Prefix *the_packet
213);
214
215/**
216 *  @brief Receive a packet.
217 *
218 *  This routine receives a packet by invoking the user provided
219 *  MPCI receive callout.
220 *
221 *  @retval This method returns the packet received.
222 */
223MP_packet_Prefix  *_MPCI_Receive_packet ( void );
224
225/**
226 *  @brief Pass a packet to the thread.
227 *
228 *  This routine is responsible for passing @a the_packet to the thread
229 *  waiting on the remote operation to complete.  The unblocked thread is
230 *  responsible for eventually freeing @a the_packet.
231 *
232 *  @param[in] the_packet is the response packet to be processed.
233 *
234 *  @retval This method returns a pointer to the thread which was if unblocked
235 *          or NULL if the waiting thread no longer exists.
236 */
237Thread_Control *_MPCI_Process_response (
238  MP_packet_Prefix *the_packet
239);
240
241/**
242 *  @brief Receive and process all packets.
243 *
244 *  This is the server thread which receives and processes all MCPI packets.
245 *
246 *  @param[in] ignored is the thread argument.  It is not used.
247 */
248Thread _MPCI_Receive_server(
249  uint32_t   ignored
250);
251
252/**
253 *  @brief Announce the availability of a packet.
254 *
255 *  This routine informs RTEMS of the availability of an MPCI packet.
256 */
257void _MPCI_Announce ( void );
258
259/**
260 *  @brief Perform a process on another node.
261 *
262 *  This routine performs a remote procedure call so that a
263 *  process operation can be performed on another node.
264 *
265 *  @param[in] operation is the remote operation to perform.
266 */
267void _MPCI_Internal_packets_Send_process_packet (
268   MPCI_Internal_Remote_operations operation
269);
270
271/**
272 *  _MPCI_Internal_packets_Send_request_packet
273 *
274 *  This routine performs a remote procedure call so that a
275 *  directive operation can be initiated on another node.
276 *
277 *  This routine is not needed since there are no request
278 *  packets to be sent by this manager.
279 */
280
281/**
282 *  _MPCI_Internal_packets_Send_response_packet
283 *
284 *  This routine performs a remote procedure call so that a
285 *  directive can be performed on another node.
286 *
287 *  This routine is not needed since there are no response
288 *  packets to be sent by this manager.
289 */
290
291/**
292 *  @brief Perform requested action from another node.
293 *
294 *  This routine performs the actions specific to this package for
295 *  the request from another node.
296 */
297void _MPCI_Internal_packets_Process_packet (
298  MP_packet_Prefix *the_packet_prefix
299);
300
301/**
302 *  _MPCI_Internal_packets_Send_object_was_deleted
303 *
304 *  This routine is invoked indirectly by the thread queue
305 *  when a proxy has been removed from the thread queue and
306 *  the remote node must be informed of this.
307 *
308 *  This routine is not needed since there are no objects
309 *  deleted by this manager.
310 */
311
312/**
313 *  _MPCI_Internal_packets_Send_extract_proxy
314 *
315 *  This routine is invoked when a task is deleted and it
316 *  has a proxy which must be removed from a thread queue and
317 *  the remote node must be informed of this.
318 *
319 *  This routine is not needed since there are no objects
320 *  deleted by this manager.
321 */
322
323/**
324 *  @brief Obtain an internal thread.
325 *
326 *  This routine is used to obtain an internal threads MP packet.
327 */
328MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void );
329
330/**
331 * This function returns true if the the_packet_class is valid,
332 * and false otherwise.
333 *
334 * @note Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
335 *       because this enum starts at lower bound of zero.
336 */
337
338RTEMS_INLINE_ROUTINE bool _Mp_packet_Is_valid_packet_class (
339  MP_packet_Classes the_packet_class
340)
341{
342  return ( the_packet_class <= MP_PACKET_CLASSES_LAST );
343}
344
345/**@}*/
346
347#ifdef __cplusplus
348}
349#endif
350
351#endif
352/* end of include file */
Note: See TracBrowser for help on using the repository browser.