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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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