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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [itron/] [src/] [trcv_mbx.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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