1 | /** |
---|
2 | * @file rtems/itron/semaphore.inl |
---|
3 | */ |
---|
4 | |
---|
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.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _RTEMS_ITRON_SEMAPHORE_INL |
---|
17 | #define _RTEMS_ITRON_SEMAPHORE_INL |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | /* |
---|
24 | * _ITRON_Semaphore_Allocate |
---|
25 | */ |
---|
26 | |
---|
27 | #define _ITRON_Semaphore_Allocate( _semid ) \ |
---|
28 | (ITRON_Semaphore_Control *)_ITRON_Objects_Allocate_by_index( \ |
---|
29 | &_ITRON_Semaphore_Information, \ |
---|
30 | (_semid), \ |
---|
31 | sizeof(ITRON_Semaphore_Control) \ |
---|
32 | ) |
---|
33 | |
---|
34 | /* |
---|
35 | * _ITRON_Semaphore_Clarify_allocation_id_error |
---|
36 | */ |
---|
37 | |
---|
38 | #define _ITRON_Semaphore_Clarify_allocation_id_error( _id ) \ |
---|
39 | _ITRON_Objects_Clarify_allocation_id_error( \ |
---|
40 | &_ITRON_Semaphore_Information, (_id) ) |
---|
41 | |
---|
42 | /* |
---|
43 | * _ITRON_Semaphore_Clarify_get_id_error |
---|
44 | */ |
---|
45 | |
---|
46 | #define _ITRON_Semaphore_Clarify_get_id_error( _id ) \ |
---|
47 | _ITRON_Objects_Clarify_get_id_error( &_ITRON_Semaphore_Information, (_id) ) |
---|
48 | |
---|
49 | /* |
---|
50 | * _ITRON_Semaphore_Free |
---|
51 | */ |
---|
52 | |
---|
53 | #define _ITRON_Semaphore_Free( _the_semaphore ) \ |
---|
54 | _ITRON_Objects_Free( &_ITRON_Semaphore_Information, &(_the_semaphore)->Object ) |
---|
55 | |
---|
56 | /*PAGE |
---|
57 | * |
---|
58 | * _ITRON_Semaphore_Get |
---|
59 | */ |
---|
60 | |
---|
61 | #define _ITRON_Semaphore_Get( _id, _location ) \ |
---|
62 | (ITRON_Semaphore_Control *) \ |
---|
63 | _ITRON_Objects_Get( &_ITRON_Semaphore_Information, (_id), (_location) ) |
---|
64 | |
---|
65 | /*PAGE |
---|
66 | * |
---|
67 | * _ITRON_Semaphore_Is_null |
---|
68 | */ |
---|
69 | |
---|
70 | #define _ITRON_Semaphore_Is_null( _the_semaphore ) \ |
---|
71 | ( (_the_semaphore) == NULL ) |
---|
72 | |
---|
73 | /* |
---|
74 | * _ITRON_Semaphore_Translate_core_semaphore_return_code |
---|
75 | */ |
---|
76 | |
---|
77 | /* XXX fix me */ |
---|
78 | static ER _ITRON_Semaphore_Translate_core_semaphore_return_code ( |
---|
79 | uint32_t the_semaphore_status |
---|
80 | ) |
---|
81 | { |
---|
82 | /* XXX need to be able to return "E_RLWAI" */ |
---|
83 | switch ( the_semaphore_status ) { |
---|
84 | case CORE_SEMAPHORE_STATUS_SUCCESSFUL: |
---|
85 | return E_OK; |
---|
86 | case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT: |
---|
87 | return E_TMOUT; |
---|
88 | case CORE_SEMAPHORE_WAS_DELETED: |
---|
89 | return E_DLT; |
---|
90 | case CORE_SEMAPHORE_TIMEOUT: |
---|
91 | return E_TMOUT; |
---|
92 | case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED: |
---|
93 | return E_QOVR; |
---|
94 | case THREAD_STATUS_PROXY_BLOCKING: |
---|
95 | return THREAD_STATUS_PROXY_BLOCKING; |
---|
96 | } |
---|
97 | return E_OK; /* unreached - only to remove warnings */ |
---|
98 | } |
---|
99 | |
---|
100 | #ifdef __cplusplus |
---|
101 | } |
---|
102 | #endif |
---|
103 | |
---|
104 | #endif |
---|
105 | /* end of include file */ |
---|
106 | |
---|