source: rtems/cpukit/itron/src/trcv_mbf.c @ 9d9a3dd

4.104.114.84.95
Last change on this file since 9d9a3dd was 9d9a3dd, checked in by Jennifer Averett <Jennifer.Averett@…>, on Nov 17, 1999 at 4:47:58 PM

+ Updated copyright information.

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