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