summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/Makefile.am3
-rw-r--r--cpukit/rtems/include/rtems/rtems/barrierimpl.h14
-rw-r--r--cpukit/rtems/include/rtems/rtems/eventimpl.h2
-rw-r--r--cpukit/rtems/include/rtems/rtems/messageimpl.h14
-rw-r--r--cpukit/rtems/include/rtems/rtems/semimpl.h76
-rw-r--r--cpukit/rtems/include/rtems/rtems/statusimpl.h15
-rw-r--r--cpukit/rtems/src/barriertranslatereturncode.c45
-rw-r--r--cpukit/rtems/src/barrierwait.c12
-rw-r--r--cpukit/rtems/src/eventmp.c8
-rw-r--r--cpukit/rtems/src/eventreceive.c4
-rw-r--r--cpukit/rtems/src/eventseize.c20
-rw-r--r--cpukit/rtems/src/msgmp.c16
-rw-r--r--cpukit/rtems/src/msgqbroadcast.c9
-rw-r--r--cpukit/rtems/src/msgqreceive.c8
-rw-r--r--cpukit/rtems/src/msgqsend.c15
-rw-r--r--cpukit/rtems/src/msgqtranslatereturncode.c65
-rw-r--r--cpukit/rtems/src/msgqurgent.c15
-rw-r--r--cpukit/rtems/src/partmp.c17
-rw-r--r--cpukit/rtems/src/regiongetsegment.c6
-rw-r--r--cpukit/rtems/src/regionprocessqueue.c3
-rw-r--r--cpukit/rtems/src/semcreate.c25
-rw-r--r--cpukit/rtems/src/semdelete.c11
-rw-r--r--cpukit/rtems/src/semflush.c2
-rw-r--r--cpukit/rtems/src/semmp.c15
-rw-r--r--cpukit/rtems/src/semobtain.c31
-rw-r--r--cpukit/rtems/src/semrelease.c23
-rw-r--r--cpukit/rtems/src/semtranslatereturncode.c41
-rw-r--r--cpukit/rtems/src/signalmp.c8
-rw-r--r--cpukit/rtems/src/systemeventreceive.c4
-rw-r--r--cpukit/rtems/src/taskmp.c9
30 files changed, 133 insertions, 403 deletions
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 368dcdce12..0a452c8121 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -129,7 +129,6 @@ librtems_a_SOURCES += src/barrier.c
librtems_a_SOURCES += src/barriercreate.c
librtems_a_SOURCES += src/barrierdelete.c
librtems_a_SOURCES += src/barrierident.c
-librtems_a_SOURCES += src/barriertranslatereturncode.c
librtems_a_SOURCES += src/barrierrelease.c
librtems_a_SOURCES += src/barrierwait.c
@@ -170,7 +169,6 @@ librtems_a_SOURCES += src/msgqgetnumberpending.c
librtems_a_SOURCES += src/msgqident.c
librtems_a_SOURCES += src/msgqreceive.c
librtems_a_SOURCES += src/msgqsend.c
-librtems_a_SOURCES += src/msgqtranslatereturncode.c
librtems_a_SOURCES += src/msgqurgent.c
## SEMAPHORE_C_FILES
@@ -181,7 +179,6 @@ librtems_a_SOURCES += src/semident.c
librtems_a_SOURCES += src/semobtain.c
librtems_a_SOURCES += src/semrelease.c
librtems_a_SOURCES += src/semflush.c
-librtems_a_SOURCES += src/semtranslatereturncode.c
librtems_a_SOURCES += src/semsetpriority.c
## EVENT_C_FILES
diff --git a/cpukit/rtems/include/rtems/rtems/barrierimpl.h b/cpukit/rtems/include/rtems/rtems/barrierimpl.h
index 0eaadfc046..6a98917012 100644
--- a/cpukit/rtems/include/rtems/rtems/barrierimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/barrierimpl.h
@@ -79,20 +79,6 @@ RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Get(
_Objects_Get( id, &queue_context->Lock_context, &_Barrier_Information );
}
-/**
- * @brief Translate SuperCore Barrier Status Code to RTEMS Status Code
- *
- * This function returns a RTEMS status code based on the barrier
- * status code specified.
- *
- * @param[in] the_status is the SuperCore Barrier status to translate.
- *
- * @retval a status code indicating success or the reason for failure.
- */
-rtems_status_code _Barrier_Translate_core_barrier_return_code (
- CORE_barrier_Status the_status
-);
-
/**@}*/
#ifdef __cplusplus
diff --git a/cpukit/rtems/include/rtems/rtems/eventimpl.h b/cpukit/rtems/include/rtems/rtems/eventimpl.h
index df488e1f36..933ea0fe2b 100644
--- a/cpukit/rtems/include/rtems/rtems/eventimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/eventimpl.h
@@ -44,7 +44,7 @@ extern "C" {
*/
#define EVENT_SETS_NONE_PENDING 0
-void _Event_Seize(
+rtems_status_code _Event_Seize(
rtems_event_set event_in,
rtems_option option_set,
rtems_interval ticks,
diff --git a/cpukit/rtems/include/rtems/rtems/messageimpl.h b/cpukit/rtems/include/rtems/rtems/messageimpl.h
index d6217f171e..c561ff9a4b 100644
--- a/cpukit/rtems/include/rtems/rtems/messageimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/messageimpl.h
@@ -74,20 +74,6 @@ rtems_status_code _Message_queue_Submit(
);
/**
- * @brief Message queue Translate Core Message Queue Return Code
- *
- * This function returns a RTEMS status code based on
- * @a the_message_queue_status.
- *
- * @param[in] the_message_queue_status is the status code to translate
- *
- * @retval translated RTEMS status code
- */
-rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
- uint32_t the_message_queue_status
-);
-
-/**
* @brief Deallocates a message queue control block into
* the inactive chain of free message queue control blocks.
*
diff --git a/cpukit/rtems/include/rtems/rtems/semimpl.h b/cpukit/rtems/include/rtems/rtems/semimpl.h
index c23bef905a..21e16e99d0 100644
--- a/cpukit/rtems/include/rtems/rtems/semimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/semimpl.h
@@ -32,82 +32,6 @@ extern "C" {
*/
extern Objects_Information _Semaphore_Information;
-extern const rtems_status_code
- _Semaphore_Translate_core_mutex_return_code_[];
-
-extern const rtems_status_code
- _Semaphore_Translate_core_semaphore_return_code_[];
-
-/**
- * @brief Semaphore Translate Core Mutex Return Code
- *
- * This function returns a RTEMS status code based on the mutex
- * status code specified.
- *
- * @param[in] status is the mutex status code to translate
- *
- * @retval translated RTEMS status code
- */
-RTEMS_INLINE_ROUTINE rtems_status_code
-_Semaphore_Translate_core_mutex_return_code(
- uint32_t status
-)
-{
- /*
- * If this thread is blocking waiting for a result on a remote operation.
- */
- #if defined(RTEMS_MULTIPROCESSING)
- if ( _Thread_Is_proxy_blocking(status) )
- return RTEMS_PROXY_BLOCKING;
- #endif
-
- /*
- * Internal consistency check for bad status from SuperCore
- */
- #if defined(RTEMS_DEBUG)
- if ( status > CORE_MUTEX_STATUS_LAST )
- return RTEMS_INTERNAL_ERROR;
- #endif
- return _Semaphore_Translate_core_mutex_return_code_[status];
-}
-
-#if defined(RTEMS_SMP)
-RTEMS_INLINE_ROUTINE rtems_status_code
-_Semaphore_Translate_MRSP_status_code( MRSP_Status mrsp_status )
-{
- return (rtems_status_code) mrsp_status;
-}
-#endif
-
-/**
- * @brief Semaphore Translate Core Semaphore Return Code
- *
- * This function returns a RTEMS status code based on the semaphore
- * status code specified.
- *
- * @param[in] status is the semaphore status code to translate
- *
- * @retval translated RTEMS status code
- */
-RTEMS_INLINE_ROUTINE rtems_status_code
-_Semaphore_Translate_core_semaphore_return_code(
- uint32_t status
-)
-{
- #if defined(RTEMS_MULTIPROCESSING)
- if ( _Thread_Is_proxy_blocking(status) )
- return RTEMS_PROXY_BLOCKING;
- #endif
- /*
- * Internal consistency check for bad status from SuperCore
- */
- #if defined(RTEMS_DEBUG)
- if ( status > CORE_SEMAPHORE_STATUS_LAST )
- return RTEMS_INTERNAL_ERROR;
- #endif
- return _Semaphore_Translate_core_semaphore_return_code_[status];
-}
-
/**
* @brief Allocates a semaphore control block from
* the inactive chain of free semaphore control blocks.
diff --git a/cpukit/rtems/include/rtems/rtems/statusimpl.h b/cpukit/rtems/include/rtems/rtems/statusimpl.h
index 8aff36a96a..8a51bb8b19 100644
--- a/cpukit/rtems/include/rtems/rtems/statusimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/statusimpl.h
@@ -18,6 +18,7 @@
#define _RTEMS_RTEMS_STATUSIMPL_H
#include <rtems/rtems/status.h>
+#include <rtems/score/threadimpl.h>
#ifdef __cplusplus
extern "C" {
@@ -39,6 +40,20 @@ extern "C" {
*/
extern const rtems_status_code _Status_Object_name_errors_to_status[];
+RTEMS_INLINE_ROUTINE rtems_status_code _Status_Get(
+ Status_Control status
+)
+{
+ return (rtems_status_code) STATUS_GET_CLASSIC( status );
+}
+
+RTEMS_INLINE_ROUTINE rtems_status_code _Status_Get_after_wait(
+ const Thread_Control *executing
+)
+{
+ return _Status_Get( _Thread_Wait_get_status( executing ) );
+}
+
/**@}*/
#ifdef __cplusplus
diff --git a/cpukit/rtems/src/barriertranslatereturncode.c b/cpukit/rtems/src/barriertranslatereturncode.c
deleted file mode 100644
index 2402701aa4..0000000000
--- a/cpukit/rtems/src/barriertranslatereturncode.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * @file
- *
- * @brief Translate SuperCore Barrier Status Code to RTEMS Status Code
- * @ingroup ClassicBarrier
- */
-
-/*
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/barrierimpl.h>
-
-rtems_status_code _Barrier_Translate_core_barrier_return_code_[] = {
- RTEMS_SUCCESSFUL, /* CORE_BARRIER_STATUS_SUCCESSFUL */
- RTEMS_SUCCESSFUL, /* CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED */
- RTEMS_OBJECT_WAS_DELETED, /* CORE_BARRIER_WAS_DELETED */
- RTEMS_TIMEOUT /* CORE_BARRIER_TIMEOUT */
-};
-
-rtems_status_code _Barrier_Translate_core_barrier_return_code (
- CORE_barrier_Status the_barrier_status
-)
-{
- /*
- * Internal consistency check for bad status from SuperCore
- */
- #if defined(RTEMS_DEBUG)
- if ( the_barrier_status > CORE_BARRIER_STATUS_LAST )
- return RTEMS_INTERNAL_ERROR;
- #endif
- return _Barrier_Translate_core_barrier_return_code_[the_barrier_status];
-}
diff --git a/cpukit/rtems/src/barrierwait.c b/cpukit/rtems/src/barrierwait.c
index 6e133751aa..5f1f023f50 100644
--- a/cpukit/rtems/src/barrierwait.c
+++ b/cpukit/rtems/src/barrierwait.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/rtems/barrierimpl.h>
+#include <rtems/rtems/statusimpl.h>
THREAD_QUEUE_OBJECT_ASSERT( Barrier_Control, Barrier.Wait_queue );
@@ -29,7 +30,7 @@ rtems_status_code rtems_barrier_wait(
{
Barrier_Control *the_barrier;
Thread_queue_Context queue_context;
- Thread_Control *executing;
+ Status_Control status;
the_barrier = _Barrier_Get( id, &queue_context );
@@ -37,15 +38,12 @@ rtems_status_code rtems_barrier_wait(
return RTEMS_INVALID_ID;
}
- executing = _Thread_Executing;
- _CORE_barrier_Seize(
+ status = _CORE_barrier_Seize(
&the_barrier->Barrier,
- executing,
+ _Thread_Executing,
true,
timeout,
&queue_context
);
- return _Barrier_Translate_core_barrier_return_code(
- executing->Wait.return_code
- );
+ return _Status_Get( status );
}
diff --git a/cpukit/rtems/src/eventmp.c b/cpukit/rtems/src/eventmp.c
index 83e1384f84..ac9ab69f08 100644
--- a/cpukit/rtems/src/eventmp.c
+++ b/cpukit/rtems/src/eventmp.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/rtems/eventimpl.h>
+#include <rtems/rtems/statusimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/statesimpl.h>
@@ -61,6 +62,7 @@ rtems_status_code _Event_MP_Send(
)
{
Event_MP_Packet *the_packet;
+ Status_Control status;
the_packet = _Event_MP_Get_packet( id );
if ( the_packet == NULL ) {
@@ -74,12 +76,12 @@ rtems_status_code _Event_MP_Send(
the_packet->Prefix.id = id;
the_packet->event_in = event_in;
- return (rtems_status_code) _MPCI_Send_request_packet(
+ status = _MPCI_Send_request_packet(
_Objects_Get_node( id ),
&the_packet->Prefix,
- STATES_READY,
- RTEMS_TIMEOUT
+ STATES_READY
);
+ return _Status_Get( status );
}
static void _Event_MP_Send_response_packet (
diff --git a/cpukit/rtems/src/eventreceive.c b/cpukit/rtems/src/eventreceive.c
index 14f93db4e6..e03ff279eb 100644
--- a/cpukit/rtems/src/eventreceive.c
+++ b/cpukit/rtems/src/eventreceive.c
@@ -43,7 +43,7 @@ rtems_status_code rtems_event_receive(
event = &api->Event;
if ( !_Event_sets_Is_empty( event_in ) ) {
- _Event_Seize(
+ sc = _Event_Seize(
event_in,
option_set,
ticks,
@@ -54,8 +54,6 @@ rtems_status_code rtems_event_receive(
STATES_WAITING_FOR_EVENT,
&lock_context
);
-
- sc = executing->Wait.return_code;
} else {
*event_out = event->pending_events;
_Thread_Lock_release_default( executing, &lock_context );
diff --git a/cpukit/rtems/src/eventseize.c b/cpukit/rtems/src/eventseize.c
index 0be6bd6f45..c91d308438 100644
--- a/cpukit/rtems/src/eventseize.c
+++ b/cpukit/rtems/src/eventseize.c
@@ -21,17 +21,11 @@
#include <rtems/sysinit.h>
#include <rtems/rtems/eventimpl.h>
#include <rtems/rtems/optionsimpl.h>
+#include <rtems/rtems/statusimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/watchdogimpl.h>
-/*
- * INTERRUPT LATENCY:
- * available
- * wait
- * check sync
- */
-
-void _Event_Seize(
+rtems_status_code _Event_Seize(
rtems_event_set event_in,
rtems_option option_set,
rtems_interval ticks,
@@ -49,8 +43,6 @@ void _Event_Seize(
Thread_Wait_flags intend_to_block;
Per_CPU_Control *cpu_self;
- executing->Wait.return_code = RTEMS_SUCCESSFUL;
-
pending_events = event->pending_events;
seized_events = _Event_sets_Get( pending_events, event_in );
@@ -60,14 +52,13 @@ void _Event_Seize(
_Event_sets_Clear( pending_events, seized_events );
_Thread_Lock_release_default( executing, lock_context );
*event_out = seized_events;
- return;
+ return RTEMS_SUCCESSFUL;
}
if ( _Options_Is_no_wait( option_set ) ) {
_Thread_Lock_release_default( executing, lock_context );
- executing->Wait.return_code = RTEMS_UNSATISFIED;
*event_out = seized_events;
- return;
+ return RTEMS_UNSATISFIED;
}
intend_to_block = wait_class | THREAD_WAIT_STATE_INTEND_TO_BLOCK;
@@ -80,6 +71,7 @@ void _Event_Seize(
* NOTE: Since interrupts are disabled, this isn't that much of an
* issue but better safe than sorry.
*/
+ executing->Wait.return_code = STATUS_SUCCESSFUL;
executing->Wait.option = option_set;
executing->Wait.count = event_in;
executing->Wait.return_argument = event_out;
@@ -89,7 +81,6 @@ void _Event_Seize(
_Thread_Lock_release_default( executing, lock_context );
if ( ticks ) {
- _Thread_Wait_set_timeout_code( executing, RTEMS_TIMEOUT );
_Thread_Timer_insert_relative(
executing,
cpu_self,
@@ -117,6 +108,7 @@ void _Event_Seize(
}
_Thread_Dispatch_enable( cpu_self );
+ return _Status_Get_after_wait( executing );
}
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/rtems/src/msgmp.c b/cpukit/rtems/src/msgmp.c
index d8077a71ec..6ec6982fcb 100644
--- a/cpukit/rtems/src/msgmp.c
+++ b/cpukit/rtems/src/msgmp.c
@@ -20,6 +20,7 @@
#include <rtems/rtems/messageimpl.h>
#include <rtems/rtems/optionsimpl.h>
+#include <rtems/rtems/statusimpl.h>
#include <rtems/score/coremsgimpl.h>
#include <rtems/score/statesimpl.h>
#include <rtems/score/threadimpl.h>
@@ -105,6 +106,7 @@ static rtems_status_code _Message_queue_MP_Send_request_packet (
)
{
Message_queue_MP_Packet *the_packet;
+ Status_Control status;
if ( !_Message_queue_MP_Is_remote( message_queue_id ) ) {
return RTEMS_INVALID_ID;
@@ -155,13 +157,12 @@ static rtems_status_code _Message_queue_MP_Send_request_packet (
);
}
- return (rtems_status_code) _MPCI_Send_request_packet(
+ status = _MPCI_Send_request_packet(
_Objects_Get_node(message_queue_id),
&the_packet->Prefix,
- STATES_WAITING_FOR_MESSAGE,
- RTEMS_TIMEOUT
+ STATES_WAITING_FOR_MESSAGE
);
- break;
+ return _Status_Get( status );
case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
@@ -181,13 +182,12 @@ static rtems_status_code _Message_queue_MP_Send_request_packet (
_Thread_Executing->Wait.return_argument_second.immutable_object = buffer;
_Thread_Executing->Wait.return_argument = size_p;
- return (rtems_status_code) _MPCI_Send_request_packet(
+ status = _MPCI_Send_request_packet(
_Objects_Get_node(message_queue_id),
&the_packet->Prefix,
- STATES_WAITING_FOR_MESSAGE,
- RTEMS_TIMEOUT
+ STATES_WAITING_FOR_MESSAGE
);
- break;
+ return _Status_Get( status );
case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE:
diff --git a/cpukit/rtems/src/msgqbroadcast.c b/cpukit/rtems/src/msgqbroadcast.c
index 75f9d60e1b..cc38be96f8 100644
--- a/cpukit/rtems/src/msgqbroadcast.c
+++ b/cpukit/rtems/src/msgqbroadcast.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/rtems/messageimpl.h>
+#include <rtems/rtems/statusimpl.h>
rtems_status_code rtems_message_queue_broadcast(
rtems_id id,
@@ -27,9 +28,9 @@ rtems_status_code rtems_message_queue_broadcast(
uint32_t *count
)
{
- Message_queue_Control *the_message_queue;
- Thread_queue_Context queue_context;
- CORE_message_queue_Status status;
+ Message_queue_Control *the_message_queue;
+ Thread_queue_Context queue_context;
+ Status_Control status;
if ( buffer == NULL ) {
return RTEMS_INVALID_ADDRESS;
@@ -60,5 +61,5 @@ rtems_status_code rtems_message_queue_broadcast(
count,
&queue_context
);
- return _Message_queue_Translate_core_message_queue_return_code( status );
+ return _Status_Get( status );
}
diff --git a/cpukit/rtems/src/msgqreceive.c b/cpukit/rtems/src/msgqreceive.c
index 6ed3d25674..66e38f7cae 100644
--- a/cpukit/rtems/src/msgqreceive.c
+++ b/cpukit/rtems/src/msgqreceive.c
@@ -20,6 +20,7 @@
#include <rtems/rtems/messageimpl.h>
#include <rtems/rtems/optionsimpl.h>
+#include <rtems/rtems/statusimpl.h>
THREAD_QUEUE_OBJECT_ASSERT( Message_queue_Control, message_queue.Wait_queue );
@@ -34,6 +35,7 @@ rtems_status_code rtems_message_queue_receive(
Message_queue_Control *the_message_queue;
Thread_queue_Context queue_context;
Thread_Control *executing;
+ Status_Control status;
if ( buffer == NULL ) {
return RTEMS_INVALID_ADDRESS;
@@ -59,7 +61,7 @@ rtems_status_code rtems_message_queue_receive(
);
executing = _Thread_Executing;
- _CORE_message_queue_Seize(
+ status = _CORE_message_queue_Seize(
&the_message_queue->message_queue,
executing,
buffer,
@@ -68,7 +70,5 @@ rtems_status_code rtems_message_queue_receive(
timeout,
&queue_context
);
- return _Message_queue_Translate_core_message_queue_return_code(
- executing->Wait.return_code
- );
+ return _Status_Get( status );
}
diff --git a/cpukit/rtems/src/msgqsend.c b/cpukit/rtems/src/msgqsend.c
index c5bde9d348..9489081a79 100644
--- a/cpukit/rtems/src/msgqsend.c
+++ b/cpukit/rtems/src/msgqsend.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/rtems/messageimpl.h>
+#include <rtems/rtems/statusimpl.h>
rtems_status_code rtems_message_queue_send(
rtems_id id,
@@ -26,9 +27,9 @@ rtems_status_code rtems_message_queue_send(
size_t size
)
{
- Message_queue_Control *the_message_queue;
- Thread_queue_Context queue_context;
- CORE_message_queue_Status status;
+ Message_queue_Control *the_message_queue;
+ Thread_queue_Context queue_context;
+ Status_Control status;
if ( buffer == NULL ) {
return RTEMS_INVALID_ADDRESS;
@@ -60,11 +61,5 @@ rtems_status_code rtems_message_queue_send(
0, /* no timeout */
&queue_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 );
+ return _Status_Get( status );
}
diff --git a/cpukit/rtems/src/msgqtranslatereturncode.c b/cpukit/rtems/src/msgqtranslatereturncode.c
deleted file mode 100644
index acd5ba84bb..0000000000
--- a/cpukit/rtems/src/msgqtranslatereturncode.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * @file
- *
- * @brief Message queue Translate Core Message Queue Return Code
- * @ingroup ClassicMessageQueue
- */
-
-/*
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#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/rtems/options.h>
-#include <rtems/rtems/support.h>
-
-rtems_status_code _Message_queue_Translate_core_return_code_[] = {
- RTEMS_SUCCESSFUL, /* CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL */
- RTEMS_INVALID_SIZE, /* CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE */
- RTEMS_TOO_MANY, /* CORE_MESSAGE_QUEUE_STATUS_TOO_MANY */
- RTEMS_UNSATISFIED, /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED */
- RTEMS_UNSATISFIED, /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT */
- RTEMS_OBJECT_WAS_DELETED, /* CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED */
- RTEMS_TIMEOUT /* CORE_MESSAGE_QUEUE_STATUS_TIMEOUT */
-};
-
-rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
- uint32_t status
-)
-{
- /*
- * Check for proxy blocking first since it is out of range
- * from the external status codes.
- */
- #if defined(RTEMS_MULTIPROCESSING)
- if ( _Thread_Is_proxy_blocking(status) )
- return RTEMS_PROXY_BLOCKING;
- #endif
-
- /*
- * Internal consistency check for bad status from SuperCore
- */
- #if defined(RTEMS_DEBUG)
- if ( status > CORE_MESSAGE_QUEUE_STATUS_TIMEOUT )
- return RTEMS_INTERNAL_ERROR;
- #endif
-
- return _Message_queue_Translate_core_return_code_[status];
-}
diff --git a/cpukit/rtems/src/msgqurgent.c b/cpukit/rtems/src/msgqurgent.c
index add5f09bb2..6522d8fb1a 100644
--- a/cpukit/rtems/src/msgqurgent.c
+++ b/cpukit/rtems/src/msgqurgent.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/rtems/messageimpl.h>
+#include <rtems/rtems/statusimpl.h>
rtems_status_code rtems_message_queue_urgent(
rtems_id id,
@@ -26,9 +27,9 @@ rtems_status_code rtems_message_queue_urgent(
size_t size
)
{
- Message_queue_Control *the_message_queue;
- Thread_queue_Context queue_context;
- CORE_message_queue_Status status;
+ Message_queue_Control *the_message_queue;
+ Thread_queue_Context queue_context;
+ Status_Control status;
if ( buffer == NULL ) {
return RTEMS_INVALID_ADDRESS;
@@ -60,11 +61,5 @@ rtems_status_code rtems_message_queue_urgent(
0, /* no timeout */
&queue_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 );
+ return _Status_Get( status );
}
diff --git a/cpukit/rtems/src/partmp.c b/cpukit/rtems/src/partmp.c
index f094d619eb..c613ce2c18 100644
--- a/cpukit/rtems/src/partmp.c
+++ b/cpukit/rtems/src/partmp.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/rtems/partimpl.h>
+#include <rtems/rtems/statusimpl.h>
#include <rtems/score/statesimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
@@ -100,6 +101,7 @@ static rtems_status_code _Partition_MP_Send_request_packet (
)
{
Partition_MP_Packet *the_packet;
+ Status_Control status;
if ( !_Partition_MP_Is_remote( partition_id ) ) {
return RTEMS_INVALID_ID;
@@ -114,15 +116,12 @@ static rtems_status_code _Partition_MP_Send_request_packet (
_Partition_MP_Initialize_packet( the_packet, partition_id, operation );
the_packet->buffer = buffer;
- return
- _MPCI_Send_request_packet(
- _Objects_Get_node( partition_id ),
- &the_packet->Prefix,
- STATES_READY, /* Not used */
- RTEMS_TIMEOUT
- );
-
- break;
+ status = _MPCI_Send_request_packet(
+ _Objects_Get_node( partition_id ),
+ &the_packet->Prefix,
+ STATES_READY /* Not used */
+ );
+ return _Status_Get( status );
case PARTITION_MP_ANNOUNCE_CREATE:
case PARTITION_MP_ANNOUNCE_DELETE:
diff --git a/cpukit/rtems/src/regiongetsegment.c b/cpukit/rtems/src/regiongetsegment.c
index d59de38e4a..fe2b9e78ea 100644
--- a/cpukit/rtems/src/regiongetsegment.c
+++ b/cpukit/rtems/src/regiongetsegment.c
@@ -20,6 +20,7 @@
#include <rtems/rtems/regionimpl.h>
#include <rtems/rtems/optionsimpl.h>
+#include <rtems/rtems/statusimpl.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/score/statesimpl.h>
@@ -85,13 +86,12 @@ rtems_status_code rtems_region_get_segment(
the_region->wait_operations,
executing,
STATES_WAITING_FOR_SEGMENT,
- timeout,
- RTEMS_TIMEOUT
+ timeout
);
_Thread_Dispatch_enable( cpu_self );
- return (rtems_status_code) executing->Wait.return_code;
+ return _Status_Get_after_wait( executing );
}
}
diff --git a/cpukit/rtems/src/regionprocessqueue.c b/cpukit/rtems/src/regionprocessqueue.c
index db5759a8d0..845454b6c7 100644
--- a/cpukit/rtems/src/regionprocessqueue.c
+++ b/cpukit/rtems/src/regionprocessqueue.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/rtems/regionimpl.h>
+#include <rtems/score/status.h>
#include <rtems/score/threadqimpl.h>
void _Region_Process_queue(
@@ -65,7 +66,7 @@ void _Region_Process_queue(
*(void **)the_thread->Wait.return_argument = the_segment;
_Thread_queue_Extract( the_thread );
- the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
+ the_thread->Wait.return_code = STATUS_SUCCESSFUL;
}
_Thread_Dispatch_enable( cpu_self );
diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index d2895465b7..83d46b607e 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -25,6 +25,7 @@
#include <rtems/score/isr.h>
#include <rtems/rtems/options.h>
#include <rtems/rtems/semimpl.h>
+#include <rtems/rtems/statusimpl.h>
#include <rtems/rtems/tasksimpl.h>
#include <rtems/score/coremuteximpl.h>
#include <rtems/score/coresemimpl.h>
@@ -63,7 +64,7 @@ rtems_status_code rtems_semaphore_create(
Semaphore_Control *the_semaphore;
CORE_mutex_Attributes the_mutex_attr;
CORE_semaphore_Disciplines semaphore_discipline;
- CORE_mutex_Status mutex_status;
+ Status_Control status;
if ( !rtems_is_name_valid( name ) )
return RTEMS_INVALID_NAME;
@@ -155,21 +156,15 @@ rtems_status_code rtems_semaphore_create(
semaphore_discipline,
count
);
+ status = STATUS_SUCCESSFUL;
#if defined(RTEMS_SMP)
} else if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
- MRSP_Status mrsp_status = _MRSP_Initialize(
+ status = _MRSP_Initialize(
&the_semaphore->Core_control.mrsp,
priority_ceiling,
_Thread_Get_executing(),
count != 1
);
-
- if ( mrsp_status != MRSP_SUCCESSFUL ) {
- _Semaphore_Free( the_semaphore );
- _Objects_Allocator_unlock();
-
- return _Semaphore_Translate_MRSP_status_code( mrsp_status );
- }
#endif
} else {
/*
@@ -202,18 +197,18 @@ rtems_status_code rtems_semaphore_create(
the_mutex_attr.only_owner_release = false;
}
- mutex_status = _CORE_mutex_Initialize(
+ status = _CORE_mutex_Initialize(
&the_semaphore->Core_control.mutex,
_Thread_Get_executing(),
&the_mutex_attr,
count != 1
);
+ }
- if ( mutex_status == CORE_MUTEX_STATUS_CEILING_VIOLATED ) {
- _Semaphore_Free( the_semaphore );
- _Objects_Allocator_unlock();
- return RTEMS_INVALID_PRIORITY;
- }
+ if ( status != STATUS_SUCCESSFUL ) {
+ _Semaphore_Free( the_semaphore );
+ _Objects_Allocator_unlock();
+ return _Status_Get( status );
}
/*
diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
index 023a57cf23..405c8055c3 100644
--- a/cpukit/rtems/src/semdelete.c
+++ b/cpukit/rtems/src/semdelete.c
@@ -20,6 +20,7 @@
#include <rtems/rtems/semimpl.h>
#include <rtems/rtems/attrimpl.h>
+#include <rtems/rtems/statusimpl.h>
rtems_status_code rtems_semaphore_delete(
rtems_id id
@@ -52,20 +53,20 @@ rtems_status_code rtems_semaphore_delete(
#if defined(RTEMS_SMP)
if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
- MRSP_Status mrsp_status;
+ Status_Control status;
_MRSP_Acquire_critical(
&the_semaphore->Core_control.mrsp,
&queue_context
);
- mrsp_status = _MRSP_Can_destroy( &the_semaphore->Core_control.mrsp );
- if ( mrsp_status != MRSP_SUCCESSFUL ) {
+ status = _MRSP_Can_destroy( &the_semaphore->Core_control.mrsp );
+ if ( status != STATUS_SUCCESSFUL ) {
_MRSP_Release(
&the_semaphore->Core_control.mrsp,
&queue_context
);
_Objects_Allocator_unlock();
- return _Semaphore_Translate_MRSP_status_code( mrsp_status );
+ return _Status_Get( status );
}
} else
#endif
@@ -103,7 +104,7 @@ rtems_status_code rtems_semaphore_delete(
if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
_CORE_mutex_Flush(
&the_semaphore->Core_control.mutex,
- _CORE_mutex_Was_deleted,
+ _Thread_queue_Flush_status_object_was_deleted,
&queue_context
);
_CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
diff --git a/cpukit/rtems/src/semflush.c b/cpukit/rtems/src/semflush.c
index b18de6d4a7..73305354ec 100644
--- a/cpukit/rtems/src/semflush.c
+++ b/cpukit/rtems/src/semflush.c
@@ -58,7 +58,7 @@ rtems_status_code rtems_semaphore_flush( rtems_id id )
);
_CORE_mutex_Flush(
&the_semaphore->Core_control.mutex,
- _CORE_mutex_Unsatisfied_nowait,
+ _Thread_queue_Flush_status_unavailable,
&queue_context
);
} else {
diff --git a/cpukit/rtems/src/semmp.c b/cpukit/rtems/src/semmp.c
index 7f7506cd5f..2b14763694 100644
--- a/cpukit/rtems/src/semmp.c
+++ b/cpukit/rtems/src/semmp.c
@@ -20,6 +20,7 @@
#include <rtems/rtems/semimpl.h>
#include <rtems/rtems/optionsimpl.h>
+#include <rtems/rtems/statusimpl.h>
RTEMS_STATIC_ASSERT(
sizeof(Semaphore_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
@@ -80,6 +81,7 @@ static rtems_status_code _Semaphore_MP_Send_request_packet(
)
{
Semaphore_MP_Packet *the_packet;
+ Status_Control status;
switch ( operation ) {
@@ -97,13 +99,12 @@ static rtems_status_code _Semaphore_MP_Send_request_packet(
the_packet->Prefix.id = semaphore_id;
the_packet->option_set = option_set;
- return _MPCI_Send_request_packet(
- _Objects_Get_node( semaphore_id ),
- &the_packet->Prefix,
- STATES_WAITING_FOR_SEMAPHORE,
- RTEMS_TIMEOUT
- );
- break;
+ status = _MPCI_Send_request_packet(
+ _Objects_Get_node( semaphore_id ),
+ &the_packet->Prefix,
+ STATES_WAITING_FOR_SEMAPHORE
+ );
+ return _Status_Get( status );
case SEMAPHORE_MP_ANNOUNCE_CREATE:
case SEMAPHORE_MP_ANNOUNCE_DELETE:
diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index 6d994f4707..527f7ea03f 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/rtems/src/semobtain.c
@@ -21,6 +21,7 @@
#include <rtems/rtems/semimpl.h>
#include <rtems/rtems/attrimpl.h>
#include <rtems/rtems/optionsimpl.h>
+#include <rtems/rtems/statusimpl.h>
THREAD_QUEUE_OBJECT_ASSERT(
Semaphore_Control,
@@ -43,6 +44,7 @@ rtems_status_code rtems_semaphore_obtain(
Thread_Control *executing;
rtems_attribute attribute_set;
bool wait;
+ Status_Control status;
the_semaphore = _Semaphore_Get( id, &queue_context, NULL );
@@ -59,40 +61,33 @@ rtems_status_code rtems_semaphore_obtain(
wait = !_Options_Is_no_wait( option_set );
#if defined(RTEMS_SMP)
if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
- MRSP_Status mrsp_status;
-
- mrsp_status = _MRSP_Seize(
+ status = _MRSP_Seize(
&the_semaphore->Core_control.mrsp,
executing,
wait,
timeout,
&queue_context
);
- return _Semaphore_Translate_MRSP_status_code( mrsp_status );
} else
#endif
if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
- _CORE_mutex_Seize(
+ status = _CORE_mutex_Seize(
&the_semaphore->Core_control.mutex,
executing,
wait,
timeout,
&queue_context
);
- return _Semaphore_Translate_core_mutex_return_code(
- executing->Wait.return_code
+ } else {
+ /* must be a counting semaphore */
+ status = _CORE_semaphore_Seize(
+ &the_semaphore->Core_control.semaphore,
+ executing,
+ wait,
+ timeout,
+ &queue_context
);
}
- /* must be a counting semaphore */
- _CORE_semaphore_Seize(
- &the_semaphore->Core_control.semaphore,
- executing,
- wait,
- timeout,
- &queue_context
- );
- return _Semaphore_Translate_core_semaphore_return_code(
- executing->Wait.return_code
- );
+ return _Status_Get( status );
}
diff --git a/cpukit/rtems/src/semrelease.c b/cpukit/rtems/src/semrelease.c
index aa80e8385f..007914c09a 100644
--- a/cpukit/rtems/src/semrelease.c
+++ b/cpukit/rtems/src/semrelease.c
@@ -23,14 +23,14 @@
#include <rtems/rtems/semimpl.h>
#include <rtems/rtems/attrimpl.h>
+#include <rtems/rtems/statusimpl.h>
rtems_status_code rtems_semaphore_release( rtems_id id )
{
- Semaphore_Control *the_semaphore;
- CORE_mutex_Status mutex_status;
- CORE_semaphore_Status semaphore_status;
- rtems_attribute attribute_set;
- Thread_queue_Context queue_context;
+ Semaphore_Control *the_semaphore;
+ Thread_queue_Context queue_context;
+ rtems_attribute attribute_set;
+ Status_Control status;
the_semaphore = _Semaphore_Get(
id,
@@ -49,28 +49,25 @@ rtems_status_code rtems_semaphore_release( rtems_id id )
attribute_set = the_semaphore->attribute_set;
#if defined(RTEMS_SMP)
if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
- MRSP_Status mrsp_status;
-
- mrsp_status = _MRSP_Surrender(
+ status = _MRSP_Surrender(
&the_semaphore->Core_control.mrsp,
_Thread_Executing,
&queue_context
);
- return _Semaphore_Translate_MRSP_status_code( mrsp_status );
} else
#endif
if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
- mutex_status = _CORE_mutex_Surrender(
+ status = _CORE_mutex_Surrender(
&the_semaphore->Core_control.mutex,
&queue_context
);
- return _Semaphore_Translate_core_mutex_return_code( mutex_status );
} else {
- semaphore_status = _CORE_semaphore_Surrender(
+ status = _CORE_semaphore_Surrender(
&the_semaphore->Core_control.semaphore,
UINT32_MAX,
&queue_context
);
- return _Semaphore_Translate_core_semaphore_return_code( semaphore_status );
}
+
+ return _Status_Get( status );
}
diff --git a/cpukit/rtems/src/semtranslatereturncode.c b/cpukit/rtems/src/semtranslatereturncode.c
deleted file mode 100644
index ea7e8bcb6b..0000000000
--- a/cpukit/rtems/src/semtranslatereturncode.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * @file
- *
- * @brief Semaphore Translate Core Mutex and Semaphore Return Code
- * @ingroup ClassicSem
- */
-
-/*
- * COPYRIGHT (c) 1989-2009.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/rtems/semimpl.h>
-
-const rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
- RTEMS_SUCCESSFUL, /* CORE_MUTEX_STATUS_SUCCESSFUL */
- RTEMS_UNSATISFIED, /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */
-#if defined(RTEMS_POSIX_API)
- RTEMS_UNSATISFIED, /* CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED */
-#endif
- RTEMS_NOT_OWNER_OF_RESOURCE, /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
- RTEMS_OBJECT_WAS_DELETED, /* CORE_MUTEX_WAS_DELETED */
- RTEMS_TIMEOUT, /* CORE_MUTEX_TIMEOUT */
- RTEMS_INVALID_PRIORITY /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
-};
-
-const rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = {
- RTEMS_SUCCESSFUL, /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */
- RTEMS_UNSATISFIED, /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */
- RTEMS_OBJECT_WAS_DELETED, /* CORE_SEMAPHORE_WAS_DELETED */
- RTEMS_TIMEOUT, /* CORE_SEMAPHORE_TIMEOUT */
- RTEMS_UNSATISFIED /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
-};
diff --git a/cpukit/rtems/src/signalmp.c b/cpukit/rtems/src/signalmp.c
index cd89e9f0dd..119fe5ace0 100644
--- a/cpukit/rtems/src/signalmp.c
+++ b/cpukit/rtems/src/signalmp.c
@@ -20,6 +20,7 @@
#include <rtems/rtems/signalimpl.h>
#include <rtems/rtems/optionsimpl.h>
+#include <rtems/rtems/statusimpl.h>
#include <rtems/score/statesimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
@@ -71,6 +72,7 @@ rtems_status_code _Signal_MP_Send(
)
{
Signal_MP_Packet *the_packet;
+ Status_Control status;
the_packet = _Signal_MP_Get_packet( id );
if ( the_packet == NULL ) {
@@ -84,12 +86,12 @@ rtems_status_code _Signal_MP_Send(
the_packet->Prefix.id = id;
the_packet->signal_set = signal_set;
- return (rtems_status_code) _MPCI_Send_request_packet(
+ status = _MPCI_Send_request_packet(
_Objects_Get_node( id ),
&the_packet->Prefix,
- STATES_READY,
- RTEMS_TIMEOUT
+ STATES_READY
);
+ return _Status_Get( status );
}
static void _Signal_MP_Send_response_packet (
diff --git a/cpukit/rtems/src/systemeventreceive.c b/cpukit/rtems/src/systemeventreceive.c
index c33f468790..a2215fa7ec 100644
--- a/cpukit/rtems/src/systemeventreceive.c
+++ b/cpukit/rtems/src/systemeventreceive.c
@@ -49,7 +49,7 @@ rtems_status_code rtems_event_system_receive(
event = &api->System_event;
if ( !_Event_sets_Is_empty( event_in ) ) {
- _Event_Seize(
+ sc = _Event_Seize(
event_in,
option_set,
ticks,
@@ -60,8 +60,6 @@ rtems_status_code rtems_event_system_receive(
STATES_WAITING_FOR_SYSTEM_EVENT,
&lock_context
);
-
- sc = executing->Wait.return_code;
} else {
*event_out = event->pending_events;
_Thread_Lock_release_default( executing, &lock_context );
diff --git a/cpukit/rtems/src/taskmp.c b/cpukit/rtems/src/taskmp.c
index d59db2e313..e3742c528d 100644
--- a/cpukit/rtems/src/taskmp.c
+++ b/cpukit/rtems/src/taskmp.c
@@ -20,6 +20,7 @@
#include <rtems/rtems/tasksimpl.h>
#include <rtems/rtems/optionsimpl.h>
+#include <rtems/rtems/statusimpl.h>
#include <rtems/score/statesimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
@@ -101,18 +102,20 @@ static rtems_status_code _RTEMS_tasks_MP_Send_request_packet(
RTEMS_tasks_MP_Remote_operations operation
)
{
+ Status_Control status;
+
the_packet->Prefix.the_class = MP_PACKET_TASKS;
the_packet->Prefix.length = sizeof( *the_packet );
the_packet->Prefix.to_convert = sizeof( *the_packet );
the_packet->Prefix.id = id;
the_packet->operation = operation;
- return _MPCI_Send_request_packet(
+ status = _MPCI_Send_request_packet(
_Objects_Get_node( id ),
&the_packet->Prefix,
- STATES_READY, /* Not used */
- RTEMS_TIMEOUT
+ STATES_READY /* Not used */
);
+ return _Status_Get( status );
}
rtems_status_code _RTEMS_tasks_MP_Set_priority(