summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/coremsgimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-23 16:47:58 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-28 07:16:01 +0200
commit4a4f41ed642cd5d9f4056b12d86bbf80e8da983a (patch)
tree40a7ff0913194c8aa9603dd47625816ae332ce01 /cpukit/include/rtems/score/coremsgimpl.h
parentrtems: Remove Message_queue_Control::attribute_set (diff)
downloadrtems-4a4f41ed642cd5d9f4056b12d86bbf80e8da983a.tar.bz2
rtems: Add rtems_message_queue_construct()
In contrast to message queues created by rtems_message_queue_create(), the message queues constructed by this directive use a user-provided message buffer storage area. Add RTEMS_MESSAGE_QUEUE_BUFFER() to define a message buffer type for message buffer storage areas. Update #4007.
Diffstat (limited to 'cpukit/include/rtems/score/coremsgimpl.h')
-rw-r--r--cpukit/include/rtems/score/coremsgimpl.h67
1 files changed, 61 insertions, 6 deletions
diff --git a/cpukit/include/rtems/score/coremsgimpl.h b/cpukit/include/rtems/score/coremsgimpl.h
index cb84bfb207..0bf5fa52d0 100644
--- a/cpukit/include/rtems/score/coremsgimpl.h
+++ b/cpukit/include/rtems/score/coremsgimpl.h
@@ -69,6 +69,54 @@ extern "C" {
typedef int CORE_message_queue_Submit_types;
/**
+ * @brief This handler shall allocate the message buffer storage area for a
+ * message queue.
+ *
+ * The handler shall set the CORE_message_queue_Control::free_message_buffers
+ * member.
+ *
+ * @param[out] the_message_queue is the message queue control.
+ *
+ * @param size is the message buffer storage area size to allocate.
+ *
+ * @param arg is the handler argument.
+ *
+ * @retval NULL The allocation failed.
+ *
+ * @return Otherwise the pointer to the allocated message buffer storage area
+ * begin shall be returned.
+ */
+typedef void *( *CORE_message_queue_Allocate_buffers )(
+ CORE_message_queue_Control *the_message_queue,
+ size_t size,
+ const void *arg
+);
+
+/**
+ * @brief This handler allocates the message buffer storage area for a message
+ * queue from the RTEMS Workspace.
+ *
+ * The handler sets the CORE_message_queue_Control::free_message_buffers
+ * to _Workspace_Free().
+ *
+ * @param[out] the_message_queue is the message queue control.
+ *
+ * @param size is the message buffer storage area size to allocate.
+ *
+ * @param arg is the unused handler argument.
+ *
+ * @retval NULL The allocation failed.
+ *
+ * @return Otherwise the pointer to the allocated message buffer storage area
+ * begin is returned.
+ */
+void *_CORE_message_queue_Workspace_allocate(
+ CORE_message_queue_Control *the_message_queue,
+ size_t size,
+ const void *arg
+);
+
+/**
* @brief Initializes a message queue.
*
* @param[out] the_message_queue is the message queue to initialize.
@@ -81,19 +129,26 @@ typedef int CORE_message_queue_Submit_types;
* @param maximum_message_size is the size of the largest message that may be
* sent to this message queue instance.
*
+ * @param allocate_buffers is the message buffer storage area allocation
+ * handler.
+ *
+ * @param arg is the message buffer storage area allocation handler argument.
+ *
* @retval STATUS_SUCCESSFUL The message queue was initialized.
*
* @retval STATUS_MESSAGE_QUEUE_INVALID_SIZE Calculations with the maximum
* pending messages or maximum message size produced an integer overflow.
*
- * @retval STATUS_MESSAGE_QUEUE_NO_MEMORY There was not enough memory to
- * allocate the message buffers.
+ * @retval STATUS_MESSAGE_QUEUE_NO_MEMORY The message buffer storage area
+ * allocation failed.
*/
Status_Control _CORE_message_queue_Initialize(
- CORE_message_queue_Control *the_message_queue,
- CORE_message_queue_Disciplines discipline,
- uint32_t maximum_pending_messages,
- size_t maximum_message_size
+ CORE_message_queue_Control *the_message_queue,
+ CORE_message_queue_Disciplines discipline,
+ uint32_t maximum_pending_messages,
+ size_t maximum_message_size,
+ CORE_message_queue_Allocate_buffers allocate_buffers,
+ const void *arg
);
/**