source: rtems/cpukit/itron/src/trcv_mbf.c @ c0d405ca

4.104.114.84.95
Last change on this file since c0d405ca was c0d405ca, checked in by Joel Sherrill <joel.sherrill@…>, on 01/05/00 at 22:13:15

Added new message priority parameter as returned by core support routine.

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[9da0994]1/*
2 *  ITRON Message Buffer Manager
3 *
[9d9a3dd]4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
[9da0994]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{
[c0d405ca]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  CORE_message_queue_Submit_types core_priority;
[9da0994]36
37  interval = 0;
38  if (tmout == TMO_POL) {
39    wait = FALSE;
40  } else {
41    wait = TRUE;
42    if (tmout != TMO_FEVR)
43      interval = TOD_MILLISECONDS_TO_TICKS(tmout);
44  }
45
46  if (wait && _ITRON_Is_in_non_task_state() )
47    return E_CTX;
48
49  if (!p_msgsz || !msg || tmout <= -2)
50    return E_PAR;
51   
52  the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
53  switch (location) {
54    case OBJECTS_REMOTE:
55    case OBJECTS_ERROR:           /* Multiprocessing not supported */
56      return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
57
58    case OBJECTS_LOCAL:
59      _CORE_message_queue_Seize(
60          &the_message_buffer->message_queue,
61          the_message_buffer->Object.id,
62          msg,
63          p_msgsz,
64          wait,
[c0d405ca]65          &core_priority,
[9da0994]66          interval
67      );
68      _Thread_Enable_dispatch();
69      status = (CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
70      return
71        _ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
72    }
73
74    /*
75     *  If multiprocessing were supported, this is where we would announce
76     *  the existence of the semaphore to the rest of the system.
77     */
78
79#if defined(RTEMS_MULTIPROCESSING)
80#endif
81    return E_OK;
82}
Note: See TracBrowser for help on using the repository browser.