From 88e09b983d3860f6560d3d1ef24ae8d122cdca84 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 29 Apr 2016 10:41:36 +0200 Subject: score: _CORE_message_queue_Insert_message() Move common code into _CORE_message_queue_Insert_message(). --- cpukit/score/include/rtems/score/coremsgimpl.h | 12 ++++++------ cpukit/score/src/coremsginsert.c | 10 ++++++++++ cpukit/score/src/coremsgseize.c | 10 +++------- cpukit/score/src/coremsgsubmit.c | 14 +++++--------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/cpukit/score/include/rtems/score/coremsgimpl.h b/cpukit/score/include/rtems/score/coremsgimpl.h index 7edca17306..b6103978e8 100644 --- a/cpukit/score/include/rtems/score/coremsgimpl.h +++ b/cpukit/score/include/rtems/score/coremsgimpl.h @@ -430,21 +430,21 @@ void _CORE_message_queue_Seize( /** * @brief Insert a message into the message queue. * - * This kernel routine inserts the specified message into the - * message queue. It is assumed that the message has been filled - * in before this routine is called. + * Copies the specified content into the message storage space and then + * inserts the message into the message queue according to the submit type. * * @param[in] the_message_queue points to the message queue * @param[in] the_message is the message to enqueue + * @param[in] content_source the message content source + * @param[in] content_size the message content size in bytes * @param[in] submit_type determines whether the message is prepended, * appended, or enqueued in priority order. - * - * - INTERRUPT LATENCY: - * + insert */ void _CORE_message_queue_Insert_message( CORE_message_queue_Control *the_message_queue, CORE_message_queue_Buffer_control *the_message, + const void *content_source, + size_t content_size, CORE_message_queue_Submit_types submit_type ); diff --git a/cpukit/score/src/coremsginsert.c b/cpukit/score/src/coremsginsert.c index a58a451891..8baea36067 100644 --- a/cpukit/score/src/coremsginsert.c +++ b/cpukit/score/src/coremsginsert.c @@ -40,6 +40,8 @@ static bool _CORE_message_queue_Order( void _CORE_message_queue_Insert_message( CORE_message_queue_Control *the_message_queue, CORE_message_queue_Buffer_control *the_message, + const void *content_source, + size_t content_size, CORE_message_queue_Submit_types submit_type ) { @@ -48,6 +50,14 @@ void _CORE_message_queue_Insert_message( bool notify; #endif + the_message->Contents.size = content_size; + + _CORE_message_queue_Copy_buffer( + content_source, + the_message->Contents.buffer, + content_size + ); + #if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY) the_message->priority = submit_type; #endif diff --git a/cpukit/score/src/coremsgseize.c b/cpukit/score/src/coremsgseize.c index 4c318bc5c4..534dc0bea4 100644 --- a/cpukit/score/src/coremsgseize.c +++ b/cpukit/score/src/coremsgseize.c @@ -90,16 +90,12 @@ void _CORE_message_queue_Seize( * puts the messages in the message queue on behalf of the * waiting task. */ - the_message->Contents.size = (size_t) the_thread->Wait.option; - _CORE_message_queue_Copy_buffer( - the_thread->Wait.return_argument_second.immutable_object, - the_message->Contents.buffer, - the_message->Contents.size - ); _CORE_message_queue_Insert_message( the_message_queue, the_message, - the_thread->Wait.count + the_thread->Wait.return_argument_second.immutable_object, + (size_t) the_thread->Wait.option, + (CORE_message_queue_Submit_types) the_thread->Wait.count ); _Thread_queue_Extract_critical( &the_message_queue->Wait_queue.Queue, diff --git a/cpukit/score/src/coremsgsubmit.c b/cpukit/score/src/coremsgsubmit.c index e8997347af..1d6d298ea7 100644 --- a/cpukit/score/src/coremsgsubmit.c +++ b/cpukit/score/src/coremsgsubmit.c @@ -72,16 +72,12 @@ CORE_message_queue_Status _CORE_message_queue_Do_submit( the_message = _CORE_message_queue_Allocate_message_buffer( the_message_queue ); if ( the_message ) { - the_message->Contents.size = size; - _CORE_message_queue_Copy_buffer( - buffer, - the_message->Contents.buffer, - size - ); _CORE_message_queue_Insert_message( - the_message_queue, - the_message, - submit_type + the_message_queue, + the_message, + buffer, + size, + submit_type ); _CORE_message_queue_Release( the_message_queue, lock_context ); return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; -- cgit v1.2.3