summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/coremsgimpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/include/rtems/score/coremsgimpl.h')
-rw-r--r--cpukit/include/rtems/score/coremsgimpl.h81
1 files changed, 52 insertions, 29 deletions
diff --git a/cpukit/include/rtems/score/coremsgimpl.h b/cpukit/include/rtems/score/coremsgimpl.h
index 6f6a01bea6..a11beef938 100644
--- a/cpukit/include/rtems/score/coremsgimpl.h
+++ b/cpukit/include/rtems/score/coremsgimpl.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/**
* @file
*
@@ -12,9 +14,26 @@
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
+ * 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_COREMSGIMPL_H
@@ -261,7 +280,7 @@ Status_Control _CORE_message_queue_Broadcast(
* @retval STATUS_MESSAGE_INVALID_SIZE The message size was too big.
* @retval STATUS_TOO_MANY No message buffers were available.
* @retval STATUS_MESSAGE_QUEUE_WAIT_IN_ISR The caller is in an ISR, do not block!
- * @retval STATUS_TIMEOUT A timeout occured.
+ * @retval STATUS_TIMEOUT A timeout occurred.
*/
Status_Control _CORE_message_queue_Submit(
CORE_message_queue_Control *the_message_queue,
@@ -298,7 +317,7 @@ Status_Control _CORE_message_queue_Submit(
*
* @retval STATUS_SUCCESSFUL The message was successfully seized from the message queue.
* @retval STATUS_UNSATISFIED Wait was set to false and there is currently no pending message.
- * @retval STATUS_TIMEOUT A timeout occured.
+ * @retval STATUS_TIMEOUT A timeout occurred.
*
* @note Returns message priority via return area in TCB.
*
@@ -351,9 +370,9 @@ void _CORE_message_queue_Insert_message(
* @retval STATUS_MESSAGE_INVALID_SIZE The message size was too big.
* @retval STATUS_TOO_MANY No message buffers were available.
* @retval STATUS_MESSAGE_QUEUE_WAIT_IN_ISR The caller is in an ISR, do not block!
- * @retval STATUS_TIMEOUT A timeout occured.
+ * @retval STATUS_TIMEOUT A timeout occurred.
*/
-RTEMS_INLINE_ROUTINE Status_Control _CORE_message_queue_Send(
+static inline Status_Control _CORE_message_queue_Send(
CORE_message_queue_Control *the_message_queue,
const void *buffer,
size_t size,
@@ -387,9 +406,9 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_message_queue_Send(
* @retval STATUS_MESSAGE_INVALID_SIZE The message size was too big.
* @retval STATUS_TOO_MANY No message buffers were available.
* @retval STATUS_MESSAGE_QUEUE_WAIT_IN_ISR The caller is in an ISR, do not block!
- * @retval STATUS_TIMEOUT A timeout occured.
+ * @retval STATUS_TIMEOUT A timeout occurred.
*/
-RTEMS_INLINE_ROUTINE Status_Control _CORE_message_queue_Urgent(
+static inline Status_Control _CORE_message_queue_Urgent(
CORE_message_queue_Control *the_message_queue,
const void *buffer,
size_t size,
@@ -411,10 +430,10 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_message_queue_Urgent(
/**
* @brief Acquires the message queue.
*
- * @param[in, out] the_message_queue Rhe message queue to acquire.
+ * @param[in, out] the_message_queue The message queue to acquire.
* @param queue_context The thread queue context.
*/
-RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire(
+static inline void _CORE_message_queue_Acquire(
CORE_message_queue_Control *the_message_queue,
Thread_queue_Context *queue_context
)
@@ -428,7 +447,7 @@ RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire(
* @param[in, out] the_message_queue The message queue to acquire critical.
* @param queue_context The thread queue context.
*/
-RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire_critical(
+static inline void _CORE_message_queue_Acquire_critical(
CORE_message_queue_Control *the_message_queue,
Thread_queue_Context *queue_context
)
@@ -442,7 +461,7 @@ RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire_critical(
* @param[in, out] the_message_queue The message queue to release.
* @param queue_context The thread queue context.
*/
-RTEMS_INLINE_ROUTINE void _CORE_message_queue_Release(
+static inline void _CORE_message_queue_Release(
CORE_message_queue_Control *the_message_queue,
Thread_queue_Context *queue_context
)
@@ -460,7 +479,7 @@ RTEMS_INLINE_ROUTINE void _CORE_message_queue_Release(
* @param[out] destination The destination messag buffer to copy the source to.
* @param size The size of the source buffer.
*/
-RTEMS_INLINE_ROUTINE void _CORE_message_queue_Copy_buffer (
+static inline void _CORE_message_queue_Copy_buffer (
const void *source,
void *destination,
size_t size
@@ -480,7 +499,7 @@ RTEMS_INLINE_ROUTINE void _CORE_message_queue_Copy_buffer (
* @retval pointer The allocated message buffer.
* @retval NULL The inactive message buffer chain is empty.
*/
-RTEMS_INLINE_ROUTINE CORE_message_queue_Buffer *
+static inline CORE_message_queue_Buffer *
_CORE_message_queue_Allocate_message_buffer (
CORE_message_queue_Control *the_message_queue
)
@@ -498,7 +517,7 @@ _CORE_message_queue_Allocate_message_buffer (
* @param[in, out] the_message_queue The message queue to free the message buffer to.
* @param[out] the_message The message to be freed.
*/
-RTEMS_INLINE_ROUTINE void _CORE_message_queue_Free_message_buffer (
+static inline void _CORE_message_queue_Free_message_buffer (
CORE_message_queue_Control *the_message_queue,
CORE_message_queue_Buffer *the_message
)
@@ -519,7 +538,7 @@ RTEMS_INLINE_ROUTINE void _CORE_message_queue_Free_message_buffer (
* @note It encapsulates the optional behavior that message priority is
* disabled if no API requires it.
*/
-RTEMS_INLINE_ROUTINE int _CORE_message_queue_Get_message_priority (
+static inline int _CORE_message_queue_Get_message_priority (
const CORE_message_queue_Buffer *the_message
)
{
@@ -541,7 +560,7 @@ RTEMS_INLINE_ROUTINE int _CORE_message_queue_Get_message_priority (
* @retval pointer The first message if the message queue is not empty.
* @retval NULL The message queue is empty.
*/
-RTEMS_INLINE_ROUTINE
+static inline
CORE_message_queue_Buffer *_CORE_message_queue_Get_pending_message (
CORE_message_queue_Control *the_message_queue
)
@@ -562,7 +581,7 @@ RTEMS_INLINE_ROUTINE
* @retval true Notification is enabled on this message queue.
* @retval false Notification is not enabled on this message queue.
*/
- RTEMS_INLINE_ROUTINE bool _CORE_message_queue_Is_notify_enabled (
+ static inline bool _CORE_message_queue_Is_notify_enabled (
CORE_message_queue_Control *the_message_queue
)
{
@@ -580,7 +599,7 @@ RTEMS_INLINE_ROUTINE
* @param[out] the_handler The notification information for the message queue.
*/
#if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
- RTEMS_INLINE_ROUTINE void _CORE_message_queue_Set_notify (
+ static inline void _CORE_message_queue_Set_notify (
CORE_message_queue_Control *the_message_queue,
CORE_message_queue_Notify_Handler the_handler
)
@@ -608,7 +627,7 @@ RTEMS_INLINE_ROUTINE
* @retval thread The Thread_Control for the first locked thread, if there is a locked thread.
* @retval NULL There are pending messages or no thread waiting to receive.
*/
-RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Dequeue_receiver(
+static inline Thread_Control *_CORE_message_queue_Dequeue_receiver(
CORE_message_queue_Control *the_message_queue,
const void *buffer,
size_t size,
@@ -616,7 +635,8 @@ RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Dequeue_receiver(
Thread_queue_Context *queue_context
)
{
- Thread_Control *the_thread;
+ Thread_queue_Heads *heads;
+ Thread_Control *the_thread;
/*
* If there are pending messages, then there can't be threads
@@ -634,14 +654,18 @@ RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Dequeue_receiver(
* There must be no pending messages if there is a thread waiting to
* receive a message.
*/
- the_thread = _Thread_queue_First_locked(
- &the_message_queue->Wait_queue,
- the_message_queue->operations
- );
- if ( the_thread == NULL ) {
+ heads = the_message_queue->Wait_queue.Queue.heads;
+ if ( heads == NULL ) {
return NULL;
}
+ the_thread = ( *the_message_queue->operations->surrender )(
+ &the_message_queue->Wait_queue.Queue,
+ heads,
+ NULL,
+ queue_context
+ );
+
*(size_t *) the_thread->Wait.return_argument = size;
the_thread->Wait.count = (uint32_t) submit_type;
@@ -651,9 +675,8 @@ RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Dequeue_receiver(
size
);
- _Thread_queue_Extract_critical(
+ _Thread_queue_Resume(
&the_message_queue->Wait_queue.Queue,
- the_message_queue->operations,
the_thread,
queue_context
);