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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 30 unneback
/*
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
 *  $Id: tsnd_mbf.c,v 1.2 2001-09-27 11:59:13 chris Exp $
12
 */
13
 
14
#include <itron.h>
15
 
16
#include <rtems/itron/msgbuffer.h>
17
#include <rtems/itron/task.h>
18
 
19
#include <assert.h>  /* only for blocking */
20
 
21
/*
22
 *  tsnd_mbf - Send Message to MessageBuffer with Timeout
23
 */
24
 
25
ER tsnd_mbf(
26
  ID  mbfid,
27
  VP  msg,
28
  INT msgsz,
29
  TMO tmout
30
)
31
{
32
  ITRON_Message_buffer_Control  *the_message_buffer;
33
  Objects_Locations              location;
34
  Watchdog_Interval              interval;
35
  boolean                        wait;
36
 
37
  if (msgsz <= 0 || !msg)
38
    return E_PAR;
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
  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
      /* XXX Submit needs to take into account blocking */
60
      _CORE_message_queue_Submit(
61
        &the_message_buffer->message_queue,
62
        msg,
63
        msgsz,
64
        the_message_buffer->Object.id,
65
        NULL,
66
        CORE_MESSAGE_QUEUE_SEND_REQUEST,
67
        wait,      /* sender may block */
68
        interval   /* timeout interval */
69
      );
70
      _Thread_Enable_dispatch();
71
      return _ITRON_Message_buffer_Translate_core_message_buffer_return_code(
72
          _Thread_Executing->Wait.return_code
73
      );
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
 
84
    return E_OK;
85
}

powered by: WebSVN 2.1.0

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