#4007 accepted enhancement

Add rtems_message_queue_construct()

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: rtems Version: 6
Severity: normal Keywords:
Cc: Blocked By:

Description (last modified by Sebastian Huber)

In RTEMS 5 a lot of development was done to allow a static allocation of resources provided by RTEMS and avoid the use of a heap. Similar to #3959 a new directive to build Classic API message queues without using the workspace is proposed:

 * @brief The message queue configuration to construct a message queue.
typedef struct {
   * @brief The name of the message queue.
  rtems_name name;

   * @brief The count of the provided buffers.
   * This value defines the maximum number of pending messages.
  size_t buffer_count;

   * @brief The size of the provided buffers in bytes.
  size_t buffer_size;

   * @brief The array of count message buffers.
   * Each buffer shall have the size of the buffer_size member.  The maximum
   * message size is buffer_size minus sizeof( rtems_message_queue_buffer ).
  rtems_message_queue_buffer *buffers;

   * @brief The attribute set of the message queue.
  rtems_attribute attributes;
} rtems_message_queue_config;

 * @brief Constructs a message queue according to the specified configuration.
 * @param config The message queue configuration.
 * @param[out] id The message queue identifier of the new message queue.
 * @retval RTEMS_SUCCESSFUL Successful operation.
 * @retval RTEMS_INVALID_ADDRESS The id parameter is @c NULL.
 * @retval RTEMS_INVALID_NAME The message queue name is invalid.
 * @retval RTEMS_TOO_MANY No message queue is available.
rtems_status_code rtems_message_queue_construct(
  const rtems_message_queue_config *config,
  rtems_id                         *id

Change History (11)

comment:1 Changed on Sep 17, 2020 at 4:18:59 PM by Sebastian Huber

Description: modified (diff)
Status: assignedaccepted
Summary: Add rtems_message_queue_build()Add rtems_message_queue_construct()

comment:2 Changed on Sep 17, 2020 at 4:19:28 PM by Sebastian Huber

Description: modified (diff)

comment:3 Changed on Sep 28, 2020 at 5:17:56 AM by Sebastian Huber <sebastian.huber@…>

In 3c025576/rtems:

score: Use RTEMS_ALIGN_UP()

Update #4007.

comment:4 Changed on Sep 28, 2020 at 5:17:59 AM by Sebastian Huber <sebastian.huber@…>

In fe2cb7c4/rtems:

score: Fix allocation size calculation

The previous multiplication error check is broken on 64-bit machines. Use the
recommended check from SEI CERT C Coding Standard, "INT30-C. Ensure that
unsigned integer operations do not wrap".

Make sure the message size computation does not overflow.

Update #4007.

comment:5 Changed on Sep 28, 2020 at 5:18:03 AM by Sebastian Huber <sebastian.huber@…>

In 34dd90a5/rtems:

score: Gather message queue control initialization

Initialize the structure in a single code block after the error checks and

Update #4007.

comment:6 Changed on Sep 28, 2020 at 5:18:06 AM by Sebastian Huber <sebastian.huber@…>

In 5bc7c37/rtems:

score: Improve _CORE_message_queue_Initialize()

Return a status code and differentiate between error conditions.

Update #4007.

comment:7 Changed on Sep 28, 2020 at 5:18:09 AM by Sebastian Huber <sebastian.huber@…>

In 69b4fe59/rtems:

score: Simplify CORE_message_queue_Buffer

Merge CORE_message_queue_Buffer structure into

Use a zero-length array for the actual message buffer. This reduces the
structure size on all targets.

Update #4007.

comment:8 Changed on Sep 28, 2020 at 5:18:13 AM by Sebastian Huber <sebastian.huber@…>

In 2c09f54f/rtems:

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.

comment:9 Changed on Sep 28, 2020 at 5:18:16 AM by Sebastian Huber <sebastian.huber@…>

In 24ea1ce/rtems:

rtems: Remove Message_queue_Control::attribute_set

Add Message_queue_Control::is_global if RTEMS_MULTIPROCESSING is defined. This
reduces the Message_queue_Control size in standard RTEMS configurations.

Update #4007.

comment:10 Changed on Sep 28, 2020 at 5:18:20 AM by Sebastian Huber <sebastian.huber@…>

In 4a4f41e/rtems:

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.

comment:11 Changed on Sep 28, 2020 at 5:18:23 AM by Sebastian Huber <sebastian.huber@…>

In febc6604/rtems:

validation: Test rtems_message_queue_construct()

Update #4007.

Note: See TracTickets for help on using tickets.