1 | /* |
---|
2 | * The license and distribution terms for this file may be |
---|
3 | * found in the file LICENSE in this distribution or at |
---|
4 | * http://www.OARcorp.com/rtems/license.html. |
---|
5 | * |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef __ITRON_MBOX_h_ |
---|
10 | #define __ITRON_MBOX_h_ |
---|
11 | |
---|
12 | #ifdef __cplusplus |
---|
13 | extern "C" { |
---|
14 | #endif |
---|
15 | |
---|
16 | /* |
---|
17 | * Create Mailbox (cre_mbx) Structure |
---|
18 | */ |
---|
19 | |
---|
20 | typedef struct t_cmbx { |
---|
21 | VP exinf; /* extended information */ |
---|
22 | ATR mbxatr; /* mailbox attributes */ |
---|
23 | /* Following is implementation-dependent function */ |
---|
24 | INT bufcnt; /* ring buffer size */ |
---|
25 | /* additional information may be included depending on the implementation */ |
---|
26 | } T_CMBX; |
---|
27 | |
---|
28 | /* |
---|
29 | * mbxatr |
---|
30 | */ |
---|
31 | |
---|
32 | #define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ |
---|
33 | #define TA_TPRI 0x01 /* waiting tasks are handled by priority */ |
---|
34 | #define TA_MFIFO 0x00 /* messages are handled by FIFO */ |
---|
35 | #define TA_MPRI 0x02 /* messages are handled by priority */ |
---|
36 | |
---|
37 | typedef struct t_msg { |
---|
38 | /* |
---|
39 | * A region (header) reserved by the OS may be included first |
---|
40 | * depending on the implementation. |
---|
41 | */ |
---|
42 | /* VB msgcont[]; XXX */ |
---|
43 | unsigned8 msgcont[1]; |
---|
44 | } T_MSG; |
---|
45 | |
---|
46 | /* |
---|
47 | * Reference Mailbox (ref_mbx) Structure |
---|
48 | */ |
---|
49 | |
---|
50 | typedef struct t_rmbx { |
---|
51 | VP exinf; /* extended information */ |
---|
52 | BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ |
---|
53 | T_MSG *pk_msg; /* message to be sent next */ |
---|
54 | /* additional information may be included depending on the implementation */ |
---|
55 | } T_RMBX; |
---|
56 | |
---|
57 | /* |
---|
58 | * Mailbox Functions |
---|
59 | */ |
---|
60 | |
---|
61 | /* |
---|
62 | * cre_mbx - Create Mailbox |
---|
63 | */ |
---|
64 | |
---|
65 | ER cre_mbx( |
---|
66 | ID mbxid, |
---|
67 | T_CMBX* pk_cmbx |
---|
68 | ); |
---|
69 | |
---|
70 | /* |
---|
71 | * del_mbx - Delete Mailbox |
---|
72 | */ |
---|
73 | |
---|
74 | ER del_mbx( |
---|
75 | ID mbxid |
---|
76 | ); |
---|
77 | |
---|
78 | /* |
---|
79 | * snd_msg - Send Message to Mailbox |
---|
80 | */ |
---|
81 | |
---|
82 | ER snd_msg( |
---|
83 | ID mbxid, |
---|
84 | T_MSG *pk_msg |
---|
85 | ); |
---|
86 | |
---|
87 | /* |
---|
88 | * rcv_msg - Receive Message from Mailbox |
---|
89 | */ |
---|
90 | |
---|
91 | ER rcv_msg( |
---|
92 | T_MSG **ppk_msg, |
---|
93 | ID mbxid |
---|
94 | ); |
---|
95 | |
---|
96 | /* |
---|
97 | * prcv_msg - Poll and Receive Message from Mailbox |
---|
98 | */ |
---|
99 | |
---|
100 | ER prcv_msg( |
---|
101 | T_MSG **ppk_msg, |
---|
102 | ID mbxid |
---|
103 | ); |
---|
104 | |
---|
105 | /* |
---|
106 | * trcv_msg - Receive Message from Mailbox with Timeout |
---|
107 | */ |
---|
108 | |
---|
109 | ER trcv_msg( |
---|
110 | T_MSG **ppk_msg, |
---|
111 | ID mbxid, |
---|
112 | TMO tmout |
---|
113 | ); |
---|
114 | |
---|
115 | /* |
---|
116 | * ref_mbx - Reference Mailbox Status |
---|
117 | */ |
---|
118 | |
---|
119 | ER ref_mbx( |
---|
120 | T_RMBX *pk_rmbx, |
---|
121 | ID mbxid |
---|
122 | ); |
---|
123 | |
---|
124 | |
---|
125 | #ifdef __cplusplus |
---|
126 | } |
---|
127 | #endif |
---|
128 | |
---|
129 | #endif |
---|
130 | /* end of include file */ |
---|
131 | |
---|