OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [itron/] [src/] [trcv_mbx.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: trcv_mbx.c,v 1.2 2001-09-27 11:59:13 chris Exp $
12
 */
13
 
14
#include <itron.h>
15
 
16
#include <rtems/itron/mbox.h>
17
#include <rtems/itron/task.h>
18
 
19
/*
20
 *  trcv_msg - Receive Message from Mailbox with Timeout
21
 */
22
 
23
ER trcv_msg(
24
  T_MSG **ppk_msg,
25
  ID      mbxid,
26
  TMO     tmout
27
)
28
{
29
  register ITRON_Mailbox_Control *the_mailbox;
30
  Watchdog_Interval               interval;
31
  boolean                         wait;
32
  Objects_Locations               location;
33
  unsigned32                      size;
34
 
35
  if (!ppk_msg)
36
    return E_PAR;
37
 
38
  interval = 0;
39
  if ( tmout == TMO_POL ) {
40
    wait = FALSE;
41
  } else {
42
    wait = TRUE;
43
    if ( tmout != TMO_FEVR )
44
      interval = TOD_MILLISECONDS_TO_TICKS(tmout);
45
  }
46
 
47
  if ( wait && _ITRON_Is_in_non_task_state() )
48
    return E_CTX;
49
 
50
  the_mailbox = _ITRON_Mailbox_Get( mbxid, &location );
51
  switch ( location ) {
52
    case OBJECTS_REMOTE:
53
    case OBJECTS_ERROR:
54
      return _ITRON_Mailbox_Clarify_get_id_error( mbxid );
55
 
56
    case OBJECTS_LOCAL:
57
 
58
      _CORE_message_queue_Seize(
59
        &the_mailbox->message_queue,
60
        the_mailbox->Object.id,
61
        ppk_msg,
62
        &size,
63
        wait,
64
        interval
65
      );
66
      break;
67
  }
68
 
69
  _ITRON_return_errorno(
70
    _ITRON_Mailbox_Translate_core_message_queue_return_code(
71
        _Thread_Executing->Wait.return_code ) );
72
}

powered by: WebSVN 2.1.0

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