source: rtems/c/src/exec/itron/src/tsnd_mbf.c @ f42b726

4.104.114.84.95
Last change on this file since f42b726 was f42b726, checked in by Joel Sherrill <joel.sherrill@…>, on 01/24/01 at 14:17:28

2001-01-24 Ralf Corsepius <corsepiu@…>

  • configure.in: Add src/config.h
  • src/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • src/.cvsignore: Add config.h and stamp-h
  • src/*.c: Add config.h support.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  ITRON Message Buffer 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#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <itron.h>
19
20#include <rtems/itron/msgbuffer.h>
21#include <rtems/itron/task.h>
22
23#include <assert.h>  /* only for blocking */
24
25/*
26 *  tsnd_mbf - Send Message to MessageBuffer with Timeout
27 */
28
29ER tsnd_mbf(
30  ID  mbfid,
31  VP  msg,
32  INT msgsz,
33  TMO tmout
34)
35{
36  ITRON_Message_buffer_Control  *the_message_buffer;
37  Objects_Locations              location;
38  Watchdog_Interval              interval;
39  boolean                        wait;
40
41  if (msgsz <= 0 || !msg)
42    return E_PAR;
43
44  interval = 0;
45  if ( tmout == TMO_POL ) {
46    wait = FALSE;
47  } else {
48    wait = TRUE;
49    if ( tmout != TMO_FEVR )
50      interval = TOD_MILLISECONDS_TO_TICKS(tmout);
51  }
52
53  if ( wait && _ITRON_Is_in_non_task_state() )
54    return E_CTX;
55
56  the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
57  switch (location) {
58    case OBJECTS_REMOTE:
59    case OBJECTS_ERROR:           /* Multiprocessing not supported */
60      return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
61
62    case OBJECTS_LOCAL:
63      /* XXX Submit needs to take into account blocking */
64      _CORE_message_queue_Submit(
65        &the_message_buffer->message_queue,
66        msg,
67        msgsz,
68        the_message_buffer->Object.id,
69        NULL,
70        CORE_MESSAGE_QUEUE_SEND_REQUEST,
71        wait,      /* sender may block */
72        interval   /* timeout interval */
73      );
74      _Thread_Enable_dispatch();
75      return _ITRON_Message_buffer_Translate_core_message_buffer_return_code(
76          _Thread_Executing->Wait.return_code
77      );
78    }
79
80    /*
81     *  If multiprocessing were supported, this is where we would announce
82     *  the existence of the semaphore to the rest of the system.
83     */
84
85#if defined(RTEMS_MULTIPROCESSING)
86#endif
87
88    return E_OK;
89}
Note: See TracBrowser for help on using the repository browser.