1 |
145 |
lanttu |
/*
|
2 |
|
|
* Copyright (c) 2010, Mentor Graphics Corporation
|
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 met:
|
7 |
|
|
*
|
8 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
9 |
|
|
* this list of conditions and the following disclaimer.
|
10 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
11 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
12 |
|
|
* and/or other materials provided with the distribution.
|
13 |
|
|
* 3. Neither the name of the <ORGANIZATION> nor the names of its contributors
|
14 |
|
|
* may be used to endorse or promote products derived from this software
|
15 |
|
|
* without specific prior written permission.
|
16 |
|
|
*
|
17 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
18 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
20 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
21 |
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
22 |
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
#ifndef MCAPI_DEFS_H
|
33 |
|
|
#define MCAPI_DEFS_H
|
34 |
|
|
|
35 |
|
|
#include <mcapi.h>
|
36 |
|
|
#include <openmcapi_cfg.h>
|
37 |
|
|
|
38 |
|
|
#ifdef __cplusplus
|
39 |
|
|
extern "C" { /* C declarations in C++ */
|
40 |
|
|
#endif /* _cplusplus */
|
41 |
|
|
|
42 |
|
|
extern mcapi_node_t MCAPI_Node_ID;
|
43 |
|
|
|
44 |
|
|
#define MCAPI_MSG_TYPE 0
|
45 |
|
|
#define MCAPI_CHAN_PKT_TYPE 1
|
46 |
|
|
#define MCAPI_CHAN_SCAL_TYPE 2
|
47 |
|
|
|
48 |
|
|
/* Packet header offsets. */
|
49 |
|
|
#define MCAPI_SRC_NODE_OFFSET 0
|
50 |
|
|
#define MCAPI_SRC_PORT_OFFSET 2
|
51 |
|
|
#define MCAPI_DEST_NODE_OFFSET 4
|
52 |
|
|
#define MCAPI_DEST_PORT_OFFSET 6
|
53 |
|
|
#define MCAPI_PRIO_OFFSET 8
|
54 |
|
|
#define MCAPI_UNUSED_OFFSET 10
|
55 |
|
|
|
56 |
|
|
/* The length of the MCAPI headers, in bytes. */
|
57 |
|
|
#define MCAPI_HEADER_LEN 12
|
58 |
|
|
#define MCAPI_GET_ENDP_LEN 12
|
59 |
|
|
#define MCAPI_CONNECT_MSG_LEN 20
|
60 |
|
|
#define MCAPI_FIN_MSG_LEN 8
|
61 |
|
|
|
62 |
|
|
/* Packet types. */
|
63 |
|
|
#define MCAPI_MESSAGE_TYPE 1
|
64 |
|
|
#define MCAPI_PACKET_TYPE 2
|
65 |
|
|
|
66 |
|
|
/* Protocol types. */
|
67 |
|
|
#define MCAPI_GETENDP_REQUEST 1
|
68 |
|
|
#define MCAPI_GETENDP_RESPONSE 2
|
69 |
|
|
#define MCAPI_CONNECT_REQUEST 3
|
70 |
|
|
#define MCAPI_CONNECT_RESPONSE 4
|
71 |
|
|
#define MCAPI_CONNECT_SYN 5
|
72 |
|
|
#define MCAPI_CONNECT_ACK 6
|
73 |
|
|
#define MCAPI_CANCEL_MSG 7
|
74 |
|
|
#define MCAPI_OPEN_TX 8
|
75 |
|
|
#define MCAPI_OPEN_RX 9
|
76 |
|
|
#define MCAPI_OPEN_TX_ACK 10
|
77 |
|
|
#define MCAPI_OPEN_RX_ACK 11
|
78 |
|
|
#define MCAPI_CONNECT_FIN 12
|
79 |
|
|
|
80 |
|
|
/* Protocol offsets. */
|
81 |
|
|
#define MCAPI_PROT_TYPE 0
|
82 |
|
|
|
83 |
|
|
/* Endpoint Request Message offsets. */
|
84 |
|
|
#define MCAPI_GETENDP_PORT 2
|
85 |
|
|
#define MCAPI_GETENDP_ENDP 4
|
86 |
|
|
#define MCAPI_GETENDP_STATUS 8
|
87 |
|
|
|
88 |
|
|
/* Connection message offsets. */
|
89 |
|
|
#define MCAPI_CNCT_REQ_NODE 2
|
90 |
|
|
#define MCAPI_CNCT_REQ_PORT 4
|
91 |
|
|
#define MCAPI_CNCT_TX_NODE 6
|
92 |
|
|
#define MCAPI_CNCT_TX_PORT 8
|
93 |
|
|
#define MCAPI_CNCT_RX_NODE 10
|
94 |
|
|
#define MCAPI_CNCT_RX_PORT 12
|
95 |
|
|
#define MCAPI_CNCT_CHAN_TYPE 14
|
96 |
|
|
#define MCAPI_CNCT_STATUS 16
|
97 |
|
|
|
98 |
|
|
/* Connection FIN offsets. */
|
99 |
|
|
#define MCAPI_CNCT_FIN_TX_NODE 2
|
100 |
|
|
#define MCAPI_CNCT_FIN_TX_PORT 4
|
101 |
|
|
#define MCAPI_CNCT_FIN_PORT 6
|
102 |
|
|
|
103 |
|
|
#define MCAPI_TX_SIDE 1
|
104 |
|
|
#define MCAPI_RX_SIDE 2
|
105 |
|
|
|
106 |
|
|
/* Endpoint attributes that can be set/retrieved. */
|
107 |
|
|
#define MCAPI_ATTR_NO_PRIORITIES 1 /* Number of priorities */
|
108 |
|
|
#define MCAPI_ATTR_NO_BUFFERS 2 /* Number of buffers */
|
109 |
|
|
#define MCAPI_ATTR_BUFFER_SIZE 3 /* Buffer size */
|
110 |
|
|
#define MCAPI_ATTR_BUFFER_TYPE 4 /* Buffer type, FIFO */
|
111 |
|
|
#define MCAPI_ATTR_MEMORY_TYPE 5 /* Shared/local (0-copy) */
|
112 |
|
|
#define MCAPI_ATTR_TIMEOUT 6 /* Timeout */
|
113 |
|
|
#define MCAPI_ATTR_ENDP_PRIO 7 /* Priority on connected endpoint */
|
114 |
|
|
#define MCAPI_ATTR_ENDP_STATUS 8 /* Endpoint status, connected, open etc. */
|
115 |
|
|
#define MCAPI_ATTR_RECV_BUFFERS_AVAILABLE 9 /* Available receive buffers */
|
116 |
|
|
#define MCAPI_FINALIZE_DRIVER 10 /* Shut down the driver. */
|
117 |
|
|
|
118 |
|
|
/* Identifiers denoting what types of operations a suspended thread wants
|
119 |
|
|
* to be woken up for.
|
120 |
|
|
*/
|
121 |
|
|
#define MCAPI_REQ_DELETED 1 /* Endpoint associated with the request has been deleted. */
|
122 |
|
|
#define MCAPI_REQ_CREATED 2 /* Endpoint associated with the request has been created. */
|
123 |
|
|
#define MCAPI_REQ_TX_FIN 3 /* Outgoing data has been sent. */
|
124 |
|
|
#define MCAPI_REQ_RX_FIN 4 /* Incoming data has been received. */
|
125 |
|
|
#define MCAPI_REQ_CONNECTED 5 /* Two endpoints have been connected. */
|
126 |
|
|
#define MCAPI_REQ_RX_OPEN 6 /* The receive end of a connection has been opened. */
|
127 |
|
|
#define MCAPI_REQ_TX_OPEN 7 /* The send end of a connection has been opened. */
|
128 |
|
|
#define MCAPI_REQ_CLOSED 8 /* The local end of a connection has been closed. */
|
129 |
|
|
|
130 |
|
|
/* States of an MCAPI Node in the global list. */
|
131 |
|
|
#define MCAPI_NODE_UNUSED 0
|
132 |
|
|
#define MCAPI_NODE_INITIALIZED 1
|
133 |
|
|
#define MCAPI_NODE_FINALIZED 2
|
134 |
|
|
|
135 |
|
|
/* State of an MCAPI Endpoint in the global list. */
|
136 |
|
|
#define MCAPI_ENDP_CLOSED 0x1
|
137 |
|
|
#define MCAPI_ENDP_OPEN 0x2
|
138 |
|
|
#define MCAPI_ENDP_CONNECTING 0x4
|
139 |
|
|
#define MCAPI_ENDP_CONNECTED 0x8
|
140 |
|
|
#define MCAPI_ENDP_TX 0x10
|
141 |
|
|
#define MCAPI_ENDP_RX 0x20
|
142 |
|
|
#define MCAPI_ENDP_TX_ACKED 0x40
|
143 |
|
|
#define MCAPI_ENDP_RX_ACKED 0x80
|
144 |
|
|
#define MCAPI_ENDP_DISCONNECTED 0x100
|
145 |
|
|
#define MCAPI_ENDP_CONNECTING_TX 0x200
|
146 |
|
|
#define MCAPI_ENDP_CONNECTING_RX 0x400
|
147 |
|
|
|
148 |
|
|
/* Scalar types. */
|
149 |
|
|
#define MCAPI_SCALAR_UINT8 1
|
150 |
|
|
#define MCAPI_SCALAR_UINT16 2
|
151 |
|
|
#define MCAPI_SCALAR_UINT32 3
|
152 |
|
|
#define MCAPI_SCALAR_UINT64 4
|
153 |
|
|
|
154 |
|
|
#define MCAPI_REMOVE_REQUEST 0x01
|
155 |
|
|
|
156 |
|
|
/* An MCAPI buffer structure for data. Used to check the status
|
157 |
|
|
* of a non-blocking operation.
|
158 |
|
|
*/
|
159 |
|
|
struct _mcapi_buffer
|
160 |
|
|
{
|
161 |
|
|
MCAPI_POINTER next_buf;
|
162 |
|
|
MCAPI_POINTER prev_buf;
|
163 |
|
|
unsigned char buf_ptr[MCAPI_MAX_DATA_LEN];
|
164 |
|
|
mcapi_uint32_t buf_size;
|
165 |
|
|
MCAPI_POINTER mcapi_dev_ptr;
|
166 |
|
|
};
|
167 |
|
|
|
168 |
|
|
typedef struct _mcapi_buffer MCAPI_BUFFER;
|
169 |
|
|
|
170 |
|
|
/* Incoming RX queue structure for receiving data on an endpoint. */
|
171 |
|
|
struct _mcapi_buf_queue
|
172 |
|
|
{
|
173 |
|
|
MCAPI_BUFFER *head;
|
174 |
|
|
MCAPI_BUFFER *tail;
|
175 |
|
|
};
|
176 |
|
|
|
177 |
|
|
typedef struct _mcapi_buf_queue MCAPI_BUF_QUEUE;
|
178 |
|
|
|
179 |
|
|
typedef struct
|
180 |
|
|
{
|
181 |
|
|
unsigned long *mcapi_rx_ptr;
|
182 |
|
|
unsigned mcapi_extra_data;
|
183 |
|
|
} MCAPI_DRIVER;
|
184 |
|
|
|
185 |
|
|
/* Endpoint data structure. Holds all data pertinent to an individual
|
186 |
|
|
* endpoint on a node.
|
187 |
|
|
*/
|
188 |
|
|
struct _mcapi_endpoint
|
189 |
|
|
{
|
190 |
|
|
mcapi_node_t mcapi_node_id;
|
191 |
|
|
mcapi_port_t mcapi_port_id;
|
192 |
|
|
mcapi_node_t mcapi_foreign_node_id;
|
193 |
|
|
mcapi_port_t mcapi_foreign_port_id;
|
194 |
|
|
mcapi_uint32_t mcapi_state;
|
195 |
|
|
mcapi_uint32_t mcapi_chan_type;
|
196 |
|
|
mcapi_uint32_t mcapi_endp_handle;
|
197 |
|
|
mcapi_node_t mcapi_req_node_id;
|
198 |
|
|
mcapi_port_t mcapi_req_port_id;
|
199 |
|
|
mcapi_uint32_t mcapi_priority;
|
200 |
|
|
struct _mcapi_route *mcapi_route;
|
201 |
|
|
MCAPI_BUF_QUEUE mcapi_rx_queue;
|
202 |
|
|
MCAPI_DRIVER mcapi_driver_spec;
|
203 |
|
|
};
|
204 |
|
|
|
205 |
|
|
typedef struct _mcapi_endpoint MCAPI_ENDPOINT;
|
206 |
|
|
|
207 |
|
|
/* An MCAPI interface used to send data to an endpoint. */
|
208 |
|
|
struct _mcapi_interface
|
209 |
|
|
{
|
210 |
|
|
char mcapi_int_name[MCAPI_INT_NAME_LEN];
|
211 |
|
|
mcapi_uint32_t mcapi_max_buf_size;
|
212 |
|
|
mcapi_status_t (*mcapi_tx_output)(MCAPI_BUFFER *, size_t, mcapi_priority_t, struct _mcapi_endpoint *);
|
213 |
|
|
MCAPI_BUFFER *(*mcapi_get_buffer)(mcapi_node_t, size_t, mcapi_uint32_t);
|
214 |
|
|
void (*mcapi_recover_buffer)(MCAPI_BUFFER *);
|
215 |
|
|
mcapi_status_t (*mcapi_ioctl)(mcapi_uint_t, void *, size_t);
|
216 |
|
|
};
|
217 |
|
|
|
218 |
|
|
typedef struct _mcapi_interface MCAPI_INTERFACE;
|
219 |
|
|
|
220 |
|
|
typedef struct
|
221 |
|
|
{
|
222 |
|
|
mcapi_status_t (*mcapi_init)(mcapi_node_t, struct _mcapi_interface *);
|
223 |
|
|
} MCAPI_INT_INIT;
|
224 |
|
|
|
225 |
|
|
/* An MCAPI route used to find the interface to use to send data to
|
226 |
|
|
* a remote node.
|
227 |
|
|
*/
|
228 |
|
|
struct _mcapi_route
|
229 |
|
|
{
|
230 |
|
|
mcapi_uint16_t mcapi_rt_dest_node_id;
|
231 |
|
|
mcapi_uint8_t mcapi_padN[2];
|
232 |
|
|
struct _mcapi_interface *mcapi_rt_int;
|
233 |
|
|
};
|
234 |
|
|
|
235 |
|
|
typedef struct _mcapi_route MCAPI_ROUTE;
|
236 |
|
|
|
237 |
|
|
/* Node data structure. Holds all data pertinent to an individual node
|
238 |
|
|
* in a system.
|
239 |
|
|
*/
|
240 |
|
|
typedef struct
|
241 |
|
|
{
|
242 |
|
|
mcapi_uint16_t mcapi_node_id;
|
243 |
|
|
mcapi_uint16_t mcapi_state;
|
244 |
|
|
mcapi_uint32_t mcapi_endpoint_count;
|
245 |
|
|
mcapi_port_t mcapi_status_port;
|
246 |
|
|
mcapi_uint8_t mcapi_padN;
|
247 |
|
|
MCAPI_ENDPOINT mcapi_endpoint_list[MCAPI_MAX_ENDPOINTS];
|
248 |
|
|
MCAPI_ROUTE mcapi_route_list[MCAPI_ROUTE_COUNT];
|
249 |
|
|
} MCAPI_NODE;
|
250 |
|
|
|
251 |
|
|
/* A queue of blocking requests within the system. */
|
252 |
|
|
typedef struct
|
253 |
|
|
{
|
254 |
|
|
mcapi_request_t *flink;
|
255 |
|
|
mcapi_request_t *blink;
|
256 |
|
|
} MCAPI_REQ_QUEUE;
|
257 |
|
|
|
258 |
|
|
/* A route initialization structure populated by the system designer
|
259 |
|
|
* at compile-time.
|
260 |
|
|
*/
|
261 |
|
|
typedef struct
|
262 |
|
|
{
|
263 |
|
|
mcapi_uint16_t mcapi_rt_dest_id;
|
264 |
|
|
char mcapi_int_name[MCAPI_INT_NAME_LEN];
|
265 |
|
|
mcapi_uint8_t mcapi_padN[2];
|
266 |
|
|
} MCAPI_RT_INIT_STRUCT;
|
267 |
|
|
|
268 |
|
|
/* The global data structure; ie, MCAPI Database. This data structure
|
269 |
|
|
* is stored in global memory and is accessible by all nodes in the
|
270 |
|
|
* system.
|
271 |
|
|
*/
|
272 |
|
|
typedef struct
|
273 |
|
|
{
|
274 |
|
|
mcapi_uint32_t mcapi_node_count;
|
275 |
|
|
MCAPI_RT_INIT_STRUCT mcapi_route_list[MCAPI_ROUTE_COUNT];
|
276 |
|
|
MCAPI_REQ_QUEUE mcapi_local_req_queue;
|
277 |
|
|
MCAPI_REQ_QUEUE mcapi_foreign_req_queue;
|
278 |
|
|
MCAPI_NODE mcapi_node_list[MCAPI_NODE_COUNT];
|
279 |
|
|
} MCAPI_GLOBAL_DATA;
|
280 |
|
|
|
281 |
|
|
typedef struct
|
282 |
|
|
{
|
283 |
|
|
union
|
284 |
|
|
{
|
285 |
|
|
mcapi_uint8_t scal_uint8;
|
286 |
|
|
mcapi_uint16_t scal_uint16;
|
287 |
|
|
mcapi_uint32_t scal_uint32;
|
288 |
|
|
mcapi_uint64_t scal_uint64;
|
289 |
|
|
} mcapi_scal;
|
290 |
|
|
|
291 |
|
|
} MCAPI_SCALAR;
|
292 |
|
|
|
293 |
|
|
/* cntrl_msg.c */
|
294 |
|
|
MCAPI_THREAD_ENTRY(mcapi_process_ctrl_msg);
|
295 |
|
|
|
296 |
|
|
void mcapi_tx_response(MCAPI_GLOBAL_DATA *, mcapi_request_t *);
|
297 |
|
|
void mcapi_rx_data(void);
|
298 |
|
|
|
299 |
|
|
/* node_data.c */
|
300 |
|
|
void mcapi_lock_node_data(void);
|
301 |
|
|
void mcapi_unlock_node_data(void);
|
302 |
|
|
MCAPI_GLOBAL_DATA *mcapi_get_node_data(void);
|
303 |
|
|
void mcapi_init_node_data(void);
|
304 |
|
|
|
305 |
|
|
/* node.c */
|
306 |
|
|
int mcapi_find_node(mcapi_node_t, MCAPI_GLOBAL_DATA *);
|
307 |
|
|
|
308 |
|
|
/* handle.c */
|
309 |
|
|
mcapi_endpoint_t mcapi_encode_handle(mcapi_uint16_t, mcapi_uint16_t);
|
310 |
|
|
void mcapi_decode_handle(mcapi_endpoint_t, int *, int *);
|
311 |
|
|
|
312 |
|
|
/* endpoint.c */
|
313 |
|
|
int mcapi_find_endpoint(mcapi_port_t, MCAPI_NODE *);
|
314 |
|
|
mcapi_endpoint_t mcapi_encode_endpoint(mcapi_node_t, mcapi_port_t);
|
315 |
|
|
void mcapi_decode_endpoint(mcapi_endpoint_t, mcapi_node_t *, mcapi_port_t *);
|
316 |
|
|
MCAPI_ENDPOINT *mcapi_decode_local_endpoint(MCAPI_GLOBAL_DATA *, mcapi_node_t *,
|
317 |
|
|
mcapi_port_t *, mcapi_endpoint_t,
|
318 |
|
|
mcapi_status_t *);
|
319 |
|
|
MCAPI_ENDPOINT *mcapi_find_local_endpoint(MCAPI_GLOBAL_DATA *, mcapi_node_t ,
|
320 |
|
|
mcapi_port_t);
|
321 |
|
|
|
322 |
|
|
/* suspend.c */
|
323 |
|
|
void mcapi_check_resume(int, mcapi_endpoint_t, MCAPI_ENDPOINT *, size_t, mcapi_status_t);
|
324 |
|
|
mcapi_request_t *mcapi_find_request(mcapi_request_t *, MCAPI_REQ_QUEUE *);
|
325 |
|
|
void mcapi_resume(MCAPI_GLOBAL_DATA *, mcapi_request_t *, mcapi_status_t);
|
326 |
|
|
|
327 |
|
|
/* get_endp.c */
|
328 |
|
|
void get_remote_endpoint(mcapi_node_t, mcapi_port_t, mcapi_status_t *,
|
329 |
|
|
mcapi_uint32_t);
|
330 |
|
|
|
331 |
|
|
/* queue.c */
|
332 |
|
|
void mcapi_enqueue(void *, void *);
|
333 |
|
|
void *mcapi_remove(void *, void *);
|
334 |
|
|
void *mcapi_dequeue(void *);
|
335 |
|
|
|
336 |
|
|
/* msg_snd.c */
|
337 |
|
|
void msg_send(mcapi_endpoint_t, mcapi_endpoint_t, void *, size_t, mcapi_priority_t ,
|
338 |
|
|
mcapi_request_t *, mcapi_status_t *mcapi_status, mcapi_uint32_t);
|
339 |
|
|
|
340 |
|
|
/* msg_rcv.c */
|
341 |
|
|
void msg_recv(mcapi_endpoint_t, void *, size_t, size_t *, mcapi_request_t *,
|
342 |
|
|
mcapi_status_t *, mcapi_uint32_t);
|
343 |
|
|
size_t msg_recv_copy_data(MCAPI_ENDPOINT *, void *);
|
344 |
|
|
|
345 |
|
|
/* msg_snd.c */
|
346 |
|
|
void pkt_send(mcapi_pktchan_send_hndl_t, void *, size_t, mcapi_request_t *,
|
347 |
|
|
mcapi_status_t *, mcapi_uint32_t);
|
348 |
|
|
|
349 |
|
|
/* msg_rcv.c */
|
350 |
|
|
void pkt_rcv(mcapi_pktchan_recv_hndl_t, void **, size_t *, mcapi_request_t *,
|
351 |
|
|
mcapi_status_t *, mcapi_uint32_t);
|
352 |
|
|
|
353 |
|
|
/* interface.c */
|
354 |
|
|
mcapi_status_t mcapi_init_interfaces(mcapi_node_t);
|
355 |
|
|
MCAPI_INTERFACE *mcapi_find_interface(char*);
|
356 |
|
|
|
357 |
|
|
/* loopback.c */
|
358 |
|
|
mcapi_status_t mcapi_loop_init(mcapi_node_t, MCAPI_INTERFACE *);
|
359 |
|
|
mcapi_status_t mcapi_loop_tx(MCAPI_BUFFER *, size_t, mcapi_priority_t,
|
360 |
|
|
MCAPI_ENDPOINT *);
|
361 |
|
|
mcapi_status_t mcapi_loop_ioctl(mcapi_uint_t, void *, size_t);
|
362 |
|
|
|
363 |
|
|
/* route.c */
|
364 |
|
|
MCAPI_ROUTE *mcapi_find_route(mcapi_node_t, MCAPI_NODE *);
|
365 |
|
|
|
366 |
|
|
/* buf_mgmt.c */
|
367 |
|
|
void mcapi_recover_buffer(MCAPI_BUFFER *);
|
368 |
|
|
MCAPI_BUFFER *mcapi_reserve_buffer(mcapi_node_t, size_t, mcapi_uint32_t);
|
369 |
|
|
|
370 |
|
|
/* connect.c */
|
371 |
|
|
void mcapi_connect(mcapi_endpoint_t, mcapi_endpoint_t, mcapi_uint32_t,
|
372 |
|
|
mcapi_request_t *, mcapi_status_t *);
|
373 |
|
|
void mcapi_open(mcapi_endpoint_t, mcapi_uint32_t, mcapi_request_t *,
|
374 |
|
|
mcapi_uint32_t, mcapi_uint16_t, mcapi_uint16_t,
|
375 |
|
|
mcapi_status_t *);
|
376 |
|
|
void mcapi_close(MCAPI_ENDPOINT *, mcapi_uint32_t, mcapi_request_t *,
|
377 |
|
|
mcapi_uint32_t, mcapi_status_t *);
|
378 |
|
|
void mcapi_tx_open(unsigned char *, MCAPI_ENDPOINT *, mcapi_node_t, mcapi_port_t,
|
379 |
|
|
mcapi_node_t, mcapi_port_t, mcapi_uint16_t, mcapi_uint16_t,
|
380 |
|
|
mcapi_status_t *);
|
381 |
|
|
void mcapi_tx_fin_msg(MCAPI_ENDPOINT *, mcapi_status_t *);
|
382 |
|
|
|
383 |
|
|
/* tls.c */
|
384 |
|
|
unsigned long mcapi_get32(unsigned char *, unsigned int);
|
385 |
|
|
void mcapi_put32(unsigned char *, unsigned int, unsigned long);
|
386 |
|
|
unsigned long long mcapi_get64(unsigned char *, unsigned int);
|
387 |
|
|
void mcapi_put64(unsigned char *, unsigned int, unsigned long long);
|
388 |
|
|
unsigned short mcapi_get16(unsigned char *, unsigned int);
|
389 |
|
|
void mcapi_put16(unsigned char *, unsigned int, unsigned short);
|
390 |
|
|
|
391 |
|
|
#define MCAPI_PUT8(bufferP, offset, value) \
|
392 |
|
|
(((unsigned char *)(bufferP))[offset]) = (value)
|
393 |
|
|
|
394 |
|
|
#define MCAPI_PUT16(bufferP, offset, value) \
|
395 |
|
|
mcapi_put16((unsigned char *)bufferP, offset, (value))
|
396 |
|
|
|
397 |
|
|
#define MCAPI_PUT32(bufferP, offset, value) \
|
398 |
|
|
mcapi_put32((unsigned char *)bufferP, offset, (value))
|
399 |
|
|
|
400 |
|
|
#define MCAPI_GET32(bufferP, offset) \
|
401 |
|
|
mcapi_get32((unsigned char *)bufferP, offset)
|
402 |
|
|
|
403 |
|
|
#define MCAPI_GET16(bufferP, offset) \
|
404 |
|
|
mcapi_get16((unsigned char *)bufferP, offset)
|
405 |
|
|
|
406 |
|
|
#define MCAPI_GET8(bufferP, offset) \
|
407 |
|
|
(((unsigned char *)(bufferP))[offset])
|
408 |
|
|
|
409 |
|
|
#define MCAPI_PUT64(bufferP, offset, value) \
|
410 |
|
|
mcapi_put64((unsigned char *)bufferP, offset, (value))
|
411 |
|
|
|
412 |
|
|
#define MCAPI_GET64(bufferP, offset) \
|
413 |
|
|
mcapi_get64((unsigned char *)bufferP, offset)
|
414 |
|
|
|
415 |
|
|
/* scal_snd.c */
|
416 |
|
|
void scal_send(mcapi_pktchan_send_hndl_t, MCAPI_SCALAR *, mcapi_uint8_t,
|
417 |
|
|
mcapi_status_t *);
|
418 |
|
|
|
419 |
|
|
/* scal_rcv.c */
|
420 |
|
|
void scal_rcv(mcapi_sclchan_recv_hndl_t, MCAPI_SCALAR *, mcapi_uint8_t,
|
421 |
|
|
mcapi_status_t *);
|
422 |
|
|
|
423 |
|
|
/* data_avail.c */
|
424 |
|
|
void mcapi_data_available(MCAPI_ENDPOINT *, mcapi_uint32_t, mcapi_uint_t *,
|
425 |
|
|
mcapi_status_t *);
|
426 |
|
|
|
427 |
|
|
/* data_count.c */
|
428 |
|
|
void mcapi_check_data(MCAPI_ENDPOINT *, mcapi_uint_t *);
|
429 |
|
|
|
430 |
|
|
/* create_endpoint.c */
|
431 |
|
|
mcapi_endpoint_t create_endpoint(MCAPI_NODE *, mcapi_port_t, mcapi_status_t *);
|
432 |
|
|
void mcapi_check_foreign_resume(int, mcapi_endpoint_t, mcapi_status_t);
|
433 |
|
|
|
434 |
|
|
/* forward.c */
|
435 |
|
|
void mcapi_forward(MCAPI_GLOBAL_DATA *, MCAPI_BUFFER *, mcapi_node_t);
|
436 |
|
|
|
437 |
|
|
/* request.c */
|
438 |
|
|
void mcapi_init_request(mcapi_request_t *, mcapi_uint8_t);
|
439 |
|
|
mcapi_request_t *mcapi_get_free_request_struct(void);
|
440 |
|
|
void mcapi_release_request_struct(mcapi_request_t *);
|
441 |
|
|
|
442 |
|
|
mcapi_boolean_t __mcapi_test(mcapi_request_t *request, size_t *size,
|
443 |
|
|
mcapi_status_t *mcapi_status);
|
444 |
|
|
|
445 |
|
|
/* mcapi_os.c */
|
446 |
|
|
mcapi_status_t MCAPI_Resume_Task(mcapi_request_t *);
|
447 |
|
|
mcapi_status_t MCAPI_Suspend_Task(MCAPI_GLOBAL_DATA *, mcapi_request_t *,
|
448 |
|
|
MCAPI_COND_STRUCT *, mcapi_timeout_t);
|
449 |
|
|
mcapi_status_t MCAPI_Init_OS(void);
|
450 |
|
|
void MCAPI_Exit_OS(void);
|
451 |
|
|
void MCAPI_Cleanup_Task(void);
|
452 |
|
|
mcapi_status_t MCAPI_Create_Mutex(MCAPI_MUTEX *, char *);
|
453 |
|
|
mcapi_status_t MCAPI_Delete_Mutex(MCAPI_MUTEX *);
|
454 |
|
|
mcapi_status_t MCAPI_Obtain_Mutex(MCAPI_MUTEX *);
|
455 |
|
|
mcapi_status_t MCAPI_Release_Mutex(MCAPI_MUTEX *);
|
456 |
|
|
mcapi_status_t MCAPI_Set_RX_Event(void);
|
457 |
|
|
void MCAPI_Init_Condition(MCAPI_COND_STRUCT *);
|
458 |
|
|
void MCAPI_Set_Condition(mcapi_request_t *, MCAPI_COND_STRUCT *);
|
459 |
|
|
void MCAPI_Clear_Condition(mcapi_request_t *);
|
460 |
|
|
mcapi_int_t MCAPI_Lock_RX_Queue(void);
|
461 |
|
|
void MCAPI_Unlock_RX_Queue(mcapi_int_t cookie);
|
462 |
|
|
void MCAPI_Sleep(unsigned int secs);
|
463 |
|
|
|
464 |
|
|
/* The name of the shared memory interface. */
|
465 |
|
|
#define OPENMCAPI_SHM_NAME "sha_mem"
|
466 |
|
|
mcapi_status_t openmcapi_shm_init(mcapi_node_t node_id,
|
467 |
|
|
MCAPI_INTERFACE* int_ptr);
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
#ifdef __cplusplus
|
471 |
|
|
}
|
472 |
|
|
#endif /* _cplusplus */
|
473 |
|
|
|
474 |
|
|
#endif /* MCAPI_DEFS_H */
|