source: rtems/c/src/exec/itron/src/trcv_mbf.c @ ce8cd34e

4.104.114.84.95
Last change on this file since ce8cd34e was 9da0994, checked in by Joel Sherrill <joel.sherrill@…>, on 11/15/99 at 17:15:58

Split ITRON Message Buffer Manager into multiple files.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  ITRON Message Buffer Manager
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.OARcorp.com/rtems/license.html.
7 *
8 *  $Id$
9 */
10
11#include <itron.h>
12
13#include <rtems/itron/msgbuffer.h>
14#include <rtems/itron/task.h>
15
16/*
17 *  trcv_mbf - Receive Message from MessageBuffer with Timeout
18 */
19
20ER trcv_mbf(
21  VP   msg,
22  INT *p_msgsz,
23  ID   mbfid,
24  TMO  tmout
25)
26{
27  ITRON_Message_buffer_Control  *the_message_buffer;
28  Objects_Locations              location;
29  CORE_message_queue_Status      status;
30  boolean                        wait;
31  Watchdog_Interval              interval;
32
33  interval = 0;
34  if (tmout == TMO_POL) {
35    wait = FALSE;
36  } else {
37    wait = TRUE;
38    if (tmout != TMO_FEVR)
39      interval = TOD_MILLISECONDS_TO_TICKS(tmout);
40  }
41
42  if (wait && _ITRON_Is_in_non_task_state() )
43    return E_CTX;
44
45  if (!p_msgsz || !msg || tmout <= -2)
46    return E_PAR;
47   
48  the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
49  switch (location) {
50    case OBJECTS_REMOTE:
51    case OBJECTS_ERROR:           /* Multiprocessing not supported */
52      return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
53
54    case OBJECTS_LOCAL:
55      _CORE_message_queue_Seize(
56          &the_message_buffer->message_queue,
57          the_message_buffer->Object.id,
58          msg,
59          p_msgsz,
60          wait,
61          interval
62      );
63      _Thread_Enable_dispatch();
64      status = (CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
65      return
66        _ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
67    }
68
69    /*
70     *  If multiprocessing were supported, this is where we would announce
71     *  the existence of the semaphore to the rest of the system.
72     */
73
74#if defined(RTEMS_MULTIPROCESSING)
75#endif
76    return E_OK;
77}
Note: See TracBrowser for help on using the repository browser.