1 | /** |
---|
2 | * @file itronsys/mbox.h |
---|
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 _ITRONSYS_MBOX_H |
---|
17 | #define _ITRONSYS_MBOX_H |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | /* |
---|
24 | * Create Mailbox (cre_mbx) Structure |
---|
25 | */ |
---|
26 | |
---|
27 | typedef struct t_cmbx { |
---|
28 | VP exinf; /* extended information */ |
---|
29 | ATR mbxatr; /* mailbox attributes */ |
---|
30 | /* Following is implementation-dependent function */ |
---|
31 | INT bufcnt; /* maximum number of messages to let pend */ |
---|
32 | /* additional information may be included depending on the implementation */ |
---|
33 | } T_CMBX; |
---|
34 | |
---|
35 | /* |
---|
36 | * mbxatr |
---|
37 | */ |
---|
38 | |
---|
39 | #define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ |
---|
40 | #define TA_TPRI 0x01 /* waiting tasks are handled by priority */ |
---|
41 | #define TA_MFIFO 0x00 /* messages are handled by FIFO */ |
---|
42 | #define TA_MPRI 0x02 /* messages are handled by priority */ |
---|
43 | |
---|
44 | typedef struct t_msg { |
---|
45 | /* |
---|
46 | * A region (header) reserved by the OS may be included first |
---|
47 | * depending on the implementation. |
---|
48 | * |
---|
49 | * NOTE: The first two fields are RTEMS specific. |
---|
50 | */ |
---|
51 | |
---|
52 | INT msgpri; /* priority of each message */ |
---|
53 | /* VB msgcont[]; XXX */ |
---|
54 | uint8_t msgcont[1]; |
---|
55 | } T_MSG; |
---|
56 | |
---|
57 | /* |
---|
58 | * Reference Mailbox (ref_mbx) Structure |
---|
59 | */ |
---|
60 | |
---|
61 | typedef struct t_rmbx { |
---|
62 | VP exinf; /* extended information */ |
---|
63 | BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ |
---|
64 | T_MSG *pk_msg; /* message to be sent next */ |
---|
65 | /* additional information may be included depending on the implementation */ |
---|
66 | } T_RMBX; |
---|
67 | |
---|
68 | /* |
---|
69 | * Mailbox Functions |
---|
70 | */ |
---|
71 | |
---|
72 | /* |
---|
73 | * cre_mbx - Create Mailbox |
---|
74 | */ |
---|
75 | |
---|
76 | ER cre_mbx( |
---|
77 | ID mbxid, |
---|
78 | T_CMBX *pk_cmbx |
---|
79 | ); |
---|
80 | |
---|
81 | /* |
---|
82 | * del_mbx - Delete Mailbox |
---|
83 | */ |
---|
84 | |
---|
85 | ER del_mbx( |
---|
86 | ID mbxid |
---|
87 | ); |
---|
88 | |
---|
89 | /* |
---|
90 | * snd_msg - Send Message to Mailbox |
---|
91 | */ |
---|
92 | |
---|
93 | ER snd_msg( |
---|
94 | ID mbxid, |
---|
95 | T_MSG *pk_msg |
---|
96 | ); |
---|
97 | |
---|
98 | /* |
---|
99 | * rcv_msg - Receive Message from Mailbox |
---|
100 | */ |
---|
101 | |
---|
102 | ER rcv_msg( |
---|
103 | T_MSG **ppk_msg, |
---|
104 | ID mbxid |
---|
105 | ); |
---|
106 | |
---|
107 | /* |
---|
108 | * prcv_msg - Poll and Receive Message from Mailbox |
---|
109 | */ |
---|
110 | |
---|
111 | ER prcv_msg( |
---|
112 | T_MSG **ppk_msg, |
---|
113 | ID mbxid |
---|
114 | ); |
---|
115 | |
---|
116 | /* |
---|
117 | * trcv_msg - Receive Message from Mailbox with Timeout |
---|
118 | */ |
---|
119 | |
---|
120 | ER trcv_msg( |
---|
121 | T_MSG **ppk_msg, |
---|
122 | ID mbxid, |
---|
123 | TMO tmout |
---|
124 | ); |
---|
125 | |
---|
126 | /* |
---|
127 | * ref_mbx - Reference Mailbox Status |
---|
128 | */ |
---|
129 | |
---|
130 | ER ref_mbx( |
---|
131 | T_RMBX *pk_rmbx, |
---|
132 | ID mbxid |
---|
133 | ); |
---|
134 | |
---|
135 | |
---|
136 | #ifdef __cplusplus |
---|
137 | } |
---|
138 | #endif |
---|
139 | |
---|
140 | #endif |
---|
141 | /* end of include file */ |
---|