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.OARcorp.com/rtems/license.html. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef __ITRON_SEMAPHORE_h_ |
---|
13 | #define __ITRON_SEMAPHORE_h_ |
---|
14 | |
---|
15 | #ifdef __cplusplus |
---|
16 | extern "C" { |
---|
17 | #endif |
---|
18 | |
---|
19 | /* |
---|
20 | * Create Semaphore (cre_sem) Structure |
---|
21 | */ |
---|
22 | |
---|
23 | typedef struct t_csem { |
---|
24 | VP exinf; /* extended information */ |
---|
25 | ATR sematr; /* semaphore attributes */ |
---|
26 | /* Following is the extended function for [level X]. */ |
---|
27 | INT isemcnt; /* initial semaphore count */ |
---|
28 | INT maxsem; /* maximum semaphore count */ |
---|
29 | /* additional information may be included depending on the implementation */ |
---|
30 | } T_CSEM; |
---|
31 | |
---|
32 | /* |
---|
33 | * sematr - Semaphore Attribute Values |
---|
34 | */ |
---|
35 | |
---|
36 | #define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ |
---|
37 | #define TA_TPRI 0x01 /* waiting tasks are handled by priority */ |
---|
38 | |
---|
39 | #define _ITRON_SEMAPHORE_UNUSED_ATTRIBUTES ~(TA_TPRI) |
---|
40 | |
---|
41 | /* |
---|
42 | * Reference Semaphore (ref_sem) Structure |
---|
43 | */ |
---|
44 | |
---|
45 | typedef struct t_rsem { |
---|
46 | VP exinf; /* extended information */ |
---|
47 | BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ |
---|
48 | INT semcnt; /* current semaphore count */ |
---|
49 | /* additional information may be included depending on the implementation */ |
---|
50 | } T_RSEM; |
---|
51 | |
---|
52 | /* |
---|
53 | * Semaphore Functions |
---|
54 | */ |
---|
55 | |
---|
56 | /* |
---|
57 | * cre_sem - Create Semaphore |
---|
58 | */ |
---|
59 | |
---|
60 | ER cre_sem( |
---|
61 | ID semid, |
---|
62 | T_CSEM *pk_csem |
---|
63 | ); |
---|
64 | |
---|
65 | /* |
---|
66 | * del_sem - Delete Semaphore |
---|
67 | */ |
---|
68 | |
---|
69 | ER del_sem( |
---|
70 | ID semid |
---|
71 | ); |
---|
72 | |
---|
73 | /* |
---|
74 | * sig_sem - Signal Semaphore |
---|
75 | */ |
---|
76 | |
---|
77 | ER sig_sem( |
---|
78 | ID semid |
---|
79 | ); |
---|
80 | |
---|
81 | /* |
---|
82 | * wai_sem - Wait on Semaphore |
---|
83 | */ |
---|
84 | |
---|
85 | ER wai_sem( |
---|
86 | ID semid |
---|
87 | ); |
---|
88 | |
---|
89 | /* |
---|
90 | * preq_sem - Poll and Request Semaphore |
---|
91 | */ |
---|
92 | |
---|
93 | ER preq_sem( |
---|
94 | ID semid |
---|
95 | ); |
---|
96 | |
---|
97 | /* |
---|
98 | * twai_sem - Wait on Semaphore with Timeout |
---|
99 | */ |
---|
100 | |
---|
101 | ER twai_sem( |
---|
102 | ID semid, |
---|
103 | TMO tmout |
---|
104 | ); |
---|
105 | |
---|
106 | /* |
---|
107 | * ref_sem - Reference Semaphore Status |
---|
108 | */ |
---|
109 | |
---|
110 | ER ref_sem( |
---|
111 | ID semid, |
---|
112 | T_RSEM *pk_rsem |
---|
113 | ); |
---|
114 | |
---|
115 | #ifdef __cplusplus |
---|
116 | } |
---|
117 | #endif |
---|
118 | |
---|
119 | #endif |
---|
120 | /* end of include file */ |
---|
121 | |
---|