source: rtems/cpukit/rtems/src/msgqsend.c @ 4efe1955

4.115
Last change on this file since 4efe1955 was 4efe1955, checked in by Mathew Kallada <matkallada@…>, on 12/06/12 at 00:46:05

rtems misc: Clean up Doxygen GCI Task #5

http://www.google-melange.com/gci/task/view/google/gci2012/8015207

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/**
2 * @file
3 *
4 * @brief rtems_message_queue_send
5 * @ingroup ClassicMessageQueue Message Queues
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/sysstate.h>
23#include <rtems/score/chain.h>
24#include <rtems/score/isr.h>
25#include <rtems/score/coremsg.h>
26#include <rtems/score/object.h>
27#include <rtems/score/states.h>
28#include <rtems/score/thread.h>
29#include <rtems/score/wkspace.h>
30#if defined(RTEMS_MULTIPROCESSING)
31#include <rtems/score/mpci.h>
32#endif
33#include <rtems/rtems/status.h>
34#include <rtems/rtems/attr.h>
35#include <rtems/rtems/message.h>
36#include <rtems/rtems/options.h>
37#include <rtems/rtems/support.h>
38
39/*
40 *
41 *  rtems_message_queue_send
42 *
43 *  This routine implements the directive rtems_message_queue_send.  It sends a
44 *  message to the specified message queue.
45 *
46 *  Input parameters:
47 *    id     - pointer to message queue
48 *    buffer - pointer to message buffer
49 *    size   - size of message to send
50 *
51 *  Output parameters:
52 *    RTEMS_SUCCESSFUL - if successful
53 *    error code       - if unsuccessful
54 */
55
56#if defined(RTEMS_MULTIPROCESSING)
57#define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
58#else
59#define MESSAGE_QUEUE_MP_HANDLER NULL
60#endif
61
62rtems_status_code rtems_message_queue_send(
63  rtems_id    id,
64  const void *buffer,
65  size_t      size
66)
67{
68  register Message_queue_Control  *the_message_queue;
69  Objects_Locations                location;
70  CORE_message_queue_Status        status;
71
72  if ( !buffer )
73    return RTEMS_INVALID_ADDRESS;
74
75  the_message_queue = _Message_queue_Get( id, &location );
76  switch ( location ) {
77
78    case OBJECTS_LOCAL:
79      status = _CORE_message_queue_Send(
80        &the_message_queue->message_queue,
81        buffer,
82        size,
83        id,
84        MESSAGE_QUEUE_MP_HANDLER,
85        false,   /* sender does not block */
86        0        /* no timeout */
87      );
88
89      _Thread_Enable_dispatch();
90
91      /*
92       *  Since this API does not allow for blocking sends, we can directly
93       *  return the returned status.
94       */
95
96      return _Message_queue_Translate_core_message_queue_return_code(status);
97
98#if defined(RTEMS_MULTIPROCESSING)
99    case OBJECTS_REMOTE:
100      return _Message_queue_MP_Send_request_packet(
101        MESSAGE_QUEUE_MP_SEND_REQUEST,
102        id,
103        buffer,
104        &size,
105        0,                               /* option_set */
106        MPCI_DEFAULT_TIMEOUT
107      );
108      break;
109#endif
110
111    case OBJECTS_ERROR:
112      break;
113  }
114  return RTEMS_INVALID_ID;
115}
Note: See TracBrowser for help on using the repository browser.