source: rtems/cpukit/rtems/src/msgqsubmit.c @ 9180f63

4.104.114.84.95
Last change on this file since 9180f63 was 9180f63, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 23:26:50

Fixed some typos.

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