source: rtems/cpukit/include/rtems/score/coremsg.h @ 4bd8757

5
Last change on this file since 4bd8757 was 4bd8757, checked in by Andreas Dachsberger <andreas.dachsberger@…>, on 04/05/19 at 07:13:16

doxygen: score: adjust doc in coremsg.h to doxygen guidelines

Update #3706.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSScoreMessageQueue
5 *
6 * @brief Constants and Structures Associated with the Message Queue Handler.
7 *
8 * This include file contains all the constants and structures associated
9 * with the Message queue Handler.
10 */
11
12/*
13 *  COPYRIGHT (c) 1989-2009.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.org/license/LICENSE.
19 */
20
21#ifndef _RTEMS_SCORE_COREMSG_H
22#define _RTEMS_SCORE_COREMSG_H
23
24#include <rtems/score/chain.h>
25#include <rtems/score/isrlock.h>
26#include <rtems/score/threadq.h>
27#include <rtems/score/watchdog.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/**
34 * @defgroup RTEMSScoreMessageQueue Message Queue Handler
35 *
36 * @ingroup RTEMSScore
37 *
38 * @brief Message Queue Handler
39 *
40 * This handler encapsulates functionality which provides the foundation
41 * Message Queue services used in all of the APIs supported by RTEMS.
42 *
43 * @{
44 */
45
46/**
47 *  This macro is defined when an API is enabled that requires that the
48 *  Message Queue Handler include support for priority based enqueuing
49 *  of messages.
50 */
51#define RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY
52
53#if defined(RTEMS_POSIX_API)
54  /**
55   *  This macro is defined when an API is enabled that requires that the
56   *  Message Queue Handler include support for notification of enqueuing
57   *  a message.
58   */
59  #define RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION
60#endif
61
62/**
63 *  This macro is defined when an API is enabled that requires the
64 *  Message Queue Handler include support for blocking send operations.
65 */
66#define RTEMS_SCORE_COREMSG_ENABLE_BLOCKING_SEND
67
68typedef struct CORE_message_queue_Control CORE_message_queue_Control;
69
70/**
71 *  @brief Data types needed to manipulate the contents of message buffers.
72 *
73 *  The following defines the data types needed to manipulate
74 *  the contents of message buffers.
75 *
76 *  @note  The buffer field is normally longer than a single uint32_t
77 *         but since messages are variable length we just make a ptr to 1.
78 */
79typedef struct {
80  /** This field is the size of this message. */
81  size_t      size;
82  /** This field contains the actual message. */
83  uint32_t    buffer[1];
84} CORE_message_queue_Buffer;
85
86/**
87 *  @brief The organization of a message buffer.
88 *
89 *  The following records define the organization of a message
90 *  buffer.
91 */
92typedef struct {
93  /** This element allows this structure to be placed on chains. */
94  Chain_Node                 Node;
95  #if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
96    /** This field is the priority of this message. */
97    int                        priority;
98  #endif
99  /** This field points to the contents of the message. */
100  CORE_message_queue_Buffer  Contents;
101}   CORE_message_queue_Buffer_control;
102
103/**
104 *  @brief The possible blocking disciplines for a message queue.
105 *
106 *  This enumerated types defines the possible blocking disciplines
107 *  for a message queue.
108 */
109typedef enum {
110  /** This value indicates that blocking tasks are in FIFO order. */
111  CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
112  /** This value indicates that blocking tasks are in priority order. */
113  CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
114}   CORE_message_queue_Disciplines;
115
116#if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
117  /**
118   *  @brief Type for a notification handler.
119   *
120   *  The following defines the type for a Notification handler.  A
121   *  notification handler is invoked when the message queue makes a
122   *  0->1 transition on pending messages.
123   */
124  typedef void (*CORE_message_queue_Notify_Handler)(
125    CORE_message_queue_Control *,
126    Thread_queue_Context *
127  );
128#endif
129
130/**
131 *  @brief Control block used to manage each message queue.
132 *
133 *  The following defines the control block used to manage each
134 *  Message Queue.
135 */
136struct CORE_message_queue_Control {
137  /** This field is the Waiting Queue used to manage the set of tasks
138   *  which are blocked waiting to receive a message from this queue.
139   */
140  Thread_queue_Control               Wait_queue;
141
142  /**
143   * @brief The thread queue operations according to the blocking discipline.
144   */
145  const Thread_queue_Operations     *operations;
146
147  /** This element is maximum number of messages which may be pending
148   *  at any given time.
149   */
150  uint32_t                           maximum_pending_messages;
151  /** This element is the number of messages which are currently pending.
152   */
153  uint32_t                           number_of_pending_messages;
154  /** This is the size in bytes of the largest message which may be
155   *  sent via this queue.
156   */
157  size_t                             maximum_message_size;
158  /** This chain is the set of pending messages.  It may be ordered by
159   *  message priority or in FIFO order.
160   */
161  Chain_Control                      Pending_messages;
162  /** This is the address of the memory allocated for message buffers.
163   *  It is allocated are part of message queue initialization and freed
164   *  as part of destroying it.
165   */
166  CORE_message_queue_Buffer         *message_buffers;
167  #if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
168    /** This is the routine invoked when the message queue transitions
169     *  from zero (0) messages pending to one (1) message pending.
170     */
171    CORE_message_queue_Notify_Handler  notify_handler;
172  #endif
173  /** This chain is the set of inactive messages.  A message is inactive
174   *  when it does not contain a pending message.
175   */
176  Chain_Control                      Inactive_messages;
177};
178
179/** @} */
180
181#ifdef __cplusplus
182}
183#endif
184
185#endif
186/*  end of include file */
Note: See TracBrowser for help on using the repository browser.