[PATCH v2 6/9] score: Add <rtems/score/coremsgbuffer.h>
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Sep 25 09:51:29 UTC 2020
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(-)
create mode 100644 cpukit/include/rtems/score/coremsgbuffer.h
diff --git a/cpukit/headers.am b/cpukit/headers.am
index 77df5ecb4c..23a84ca243 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 2131fa0765..220c9839a5 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
@@ -67,36 +60,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.
*
diff --git a/cpukit/include/rtems/score/coremsgbuffer.h b/cpukit/include/rtems/score/coremsgbuffer.h
new file mode 100644
index 0000000000..1960facb34
--- /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 e3606dbdc8..2baf8ef01c 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
--
2.26.2
More information about the devel
mailing list