source: rtems/c/src/exec/rtems/src/msgqsubmit.c @ 183f7748

4.104.114.84.95
Last change on this file since 183f7748 was 183f7748, checked in by Joel Sherrill <joel.sherrill@…>, on 11/30/00 at 14:34:49

2000-11-30 Joel Sherrill <joel@…>

  • src/msgqsubmit.c: Modified multiprocessing conditional so this would compile with both macros and inlines.
  • Property mode set to 100644
File size: 3.9 KB
RevLine 
[1e1b3e00]1/*
2 *  Message Queue Manager
3 *
4 *
[08311cc3]5 *  COPYRIGHT (c) 1989-1999.
[1e1b3e00]6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/score/sysstate.h>
17#include <rtems/score/chain.h>
18#include <rtems/score/isr.h>
19#include <rtems/score/coremsg.h>
20#include <rtems/score/object.h>
21#include <rtems/score/states.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24#if defined(RTEMS_MULTIPROCESSING)
25#include <rtems/score/mpci.h>
26#endif
27#include <rtems/rtems/status.h>
28#include <rtems/rtems/attr.h>
29#include <rtems/rtems/message.h>
30#include <rtems/rtems/options.h>
31#include <rtems/rtems/support.h>
32
33/*PAGE
34 *
35 *  _Message_queue_Submit
36 *
37 *  This routine implements the directives rtems_message_queue_send
38 *  and rtems_message_queue_urgent.  It processes a message that is
39 *  to be submitted to the designated message queue.  The message will
40 *  either be processed as a send send message which it will be inserted
41 *  at the rear of the queue or it will be processed as an urgent message
42 *  which will be inserted at the front of the queue.
43 *
44 *  Input parameters:
45 *    id          - pointer to message queue
46 *    buffer      - pointer to message buffer
47 *    size        - size in bytes of message to send
48 *    submit_type - send or urgent message
49 *
50 *  Output parameters:
51 *    RTEMS_SUCCESSFUL - if successful
52 *    error code       - if unsuccessful
53 */
54
[183f7748]55#if defined(RTEMS_MULTIPROCESSING)
56#define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
57#else
58#define MESSAGE_QUEUE_MP_HANDLER NULL
59#endif
60
[1e1b3e00]61rtems_status_code _Message_queue_Submit(
62  Objects_Id                  id,
63  void                       *buffer,
64  unsigned32                  size,
65  Message_queue_Submit_types  submit_type
66)
67{
68  register Message_queue_Control  *the_message_queue;
69  Objects_Locations                location;
70
71  the_message_queue = _Message_queue_Get( id, &location );
72  switch ( location )
73  {
74    case OBJECTS_REMOTE:
75#if defined(RTEMS_MULTIPROCESSING)
76      switch ( submit_type ) {
77        case MESSAGE_QUEUE_SEND_REQUEST:
78          return _Message_queue_MP_Send_request_packet(
79              MESSAGE_QUEUE_MP_SEND_REQUEST,
80              id,
81              buffer,
82              &size,
83              0,                               /* option_set */
84              MPCI_DEFAULT_TIMEOUT
85            );
86
87        case MESSAGE_QUEUE_URGENT_REQUEST:
88          return _Message_queue_MP_Send_request_packet(
89              MESSAGE_QUEUE_MP_URGENT_REQUEST,
90              id,
91              buffer,
92              &size,
93              0,                               /* option_set */
94              MPCI_DEFAULT_TIMEOUT
95            );
96      }
97      break;
98#endif
99
100    case OBJECTS_ERROR:
101      return RTEMS_INVALID_ID;
102
103    case OBJECTS_LOCAL:
104      switch ( submit_type ) {
105        case MESSAGE_QUEUE_SEND_REQUEST:
[53fb837a]106          _CORE_message_queue_Send(
107            &the_message_queue->message_queue,
108            buffer,
109            size,
110            id,
[183f7748]111            MESSAGE_QUEUE_MP_HANDLER,
[53fb837a]112            FALSE,   /* sender does not block */
113            0        /* no timeout */
114          );
[1e1b3e00]115          break;
116        case MESSAGE_QUEUE_URGENT_REQUEST:
[53fb837a]117          _CORE_message_queue_Urgent(
118            &the_message_queue->message_queue,
119            buffer,
120            size,
121            id,
[183f7748]122            MESSAGE_QUEUE_MP_HANDLER,
[53fb837a]123            FALSE,   /* sender does not block */
124            0        /* no timeout */
125          );
[1e1b3e00]126          break;
127        default:
128          return RTEMS_INTERNAL_ERROR;   /* should never get here */
129      }
130
131      _Thread_Enable_dispatch();
132      return _Message_queue_Translate_core_message_queue_return_code(
[53fb837a]133        _Thread_Executing->Wait.return_code
134      );
[1e1b3e00]135         
136  }
137  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
138}
Note: See TracBrowser for help on using the repository browser.