source: rtems/cpukit/rtems/src/msgqurgent.c @ 7f04cb18

4.115
Last change on this file since 7f04cb18 was 7f04cb18, checked in by Sebastian Huber <sebastian.huber@…>, on 07/25/13 at 07:10:38

score: Create mpci implementation header

Move implementation specific parts of mpci.h into new header file
mpciimpl.h. The mpci.h contains now only the application visible API.

  • Property mode set to 100644
File size: 2.2 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/thread.h>
27#include <rtems/score/wkspace.h>
28#include <rtems/rtems/status.h>
29#include <rtems/rtems/attrimpl.h>
30#include <rtems/rtems/messageimpl.h>
31#include <rtems/rtems/options.h>
32#include <rtems/rtems/support.h>
33
34#if defined(RTEMS_MULTIPROCESSING)
35#define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
36#else
37#define MESSAGE_QUEUE_MP_HANDLER NULL
38#endif
39
40rtems_status_code rtems_message_queue_urgent(
41  rtems_id    id,
42  const void *buffer,
43  size_t      size
44)
45{
46  register Message_queue_Control  *the_message_queue;
47  Objects_Locations                location;
48  CORE_message_queue_Status        status;
49
50  if ( !buffer )
51    return RTEMS_INVALID_ADDRESS;
52
53  the_message_queue = _Message_queue_Get( id, &location );
54  switch ( location ) {
55
56    case OBJECTS_LOCAL:
57      status = _CORE_message_queue_Urgent(
58        &the_message_queue->message_queue,
59        buffer,
60        size,
61        id,
62        MESSAGE_QUEUE_MP_HANDLER,
63        false,   /* sender does not block */
64        0        /* no timeout */
65      );
66      _Objects_Put( &the_message_queue->Object );
67
68      /*
69       *  Since this API does not allow for blocking sends, we can directly
70       *  return the returned status.
71       */
72
73      return _Message_queue_Translate_core_message_queue_return_code(status);
74
75#if defined(RTEMS_MULTIPROCESSING)
76    case OBJECTS_REMOTE:
77      return _Message_queue_MP_Send_request_packet(
78        MESSAGE_QUEUE_MP_URGENT_REQUEST,
79        id,
80        buffer,
81        &size,
82        0,                               /* option_set */
83        MPCI_DEFAULT_TIMEOUT
84      );
85#endif
86
87    case OBJECTS_ERROR:
88      break;
89  }
90
91  return RTEMS_INVALID_ID;
92}
Note: See TracBrowser for help on using the repository browser.