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/msgqurgent.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/msgqurgent.c')
-rw-r--r-- | cpukit/rtems/src/msgqurgent.c | 83 |
1 files changed, 30 insertions, 53 deletions
diff --git a/cpukit/rtems/src/msgqurgent.c b/cpukit/rtems/src/msgqurgent.c index 430f9a1c9f..5220ce845a 100644 --- a/cpukit/rtems/src/msgqurgent.c +++ b/cpukit/rtems/src/msgqurgent.c @@ -18,17 +18,7 @@ #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/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/rtems/status.h> -#include <rtems/rtems/attrimpl.h> #include <rtems/rtems/messageimpl.h> -#include <rtems/rtems/options.h> -#include <rtems/rtems/support.h> rtems_status_code rtems_message_queue_urgent( rtems_id id, @@ -36,59 +26,46 @@ rtems_status_code rtems_message_queue_urgent( size_t size ) { - Message_queue_Control *the_message_queue; - Objects_Locations location; - CORE_message_queue_Status status; - ISR_lock_Context lock_context; + Message_queue_Control *the_message_queue; + ISR_lock_Context lock_context; + CORE_message_queue_Status status; - if ( !buffer ) + if ( buffer == NULL ) { return RTEMS_INVALID_ADDRESS; + } the_message_queue = _Message_queue_Get_interrupt_disable( id, - &location, &lock_context ); - switch ( location ) { - - case OBJECTS_LOCAL: - _CORE_message_queue_Acquire_critical( - &the_message_queue->message_queue, - &lock_context - ); - status = _CORE_message_queue_Urgent( - &the_message_queue->message_queue, - buffer, - size, - _Message_queue_Core_message_queue_mp_support, - id, - false, /* sender does not block */ - 0, /* no timeout */ - &lock_context - ); - - /* - * Since this API does not allow for blocking sends, we can directly - * return the returned status. - */ - - return _Message_queue_Translate_core_message_queue_return_code(status); + if ( the_message_queue == NULL ) { #if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: - return _Message_queue_MP_Send_request_packet( - MESSAGE_QUEUE_MP_URGENT_REQUEST, - id, - buffer, - &size, - 0, /* option_set */ - MPCI_DEFAULT_TIMEOUT - ); + _Message_queue_MP_Urgent( id, buffer, size ); +#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 + ); + status = _CORE_message_queue_Urgent( + &the_message_queue->message_queue, + buffer, + size, + _Message_queue_Core_message_queue_mp_support, + id, + false, /* sender does not block */ + 0, /* no timeout */ + &lock_context + ); + + /* + * Since this API does not allow for blocking sends, we can directly + * return the returned status. + */ + + return _Message_queue_Translate_core_message_queue_return_code( status ); } |