summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coremsginsert.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-09-11 20:00:30 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-09-11 20:00:30 +0000
commit507d38261dd850ce6a572b8587a00eb3aa6c8bc6 (patch)
tree2cb63ea70e3ef4d0c5104270023f645399ee0914 /cpukit/score/src/coremsginsert.c
parent2009-09-11 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-507d38261dd850ce6a572b8587a00eb3aa6c8bc6.tar.bz2
2009-09-11 Joel Sherrill <joel.sherrill@OARcorp.com>
* 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.
Diffstat (limited to 'cpukit/score/src/coremsginsert.c')
-rw-r--r--cpukit/score/src/coremsginsert.c96
1 files changed, 55 insertions, 41 deletions
diff --git a/cpukit/score/src/coremsginsert.c b/cpukit/score/src/coremsginsert.c
index 20d445efc7..9b5dbdfeef 100644
--- a/cpukit/score/src/coremsginsert.c
+++ b/cpukit/score/src/coremsginsert.c
@@ -56,59 +56,73 @@ void _CORE_message_queue_Insert_message(
)
{
ISR_Level level;
- bool notify = false;
+ #if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
+ bool notify = false;
+ #define SET_NOTIFY() \
+ if ( the_message_queue->number_of_pending_messages == 0 )
+ notify = true;
+ #else
+ #define SET_NOTIFY()
+ #endif
- the_message->priority = submit_type;
+ #if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
+ the_message->priority = submit_type;
+ #endif
- switch ( submit_type ) {
- case CORE_MESSAGE_QUEUE_SEND_REQUEST:
+ #if !defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
+ _ISR_Disable( level );
+ SET_NOTIFY();
+ the_message_queue->number_of_pending_messages++;
+ if ( submit_type == CORE_MESSAGE_QUEUE_SEND_REQUEST )
+ _CORE_message_queue_Append_unprotected(the_message_queue, the_message);
+ else
+ _CORE_message_queue_Prepend_unprotected(the_message_queue, the_message);
+ _ISR_Enable( level );
+ #else
+ if ( submit_type == CORE_MESSAGE_QUEUE_SEND_REQUEST ) {
_ISR_Disable( level );
- if ( the_message_queue->number_of_pending_messages++ == 0 )
- notify = true;
+ SET_NOTIFY();
+ the_message_queue->number_of_pending_messages++;
_CORE_message_queue_Append_unprotected(the_message_queue, the_message);
_ISR_Enable( level );
- break;
- case CORE_MESSAGE_QUEUE_URGENT_REQUEST:
+ } else if ( submit_type == CORE_MESSAGE_QUEUE_URGENT_REQUEST ) {
_ISR_Disable( level );
- if ( the_message_queue->number_of_pending_messages++ == 0 )
- notify = true;
+ SET_NOTIFY();
+ the_message_queue->number_of_pending_messages++;
_CORE_message_queue_Prepend_unprotected(the_message_queue, the_message);
_ISR_Enable( level );
- break;
- default:
- {
- CORE_message_queue_Buffer_control *this_message;
- Chain_Node *the_node;
- Chain_Control *the_header;
-
- the_header = &the_message_queue->Pending_messages;
- the_node = the_header->first;
- while ( !_Chain_Is_tail( the_header, the_node ) ) {
+ } else {
+ CORE_message_queue_Buffer_control *this_message;
+ Chain_Node *the_node;
+ Chain_Control *the_header;
- this_message = (CORE_message_queue_Buffer_control *) the_node;
+ the_header = &the_message_queue->Pending_messages;
+ the_node = the_header->first;
+ while ( !_Chain_Is_tail( the_header, the_node ) ) {
- if ( this_message->priority <= the_message->priority ) {
- the_node = the_node->next;
- continue;
- }
+ this_message = (CORE_message_queue_Buffer_control *) the_node;
- break;
+ if ( this_message->priority <= the_message->priority ) {
+ the_node = the_node->next;
+ continue;
}
- _ISR_Disable( level );
- if ( the_message_queue->number_of_pending_messages++ == 0 )
- notify = true;
- _Chain_Insert_unprotected( the_node->previous, &the_message->Node );
- _ISR_Enable( level );
+ break;
}
- break;
- }
-
- /*
- * According to POSIX, does this happen before or after the message
- * is actually enqueued. It is logical to think afterwards, because
- * the message is actually in the queue at this point.
- */
+ _ISR_Disable( level );
+ SET_NOTIFY();
+ the_message_queue->number_of_pending_messages++;
+ _Chain_Insert_unprotected( the_node->previous, &the_message->Node );
+ _ISR_Enable( level );
+ }
+ #endif
- if ( notify && the_message_queue->notify_handler )
- (*the_message_queue->notify_handler)( the_message_queue->notify_argument );
+ #if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
+ /*
+ * According to POSIX, does this happen before or after the message
+ * is actually enqueued. It is logical to think afterwards, because
+ * the message is actually in the queue at this point.
+ */
+ if ( notify && the_message_queue->notify_handler )
+ (*the_message_queue->notify_handler)(the_message_queue->notify_argument);
+ #endif
}