source: rtems/cpukit/itron/src/cre_sem.c @ ebbe119e

4.104.114.84.95
Last change on this file since ebbe119e was ebbe119e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/01/04 at 10:14:23

2004-04-01 Ralf Corsepius <ralf_corsepius@…>

  • libblock/include/rtems/bdbuf.h: Include <rtems/chain.h> instead of <chain.h>.
  • libblock/include/rtems/ide_part_table.h: Include <rtems/chain.h> instead of <chain.h>.
  • libcsupport/src/malloc.c: Include <rtems/chain.h> instead of <chain.h>.
  • libcsupport/src/mount.c: Include <rtems/chain.h> instead of <chain.h>.
  • libcsupport/src/unmount.c: Include <rtems/chain.h> instead of <chain.h>.
  • libfs/src/imfs/imfs.h: Include <rtems/chain.h> instead of <chain.h>.
  • libfs/src/imfs/imfs_directory.c: Include <rtems/chain.h> instead of <chain.h>.
  • libfs/src/imfs/imfs_load_tar.c: Include <rtems/chain.h> instead of <chain.h>.
  • sapi/include/confdefs.h: Include <rtems/clockdrv.h> instead of <clockdrv.h>.
  • sapi/include/confdefs.h: Include <rtems/console.h> instead of <console.h>.
  • libfs/src/imfs/imfs_load_tar.c: Include <rtems/imfs.h> instead of <imfs.h>.
  • libmisc/shell/cmds.c: Include <rtems/imfs.h> instead of <imfs.h>.
  • libmisc/fsmount/fsmount.c: Include <rtems/imfs.h> instead of <imfs.h>.
  • sapi/include/confdefs.h: Include <rtems/imfs.h> instead of <imfs.h>.
  • itron/src/can_wup.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/chg_pri.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/cre_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/cre_mbx.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/cre_sem.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/cre_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/del_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/del_mbx.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/del_sem.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/del_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/dis_dsp.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/ena_dsp.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/eventflags.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/exd_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/ext_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/fmempool.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/frsm_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/get_tid.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/itronintr.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/itronsem.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/itrontime.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/mbox.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/mboxtranslatereturncode.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/msgbuffer.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/msgbuffertranslatereturncode.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/network.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/port.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/prcv_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/prcv_mbx.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/preq_sem.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/psnd_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/rcv_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/rcv_mbx.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/ref_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/ref_mbx.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/ref_sem.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/ref_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/rel_wai.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/rot_rdq.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/rsm_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/sig_sem.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/slp_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/snd_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/snd_mbx.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/sta_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/sus_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/sysmgmt.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/task.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/ter_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/trcv_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/trcv_mbx.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/tslp_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/tsnd_mbf.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/twai_sem.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/vmempool.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/wai_sem.c: Include <rtems/itron.h> instead of <itron.h>.
  • itron/src/wup_tsk.c: Include <rtems/itron.h> instead of <itron.h>.
  • sapi/include/rtems/config.h: Include <rtems/itron.h> instead of <itron.h>.
  • sapi/include/confdefs.h: Include <rtems/itron.h> instead of <itron.h>.
  • sapi/src/itronapi.c: Include <rtems/itron.h> instead of <itron.h>.
  • sapi/include/confdefs.h: Include <rtems/rtc.h> instead of <rtc.h>.
  • sapi/include/confdefs.h: Include <rtems/timerdrv.h> instead of <timerdrv.h>.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-1999.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/itron.h>
17
18#include <rtems/itron/semaphore.h>
19#include <rtems/itron/task.h>
20#include <rtems/score/tod.h>
21
22/*
23 *  cre_sem - Create Semaphore
24 *
25 *  This function implements the ITRON 3.0 cre_sem() service.
26 */
27
28ER cre_sem(
29  ID      semid,
30  T_CSEM *pk_csem
31)
32{
33  CORE_semaphore_Attributes   the_semaphore_attributes;
34  ITRON_Semaphore_Control    *the_semaphore;
35
36  /*
37   *  Bad pointer to the attributes structure
38   */
39
40  if ( !pk_csem )
41    return E_PAR;
42
43  /*
44   *  Bits were set that were note defined.
45   */
46
47  if ( pk_csem->sematr & _ITRON_SEMAPHORE_UNUSED_ATTRIBUTES )
48    return E_RSATR;
49
50  /*
51   *  Initial semaphore count exceeds the maximum.
52   */
53
54  if ( pk_csem->isemcnt > pk_csem->maxsem )
55    return E_PAR;
56
57  /*
58   *  This error is not in the specification but this condition
59   *  does not make sense.
60   */
61
62  if ( pk_csem->maxsem == 0 )
63    return E_PAR;
64
65  _Thread_Disable_dispatch();             /* prevents deletion */
66
67  the_semaphore = _ITRON_Semaphore_Allocate( semid );
68  if ( !the_semaphore ) {
69    _Thread_Enable_dispatch();
70    return _ITRON_Semaphore_Clarify_allocation_id_error( semid );
71  }
72
73  if ( pk_csem->sematr & TA_TPRI )
74    the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY;
75  else
76    the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
77
78  the_semaphore_attributes.maximum_count = pk_csem->maxsem;
79
80  _CORE_semaphore_Initialize(
81    &the_semaphore->semaphore,
82    &the_semaphore_attributes,
83    pk_csem->isemcnt
84  );
85
86  _ITRON_Objects_Open( &_ITRON_Semaphore_Information, &the_semaphore->Object );
87
88  /*
89   *  If multiprocessing were supported, this is where we would announce
90   *  the existence of the semaphore to the rest of the system.
91   */
92
93#if defined(RTEMS_MULTIPROCESSING)
94#endif
95
96  _Thread_Enable_dispatch();
97  return E_OK;
98}
Note: See TracBrowser for help on using the repository browser.