source: rtems/cpukit/itron/src/cre_mbf.c @ e49f9e6b

4.104.114.84.95
Last change on this file since e49f9e6b was e49f9e6b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:54:02

2003-09-04 Joel Sherrill <joel@…>

  • include/itron.h, include/itronsys/eventflags.h, include/itronsys/fmempool.h, include/itronsys/intr.h, include/itronsys/mbox.h, include/itronsys/msgbuffer.h, include/itronsys/network.h, include/itronsys/port.h, include/itronsys/semaphore.h, include/itronsys/status.h, include/itronsys/sysmgmt.h, include/itronsys/task.h, include/itronsys/time.h, include/itronsys/types.h, include/itronsys/vmempool.h, include/rtems/itron/config.h, include/rtems/itron/eventflags.h, include/rtems/itron/fmempool.h, include/rtems/itron/intr.h, include/rtems/itron/itronapi.h, include/rtems/itron/mbox.h, include/rtems/itron/msgbuffer.h, include/rtems/itron/network.h, include/rtems/itron/object.h, include/rtems/itron/port.h, include/rtems/itron/semaphore.h, include/rtems/itron/sysmgmt.h, include/rtems/itron/task.h, include/rtems/itron/time.h, include/rtems/itron/vmempool.h, inline/rtems/itron/eventflags.inl, inline/rtems/itron/fmempool.inl, inline/rtems/itron/intr.inl, inline/rtems/itron/mbox.inl, inline/rtems/itron/msgbuffer.inl, inline/rtems/itron/network.inl, inline/rtems/itron/port.inl, inline/rtems/itron/semaphore.inl, inline/rtems/itron/sysmgmt.inl, inline/rtems/itron/task.inl, inline/rtems/itron/time.inl, inline/rtems/itron/vmempool.inl, macros/rtems/itron/eventflags.inl, macros/rtems/itron/fmempool.inl, macros/rtems/itron/intr.inl, macros/rtems/itron/mbox.inl, macros/rtems/itron/msgbuffer.inl, macros/rtems/itron/network.inl, macros/rtems/itron/port.inl, macros/rtems/itron/semaphore.inl, macros/rtems/itron/sysmgmt.inl, macros/rtems/itron/task.inl, macros/rtems/itron/time.inl, macros/rtems/itron/vmempool.inl, src/can_wup.c, src/chg_pri.c, src/cre_mbf.c, src/cre_mbx.c, src/cre_sem.c, src/cre_tsk.c, src/del_mbf.c, src/del_mbx.c, src/del_sem.c, src/del_tsk.c, src/dis_dsp.c, src/ena_dsp.c, src/eventflags.c, src/exd_tsk.c, src/ext_tsk.c, src/fmempool.c, src/frsm_tsk.c, src/get_tid.c, src/itronintr.c, src/itronsem.c, src/itrontime.c, src/mbox.c, src/mboxtranslatereturncode.c, src/msgbuffer.c, src/msgbuffertranslatereturncode.c, src/network.c, src/port.c, src/prcv_mbf.c, src/prcv_mbx.c, src/preq_sem.c, src/psnd_mbf.c, src/rcv_mbf.c, src/rcv_mbx.c, src/ref_mbf.c, src/ref_mbx.c, src/ref_sem.c, src/ref_tsk.c, src/rel_wai.c, src/rot_rdq.c, src/rsm_tsk.c, src/sig_sem.c, src/slp_tsk.c, src/snd_mbf.c, src/snd_mbx.c, src/sta_tsk.c, src/sus_tsk.c, src/sysmgmt.c, src/task.c, src/ter_tsk.c, src/trcv_mbf.c, src/trcv_mbx.c, src/tslp_tsk.c, src/tsnd_mbf.c, src/twai_sem.c, src/vmempool.c, src/wai_sem.c, src/wup_tsk.c: URL for license changed.
  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
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.rtems.com/license/LICENSE.
10 *
11 *  $Id$
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 *  cre_mbf - Create MessageBuffer
25 */
26
27ER cre_mbf(
28  ID      mbfid,
29  T_CMBF *pk_cmbf
30)
31{
32  CORE_message_queue_Attributes    the_msgq_attributes;
33  ITRON_Message_buffer_Control    *the_message_buffer;
34
35  /*
36   *  Bad pointer to the attributes structure
37   */
38
39  if ( !pk_cmbf )
40    return E_PAR;
41
42  /*
43   *  Bits were set that were note defined.
44   */
45
46  if (pk_cmbf->mbfatr & ~(TA_TPRI))
47    return E_RSATR;
48
49  if (pk_cmbf->bufsz < 0 || pk_cmbf->maxmsz < 0)
50    return E_PAR;
51   
52  if (pk_cmbf->bufsz < pk_cmbf->maxmsz)
53    return E_PAR;
54
55  _Thread_Disable_dispatch();             /* prevents deletion */
56
57  the_message_buffer = _ITRON_Message_buffer_Allocate(mbfid);
58  if ( !the_message_buffer ) {
59    _Thread_Enable_dispatch();
60    return _ITRON_Message_buffer_Clarify_allocation_id_error(mbfid);
61  }
62
63  if ( pk_cmbf->mbfatr & TA_TPRI )
64    the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
65  else
66    the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
67
68  _CORE_message_queue_Initialize(
69    &the_message_buffer->message_queue,
70    &the_msgq_attributes,
71    pk_cmbf->bufsz / pk_cmbf->maxmsz,
72    pk_cmbf->maxmsz
73  );
74
75  _ITRON_Objects_Open( &_ITRON_Message_buffer_Information,
76                       &the_message_buffer->Object );
77   
78  /*
79   *  If multiprocessing were supported, this is where we would announce
80   *  the existence of the semaphore to the rest of the system.
81   */
82
83#if defined(RTEMS_MULTIPROCESSING)
84#endif
85
86  _Thread_Enable_dispatch();
87
88  return E_OK;
89}
Note: See TracBrowser for help on using the repository browser.