OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [exec/] [itron/] [src/] [trcv_mbf.c] - Blame information for rev 158

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 158 chris
/*
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: trcv_mbf.c,v 1.1.1.1 2001-07-10 09:42:09 chris Exp $
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
 
23
ER 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.