1 | /* sem.inl |
---|
2 | * |
---|
3 | * This file contains the static inlin implementation of the inlined |
---|
4 | * routines from the Semaphore Manager. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1999. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.OARcorp.com/rtems/license.html. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __SEMAPHORE_inl |
---|
17 | #define __SEMAPHORE_inl |
---|
18 | |
---|
19 | /*PAGE |
---|
20 | * |
---|
21 | * _Semaphore_Allocate |
---|
22 | * |
---|
23 | * DESCRIPTION: |
---|
24 | * |
---|
25 | * This function allocates a semaphore control block from |
---|
26 | * the inactive chain of free semaphore control blocks. |
---|
27 | */ |
---|
28 | |
---|
29 | RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Allocate( void ) |
---|
30 | { |
---|
31 | return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information ); |
---|
32 | } |
---|
33 | |
---|
34 | /*PAGE |
---|
35 | * |
---|
36 | * _Semaphore_Free |
---|
37 | * |
---|
38 | * DESCRIPTION: |
---|
39 | * |
---|
40 | * This routine frees a semaphore control block to the |
---|
41 | * inactive chain of free semaphore control blocks. |
---|
42 | */ |
---|
43 | |
---|
44 | RTEMS_INLINE_ROUTINE void _Semaphore_Free ( |
---|
45 | Semaphore_Control *the_semaphore |
---|
46 | ) |
---|
47 | { |
---|
48 | _Objects_Free( &_Semaphore_Information, &the_semaphore->Object ); |
---|
49 | } |
---|
50 | |
---|
51 | /*PAGE |
---|
52 | * |
---|
53 | * _Semaphore_Get |
---|
54 | * |
---|
55 | * DESCRIPTION: |
---|
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 | */ |
---|
65 | |
---|
66 | RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get ( |
---|
67 | Objects_Id id, |
---|
68 | Objects_Locations *location |
---|
69 | ) |
---|
70 | { |
---|
71 | return (Semaphore_Control *) |
---|
72 | _Objects_Get( &_Semaphore_Information, id, location ); |
---|
73 | } |
---|
74 | |
---|
75 | /*PAGE |
---|
76 | * |
---|
77 | * _Semaphore_Is_null |
---|
78 | * |
---|
79 | * DESCRIPTION: |
---|
80 | * |
---|
81 | * This function returns TRUE if the_semaphore is NULL and FALSE otherwise. |
---|
82 | */ |
---|
83 | |
---|
84 | RTEMS_INLINE_ROUTINE boolean _Semaphore_Is_null ( |
---|
85 | Semaphore_Control *the_semaphore |
---|
86 | ) |
---|
87 | { |
---|
88 | return ( the_semaphore == NULL ); |
---|
89 | } |
---|
90 | |
---|
91 | #endif |
---|
92 | /* end of include file */ |
---|