source: rtems/cpukit/rtems/inline/rtems/rtems/sem.inl @ 4d24fccb

4.104.114.95
Last change on this file since 4d24fccb was 4d24fccb, checked in by Ralf Corsepius <ralf.corsepius@…>, on 08/19/08 at 12:09:40

Add header guard to force indirect inclusion.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/**
2 * @file rtems/rtems/sem.inl
3 *
4 *  This file contains the static inlin implementation of the inlined
5 *  routines from the Semaphore Manager.
6 */
7
8/*  COPYRIGHT (c) 1989-2008.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  $Id$
16 */
17
18#ifndef _RTEMS_RTEMS_SEM_H
19# error "Never use <rtems/rtems/sem.inl> directly; include <rtems/rtems/sem.h> instead."
20#endif
21
22#ifndef _RTEMS_RTEMS_SEM_INL
23#define _RTEMS_RTEMS_SEM_INL
24
25/**
26 *  @addtogroup ClassicSem
27 *  @{
28 */
29
30/**
31 *  @brief Semaphore_Allocate
32 *
33 *  This function allocates a semaphore control block from
34 *  the inactive chain of free semaphore control blocks.
35 */
36RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Allocate( void )
37{
38  return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information );
39}
40
41/**
42 *  @brief Semaphore_Free
43 *
44 *  This routine frees a semaphore control block to the
45 *  inactive chain of free semaphore control blocks.
46 */
47RTEMS_INLINE_ROUTINE void _Semaphore_Free (
48  Semaphore_Control *the_semaphore
49)
50{
51  _Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
52}
53
54/**
55 *  @brief Semaphore_Get
56 *
57 *  This function maps semaphore IDs to semaphore control blocks.
58 *  If ID corresponds to a local semaphore, then it returns
59 *  the_semaphore control pointer which maps to ID and location
60 *  is set to OBJECTS_LOCAL.  if the semaphore ID is global and
61 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
62 *  and the_semaphore is undefined.  Otherwise, location is set
63 *  to OBJECTS_ERROR and the_semaphore is undefined.
64 */
65RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get (
66  Objects_Id         id,
67  Objects_Locations *location
68)
69{
70  return (Semaphore_Control *)
71    _Objects_Get( &_Semaphore_Information, id, location );
72}
73
74/**
75 *  @brief Semaphore_Get (Interrupts disabled)
76 *
77 *  This function maps semaphore IDs to semaphore control blocks.
78 *  If ID corresponds to a local semaphore, then it returns
79 *  the_semaphore control pointer which maps to ID and location
80 *  is set to OBJECTS_LOCAL.  if the semaphore ID is global and
81 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
82 *  and the_semaphore is undefined.  Otherwise, location is set
83 *  to OBJECTS_ERROR and the_semaphore is undefined.
84 */
85RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get_interrupt_disable (
86  Objects_Id         id,
87  Objects_Locations *location,
88  ISR_Level         *level
89)
90{
91  return (Semaphore_Control *)
92    _Objects_Get_isr_disable( &_Semaphore_Information, id, location, level );
93}
94
95/**
96 *  @brief Semaphore_Is_null
97 *
98 *  This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
99 */
100RTEMS_INLINE_ROUTINE boolean _Semaphore_Is_null (
101  Semaphore_Control *the_semaphore
102)
103{
104  return ( the_semaphore == NULL );
105}
106
107/**@}*/
108
109#endif
110/*  end of include file */
Note: See TracBrowser for help on using the repository browser.