Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:13

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSScoreMPPacket
0007  *
0008  * @brief This header file provides the interfaces of the
0009  *   @ref RTEMSScoreMPPacket.
0010  */
0011 
0012 /*
0013  *  COPYRIGHT (c) 1989-2011.
0014  *  On-Line Applications Research Corporation (OAR).
0015  *
0016  * Redistribution and use in source and binary forms, with or without
0017  * modification, are permitted provided that the following conditions
0018  * are met:
0019  * 1. Redistributions of source code must retain the above copyright
0020  *    notice, this list of conditions and the following disclaimer.
0021  * 2. Redistributions in binary form must reproduce the above copyright
0022  *    notice, this list of conditions and the following disclaimer in the
0023  *    documentation and/or other materials provided with the distribution.
0024  *
0025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0028  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0029  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0030  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0031  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0033  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0034  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0035  * POSSIBILITY OF SUCH DAMAGE.
0036  */
0037 
0038 #ifndef _RTEMS_SCORE_MPPKT_H
0039 #define _RTEMS_SCORE_MPPKT_H
0040 
0041 #include <rtems/score/object.h>
0042 #include <rtems/score/priority.h>
0043 #include <rtems/score/watchdogticks.h>
0044 
0045 #ifdef __cplusplus
0046 extern "C" {
0047 #endif
0048 
0049 /**
0050  * @defgroup RTEMSScoreMPPacket Multiprocessing (MP) Packet Handler
0051  *
0052  * @ingroup RTEMSScore
0053  *
0054  * @brief This group contains the Multiprocessing (MP) Packet Handler
0055  *   implementation.
0056  *
0057  * This handler encapsulates the primary definition of MPCI packets.  This
0058  * handler defines the part of the packet that is common to all remote
0059  * operations.  It defines the basic packet and provides mechanisms to utilize
0060  * packets based on this prefix.  Packets are the fundamental basis for
0061  * messages passed between nodes in an MP system.
0062  *
0063  * @{
0064  */
0065 
0066 /**
0067  *  The following enumerated type defines the packet classes.
0068  *
0069  *  @note  In general, each class corresponds to a manager
0070  *         which supports global operations.  Each manager
0071  *         defines the set of supported operations.
0072  */
0073 typedef enum {
0074   MP_PACKET_MPCI_INTERNAL    = 0,
0075   MP_PACKET_TASKS            = 1,
0076   MP_PACKET_MESSAGE_QUEUE    = 2,
0077   MP_PACKET_SEMAPHORE        = 3,
0078   MP_PACKET_PARTITION        = 4,
0079   MP_PACKET_REGION           = 5,
0080   MP_PACKET_EVENT            = 6,
0081   MP_PACKET_SIGNAL           = 7
0082 }   MP_packet_Classes;
0083 
0084 /**
0085  *  This constant defines the first entry in the MP_packet_Classes enumeration.
0086  */
0087 #define MP_PACKET_CLASSES_FIRST  MP_PACKET_MPCI_INTERNAL
0088 
0089 /**
0090  *  This constant defines the last entry in the MP_packet_Classes enumeration.
0091  */
0092 #define MP_PACKET_CLASSES_LAST   MP_PACKET_SIGNAL
0093 
0094 /**
0095  *  The following record contains the prefix for every packet
0096  *  passed between nodes in an MP system.
0097  *
0098  *  @note This structure is padded to ensure that anything following it
0099  *        is on a 16 byte boundary.  This is the most stringent structure
0100  *        alignment rule encountered yet.
0101  */
0102 typedef struct {
0103   /** This field indicates the API class of the operation being performed. */
0104   MP_packet_Classes       the_class;
0105   /** This field is the id of the object to be acted upon. */
0106   Objects_Id              id;
0107   /** This field is the ID of the originating thread. */
0108   Objects_Id              source_tid;
0109   /** This field is the priority of the originating thread. */
0110   uint32_t                source_priority;
0111   /** This field is where the status of the operation will be returned. */
0112   uint32_t                return_code;
0113   /** This field is the length of the data following the prefix. */
0114   uint32_t                length;
0115   /** This field is the length of the data which required network conversion. */
0116   uint32_t                to_convert;
0117   /** This field is the requested timeout for this operation. */
0118   Watchdog_Interval       timeout;
0119 }   MP_packet_Prefix;
0120 
0121 /**
0122  *  An MPCI must support packets of at least this size.
0123  */
0124 #define MP_PACKET_MINIMUM_PACKET_SIZE  64
0125 
0126 /**
0127  *  The following constant defines the number of uint32_t's
0128  *  in a packet which must be converted to native format in a
0129  *  heterogeneous system.  In packets longer than
0130  *  MP_PACKET_MINIMUN_HETERO_CONVERSION uint32_t's, some of the "extra" data
0131  *  may a user message buffer which is not automatically endian swapped.
0132  */
0133 #define MP_PACKET_MINIMUN_HETERO_CONVERSION  \
0134   ( sizeof( MP_packet_Prefix ) / sizeof( uint32_t   ) )
0135 
0136 /** @} */
0137 
0138 #ifdef __cplusplus
0139 }
0140 #endif
0141 
0142 #endif
0143 /* end of include file */