source: rtems/cpukit/include/rtems/score/mpciimpl.h @ a660e9dc

Last change on this file since a660e9dc was a660e9dc, checked in by Sebastian Huber <sebastian.huber@…>, on 09/08/22 at 08:37:05

Do not use RTEMS_INLINE_ROUTINE

Directly use "static inline" which is available in C99 and later. This brings
the RTEMS implementation closer to standard C.

Close #3935.

  • Property mode set to 100644
File size: 10.0 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSScoreMPCI
7 *
8 * @brief This header file provides interfaces of the
9 *   @ref RTEMSScoreMPCI which are only used by the implementation.
10 */
11
12/*
13 *  COPYRIGHT (c) 1989-2009.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 *    notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 *    notice, this list of conditions and the following disclaimer in the
23 *    documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _RTEMS_SCORE_MPCIIMPL_H
39#define _RTEMS_SCORE_MPCIIMPL_H
40
41#include <rtems/score/mpci.h>
42#include <rtems/score/status.h>
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/**
49 * @addtogroup RTEMSScoreMPCI
50 *
51 * @{
52 */
53
54/**
55 *  For packets associated with requests that don't already have a timeout,
56 *  use the one specified by this MPCI driver.  The value specified by
57 *   the MPCI driver sets an upper limit on how long a remote request
58 *   should take to complete.
59 */
60#define MPCI_DEFAULT_TIMEOUT    0xFFFFFFFF
61
62/**
63 *  The following defines the type for packet processing routines
64 *  invoked by the MPCI Receive server.
65 */
66typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * );
67
68/**
69 *  The following enumerated type defines the list of
70 *  internal MP operations.
71 */
72typedef enum {
73  MPCI_PACKETS_SYSTEM_VERIFY  =  0
74}   MPCI_Internal_Remote_operations;
75
76/**
77 *  The following data structure defines the packet used to perform
78 *  remote event operations.
79 */
80typedef struct {
81  /** This field is the general header for all packets. */
82  MP_packet_Prefix                 Prefix;
83  /** This value specifies the operation. */
84  MPCI_Internal_Remote_operations  operation;
85  /** This is the maximum number of nodes in the system. It must agree
86   *  on all nodes.
87   */
88  uint32_t                         maximum_nodes;
89  /** This field is the maximum number of concurrently existent
90   *  globally offered objects.
91   */
92  uint32_t                         maximum_global_objects;
93}    MPCI_Internal_packet;
94
95/**
96 *  The following thread queue is used to maintain a list of tasks
97 *  which currently have outstanding remote requests.
98 */
99extern Thread_queue_Control _MPCI_Remote_blocked_threads;
100
101/**
102 *  The following define the internal pointers to the user's
103 *  configuration information.
104 */
105extern MPCI_Control *_MPCI_table;
106
107/**
108 *  @brief Pointer to MP thread control block.
109 *
110 *  The following is used to determine when the multiprocessing receive
111 *  thread is executing so that a proxy can be allocated instead of
112 *  blocking the multiprocessing receive thread.
113 */
114extern Thread_Control *_MPCI_Receive_server_tcb;
115
116/**
117 *  The following table contains the process packet routines provided
118 *  by each object that supports MP operations.
119 */
120extern MPCI_Packet_processor
121_MPCI_Packet_processors[ MP_PACKET_CLASSES_LAST + 1 ];
122
123/**
124 * @brief Registers the MPCI packet processor for the designated object class.
125 *
126 * @param the_class The class indicator for packets which will
127 *            be processed by @a the_packet_processor method.
128 * @param the_packet_processor Pointer to a method which is
129 *            invoked when packets with @a the_class are received.
130 */
131void _MPCI_Register_packet_processor(
132  MP_packet_Classes      the_class,
133  MPCI_Packet_processor  the_packet_processor
134
135);
136
137/**
138 * @brief Obtains a packet by invoking the user provided
139 *          MPCI get packet callout.
140 *
141 * @return Returns a pointer to a MPCI packet which can be
142 *          filled in by the caller and used to perform a subsequent
143 *          remote operation.
144 */
145MP_packet_Prefix *_MPCI_Get_packet ( void );
146
147/**
148 * @brief Deallocates a packet.
149 *
150 * This routine deallocates a packet by invoking the user provided
151 * MPCI return packet callout.
152 *
153 * @param[out] the_packet The MP packet to deallocate.
154 */
155void _MPCI_Return_packet (
156  MP_packet_Prefix *the_packet
157);
158
159/**
160 * @brief Sends a process packet.
161 *
162 * This routine sends a process packet by invoking the user provided
163 * MPCI send callout.
164 *
165 * @param destination The node which should receive this packet.
166 * @param the_packet The packet to be sent.
167 */
168void _MPCI_Send_process_packet (
169  uint32_t          destination,
170  MP_packet_Prefix *the_packet
171);
172
173/**
174 * @brief Sends a request packet.
175 *
176 * This routine sends a request packet by invoking the user provided
177 * MPCI send callout.
178 *
179 * @param destination The node which should receive this packet.
180 * @param the_packet The packet to be sent.
181 * @param extra_state The extra thread state bits which should be
182 *            set in addition to the remote operation pending state.  It
183 *            may indicate the caller is blocking on a message queue
184 *            operation.
185 *
186 * @ret This method returns the operation status from the remote node.
187 */
188Status_Control _MPCI_Send_request_packet(
189  uint32_t          destination,
190  MP_packet_Prefix *the_packet,
191  States_Control    extra_state
192);
193
194/**
195 * @brief Sends a response packet.
196 *
197 * This routine sends a response packet by invoking the user provided
198 * MPCI send callout.
199 *
200 * @param destination The node which should receive this packet.
201 * @param the_packet The packet to be sent.
202 */
203void _MPCI_Send_response_packet (
204  uint32_t          destination,
205  MP_packet_Prefix *the_packet
206);
207
208/**
209 * @brief Receives a packet.
210 *
211 * This routine receives a packet by invoking the user provided
212 * MPCI receive callout.
213 *
214 * @return This method returns the packet received.
215 */
216MP_packet_Prefix  *_MPCI_Receive_packet ( void );
217
218/**
219 * @brief Passes a packet to the thread.
220 *
221 * This routine is responsible for passing @a the_packet to the thread
222 * waiting on the remote operation to complete.  The unblocked thread is
223 * responsible for eventually freeing @a the_packet.
224 *
225 * @param the_packet is the response packet to be processed.
226 *
227 * @retval pointer This method returns a pointer to the thread which was unblocked
228 * @retval NULL The waiting thread no longer exists.
229 */
230Thread_Control *_MPCI_Process_response (
231  MP_packet_Prefix *the_packet
232);
233
234/**
235 * @brief Receives and processes all packets.
236 *
237 * This is the server thread which receives and processes all MCPI packets.
238 *
239 * @param ignored The thread argument.  It is not used.
240 */
241void _MPCI_Receive_server(
242  Thread_Entry_numeric_type ignored
243);
244
245/**
246 * @brief Announces the availability of a packet.
247 *
248 * This routine informs RTEMS of the availability of an MPCI packet.
249 */
250void _MPCI_Announce ( void );
251
252/**
253 * @brief Performs a process on another node.
254 *
255 * This routine performs a remote procedure call so that a
256 * process operation can be performed on another node.
257 *
258 * @param operation The remote operation to perform.
259 */
260void _MPCI_Internal_packets_Send_process_packet (
261   MPCI_Internal_Remote_operations operation
262);
263
264/**
265 *  _MPCI_Internal_packets_Send_request_packet
266 *
267 *  This routine performs a remote procedure call so that a
268 *  directive operation can be initiated on another node.
269 *
270 *  This routine is not needed since there are no request
271 *  packets to be sent by this manager.
272 */
273
274/**
275 *  _MPCI_Internal_packets_Send_response_packet
276 *
277 *  This routine performs a remote procedure call so that a
278 *  directive can be performed on another node.
279 *
280 *  This routine is not needed since there are no response
281 *  packets to be sent by this manager.
282 */
283
284/**
285 * @brief Performs requested action from another node.
286 *
287 * This routine performs the actions specific to this package for
288 * the request from another node.
289 *
290 * @param the_packet_prefix The packet prefix for this method.
291 */
292void _MPCI_Internal_packets_Process_packet (
293  MP_packet_Prefix *the_packet_prefix
294);
295
296/**
297 *  _MPCI_Internal_packets_Send_object_was_deleted
298 *
299 *  This routine is invoked indirectly by the thread queue
300 *  when a proxy has been removed from the thread queue and
301 *  the remote node must be informed of this.
302 *
303 *  This routine is not needed since there are no objects
304 *  deleted by this manager.
305 */
306
307/**
308 *  _MPCI_Internal_packets_Send_extract_proxy
309 *
310 *  This routine is invoked when a task is deleted and it
311 *  has a proxy which must be removed from a thread queue and
312 *  the remote node must be informed of this.
313 *
314 *  This routine is not needed since there are no objects
315 *  deleted by this manager.
316 */
317
318/**
319 * @brief Obtains an internal thread.
320 *
321 * This routine is used to obtain an internal threads MP packet.
322 *
323 * @retval pointer The pointer to the obtained packet.
324 * @retval NULL Something went wrong.
325 */
326MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void );
327
328/**
329 * @brief Checks if the packet class is valid.
330 *
331 * @param the_packet_class The packet class to perform the validation on.
332 *
333 * @retval true @a the_packet_class is valid.
334 * @retval false @a the_packet_class is not valid.
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
340static inline 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.