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 |
|
|
* FILENAME
|
32 |
|
|
*
|
33 |
|
|
* fts_main.c
|
34 |
|
|
*
|
35 |
|
|
*
|
36 |
|
|
*************************************************************************/
|
37 |
|
|
|
38 |
|
|
#include "fts_defs.h"
|
39 |
|
|
#include "support_suite/mcapid_support.h"
|
40 |
|
|
|
41 |
|
|
extern MCAPI_MUTEX MCAPID_FTS_Mutex;
|
42 |
|
|
|
43 |
|
|
/************************************************************************
|
44 |
|
|
*
|
45 |
|
|
* FUNCTION
|
46 |
|
|
*
|
47 |
|
|
* MCAPI_FTS_Tx_2_32_1
|
48 |
|
|
*
|
49 |
|
|
* DESCRIPTION
|
50 |
|
|
*
|
51 |
|
|
* Testing mcapi_sclchan_send_close_i - open tx / close tx
|
52 |
|
|
*
|
53 |
|
|
* Node 1 – Create endpoint, open send side, close send side
|
54 |
|
|
*
|
55 |
|
|
*************************************************************************/
|
56 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_32_1)
|
57 |
|
|
{
|
58 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
59 |
|
|
size_t rx_len;
|
60 |
|
|
mcapi_request_t request;
|
61 |
|
|
|
62 |
|
|
/* Don't let any other test run while this test is running. */
|
63 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
64 |
|
|
|
65 |
|
|
/* Open the local endpoint as the sender. */
|
66 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
67 |
|
|
mcapi_struct->local_endp,
|
68 |
|
|
&mcapi_struct->request,
|
69 |
|
|
&mcapi_struct->status);
|
70 |
|
|
|
71 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
72 |
|
|
{
|
73 |
|
|
/* Close the send side. */
|
74 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
75 |
|
|
&request, &mcapi_struct->status);
|
76 |
|
|
|
77 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
78 |
|
|
{
|
79 |
|
|
/* Wait for the connection to close. */
|
80 |
|
|
mcapi_wait(&request, &rx_len, &mcapi_struct->status,
|
81 |
|
|
MCAPI_FTS_TIMEOUT);
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
else
|
85 |
|
|
{
|
86 |
|
|
mcapi_struct->status = -1;
|
87 |
|
|
}
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
else
|
91 |
|
|
{
|
92 |
|
|
mcapi_struct->status = -1;
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
/* Set the state of the test to completed. */
|
96 |
|
|
mcapi_struct->state = 0;
|
97 |
|
|
|
98 |
|
|
/* Allow the next test to run. */
|
99 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
100 |
|
|
|
101 |
|
|
} /* MCAPI_FTS_Tx_2_32_1 */
|
102 |
|
|
|
103 |
|
|
/************************************************************************
|
104 |
|
|
*
|
105 |
|
|
* FUNCTION
|
106 |
|
|
*
|
107 |
|
|
* MCAPI_FTS_Tx_2_32_2
|
108 |
|
|
*
|
109 |
|
|
* DESCRIPTION
|
110 |
|
|
*
|
111 |
|
|
* Testing mcapi_sclchan_send_close_i - close rx side as tx side
|
112 |
|
|
*
|
113 |
|
|
* Node 1 – Create endpoint, open receive side, close as send side
|
114 |
|
|
*
|
115 |
|
|
*************************************************************************/
|
116 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_32_2)
|
117 |
|
|
{
|
118 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
119 |
|
|
mcapi_request_t request;
|
120 |
|
|
mcapi_status_t status;
|
121 |
|
|
|
122 |
|
|
/* Don't let any other test run while this test is running. */
|
123 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
124 |
|
|
|
125 |
|
|
/* Open the local endpoint as the receiver. */
|
126 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
|
127 |
|
|
mcapi_struct->local_endp,
|
128 |
|
|
&mcapi_struct->request,
|
129 |
|
|
&mcapi_struct->status);
|
130 |
|
|
|
131 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
132 |
|
|
{
|
133 |
|
|
/* Close the receive side as the send side. */
|
134 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_rx_handle,
|
135 |
|
|
&request, &mcapi_struct->status);
|
136 |
|
|
|
137 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_DIRECTION)
|
138 |
|
|
{
|
139 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
else
|
143 |
|
|
{
|
144 |
|
|
mcapi_struct->status = -1;
|
145 |
|
|
}
|
146 |
|
|
|
147 |
|
|
/* Cancel the open call. */
|
148 |
|
|
mcapi_cancel(&mcapi_struct->request, &status);
|
149 |
|
|
}
|
150 |
|
|
|
151 |
|
|
else
|
152 |
|
|
{
|
153 |
|
|
mcapi_struct->status = -1;
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
/* Set the state of the test to completed. */
|
157 |
|
|
mcapi_struct->state = 0;
|
158 |
|
|
|
159 |
|
|
/* Allow the next test to run. */
|
160 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
161 |
|
|
|
162 |
|
|
} /* MCAPI_FTS_Tx_2_32_2 */
|
163 |
|
|
|
164 |
|
|
/************************************************************************
|
165 |
|
|
*
|
166 |
|
|
* FUNCTION
|
167 |
|
|
*
|
168 |
|
|
* MCAPI_FTS_Tx_2_32_3
|
169 |
|
|
*
|
170 |
|
|
* DESCRIPTION
|
171 |
|
|
*
|
172 |
|
|
* Testing mcapi_sclchan_send_close_i - connect / open tx / close
|
173 |
|
|
* tx
|
174 |
|
|
*
|
175 |
|
|
* Node 0 – Create endpoint
|
176 |
|
|
*
|
177 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, issue
|
178 |
|
|
* connection, open send side, close send side
|
179 |
|
|
*
|
180 |
|
|
*************************************************************************/
|
181 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_32_3)
|
182 |
|
|
{
|
183 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
184 |
|
|
size_t rx_len;
|
185 |
|
|
mcapi_status_t status;
|
186 |
|
|
mcapi_endpoint_t rx_endp;
|
187 |
|
|
mcapi_request_t request;
|
188 |
|
|
|
189 |
|
|
/* Don't let any other test run while this test is running. */
|
190 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
191 |
|
|
|
192 |
|
|
/* Indicate that a remote endpoint should be created. */
|
193 |
|
|
mcapi_struct->status =
|
194 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
195 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
196 |
|
|
|
197 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
198 |
|
|
{
|
199 |
|
|
/* Wait for a response. */
|
200 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
201 |
|
|
|
202 |
|
|
/* If the endpoint was created. */
|
203 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
204 |
|
|
{
|
205 |
|
|
/* Get the receive side endpoint. */
|
206 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
207 |
|
|
|
208 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
209 |
|
|
{
|
210 |
|
|
/* Connect the two endpoints. */
|
211 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
212 |
|
|
&mcapi_struct->request,
|
213 |
|
|
&mcapi_struct->status);
|
214 |
|
|
|
215 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
216 |
|
|
{
|
217 |
|
|
/* Wait for the connection to open. */
|
218 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
|
219 |
|
|
MCAPI_FTS_TIMEOUT);
|
220 |
|
|
|
221 |
|
|
/* Open the local endpoint as the sender. */
|
222 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
223 |
|
|
mcapi_struct->local_endp,
|
224 |
|
|
&mcapi_struct->request,
|
225 |
|
|
&mcapi_struct->status);
|
226 |
|
|
|
227 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
228 |
|
|
{
|
229 |
|
|
/* Close the send side. */
|
230 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
231 |
|
|
&request, &mcapi_struct->status);
|
232 |
|
|
|
233 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
234 |
|
|
{
|
235 |
|
|
/* Wait for the connection to close. */
|
236 |
|
|
mcapi_wait(&request, &rx_len,
|
237 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
238 |
|
|
}
|
239 |
|
|
}
|
240 |
|
|
}
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
/* Tell the other side to delete the endpoint. */
|
244 |
|
|
status =
|
245 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
246 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
247 |
|
|
|
248 |
|
|
if (status == MCAPI_SUCCESS)
|
249 |
|
|
{
|
250 |
|
|
/* Wait for the response. */
|
251 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
252 |
|
|
}
|
253 |
|
|
}
|
254 |
|
|
}
|
255 |
|
|
|
256 |
|
|
/* Set the state of the test to completed. */
|
257 |
|
|
mcapi_struct->state = 0;
|
258 |
|
|
|
259 |
|
|
/* Allow the next test to run. */
|
260 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
261 |
|
|
|
262 |
|
|
} /* MCAPI_FTS_Tx_2_32_3 */
|
263 |
|
|
|
264 |
|
|
/************************************************************************
|
265 |
|
|
*
|
266 |
|
|
* FUNCTION
|
267 |
|
|
*
|
268 |
|
|
* MCAPI_FTS_Tx_2_32_4
|
269 |
|
|
*
|
270 |
|
|
* DESCRIPTION
|
271 |
|
|
*
|
272 |
|
|
* Testing mcapi_sclchan_send_close_i - open tx / connect / close
|
273 |
|
|
* tx
|
274 |
|
|
*
|
275 |
|
|
* Node 0 – Create endpoint
|
276 |
|
|
*
|
277 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, open
|
278 |
|
|
* send side, connect, close send side
|
279 |
|
|
*
|
280 |
|
|
*************************************************************************/
|
281 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_32_4)
|
282 |
|
|
{
|
283 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
284 |
|
|
size_t rx_len;
|
285 |
|
|
mcapi_status_t status;
|
286 |
|
|
mcapi_endpoint_t rx_endp;
|
287 |
|
|
mcapi_request_t request;
|
288 |
|
|
|
289 |
|
|
/* Don't let any other test run while this test is running. */
|
290 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
291 |
|
|
|
292 |
|
|
/* Indicate that a remote endpoint should be created. */
|
293 |
|
|
mcapi_struct->status =
|
294 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
295 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
296 |
|
|
|
297 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
298 |
|
|
{
|
299 |
|
|
/* Wait for a response. */
|
300 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
301 |
|
|
|
302 |
|
|
/* If the endpoint was created. */
|
303 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
304 |
|
|
{
|
305 |
|
|
/* Get the receive side endpoint. */
|
306 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
307 |
|
|
|
308 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
309 |
|
|
{
|
310 |
|
|
/* Open the local endpoint as the sender. */
|
311 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
312 |
|
|
mcapi_struct->local_endp,
|
313 |
|
|
&request, &mcapi_struct->status);
|
314 |
|
|
|
315 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
316 |
|
|
{
|
317 |
|
|
/* Connect the two endpoints. */
|
318 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
319 |
|
|
&mcapi_struct->request,
|
320 |
|
|
&mcapi_struct->status);
|
321 |
|
|
|
322 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
323 |
|
|
{
|
324 |
|
|
/* Wait for the connection to open. */
|
325 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
|
326 |
|
|
MCAPI_FTS_TIMEOUT);
|
327 |
|
|
|
328 |
|
|
/* Close the send side. */
|
329 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
330 |
|
|
&mcapi_struct->request,
|
331 |
|
|
&mcapi_struct->status);
|
332 |
|
|
|
333 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
334 |
|
|
{
|
335 |
|
|
/* Wait for the connection to close. */
|
336 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
337 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
338 |
|
|
}
|
339 |
|
|
}
|
340 |
|
|
}
|
341 |
|
|
}
|
342 |
|
|
|
343 |
|
|
/* Tell the other side to delete the endpoint. */
|
344 |
|
|
status =
|
345 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
346 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
347 |
|
|
|
348 |
|
|
if (status == MCAPI_SUCCESS)
|
349 |
|
|
{
|
350 |
|
|
/* Wait for the response. */
|
351 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
352 |
|
|
}
|
353 |
|
|
}
|
354 |
|
|
}
|
355 |
|
|
|
356 |
|
|
/* Set the state of the test to completed. */
|
357 |
|
|
mcapi_struct->state = 0;
|
358 |
|
|
|
359 |
|
|
/* Allow the next test to run. */
|
360 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
361 |
|
|
|
362 |
|
|
} /* MCAPI_FTS_Tx_2_32_4 */
|
363 |
|
|
|
364 |
|
|
/************************************************************************
|
365 |
|
|
*
|
366 |
|
|
* FUNCTION
|
367 |
|
|
*
|
368 |
|
|
* MCAPI_FTS_Tx_2_32_5
|
369 |
|
|
*
|
370 |
|
|
* DESCRIPTION
|
371 |
|
|
*
|
372 |
|
|
* Testing mcapi_sclchan_send_close_i - open tx / connect / open rx
|
373 |
|
|
* / close tx
|
374 |
|
|
*
|
375 |
|
|
* Node 0 – Create endpoint, wait for connection, open receive side
|
376 |
|
|
*
|
377 |
|
|
* Node 1 – Create endpoint, open send side, get endpoint on
|
378 |
|
|
* Node 0, issue connection, wait for rx to open, close
|
379 |
|
|
* send side
|
380 |
|
|
*
|
381 |
|
|
*************************************************************************/
|
382 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_32_5)
|
383 |
|
|
{
|
384 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
385 |
|
|
size_t rx_len;
|
386 |
|
|
mcapi_status_t status;
|
387 |
|
|
mcapi_endpoint_t tx_endp, rx_endp;
|
388 |
|
|
mcapi_request_t request;
|
389 |
|
|
|
390 |
|
|
/* Don't let any other test run while this test is running. */
|
391 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
392 |
|
|
|
393 |
|
|
/* An additional endpoint is required for this test. */
|
394 |
|
|
tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
|
395 |
|
|
|
396 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
397 |
|
|
{
|
398 |
|
|
/* Indicate that a remote endpoint should be created. */
|
399 |
|
|
mcapi_struct->status =
|
400 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
401 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
402 |
|
|
|
403 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
404 |
|
|
{
|
405 |
|
|
/* Wait for a response. */
|
406 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
407 |
|
|
|
408 |
|
|
/* If the endpoint was created. */
|
409 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
410 |
|
|
{
|
411 |
|
|
/* Open the local endpoint as the sender. */
|
412 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
413 |
|
|
tx_endp, &request, &mcapi_struct->status);
|
414 |
|
|
|
415 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
416 |
|
|
{
|
417 |
|
|
/* Get the receive side endpoint. */
|
418 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
419 |
|
|
|
420 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
421 |
|
|
{
|
422 |
|
|
/* Connect the two endpoints. */
|
423 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
424 |
|
|
&mcapi_struct->request,
|
425 |
|
|
&mcapi_struct->status);
|
426 |
|
|
|
427 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
428 |
|
|
{
|
429 |
|
|
/* Wait for the connection to complete. */
|
430 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
|
431 |
|
|
MCAPI_FTS_TIMEOUT);
|
432 |
|
|
|
433 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
434 |
|
|
mcapi_struct->status =
|
435 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
|
436 |
|
|
1024, mcapi_struct->local_endp, 0,
|
437 |
|
|
MCAPI_DEFAULT_PRIO);
|
438 |
|
|
|
439 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
440 |
|
|
{
|
441 |
|
|
/* Wait for a response. */
|
442 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
443 |
|
|
|
444 |
|
|
/* If the receive side was opened. */
|
445 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
446 |
|
|
{
|
447 |
|
|
/* Wait for the open to return successfully. */
|
448 |
|
|
mcapi_wait(&request, &rx_len,
|
449 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
450 |
|
|
|
451 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
452 |
|
|
{
|
453 |
|
|
/* Close the send side. */
|
454 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
455 |
|
|
&request,
|
456 |
|
|
&mcapi_struct->status);
|
457 |
|
|
|
458 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
459 |
|
|
{
|
460 |
|
|
/* Wait for the connection to close. */
|
461 |
|
|
mcapi_wait(&request, &rx_len,
|
462 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
463 |
|
|
}
|
464 |
|
|
}
|
465 |
|
|
|
466 |
|
|
/* Tell the other side to close the receive side. */
|
467 |
|
|
status =
|
468 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
469 |
|
|
MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
|
470 |
|
|
1024, mcapi_struct->local_endp,
|
471 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
472 |
|
|
|
473 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
474 |
|
|
{
|
475 |
|
|
/* Wait for the response. */
|
476 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
477 |
|
|
}
|
478 |
|
|
}
|
479 |
|
|
}
|
480 |
|
|
}
|
481 |
|
|
}
|
482 |
|
|
}
|
483 |
|
|
|
484 |
|
|
/* Tell the other side to delete the endpoint. */
|
485 |
|
|
status =
|
486 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
487 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
488 |
|
|
|
489 |
|
|
if (status == MCAPI_SUCCESS)
|
490 |
|
|
{
|
491 |
|
|
/* Wait for the response. */
|
492 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
493 |
|
|
}
|
494 |
|
|
}
|
495 |
|
|
}
|
496 |
|
|
|
497 |
|
|
/* Delete the extra endpoint. */
|
498 |
|
|
mcapi_delete_endpoint(tx_endp, &status);
|
499 |
|
|
}
|
500 |
|
|
|
501 |
|
|
/* Set the state of the test to completed. */
|
502 |
|
|
mcapi_struct->state = 0;
|
503 |
|
|
|
504 |
|
|
/* Allow the next test to run. */
|
505 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
506 |
|
|
|
507 |
|
|
} /* MCAPI_FTS_Tx_2_32_5 */
|
508 |
|
|
|
509 |
|
|
/************************************************************************
|
510 |
|
|
*
|
511 |
|
|
* FUNCTION
|
512 |
|
|
*
|
513 |
|
|
* MCAPI_FTS_Tx_2_32_6
|
514 |
|
|
*
|
515 |
|
|
* DESCRIPTION
|
516 |
|
|
*
|
517 |
|
|
* Testing mcapi_sclchan_send_close_i - connect / open rx / open tx
|
518 |
|
|
* / close tx
|
519 |
|
|
*
|
520 |
|
|
* Node 0 – Create endpoint, wait for connection, open receive side
|
521 |
|
|
*
|
522 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, issue
|
523 |
|
|
* connection, wait for rx to open, open send side,
|
524 |
|
|
* close send side
|
525 |
|
|
*
|
526 |
|
|
*************************************************************************/
|
527 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_32_6)
|
528 |
|
|
{
|
529 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
530 |
|
|
size_t rx_len;
|
531 |
|
|
mcapi_status_t status;
|
532 |
|
|
mcapi_endpoint_t tx_endp, rx_endp;
|
533 |
|
|
mcapi_request_t request;
|
534 |
|
|
|
535 |
|
|
/* Don't let any other test run while this test is running. */
|
536 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
537 |
|
|
|
538 |
|
|
/* An extra endpoint is required for this test. */
|
539 |
|
|
tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
|
540 |
|
|
|
541 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
542 |
|
|
{
|
543 |
|
|
/* Indicate that a remote endpoint should be created. */
|
544 |
|
|
mcapi_struct->status =
|
545 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
546 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
547 |
|
|
|
548 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
549 |
|
|
{
|
550 |
|
|
/* Wait for a response. */
|
551 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
552 |
|
|
|
553 |
|
|
/* If the endpoint was created. */
|
554 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
555 |
|
|
{
|
556 |
|
|
/* Get the receive side endpoint. */
|
557 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
558 |
|
|
|
559 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
560 |
|
|
{
|
561 |
|
|
/* Connect the two endpoints. */
|
562 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
563 |
|
|
&mcapi_struct->request,
|
564 |
|
|
&mcapi_struct->status);
|
565 |
|
|
|
566 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
567 |
|
|
{
|
568 |
|
|
/* Wait for the connection to open. */
|
569 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
|
570 |
|
|
MCAPI_FTS_TIMEOUT);
|
571 |
|
|
|
572 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
573 |
|
|
mcapi_struct->status =
|
574 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
|
575 |
|
|
1024, mcapi_struct->local_endp, 0,
|
576 |
|
|
MCAPI_DEFAULT_PRIO);
|
577 |
|
|
|
578 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
579 |
|
|
{
|
580 |
|
|
/* Wait for a response. */
|
581 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
582 |
|
|
|
583 |
|
|
/* If the receive side was opened. */
|
584 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
585 |
|
|
{
|
586 |
|
|
/* Open the local endpoint as the sender. */
|
587 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
588 |
|
|
tx_endp, &request,
|
589 |
|
|
&mcapi_struct->status);
|
590 |
|
|
|
591 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
592 |
|
|
{
|
593 |
|
|
/* Wait for the open to return successfully. */
|
594 |
|
|
mcapi_wait(&request, &rx_len,
|
595 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
596 |
|
|
|
597 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
598 |
|
|
{
|
599 |
|
|
/* Close the send side. */
|
600 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
601 |
|
|
&request,
|
602 |
|
|
&mcapi_struct->status);
|
603 |
|
|
|
604 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
605 |
|
|
{
|
606 |
|
|
/* Wait for the connection to close. */
|
607 |
|
|
mcapi_wait(&request, &rx_len,
|
608 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
609 |
|
|
}
|
610 |
|
|
}
|
611 |
|
|
}
|
612 |
|
|
|
613 |
|
|
/* Tell the other side to close the receive side. */
|
614 |
|
|
status =
|
615 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
616 |
|
|
MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
|
617 |
|
|
1024, mcapi_struct->local_endp,
|
618 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
619 |
|
|
|
620 |
|
|
if (status == MCAPI_SUCCESS)
|
621 |
|
|
{
|
622 |
|
|
/* Wait for the response. */
|
623 |
|
|
status =
|
624 |
|
|
MCAPID_RX_Mgmt_Response(mcapi_struct);
|
625 |
|
|
}
|
626 |
|
|
}
|
627 |
|
|
}
|
628 |
|
|
}
|
629 |
|
|
}
|
630 |
|
|
|
631 |
|
|
/* Tell the other side to delete the endpoint. */
|
632 |
|
|
status =
|
633 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
634 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
635 |
|
|
|
636 |
|
|
if (status == MCAPI_SUCCESS)
|
637 |
|
|
{
|
638 |
|
|
/* Wait for the response. */
|
639 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
640 |
|
|
}
|
641 |
|
|
}
|
642 |
|
|
}
|
643 |
|
|
|
644 |
|
|
/* Delete the extra endpoint. */
|
645 |
|
|
mcapi_delete_endpoint(tx_endp, &status);
|
646 |
|
|
}
|
647 |
|
|
|
648 |
|
|
/* Set the state of the test to completed. */
|
649 |
|
|
mcapi_struct->state = 0;
|
650 |
|
|
|
651 |
|
|
/* Allow the next test to run. */
|
652 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
653 |
|
|
|
654 |
|
|
} /* MCAPI_FTS_Tx_2_32_6 */
|
655 |
|
|
|
656 |
|
|
/************************************************************************
|
657 |
|
|
*
|
658 |
|
|
* FUNCTION
|
659 |
|
|
*
|
660 |
|
|
* MCAPI_FTS_Tx_2_32_7
|
661 |
|
|
*
|
662 |
|
|
* DESCRIPTION
|
663 |
|
|
*
|
664 |
|
|
* Testing mcapi_sclchan_send_close_i - connect / open tx / open rx
|
665 |
|
|
* / close tx
|
666 |
|
|
*
|
667 |
|
|
* Node 0 – Create endpoint, wait for connection, open receive side
|
668 |
|
|
*
|
669 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, issue
|
670 |
|
|
* connection, open send side, wait for rx to open,
|
671 |
|
|
* close send side
|
672 |
|
|
*
|
673 |
|
|
*************************************************************************/
|
674 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_32_7)
|
675 |
|
|
{
|
676 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
677 |
|
|
size_t rx_len;
|
678 |
|
|
mcapi_status_t status;
|
679 |
|
|
mcapi_endpoint_t tx_endp, rx_endp;
|
680 |
|
|
mcapi_request_t request;
|
681 |
|
|
|
682 |
|
|
/* Don't let any other test run while this test is running. */
|
683 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
684 |
|
|
|
685 |
|
|
/* An extra endpoint is required for this test. */
|
686 |
|
|
tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
|
687 |
|
|
|
688 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
689 |
|
|
{
|
690 |
|
|
/* Indicate that a remote endpoint should be created. */
|
691 |
|
|
mcapi_struct->status =
|
692 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
693 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
694 |
|
|
|
695 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
696 |
|
|
{
|
697 |
|
|
/* Wait for a response. */
|
698 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
699 |
|
|
|
700 |
|
|
/* If the endpoint was created. */
|
701 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
702 |
|
|
{
|
703 |
|
|
/* Get the receive side endpoint. */
|
704 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
705 |
|
|
|
706 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
707 |
|
|
{
|
708 |
|
|
/* Connect the two endpoints. */
|
709 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
710 |
|
|
&mcapi_struct->request,
|
711 |
|
|
&mcapi_struct->status);
|
712 |
|
|
|
713 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
714 |
|
|
{
|
715 |
|
|
/* Wait for the connection to open. */
|
716 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
|
717 |
|
|
MCAPI_FTS_TIMEOUT);
|
718 |
|
|
|
719 |
|
|
/* Open the local endpoint as the sender. */
|
720 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
721 |
|
|
tx_endp, &request,
|
722 |
|
|
&mcapi_struct->status);
|
723 |
|
|
|
724 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
725 |
|
|
{
|
726 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
727 |
|
|
mcapi_struct->status =
|
728 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
|
729 |
|
|
1024, mcapi_struct->local_endp, 0,
|
730 |
|
|
MCAPI_DEFAULT_PRIO);
|
731 |
|
|
|
732 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
733 |
|
|
{
|
734 |
|
|
/* Wait for a response. */
|
735 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
736 |
|
|
|
737 |
|
|
/* If the receive side was opened. */
|
738 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
739 |
|
|
{
|
740 |
|
|
/* Wait for the open to return successfully. */
|
741 |
|
|
mcapi_wait(&request, &rx_len,
|
742 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
743 |
|
|
|
744 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
745 |
|
|
{
|
746 |
|
|
/* Close the send side. */
|
747 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
748 |
|
|
&request,
|
749 |
|
|
&mcapi_struct->status);
|
750 |
|
|
|
751 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
752 |
|
|
{
|
753 |
|
|
/* Wait for the connection to close. */
|
754 |
|
|
mcapi_wait(&request, &rx_len,
|
755 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
756 |
|
|
}
|
757 |
|
|
}
|
758 |
|
|
|
759 |
|
|
/* Tell the other side to close the receive side. */
|
760 |
|
|
status =
|
761 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
762 |
|
|
MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
|
763 |
|
|
1024, mcapi_struct->local_endp,
|
764 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
765 |
|
|
|
766 |
|
|
if (status == MCAPI_SUCCESS)
|
767 |
|
|
{
|
768 |
|
|
/* Wait for the response. */
|
769 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
770 |
|
|
}
|
771 |
|
|
}
|
772 |
|
|
}
|
773 |
|
|
}
|
774 |
|
|
}
|
775 |
|
|
}
|
776 |
|
|
|
777 |
|
|
/* Tell the other side to delete the endpoint. */
|
778 |
|
|
status =
|
779 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
780 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
781 |
|
|
|
782 |
|
|
if (status == MCAPI_SUCCESS)
|
783 |
|
|
{
|
784 |
|
|
/* Wait for the response. */
|
785 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
786 |
|
|
}
|
787 |
|
|
}
|
788 |
|
|
}
|
789 |
|
|
|
790 |
|
|
/* Delete the extra endpoint. */
|
791 |
|
|
mcapi_delete_endpoint(tx_endp, &status);
|
792 |
|
|
}
|
793 |
|
|
|
794 |
|
|
/* Set the state of the test to completed. */
|
795 |
|
|
mcapi_struct->state = 0;
|
796 |
|
|
|
797 |
|
|
/* Allow the next test to run. */
|
798 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
799 |
|
|
|
800 |
|
|
} /* MCAPI_FTS_Tx_2_32_7 */
|