1 |
145 |
lanttu |
/*
|
2 |
|
|
Copyright (c) 2008, The Multicore Association
|
3 |
|
|
All rights reserved.
|
4 |
|
|
|
5 |
|
|
Redistribution and use in source and binary forms, with or without
|
6 |
|
|
modification, are permitted provided that the following conditions are
|
7 |
|
|
met:
|
8 |
|
|
|
9 |
|
|
(1) Redistributions of source code must retain the above copyright
|
10 |
|
|
notice, this list of conditions and the following disclaimer.
|
11 |
|
|
|
12 |
|
|
(2) Redistributions in binary form must reproduce the above copyright
|
13 |
|
|
notice, this list of conditions and the following disclaimer in the
|
14 |
|
|
documentation and/or other materials provided with the distribution.
|
15 |
|
|
|
16 |
|
|
(3) Neither the name of the Multicore Association nor the names of its
|
17 |
|
|
contributors may be used to endorse or promote products derived from
|
18 |
|
|
this software without specific prior written permission.
|
19 |
|
|
|
20 |
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21 |
|
|
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
22 |
|
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
23 |
|
|
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
24 |
|
|
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25 |
|
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26 |
|
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27 |
|
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28 |
|
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29 |
|
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30 |
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
|
|
|
33 |
|
|
#ifndef MCAPI_H
|
34 |
|
|
#define MCAPI_H
|
35 |
|
|
|
36 |
|
|
#include <stddef.h> /* for size_t */
|
37 |
|
|
#include <stdint.h> /*uint_t,etc.*/
|
38 |
|
|
|
39 |
|
|
#include <mcapi_datatypes.h>
|
40 |
|
|
|
41 |
|
|
#ifdef __GNUC__
|
42 |
|
|
#define MCAPI_DECL_ALIGNED __attribute__ ((aligned (32)))
|
43 |
|
|
#else
|
44 |
|
|
#error "MCAPI_DECL_ALIGNED alignment macro currently only suports GNU compiler"
|
45 |
|
|
#endif
|
46 |
|
|
|
47 |
|
|
#define MCAPI_BUF_ALIGN 4096
|
48 |
|
|
#define MCAPI_VERSION "1.061Rel1"
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
/* useful functions not part of current MCA published API ... */
|
52 |
|
|
extern char* mcapi_display_status (mcapi_status_t status);
|
53 |
|
|
extern void mcapi_display_state (void* handle);
|
54 |
|
|
extern void mcapi_set_debug_level (int d);
|
55 |
|
|
|
56 |
|
|
/* API */
|
57 |
|
|
extern void mcapi_initialize(
|
58 |
|
|
MCAPI_IN mcapi_node_t node_id,
|
59 |
|
|
MCAPI_OUT mcapi_version_t* mcapi_version,
|
60 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
61 |
|
|
);
|
62 |
|
|
|
63 |
|
|
extern void mcapi_finalize(
|
64 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
65 |
|
|
);
|
66 |
|
|
|
67 |
|
|
extern mcapi_uint_t mcapi_get_node_id(
|
68 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
69 |
|
|
);
|
70 |
|
|
|
71 |
|
|
extern mcapi_endpoint_t mcapi_create_endpoint(
|
72 |
|
|
MCAPI_IN mcapi_port_t port_id,
|
73 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
74 |
|
|
);
|
75 |
|
|
|
76 |
|
|
extern void mcapi_get_endpoint_i(
|
77 |
|
|
MCAPI_IN mcapi_node_t node_id,
|
78 |
|
|
MCAPI_IN mcapi_port_t port_id,
|
79 |
|
|
MCAPI_OUT mcapi_endpoint_t* endpoint,
|
80 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
81 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
82 |
|
|
);
|
83 |
|
|
|
84 |
|
|
extern mcapi_endpoint_t mcapi_get_endpoint(
|
85 |
|
|
MCAPI_IN mcapi_node_t node_id,
|
86 |
|
|
MCAPI_IN mcapi_port_t port_id,
|
87 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
88 |
|
|
);
|
89 |
|
|
|
90 |
|
|
extern void mcapi_delete_endpoint(
|
91 |
|
|
MCAPI_IN mcapi_endpoint_t endpoint,
|
92 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
93 |
|
|
);
|
94 |
|
|
|
95 |
|
|
extern void mcapi_get_endpoint_attribute(
|
96 |
|
|
MCAPI_IN mcapi_endpoint_t endpoint,
|
97 |
|
|
MCAPI_IN mcapi_uint_t attribute_num,
|
98 |
|
|
MCAPI_OUT void* attribute,
|
99 |
|
|
MCAPI_IN size_t attribute_size,
|
100 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
101 |
|
|
);
|
102 |
|
|
|
103 |
|
|
extern void mcapi_set_endpoint_attribute(
|
104 |
|
|
MCAPI_IN mcapi_endpoint_t endpoint,
|
105 |
|
|
MCAPI_IN mcapi_uint_t attribute_num,
|
106 |
|
|
MCAPI_IN const void* attribute,
|
107 |
|
|
MCAPI_IN size_t attribute_size,
|
108 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
109 |
|
|
);
|
110 |
|
|
|
111 |
|
|
extern void mcapi_msg_send_i(
|
112 |
|
|
MCAPI_IN mcapi_endpoint_t send_endpoint,
|
113 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
114 |
|
|
MCAPI_IN void* buffer,
|
115 |
|
|
MCAPI_IN size_t buffer_size,
|
116 |
|
|
MCAPI_IN mcapi_priority_t priority,
|
117 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
118 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
119 |
|
|
);
|
120 |
|
|
|
121 |
|
|
extern void mcapi_msg_send(
|
122 |
|
|
MCAPI_IN mcapi_endpoint_t send_endpoint,
|
123 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
124 |
|
|
MCAPI_IN void* buffer,
|
125 |
|
|
MCAPI_IN size_t buffer_size,
|
126 |
|
|
MCAPI_IN mcapi_priority_t priority,
|
127 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
128 |
|
|
);
|
129 |
|
|
|
130 |
|
|
extern void mcapi_msg_recv_i(
|
131 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
132 |
|
|
MCAPI_OUT void* buffer,
|
133 |
|
|
MCAPI_IN size_t buffer_size,
|
134 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
135 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
136 |
|
|
);
|
137 |
|
|
|
138 |
|
|
extern void mcapi_msg_recv(
|
139 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
140 |
|
|
MCAPI_OUT void* buffer,
|
141 |
|
|
MCAPI_IN size_t buffer_size,
|
142 |
|
|
MCAPI_OUT size_t* received_size,
|
143 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
144 |
|
|
);
|
145 |
|
|
|
146 |
|
|
extern mcapi_uint_t mcapi_msg_available(
|
147 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
148 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
149 |
|
|
);
|
150 |
|
|
|
151 |
|
|
extern void mcapi_connect_pktchan_i(
|
152 |
|
|
MCAPI_IN mcapi_endpoint_t send_endpoint,
|
153 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
154 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
155 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
156 |
|
|
);
|
157 |
|
|
|
158 |
|
|
extern void mcapi_open_pktchan_recv_i(
|
159 |
|
|
MCAPI_OUT mcapi_pktchan_recv_hndl_t* recv_handle,
|
160 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
161 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
162 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
163 |
|
|
);
|
164 |
|
|
|
165 |
|
|
extern void mcapi_open_pktchan_send_i(
|
166 |
|
|
MCAPI_OUT mcapi_pktchan_send_hndl_t* send_handle,
|
167 |
|
|
MCAPI_IN mcapi_endpoint_t send_endpoint,
|
168 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
169 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
170 |
|
|
);
|
171 |
|
|
|
172 |
|
|
extern void mcapi_pktchan_send_i(
|
173 |
|
|
MCAPI_IN mcapi_pktchan_send_hndl_t send_handle,
|
174 |
|
|
MCAPI_IN void* buffer,
|
175 |
|
|
MCAPI_IN size_t size,
|
176 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
177 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
178 |
|
|
);
|
179 |
|
|
|
180 |
|
|
extern void mcapi_pktchan_send(
|
181 |
|
|
MCAPI_IN mcapi_pktchan_send_hndl_t send_handle,
|
182 |
|
|
MCAPI_IN void* buffer,
|
183 |
|
|
MCAPI_IN size_t size,
|
184 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
185 |
|
|
);
|
186 |
|
|
|
187 |
|
|
extern void mcapi_pktchan_recv_i(
|
188 |
|
|
MCAPI_IN mcapi_pktchan_recv_hndl_t receive_handle,
|
189 |
|
|
MCAPI_OUT void** buffer,
|
190 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
191 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
192 |
|
|
);
|
193 |
|
|
|
194 |
|
|
extern void mcapi_pktchan_recv(
|
195 |
|
|
MCAPI_IN mcapi_pktchan_recv_hndl_t receive_handle,
|
196 |
|
|
MCAPI_OUT void** buffer,
|
197 |
|
|
MCAPI_OUT size_t* received_size,
|
198 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
199 |
|
|
);
|
200 |
|
|
|
201 |
|
|
extern mcapi_uint_t mcapi_pktchan_available(
|
202 |
|
|
MCAPI_IN mcapi_pktchan_recv_hndl_t receive_handle,
|
203 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
204 |
|
|
);
|
205 |
|
|
|
206 |
|
|
extern void mcapi_pktchan_free(
|
207 |
|
|
MCAPI_IN void* buffer,
|
208 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
209 |
|
|
);
|
210 |
|
|
|
211 |
|
|
extern void mcapi_pktchan_recv_close_i(
|
212 |
|
|
MCAPI_IN mcapi_pktchan_recv_hndl_t receive_handle,
|
213 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
214 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
215 |
|
|
);
|
216 |
|
|
|
217 |
|
|
extern void mcapi_pktchan_send_close_i(
|
218 |
|
|
MCAPI_IN mcapi_pktchan_send_hndl_t send_handle,
|
219 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
220 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
221 |
|
|
);
|
222 |
|
|
|
223 |
|
|
extern void mcapi_connect_sclchan_i(
|
224 |
|
|
MCAPI_IN mcapi_endpoint_t send_endpoint,
|
225 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
226 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
227 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
228 |
|
|
);
|
229 |
|
|
|
230 |
|
|
extern void mcapi_open_sclchan_recv_i(
|
231 |
|
|
MCAPI_OUT mcapi_sclchan_recv_hndl_t* receive_handle,
|
232 |
|
|
MCAPI_IN mcapi_endpoint_t receive_endpoint,
|
233 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
234 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
235 |
|
|
);
|
236 |
|
|
|
237 |
|
|
extern void mcapi_open_sclchan_send_i(
|
238 |
|
|
MCAPI_OUT mcapi_sclchan_send_hndl_t* send_handle,
|
239 |
|
|
MCAPI_IN mcapi_endpoint_t send_endpoint,
|
240 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
241 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
242 |
|
|
);
|
243 |
|
|
|
244 |
|
|
extern void mcapi_sclchan_send_uint64(
|
245 |
|
|
MCAPI_IN mcapi_sclchan_send_hndl_t send_handle,
|
246 |
|
|
MCAPI_IN mcapi_uint64_t dataword,
|
247 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
248 |
|
|
);
|
249 |
|
|
|
250 |
|
|
extern void mcapi_sclchan_send_uint32(
|
251 |
|
|
MCAPI_IN mcapi_sclchan_send_hndl_t send_handle,
|
252 |
|
|
MCAPI_IN mcapi_uint32_t dataword,
|
253 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
254 |
|
|
);
|
255 |
|
|
|
256 |
|
|
extern void mcapi_sclchan_send_uint16(
|
257 |
|
|
MCAPI_IN mcapi_sclchan_send_hndl_t send_handle,
|
258 |
|
|
MCAPI_IN mcapi_uint16_t dataword,
|
259 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
260 |
|
|
);
|
261 |
|
|
|
262 |
|
|
extern void mcapi_sclchan_send_uint8(
|
263 |
|
|
MCAPI_IN mcapi_sclchan_send_hndl_t send_handle,
|
264 |
|
|
MCAPI_IN mcapi_uint8_t dataword,
|
265 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
266 |
|
|
);
|
267 |
|
|
|
268 |
|
|
extern mcapi_uint64_t mcapi_sclchan_recv_uint64(
|
269 |
|
|
MCAPI_IN mcapi_sclchan_recv_hndl_t receive_handle,
|
270 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
271 |
|
|
);
|
272 |
|
|
|
273 |
|
|
extern mcapi_uint32_t mcapi_sclchan_recv_uint32(
|
274 |
|
|
MCAPI_IN mcapi_sclchan_recv_hndl_t receive_handle,
|
275 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
276 |
|
|
);
|
277 |
|
|
|
278 |
|
|
extern mcapi_uint16_t mcapi_sclchan_recv_uint16(
|
279 |
|
|
MCAPI_IN mcapi_sclchan_recv_hndl_t receive_handle,
|
280 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
281 |
|
|
);
|
282 |
|
|
|
283 |
|
|
extern mcapi_uint8_t mcapi_sclchan_recv_uint8(
|
284 |
|
|
MCAPI_IN mcapi_sclchan_recv_hndl_t receive_handle,
|
285 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
286 |
|
|
);
|
287 |
|
|
|
288 |
|
|
extern mcapi_uint_t mcapi_sclchan_available (
|
289 |
|
|
MCAPI_IN mcapi_sclchan_recv_hndl_t receive_handle,
|
290 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
291 |
|
|
);
|
292 |
|
|
|
293 |
|
|
extern void mcapi_sclchan_recv_close_i(
|
294 |
|
|
MCAPI_IN mcapi_sclchan_recv_hndl_t receive_handle,
|
295 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
296 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
297 |
|
|
);
|
298 |
|
|
|
299 |
|
|
extern void mcapi_sclchan_send_close_i(
|
300 |
|
|
MCAPI_IN mcapi_sclchan_send_hndl_t send_handle,
|
301 |
|
|
MCAPI_OUT mcapi_request_t* request,
|
302 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
303 |
|
|
);
|
304 |
|
|
|
305 |
|
|
extern mcapi_boolean_t mcapi_test(
|
306 |
|
|
MCAPI_IN mcapi_request_t* request,
|
307 |
|
|
MCAPI_OUT size_t* size,
|
308 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
309 |
|
|
);
|
310 |
|
|
|
311 |
|
|
extern mcapi_boolean_t mcapi_wait(
|
312 |
|
|
MCAPI_IN mcapi_request_t* request,
|
313 |
|
|
MCAPI_OUT size_t* size,
|
314 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status,
|
315 |
|
|
MCAPI_IN mcapi_timeout_t timeout
|
316 |
|
|
);
|
317 |
|
|
|
318 |
|
|
extern mcapi_int_t mcapi_wait_any(
|
319 |
|
|
MCAPI_IN size_t number,
|
320 |
|
|
MCAPI_IN mcapi_request_t** requests,
|
321 |
|
|
MCAPI_OUT size_t* size,
|
322 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status,
|
323 |
|
|
MCAPI_IN mcapi_timeout_t timeout
|
324 |
|
|
);
|
325 |
|
|
|
326 |
|
|
extern void mcapi_cancel(
|
327 |
|
|
MCAPI_IN mcapi_request_t* request,
|
328 |
|
|
MCAPI_OUT mcapi_status_t* mcapi_status
|
329 |
|
|
);
|
330 |
|
|
|
331 |
|
|
#endif
|