source: rtems/cpukit/rtems/src/msgqurgent.c @ 31a4efc

4.104.114.95
Last change on this file since 31a4efc was 31a4efc, checked in by Joel Sherrill <joel.sherrill@…>, on 08/01/08 at 16:18:56

2008-08-01 Joel Sherrill <joel.sherrill@…>

  • rtems/src/msgqsend.c, rtems/src/msgqurgent.c: Fix typos.
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 *  Message Queue Manager - rtems_message_queue_urgent
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/score/sysstate.h>
20#include <rtems/score/chain.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/coremsg.h>
23#include <rtems/score/object.h>
24#include <rtems/score/states.h>
25#include <rtems/score/thread.h>
26#include <rtems/score/wkspace.h>
27#if defined(RTEMS_MULTIPROCESSING)
28#include <rtems/score/mpci.h>
29#endif
30#include <rtems/rtems/status.h>
31#include <rtems/rtems/attr.h>
32#include <rtems/rtems/message.h>
33#include <rtems/rtems/options.h>
34#include <rtems/rtems/support.h>
35
36/*PAGE
37 *
38 *  rtems_message_queue_urgent
39 *
40 *  This routine implements the directives rtems_message_queue_urgent.  It
41 *  prepends a message to the specified message queue.
42 *
43 *  Input parameters:
44 *    id     - pointer to message queue
45 *    buffer - pointer to message buffer
46 *    size   - size of message to send urgently
47 *
48 *  Output parameters:
49 *    RTEMS_SUCCESSFUL - if successful
50 *    error code       - if unsuccessful
51 */
52
53#if defined(RTEMS_MULTIPROCESSING)
54#define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
55#else
56#define MESSAGE_QUEUE_MP_HANDLER NULL
57#endif
58
59rtems_status_code rtems_message_queue_urgent(
60  Objects_Id            id,
61  void                 *buffer,
62  size_t                size
63)
64{
65  register Message_queue_Control  *the_message_queue;
66  Objects_Locations                location;
67  CORE_message_queue_Status        status;
68
69  if ( !buffer )
70    return RTEMS_INVALID_ADDRESS;
71
72  the_message_queue = _Message_queue_Get( id, &location );
73  switch ( location ) {
74
75    case OBJECTS_LOCAL:
76      status = _CORE_message_queue_Urgent(
77        &the_message_queue->message_queue,
78        buffer,
79        size,
80        id,
81        MESSAGE_QUEUE_MP_HANDLER,
82        FALSE,   /* sender does not block */
83        0        /* no timeout */
84      );
85      _Thread_Enable_dispatch();
86
87      /*
88       *  Since this API does not allow for blocking sends, we can directly
89       *  return the returned status.
90       */
91
92      return _Message_queue_Translate_core_message_queue_return_code(status);
93
94#if defined(RTEMS_MULTIPROCESSING)
95    case OBJECTS_REMOTE:
96      return _Message_queue_MP_Send_request_packet(
97        MESSAGE_QUEUE_MP_URGENT_REQUEST,
98        id,
99        buffer,
100        &size,
101        0,                               /* option_set */
102        MPCI_DEFAULT_TIMEOUT
103      );
104#endif
105
106    case OBJECTS_ERROR:
107      break;
108  }
109
110  return RTEMS_INVALID_ID;
111}
Note: See TracBrowser for help on using the repository browser.