From 507d38261dd850ce6a572b8587a00eb3aa6c8bc6 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 11 Sep 2009 20:00:30 +0000 Subject: 2009-09-11 Joel Sherrill * score/include/rtems/score/coremsg.h, score/inline/rtems/score/coremsg.inl, score/src/coremsg.c, score/src/coremsginsert.c, score/src/coremsgseize.c, score/src/coremsgsubmit.c, score/src/objectnametoidstring.c: Disable the Core Message Queue features of notification, priority messages, and blocking sends when no API requires them. --- cpukit/score/src/coremsgsubmit.c | 87 ++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 43 deletions(-) (limited to 'cpukit/score/src/coremsgsubmit.c') diff --git a/cpukit/score/src/coremsgsubmit.c b/cpukit/score/src/coremsgsubmit.c index fbebdaa0b2..d52746e9ac 100644 --- a/cpukit/score/src/coremsgsubmit.c +++ b/cpukit/score/src/coremsgsubmit.c @@ -7,7 +7,7 @@ * This core object provides task synchronization and communication functions * via messages passed to queue objects. * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -69,7 +69,6 @@ CORE_message_queue_Status _CORE_message_queue_Submit( Watchdog_Interval timeout ) { - ISR_Level level; CORE_message_queue_Buffer_control *the_message; Thread_Control *the_thread; @@ -80,7 +79,6 @@ CORE_message_queue_Status _CORE_message_queue_Submit( /* * Is there a thread currently waiting on this message queue? */ - if ( the_message_queue->number_of_pending_messages == 0 ) { the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue ); if ( the_thread ) { @@ -104,7 +102,6 @@ CORE_message_queue_Status _CORE_message_queue_Submit( * No one waiting on the message queue at this time, so attempt to * queue the message up for a future receive. */ - if ( the_message_queue->number_of_pending_messages < the_message_queue->maximum_pending_messages ) { @@ -126,7 +123,9 @@ CORE_message_queue_Status _CORE_message_queue_Submit( size ); the_message->Contents.size = size; - the_message->priority = submit_type; + #if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY) + the_message->priority = submit_type; + #endif _CORE_message_queue_Insert_message( the_message_queue, @@ -136,46 +135,48 @@ CORE_message_queue_Status _CORE_message_queue_Submit( return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; } - /* - * No message buffers were available so we may need to return an - * overflow error or block the sender until the message is placed - * on the queue. - */ - - if ( !wait ) { + #if !defined(RTEMS_SCORE_COREMSG_ENABLE_BLOCKING_SEND) return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY; - } - - /* - * Do NOT block on a send if the caller is in an ISR. It is - * deadly to block in an ISR. - */ - - if ( _ISR_Is_in_progress() ) { - return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED; - } - - /* - * WARNING!! executing should NOT be used prior to this point. - * Thus the unusual choice to open a new scope and declare - * it as a variable. Doing this emphasizes how dangerous it - * would be to use this variable prior to here. - */ - - { - Thread_Control *executing = _Thread_Executing; + #else + /* + * No message buffers were available so we may need to return an + * overflow error or block the sender until the message is placed + * on the queue. + */ + if ( !wait ) { + return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY; + } - _ISR_Disable( level ); - _Thread_queue_Enter_critical_section( &the_message_queue->Wait_queue ); - executing->Wait.queue = &the_message_queue->Wait_queue; - executing->Wait.id = id; - executing->Wait.return_argument_second.immutable_object = buffer; - executing->Wait.option = (uint32_t) size; - executing->Wait.count = submit_type; - _ISR_Enable( level ); + /* + * Do NOT block on a send if the caller is in an ISR. It is + * deadly to block in an ISR. + */ + if ( _ISR_Is_in_progress() ) { + return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED; + } - _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout ); - } + /* + * WARNING!! executing should NOT be used prior to this point. + * Thus the unusual choice to open a new scope and declare + * it as a variable. Doing this emphasizes how dangerous it + * would be to use this variable prior to here. + */ + { + Thread_Control *executing = _Thread_Executing; + ISR_Level level; + + _ISR_Disable( level ); + _Thread_queue_Enter_critical_section( &the_message_queue->Wait_queue ); + executing->Wait.queue = &the_message_queue->Wait_queue; + executing->Wait.id = id; + executing->Wait.return_argument_second.immutable_object = buffer; + executing->Wait.option = (uint32_t) size; + executing->Wait.count = submit_type; + _ISR_Enable( level ); + + _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout ); + } - return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT; + return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT; + #endif } -- cgit v1.2.3