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

Subversion Repositories or1k

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

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

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

powered by: WebSVN 2.1.0

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