[rtems commit] score: Add <rtems/score/coremsgbuffer.h>

Sebastian Huber sebh at rtems.org
Mon Sep 28 05:17:52 UTC 2020


Module:    rtems
Branch:    master
Commit:    2c09f54fc41b86265af137716013bce2e2e92b27
Changeset: http://git.rtems.org/rtems/commit/?id=2c09f54fc41b86265af137716013bce2e2e92b27

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Sep 23 13:46:38 2020 +0200

score: Add <rtems/score/coremsgbuffer.h>

Move the CORE_message_queue_Buffer definition to a separate header file to be
able to use it independent of the remaining Message Queue Handler API.

Change license to BSD-2-Clause according to file history.

Update #3053.
Update #4007.

---

 cpukit/headers.am                          |  1 +
 cpukit/include/rtems/score/coremsg.h       | 39 +-----------
 cpukit/include/rtems/score/coremsgbuffer.h | 96 ++++++++++++++++++++++++++++++
 spec/build/cpukit/librtemscpu.yml          |  1 +
 4 files changed, 99 insertions(+), 38 deletions(-)

diff --git a/cpukit/headers.am b/cpukit/headers.am
index 77df5ec..23a84ca 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -335,6 +335,7 @@ include_rtems_score_HEADERS += include/rtems/score/copyrt.h
 include_rtems_score_HEADERS += include/rtems/score/corebarrier.h
 include_rtems_score_HEADERS += include/rtems/score/corebarrierimpl.h
 include_rtems_score_HEADERS += include/rtems/score/coremsg.h
+include_rtems_score_HEADERS += include/rtems/score/coremsgbuffer.h
 include_rtems_score_HEADERS += include/rtems/score/coremsgimpl.h
 include_rtems_score_HEADERS += include/rtems/score/coremutex.h
 include_rtems_score_HEADERS += include/rtems/score/coremuteximpl.h
diff --git a/cpukit/include/rtems/score/coremsg.h b/cpukit/include/rtems/score/coremsg.h
index 2131fa0..220c983 100644
--- a/cpukit/include/rtems/score/coremsg.h
+++ b/cpukit/include/rtems/score/coremsg.h
@@ -21,7 +21,7 @@
 #ifndef _RTEMS_SCORE_COREMSG_H
 #define _RTEMS_SCORE_COREMSG_H
 
-#include <rtems/score/chain.h>
+#include <rtems/score/coremsgbuffer.h>
 #include <rtems/score/isrlock.h>
 #include <rtems/score/threadq.h>
 #include <rtems/score/watchdog.h>
@@ -43,13 +43,6 @@ extern "C" {
  * @{
  */
 
-/**
- *  This macro is defined when an API is enabled that requires that the
- *  Message Queue Handler include support for priority based enqueuing
- *  of messages.
- */
-#define RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY
-
 #if defined(RTEMS_POSIX_API)
   /**
    *  This macro is defined when an API is enabled that requires that the
@@ -68,36 +61,6 @@ extern "C" {
 typedef struct CORE_message_queue_Control CORE_message_queue_Control;
 
 /**
- * @brief The structure is used to organize message buffers of a message queue.
- */
-typedef struct {
-  /**
-   * @brief This member is used to enqueue the buffer in the pending or free
-   *   buffer queue of a message queue.
-   */
-  Chain_Node Node;
-
-  /** @brief This member defines the size of this message. */
-  size_t size;
-
-#if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
-  /** @brief This member defines the priority of this message. */
-  int priority;
-#endif
-
-  /**
-   * @brief This member contains the actual message.
-   *
-   * This is a zero-length array since the maximum message size is defined by
-   * the user.  Use a size_t array to make sure that the member offset is at
-   * the structure end.  This enables a more efficient memcpy() on 64-bit
-   * targets and makes it easier to inspect the message buffers with a
-   * debugger.
-   */
-  size_t buffer[ RTEMS_ZERO_LENGTH_ARRAY ];
-} CORE_message_queue_Buffer;
-
-/**
  *  @brief The possible blocking disciplines for a message queue.
  *
  *  This enumerated types defines the possible blocking disciplines
diff --git a/cpukit/include/rtems/score/coremsgbuffer.h b/cpukit/include/rtems/score/coremsgbuffer.h
new file mode 100644
index 0000000..1960fac
--- /dev/null
+++ b/cpukit/include/rtems/score/coremsgbuffer.h
@@ -0,0 +1,96 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSScoreMessageQueue
+ *
+ * @brief This header file defines the buffer data structure used by the
+ *   Message Queue Handler.
+ */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 1989, 2009 On-Line Applications Research Corporation (OAR)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTEMS_SCORE_COREMSGBUFFER_H
+#define _RTEMS_SCORE_COREMSGBUFFER_H
+
+#include <rtems/score/basedefs.h>
+#include <rtems/score/chain.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup RTEMSScoreMessageQueue
+ *
+ * @{
+ */
+
+/**
+ * This define enables the support for priority based enqueuing of messages in
+ * the Message Queue Handler.
+ */
+#define RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY
+
+/**
+ * @brief The structure is used to organize message buffers of a message queue.
+ */
+typedef struct {
+  /**
+   * @brief This member is used to enqueue the buffer in the pending or free
+   *   buffer queue of a message queue.
+   */
+  Chain_Node Node;
+
+  /** @brief This member defines the size of this message. */
+  size_t size;
+
+#if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
+  /** @brief This member defines the priority of this message. */
+  int priority;
+#endif
+
+  /**
+   * @brief This member contains the actual message.
+   *
+   * This is a zero-length array since the maximum message size is defined by
+   * the user.  Use a size_t array to make sure that the member offset is at
+   * the structure end.  This enables a more efficient memcpy() on 64-bit
+   * targets and makes it easier to inspect the message buffers with a
+   * debugger.
+   */
+  size_t buffer[ RTEMS_ZERO_LENGTH_ARRAY ];
+} CORE_message_queue_Buffer;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTEMS_SCORE_COREMSGBUFFER_H */
diff --git a/spec/build/cpukit/librtemscpu.yml b/spec/build/cpukit/librtemscpu.yml
index e3606db..2baf8ef 100644
--- a/spec/build/cpukit/librtemscpu.yml
+++ b/spec/build/cpukit/librtemscpu.yml
@@ -337,6 +337,7 @@ install:
   - cpukit/include/rtems/score/corebarrier.h
   - cpukit/include/rtems/score/corebarrierimpl.h
   - cpukit/include/rtems/score/coremsg.h
+  - cpukit/include/rtems/score/coremsgbuffer.h
   - cpukit/include/rtems/score/coremsgimpl.h
   - cpukit/include/rtems/score/coremutex.h
   - cpukit/include/rtems/score/coremuteximpl.h



More information about the vc mailing list