source: rtems/cpukit/itron/inline/rtems/itron/semaphore.inl @ 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: 4.5 KB
RevLine 
[352c9b2]1/*
[9d9a3dd]2 *  COPYRIGHT (c) 1989-1999.
3 *  On-Line Applications Research Corporation (OAR).
4 *
[352c9b2]5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
[e49f9e6b]7 *  http://www.rtems.com/license/LICENSE.
[352c9b2]8 *
9 *  $Id$
10 */
11
12#ifndef __ITRON_SEMAPHORE_inl_
13#define __ITRON_SEMAPHORE_inl_
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/*
20 *  _ITRON_Semaphore_Allocate
21 *
22 *  DESCRIPTION:
23 *
24 *  This routine allocates the semaphore associated with the specified
25 *  semaphore ID from the pool of inactive semaphores.
26 *
27 *  Input parameters:
28 *    semid   - id of semaphore to allocate
29 *    status  - pointer to status variable
30 *
31 *  Output parameters:
32 *    returns - pointer to the semaphore control block
33 *    *status - status
34 */
35
36RTEMS_INLINE_ROUTINE ITRON_Semaphore_Control *_ITRON_Semaphore_Allocate(
37  ID   semid
38)
39{
40  return (ITRON_Semaphore_Control *)_ITRON_Objects_Allocate_by_index(
41    &_ITRON_Semaphore_Information,
42    semid,
43    sizeof(ITRON_Semaphore_Control)
44  );
45}
46
47/*
48 *  _ITRON_Semaphore_Clarify_allocation_id_error
49 *
50 *  This function is invoked when an object allocation ID error
51 *  occurs to determine the specific ITRON error code to return.
52 */
53
54#define _ITRON_Semaphore_Clarify_allocation_id_error( _id ) \
55  _ITRON_Objects_Clarify_allocation_id_error( \
56      &_ITRON_Semaphore_Information, (_id) )
57
58/*
59 *  _ITRON_Semaphore_Clarify_get_id_error
60 *
61 *  This function is invoked when an object get ID error
62 *  occurs to determine the specific ITRON error code to return.
63 */
64
65#define _ITRON_Semaphore_Clarify_get_id_error( _id ) \
66 _ITRON_Objects_Clarify_get_id_error( &_ITRON_Semaphore_Information, (_id) )
67
68/*
69 *  _ITRON_Semaphore_Free
70 *
71 *  DESCRIPTION:
72 *
73 *  This routine frees a semaphore control block to the
74 *  inactive chain of free semaphore control blocks.
75 *
76 *  Input parameters:
77 *    the_semaphore - pointer to semaphore control block
78 *
79 *  Output parameters: NONE
80 */
81
82RTEMS_INLINE_ROUTINE void _ITRON_Semaphore_Free (
83  ITRON_Semaphore_Control *the_semaphore
84)
85{
86  _ITRON_Objects_Free( &_ITRON_Semaphore_Information, &the_semaphore->Object );
87}
88
89/*PAGE
90 *
91 *  _ITRON_Semaphore_Get
92 *
93 *  DESCRIPTION:
94 *
95 *  This function maps semaphore IDs to semaphore control blocks.
96 *  If ID corresponds to a local semaphore, then it returns
97 *  the_semaphore control pointer which maps to ID and location
98 *  is set to OBJECTS_LOCAL.  if the semaphore ID is global and
99 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
100 *  and the_semaphore is undefined.  Otherwise, location is set
101 *  to OBJECTS_ERROR and the_semaphore is undefined.
102 *
103 *  Input parameters:
104 *    id            - ITRON semaphore ID.
105 *    the_location  - pointer to a location variable
106 *
107 *  Output parameters:
108 *    *the_location  - location of the object
109 */
110
111RTEMS_INLINE_ROUTINE ITRON_Semaphore_Control *_ITRON_Semaphore_Get (
112  ID                 id,
113  Objects_Locations *location
114)
115{
116  return (ITRON_Semaphore_Control *)
117    _ITRON_Objects_Get( &_ITRON_Semaphore_Information, id, location );
118}
119
120/*PAGE
121 *
122 *  _ITRON_Semaphore_Is_null
123 *
124 *  This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
125 *
126 *  Input parameters:
127 *    the_semaphore - pointer to semaphore control block
128 *
129 *  Output parameters:
130 *    TRUE  - if the_semaphore is NULL
131 *    FALSE - otherwise
132 */
133
134RTEMS_INLINE_ROUTINE boolean _ITRON_Semaphore_Is_null (
135  ITRON_Semaphore_Control *the_semaphore
136)
137{
138  return ( the_semaphore == NULL );
139}
140
141/*
142 *  _ITRON_Semaphore_Translate_core_semaphore_return_code
143 *
144 *  This function returns a ITRON status code based on the semaphore
145 *  status code specified.
146 *
147 *  Input parameters:
148 *    the_semaphore_status - semaphore status code to translate
149 *
150 *  Output parameters:
151 *    ITRON status code - translated ITRON status code
152 *
153 */
154
155RTEMS_INLINE_ROUTINE ER  _ITRON_Semaphore_Translate_core_semaphore_return_code (
156  unsigned32 the_semaphore_status
157)
158{
159/* XXX need to be able to return "E_RLWAI" */
160  switch ( the_semaphore_status ) {
161    case  CORE_SEMAPHORE_STATUS_SUCCESSFUL:
162      return E_OK;
163    case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
164      return E_TMOUT;
165    case CORE_SEMAPHORE_WAS_DELETED:
166      return E_DLT;
167    case CORE_SEMAPHORE_TIMEOUT:
168      return E_TMOUT;
169    case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
170      return E_QOVR;
171    case THREAD_STATUS_PROXY_BLOCKING:
172      return THREAD_STATUS_PROXY_BLOCKING;
173  }
174  return E_OK;   /* unreached - only to remove warnings */
175}
176
177#ifdef __cplusplus
178}
179#endif
180
181#endif
182/* end of include file */
183
Note: See TracBrowser for help on using the repository browser.