diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 14:21:12 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 16:16:59 +0200 |
commit | 641b44c225c71af51285f9a1b408a4f4c2844f8b (patch) | |
tree | 0141b2e6d009fc681b3599796874734457ced6dd /cpukit/rtems/src/msgqreceive.c | |
parent | rtems: Remove location from _Partition_Get() (diff) | |
download | rtems-641b44c225c71af51285f9a1b408a4f4c2844f8b.tar.bz2 |
rtems: _Message_queue_Get_interrupt_disable()
Use _Objects_Get_local() for _Message_queue_Get_interrupt_disable() to
get rid of the location parameter. Move remote object handling to
message queue MPCI support.
Diffstat (limited to 'cpukit/rtems/src/msgqreceive.c')
-rw-r--r-- | cpukit/rtems/src/msgqreceive.c | 88 |
1 files changed, 31 insertions, 57 deletions
diff --git a/cpukit/rtems/src/msgqreceive.c b/cpukit/rtems/src/msgqreceive.c index e3b3466954..2c8b90e3e7 100644 --- a/cpukit/rtems/src/msgqreceive.c +++ b/cpukit/rtems/src/msgqreceive.c @@ -18,17 +18,9 @@ #include "config.h" #endif -#include <rtems/system.h> -#include <rtems/score/chain.h> -#include <rtems/score/isr.h> -#include <rtems/score/coremsgimpl.h> -#include <rtems/score/threadimpl.h> -#include <rtems/score/wkspace.h> -#include <rtems/rtems/status.h> -#include <rtems/rtems/attrimpl.h> #include <rtems/rtems/messageimpl.h> +#include <rtems/score/threadimpl.h> #include <rtems/rtems/optionsimpl.h> -#include <rtems/rtems/support.h> THREAD_WAIT_QUEUE_OBJECT_ASSERT( Message_queue_Control, @@ -43,66 +35,48 @@ rtems_status_code rtems_message_queue_receive( rtems_interval timeout ) { - Message_queue_Control *the_message_queue; - Objects_Locations location; - bool wait; - Thread_Control *executing; - ISR_lock_Context lock_context; + Message_queue_Control *the_message_queue; + ISR_lock_Context lock_context; + Thread_Control *executing; - if ( !buffer ) + if ( buffer == NULL ) { return RTEMS_INVALID_ADDRESS; + } - if ( !size ) + if ( size == NULL ) { return RTEMS_INVALID_ADDRESS; + } the_message_queue = _Message_queue_Get_interrupt_disable( id, - &location, &lock_context ); - switch ( location ) { - - case OBJECTS_LOCAL: - if ( _Options_Is_no_wait( option_set ) ) - wait = false; - else - wait = true; - - _CORE_message_queue_Acquire_critical( - &the_message_queue->message_queue, - &lock_context - ); - - executing = _Thread_Executing; - _CORE_message_queue_Seize( - &the_message_queue->message_queue, - executing, - the_message_queue->Object.id, - buffer, - size, - wait, - timeout, - &lock_context - ); - return _Message_queue_Translate_core_message_queue_return_code( - executing->Wait.return_code - ); + if ( the_message_queue == NULL ) { #if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: - return _Message_queue_MP_Send_request_packet( - MESSAGE_QUEUE_MP_RECEIVE_REQUEST, - id, - buffer, - size, - option_set, - timeout - ); + _Message_queue_MP_Receive( id, buffer, size, option_set, timeout ); +#else + return RTEMS_INVALID_ID; #endif - - case OBJECTS_ERROR: - break; } - return RTEMS_INVALID_ID; + _CORE_message_queue_Acquire_critical( + &the_message_queue->message_queue, + &lock_context + ); + + executing = _Thread_Executing; + _CORE_message_queue_Seize( + &the_message_queue->message_queue, + executing, + the_message_queue->Object.id, + buffer, + size, + !_Options_Is_no_wait( option_set ), + timeout, + &lock_context + ); + return _Message_queue_Translate_core_message_queue_return_code( + executing->Wait.return_code + ); } |