1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief RTEMS Urgent Message Queue |
---|
5 | * @ingroup ClassicMessageQueue |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2014. |
---|
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.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/rtems/messageimpl.h> |
---|
22 | |
---|
23 | rtems_status_code rtems_message_queue_urgent( |
---|
24 | rtems_id id, |
---|
25 | const void *buffer, |
---|
26 | size_t size |
---|
27 | ) |
---|
28 | { |
---|
29 | Message_queue_Control *the_message_queue; |
---|
30 | ISR_lock_Context lock_context; |
---|
31 | CORE_message_queue_Status status; |
---|
32 | |
---|
33 | if ( buffer == NULL ) { |
---|
34 | return RTEMS_INVALID_ADDRESS; |
---|
35 | } |
---|
36 | |
---|
37 | the_message_queue = _Message_queue_Get( id, &lock_context ); |
---|
38 | |
---|
39 | if ( the_message_queue == NULL ) { |
---|
40 | #if defined(RTEMS_MULTIPROCESSING) |
---|
41 | return _Message_queue_MP_Urgent( id, buffer, size ); |
---|
42 | #else |
---|
43 | return RTEMS_INVALID_ID; |
---|
44 | #endif |
---|
45 | } |
---|
46 | |
---|
47 | _CORE_message_queue_Acquire_critical( |
---|
48 | &the_message_queue->message_queue, |
---|
49 | &lock_context |
---|
50 | ); |
---|
51 | status = _CORE_message_queue_Urgent( |
---|
52 | &the_message_queue->message_queue, |
---|
53 | buffer, |
---|
54 | size, |
---|
55 | _Message_queue_Core_message_queue_mp_support, |
---|
56 | false, /* sender does not block */ |
---|
57 | 0, /* no timeout */ |
---|
58 | &lock_context |
---|
59 | ); |
---|
60 | |
---|
61 | /* |
---|
62 | * Since this API does not allow for blocking sends, we can directly |
---|
63 | * return the returned status. |
---|
64 | */ |
---|
65 | |
---|
66 | return _Message_queue_Translate_core_message_queue_return_code( status ); |
---|
67 | } |
---|