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