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/msgqflush.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/msgqflush.c')
-rw-r--r-- | cpukit/rtems/src/msgqflush.c | 69 |
1 files changed, 13 insertions, 56 deletions
diff --git a/cpukit/rtems/src/msgqflush.c b/cpukit/rtems/src/msgqflush.c index 809c243b52..5cd09b6408 100644 --- a/cpukit/rtems/src/msgqflush.c +++ b/cpukit/rtems/src/msgqflush.c @@ -18,79 +18,36 @@ #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_message_queue_flush - * - * This directive removes all pending messages from a queue and returns - * the number of messages removed. If no messages were present then - * a count of zero is returned. - * - * Input parameters: - * id - queue id - * count - return area for count - * - * Output parameters: - * count - number of messages removed ( 0 = empty queue ) - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ rtems_status_code rtems_message_queue_flush( rtems_id id, uint32_t *count ) { - Message_queue_Control *the_message_queue; - Objects_Locations location; - ISR_lock_Context lock_context; + Message_queue_Control *the_message_queue; + ISR_lock_Context lock_context; - if ( !count ) + if ( count == NULL ) { return RTEMS_INVALID_ADDRESS; + } the_message_queue = _Message_queue_Get_interrupt_disable( id, - &location, &lock_context ); - switch ( location ) { - - case OBJECTS_LOCAL: - *count = _CORE_message_queue_Flush( - &the_message_queue->message_queue, - &lock_context - ); - return RTEMS_SUCCESSFUL; + if ( the_message_queue == NULL ) { #if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: - _Thread_Executing->Wait.return_argument = count; - - return - _Message_queue_MP_Send_request_packet( - MESSAGE_QUEUE_MP_FLUSH_REQUEST, - id, - 0, /* buffer not used */ - 0, /* size */ - 0, /* option_set not used */ - MPCI_DEFAULT_TIMEOUT - ); + _Message_queue_MP_Flush( id, count ); +#else + return RTEMS_INVALID_ID; #endif - - case OBJECTS_ERROR: - break; } - return RTEMS_INVALID_ID; + *count = _CORE_message_queue_Flush( + &the_message_queue->message_queue, + &lock_context + ); + return RTEMS_SUCCESSFUL; } |