summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coremsgsubmit.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-23 13:37:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-26 21:44:31 +0200
commitdce487912d98835b8168e755b60514f5a8592b27 (patch)
tree8778547fbb0f2dbb07bb6a83f28d3f4464924141 /cpukit/score/src/coremsgsubmit.c
parentposix: Fix sem_init() with too large initial value (diff)
downloadrtems-dce487912d98835b8168e755b60514f5a8592b27.tar.bz2
score: Add Status_Control for all APIs
Unify the status codes of the Classic and POSIX API to use the new enum Status_Control. This eliminates the Thread_Control::Wait::timeout_code field and the timeout parameter of _Thread_queue_Enqueue_critical() and _MPCI_Send_request_packet(). It gets rid of the status code translation tables and instead uses simple bit operations to get the status for a particular API. This enables translation of status code constants at compile time. Add _Thread_Wait_get_status() to avoid direct access of thread internal data structures.
Diffstat (limited to 'cpukit/score/src/coremsgsubmit.c')
-rw-r--r--cpukit/score/src/coremsgsubmit.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/cpukit/score/src/coremsgsubmit.c b/cpukit/score/src/coremsgsubmit.c
index a86774175f..a623291776 100644
--- a/cpukit/score/src/coremsgsubmit.c
+++ b/cpukit/score/src/coremsgsubmit.c
@@ -22,10 +22,11 @@
#include <rtems/score/coremsgimpl.h>
#include <rtems/score/objectimpl.h>
#include <rtems/score/isr.h>
+#include <rtems/score/threadimpl.h>
#include <rtems/score/statesimpl.h>
#include <rtems/score/wkspace.h>
-CORE_message_queue_Status _CORE_message_queue_Submit(
+Status_Control _CORE_message_queue_Submit(
CORE_message_queue_Control *the_message_queue,
Thread_Control *executing,
const void *buffer,
@@ -41,7 +42,7 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
if ( size > the_message_queue->maximum_message_size ) {
_CORE_message_queue_Release( the_message_queue, queue_context );
- return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE;
+ return STATUS_MESSAGE_INVALID_SIZE;
}
/*
@@ -56,7 +57,7 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
queue_context
);
if ( the_thread != NULL ) {
- return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+ return STATUS_SUCCESSFUL;
}
/*
@@ -95,12 +96,12 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
_CORE_message_queue_Release( the_message_queue, queue_context );
#endif
- return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
+ return STATUS_SUCCESSFUL;
}
#if !defined(RTEMS_SCORE_COREMSG_ENABLE_BLOCKING_SEND)
_CORE_message_queue_Release( the_message_queue, queue_context );
- return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
+ return STATUS_TOO_MANY;
#else
/*
* No message buffers were available so we may need to return an
@@ -109,7 +110,7 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
*/
if ( !wait ) {
_CORE_message_queue_Release( the_message_queue, queue_context );
- return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
+ return STATUS_TOO_MANY;
}
/*
@@ -118,7 +119,7 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
*/
if ( _ISR_Is_in_progress() ) {
_CORE_message_queue_Release( the_message_queue, queue_context );
- return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED;
+ return STATUS_MESSAGE_QUEUE_WAIT_IN_ISR;
}
/*
@@ -127,7 +128,6 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
* it as a variable. Doing this emphasizes how dangerous it
* would be to use this variable prior to here.
*/
- executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
executing->Wait.return_argument_second.immutable_object = buffer;
executing->Wait.option = (uint32_t) size;
executing->Wait.count = submit_type;
@@ -138,9 +138,8 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
executing,
STATES_WAITING_FOR_MESSAGE,
timeout,
- CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
&queue_context->Lock_context
);
- return executing->Wait.return_code;
+ return _Thread_Wait_get_status( executing );
#endif
}