📄 coremsg.h
字号:
/** * @file rtems/score/coremsg.h * * This include file contains all the constants and structures associated * with the Message queue Handler. *//* * COPYRIGHT (c) 1989-2006. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * * $Id: coremsg.h,v 1.24 2006/01/16 15:13:58 joel Exp $ */#ifndef _RTEMS_SCORE_COREMSG_H#define _RTEMS_SCORE_COREMSG_H/** * @defgroup ScoreMessageQueue Message Queue Handler * * This handler encapsulates functionality which provides the foundation * Message Queue services used in all of the APIs supported by RTEMS. *//**@{*/#ifdef __cplusplusextern "C" {#endif#include <limits.h>#include <rtems/score/thread.h>#include <rtems/score/threadq.h>#include <rtems/score/priority.h>#include <rtems/score/watchdog.h>/** * @brief Message Queue MP Callback Prototype * * The following type defines the callout which the API provides * to support global/multiprocessor operations on message_queues. */typedef void ( *CORE_message_queue_API_mp_support_callout )( Thread_Control *, Objects_Id );/** * @brief Message Buffer Contents Management Structure * * The following defines the data types needed to manipulate * the contents of message buffers. * * @note The buffer field is normally longer than a single uint32_t * but since messages are variable length we just make a ptr to 1. */typedef struct { /** This field is the size of this message. */ uint32_t size; /** This field contains the actual message. */ uint32_t buffer[1];} CORE_message_queue_Buffer;/** * @brief Message Structure * * The following records define the organization of a message * buffer. */typedef struct { /** This element allows this structure to be placed on chains. */ Chain_Node Node; /** This field is the priority of this message. */ int priority; /** This field points to the contents of the message. */ CORE_message_queue_Buffer Contents;} CORE_message_queue_Buffer_control;/** * @brief Message Queue Blocking Disciplines * * This enumerated types defines the possible blocking disciplines * for a message queue. */typedef enum { /** This value indicates that pending messages are in FIFO order. */ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO, /** This value indicates that pending messages are in priority order. */ CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY} CORE_message_queue_Disciplines;/** * @brief Message Priority for Appending * * This is the priority constant used when appending messages onto * a message queue. */#define CORE_MESSAGE_QUEUE_SEND_REQUEST INT_MAX/** * @brief Message Priority for Prepending * * This is the priority constant used when prepending messages onto * a message queue. */#define CORE_MESSAGE_QUEUE_URGENT_REQUEST INT_MIN/** * @brief Message Insertion Operation Types * * The following type details the modes in which a message * may be submitted to a message queue. The message may be posted * in a send or urgent fashion. * * @note All other values are message priorities. Numerically smaller * priorities indicate higher priority messages. */typedef int CORE_message_queue_Submit_types;/** * @brief Core Message Queue Return Statuses * * This enumerated type defines the possible set of Core Message * Queue handler return statuses. */typedef enum { /** This value indicates the operation completed sucessfully. */ CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL, /** This value indicates that the message was too large for this queue. */ CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE, /** This value indicates that there are too many messages pending. */ CORE_MESSAGE_QUEUE_STATUS_TOO_MANY, /** This value indicates that a receive was unsuccessful. */ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED, /** This value indicates that a blocking send was unsuccessful. */ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT, /** This value indicates that the message queue being blocked upon * was deleted while the thread was waiting. */ CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED, /** This value indicates that the thread had to timeout while waiting * to receive a message because one did not become available. */ CORE_MESSAGE_QUEUE_STATUS_TIMEOUT, /** This value indicates that a blocking receive was unsuccessful. */ CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT} CORE_message_queue_Status;/** * @brief Message Queue Attributes Type * * The following defines the control block used to manage the * attributes of each message queue. */typedef struct { /** This field specifies the order in which blocking tasks will be ordered. */ CORE_message_queue_Disciplines discipline;} CORE_message_queue_Attributes;/** * @brief Message Queue Notification Callback Prototype * * The following defines the type for a Notification handler. A notification * handler is invoked when the message queue makes a 0->1 transition on * pending messages. */typedef void (*CORE_message_queue_Notify_Handler)( void * );/** * @brief Core Message Queue Control Structure * * The following defines the control block used to manage each * Message Queue */typedef struct { /** This field is the Waiting Queue used to manage the set of tasks * which are blocked waiting to receive a message from this queue. */ Thread_queue_Control Wait_queue; /** This element is the set of attributes which define this instance's * behavior. */ CORE_message_queue_Attributes Attributes; /** This element is maximum number of messages which may be pending * at any given time. */ uint32_t maximum_pending_messages; /** This element is the number of messages which are currently pending. */ uint32_t number_of_pending_messages; /** This is the size in bytes of the largest message which may be * sent via this queue. */ uint32_t maximum_message_size; /** This chain is the set of pending messages. It may be ordered by * message priority or in FIFO order. */ Chain_Control Pending_messages; /** This is the address of the memory allocated for message buffers. * It is allocated are part of message queue initialization and freed * as part of destroying it. */ CORE_message_queue_Buffer *message_buffers; /** This is the routine invoked when the message queue transitions * from zero (0) messages pending to one (1) message pending. */ CORE_message_queue_Notify_Handler notify_handler; /** This field is the argument passed to the @ref notify_argument. */ void *notify_argument; /** This chain is the set of inactive messages. A message is inactive
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -