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_MESSAGEBUFFER_h_ |
---|
10 | #define __ITRON_MESSAGEBUFFER_h_ |
---|
11 | |
---|
12 | #ifdef __cplusplus |
---|
13 | extern "C" { |
---|
14 | #endif |
---|
15 | |
---|
16 | /* |
---|
17 | * Create Message Buffer (cre_mbf) Structure |
---|
18 | */ |
---|
19 | |
---|
20 | typedef struct t_cmbf { |
---|
21 | VP exinf; /* extended information */ |
---|
22 | ATR mbfatr; /* messagebuffer attributes */ |
---|
23 | INT bufsz; /* messagebuffer size */ |
---|
24 | INT maxmsz; /* maximum size of messages */ |
---|
25 | /* additional information may be included depending on the implementation */ |
---|
26 | } T_CMBF; |
---|
27 | |
---|
28 | /* |
---|
29 | * mbfatr |
---|
30 | */ |
---|
31 | |
---|
32 | #define TA_TFIFO 0x00 /* tasks waiting to receive messages are handled |
---|
33 | by FIFO */ |
---|
34 | #define TA_TPRI 0x01 /* tasks waiting to receive messages are handled |
---|
35 | by priority */ |
---|
36 | |
---|
37 | /* |
---|
38 | * mbfid |
---|
39 | */ |
---|
40 | |
---|
41 | #define TMBF_OS (-4) /* messagebuffer used for OS error log */ |
---|
42 | #define TMBF_DB (-3) /* messagebuffer used for debugging */ |
---|
43 | |
---|
44 | /* |
---|
45 | * Reference Message Buffer (ref_mbf) Structure |
---|
46 | */ |
---|
47 | |
---|
48 | typedef struct t_rmbf { |
---|
49 | VP exinf; /* extended information */ |
---|
50 | BOOL_ID wtsk; /* indicates whether or not there is a */ |
---|
51 | /* task waiting to receive a message */ |
---|
52 | BOOL_ID stsk; /* indicates whether or not there is a */ |
---|
53 | /* task waiting to send a message */ |
---|
54 | INT msgsz; /* size of message to be sent next */ |
---|
55 | INT frbufsz; /* size of free buffer */ |
---|
56 | /* additional information may be included depending on the implementation */ |
---|
57 | } T_RMBF; |
---|
58 | |
---|
59 | /* |
---|
60 | * Message Buffer Functions |
---|
61 | */ |
---|
62 | |
---|
63 | /* |
---|
64 | * cre_mbf - Create MessageBuffer |
---|
65 | */ |
---|
66 | |
---|
67 | ER cre_mbf( |
---|
68 | ID mbfid, |
---|
69 | T_CMBF *pk_cmbf |
---|
70 | ); |
---|
71 | |
---|
72 | /* |
---|
73 | * del_mbf - Delete MessageBuffer |
---|
74 | */ |
---|
75 | |
---|
76 | ER del_mbf( |
---|
77 | ID mbfid |
---|
78 | ); |
---|
79 | |
---|
80 | /* |
---|
81 | * snd_mbf - Send Message to MessageBuffer |
---|
82 | */ |
---|
83 | |
---|
84 | ER snd_mbf( |
---|
85 | ID mbfid, |
---|
86 | VP msg, |
---|
87 | INT msgsz |
---|
88 | ); |
---|
89 | |
---|
90 | /* |
---|
91 | * psnd_mbf - Poll and Send Message to MessageBuffer |
---|
92 | */ |
---|
93 | |
---|
94 | ER psnd_mbf( |
---|
95 | ID mbfid, |
---|
96 | VP msg, |
---|
97 | INT msgsz |
---|
98 | ); |
---|
99 | |
---|
100 | /* |
---|
101 | * tsnd_mbf - Send Message to MessageBuffer with Timeout |
---|
102 | */ |
---|
103 | |
---|
104 | ER tsnd_mbf( |
---|
105 | ID mbfid, |
---|
106 | VP msg, |
---|
107 | INT msgsz, |
---|
108 | TMO tmout |
---|
109 | ); |
---|
110 | |
---|
111 | /* |
---|
112 | * rcv_mbf - Receive Message from MessageBuffer |
---|
113 | */ |
---|
114 | |
---|
115 | ER rcv_mbf( |
---|
116 | VP msg, |
---|
117 | INT *p_msgsz, |
---|
118 | ID mbfid |
---|
119 | ); |
---|
120 | |
---|
121 | /* |
---|
122 | * prcv_mbf - Poll and Receive Message from MessageBuffer |
---|
123 | */ |
---|
124 | |
---|
125 | ER prcv_mbf( |
---|
126 | VP msg, |
---|
127 | INT *p_msgsz, |
---|
128 | ID mbfid |
---|
129 | ); |
---|
130 | |
---|
131 | /* |
---|
132 | * trcv_mbf - Receive Message from MessageBuffer with Timeout |
---|
133 | */ |
---|
134 | |
---|
135 | ER trcv_mbf( |
---|
136 | VP msg, |
---|
137 | INT *p_msgsz, |
---|
138 | ID mbfid, |
---|
139 | TMO tmout |
---|
140 | ); |
---|
141 | |
---|
142 | /* |
---|
143 | * ref_mbf - Reference MessageBuffer Status |
---|
144 | */ |
---|
145 | |
---|
146 | ER ref_mbf( |
---|
147 | T_RMBF *pk_rmbf, |
---|
148 | ID mbfid |
---|
149 | ); |
---|
150 | |
---|
151 | #ifdef __cplusplus |
---|
152 | } |
---|
153 | #endif |
---|
154 | |
---|
155 | #endif |
---|
156 | /* end of include file */ |
---|
157 | |
---|