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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [itron/] [src/] [ref_mbx.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 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
 *  ref_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
 *  ref_mbx - Reference Mailbox Status
25
 */
26
 
27
ER ref_mbx(
28
  T_RMBX *pk_rmbx,
29
  ID      mbxid
30
)
31
{
32
  register ITRON_Mailbox_Control *the_mailbox;
33
  Objects_Locations               location;
34
  Chain_Control                  *pending;
35
 
36
  if ( !pk_rmbx )
37
    return E_PAR;
38
 
39
  the_mailbox = _ITRON_Mailbox_Get( mbxid, &location );
40
  switch ( location ) {
41
    case OBJECTS_REMOTE:
42
    case OBJECTS_ERROR:
43
      return _ITRON_Mailbox_Clarify_get_id_error( mbxid );
44
 
45
    case OBJECTS_LOCAL:
46
 
47
      pending = &the_mailbox->message_queue.Pending_messages;
48
      if ( _Chain_Is_empty( pending ) )
49
        pk_rmbx->pk_msg = NULL;
50
      else
51
        pk_rmbx->pk_msg = (T_MSG *) pending->first;
52
 
53
      /*
54
       *  Fill in whether or not there is a waiting task
55
       */
56
 
57
      if ( !_Thread_queue_First( &the_mailbox->message_queue.Wait_queue ) )
58
        pk_rmbx->wtsk = FALSE;
59
      else
60
        pk_rmbx->wtsk = TRUE;
61
 
62
      break;
63
  }
64
  _ITRON_return_errorno( E_OK );
65
}
66
 

powered by: WebSVN 2.1.0

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