1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Message queue Translate Core Message Queue Return Code |
---|
5 | * @ingroup ClassicMessageQueue |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/system.h> |
---|
22 | #include <rtems/score/chain.h> |
---|
23 | #include <rtems/score/isr.h> |
---|
24 | #include <rtems/score/coremsgimpl.h> |
---|
25 | #include <rtems/score/object.h> |
---|
26 | #include <rtems/score/states.h> |
---|
27 | #include <rtems/score/thread.h> |
---|
28 | #include <rtems/score/wkspace.h> |
---|
29 | #if defined(RTEMS_MULTIPROCESSING) |
---|
30 | #include <rtems/score/mpci.h> |
---|
31 | #endif |
---|
32 | #include <rtems/rtems/status.h> |
---|
33 | #include <rtems/rtems/attrimpl.h> |
---|
34 | #include <rtems/rtems/messageimpl.h> |
---|
35 | #include <rtems/rtems/options.h> |
---|
36 | #include <rtems/rtems/support.h> |
---|
37 | |
---|
38 | rtems_status_code _Message_queue_Translate_core_return_code_[] = { |
---|
39 | RTEMS_SUCCESSFUL, /* CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL */ |
---|
40 | RTEMS_INVALID_SIZE, /* CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE */ |
---|
41 | RTEMS_TOO_MANY, /* CORE_MESSAGE_QUEUE_STATUS_TOO_MANY */ |
---|
42 | RTEMS_UNSATISFIED, /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED */ |
---|
43 | RTEMS_UNSATISFIED, /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT */ |
---|
44 | RTEMS_OBJECT_WAS_DELETED, /* CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED */ |
---|
45 | RTEMS_TIMEOUT /* CORE_MESSAGE_QUEUE_STATUS_TIMEOUT */ |
---|
46 | }; |
---|
47 | |
---|
48 | rtems_status_code _Message_queue_Translate_core_message_queue_return_code ( |
---|
49 | uint32_t status |
---|
50 | ) |
---|
51 | { |
---|
52 | /* |
---|
53 | * Check for proxy blocking first since it is out of range |
---|
54 | * from the external status codes. |
---|
55 | */ |
---|
56 | #if defined(RTEMS_MULTIPROCESSING) |
---|
57 | if ( _Thread_Is_proxy_blocking(status) ) |
---|
58 | return RTEMS_PROXY_BLOCKING; |
---|
59 | #endif |
---|
60 | |
---|
61 | /* |
---|
62 | * Internal consistency check for bad status from SuperCore |
---|
63 | */ |
---|
64 | #if defined(RTEMS_DEBUG) |
---|
65 | if ( status > CORE_MESSAGE_QUEUE_STATUS_TIMEOUT ) |
---|
66 | return RTEMS_INTERNAL_ERROR; |
---|
67 | #endif |
---|
68 | |
---|
69 | return _Message_queue_Translate_core_return_code_[status]; |
---|
70 | } |
---|