source: rtems/cpukit/rtems/src/msgqurgent.c @ 39046f7

4.115
Last change on this file since 39046f7 was 39046f7, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 09:09:23

score: Merge sysstate API into one file

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Urgent Message Queue
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#if defined(RTEMS_MULTIPROCESSING)
39#define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
40#else
41#define MESSAGE_QUEUE_MP_HANDLER NULL
42#endif
43
44rtems_status_code rtems_message_queue_urgent(
45  rtems_id    id,
46  const void *buffer,
47  size_t      size
48)
49{
50  register Message_queue_Control  *the_message_queue;
51  Objects_Locations                location;
52  CORE_message_queue_Status        status;
53
54  if ( !buffer )
55    return RTEMS_INVALID_ADDRESS;
56
57  the_message_queue = _Message_queue_Get( id, &location );
58  switch ( location ) {
59
60    case OBJECTS_LOCAL:
61      status = _CORE_message_queue_Urgent(
62        &the_message_queue->message_queue,
63        buffer,
64        size,
65        id,
66        MESSAGE_QUEUE_MP_HANDLER,
67        false,   /* sender does not block */
68        0        /* no timeout */
69      );
70      _Objects_Put( &the_message_queue->Object );
71
72      /*
73       *  Since this API does not allow for blocking sends, we can directly
74       *  return the returned status.
75       */
76
77      return _Message_queue_Translate_core_message_queue_return_code(status);
78
79#if defined(RTEMS_MULTIPROCESSING)
80    case OBJECTS_REMOTE:
81      return _Message_queue_MP_Send_request_packet(
82        MESSAGE_QUEUE_MP_URGENT_REQUEST,
83        id,
84        buffer,
85        &size,
86        0,                               /* option_set */
87        MPCI_DEFAULT_TIMEOUT
88      );
89#endif
90
91    case OBJECTS_ERROR:
92      break;
93  }
94
95  return RTEMS_INVALID_ID;
96}
Note: See TracBrowser for help on using the repository browser.