source: rtems/c/src/exec/itron/src/snd_mbx.c @ 3bb9542c

Last change on this file since 3bb9542c was 3bb9542c, checked in by Joel Sherrill <joel.sherrill@…>, on 08/09/01 at 21:08:50

2001-08-09 Joel Sherrill <joel@…>

  • c/src/exec/itron/src/snd_mbx.c, c/src/exec/itron/src/tsnd_mbf.c c/src/exec/posix/src/mqueuesendsupp.c, c/src/exec/rtems/src/msgqsubmit.c, c/src/exec/score/include/rtems/score/coremsg.h, c/src/exec/score/inline/rtems/score/coremsg.inl, c/src/exec/score/src/coremsgsubmit.c: Unblocking message queue operations should NOT use _Thread_Executing for return status since it is permissible to invoke message send operations from an ISR. This was reported by Suvrat Gupta <suvrat@…>.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  ITRON 3.0 Mailbox Manager
3 *
4 *  COPYRIGHT (c) 1989-1999.
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.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14#include <itron.h>
15
16#include <rtems/itron/mbox.h>
17#include <rtems/itron/task.h>
18
19/*
20 *  snd_msg - Send Message to Mailbox
21 */
22
23ER snd_msg(
24  ID     mbxid,
25  T_MSG *pk_msg
26)
27{
28  register ITRON_Mailbox_Control *the_mailbox;
29  Objects_Locations                location;
30  unsigned32                       message_priority;
31  void                            *message_contents;
32  CORE_message_queue_Status        msg_status;
33
34  if ( !pk_msg )
35    return E_PAR;
36
37  the_mailbox = _ITRON_Mailbox_Get( mbxid, &location );
38  switch ( location ) {
39    case OBJECTS_REMOTE:
40    case OBJECTS_ERROR:
41      return _ITRON_Mailbox_Clarify_get_id_error( mbxid );
42
43    case OBJECTS_LOCAL:
44      if ( the_mailbox->do_message_priority )
45        message_priority = pk_msg->msgpri;
46      else
47        message_priority = CORE_MESSAGE_QUEUE_SEND_REQUEST;
48
49      message_contents = pk_msg;
50      msg_status = _CORE_message_queue_Submit(
51        &the_mailbox->message_queue,
52        &message_contents,
53        sizeof(T_MSG *),
54        the_mailbox->Object.id,
55        NULL,          /* multiprocessing not supported */
56        message_priority,
57        FALSE,     /* do not allow sender to block */
58        0          /* no timeout */
59     );
60     break;
61  }
62
63  _ITRON_return_errorno(
64     _ITRON_Mailbox_Translate_core_message_queue_return_code( msg_status )
65  );
66}
Note: See TracBrowser for help on using the repository browser.