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_25_1
|
48 |
|
|
*
|
49 |
|
|
* DESCRIPTION
|
50 |
|
|
*
|
51 |
|
|
* Testing mcapi_connect_sclchan_i - connect two remote endpoints on
|
52 |
|
|
* the same foreign node.
|
53 |
|
|
*
|
54 |
|
|
* Node 0 – Create two endpoints
|
55 |
|
|
*
|
56 |
|
|
* Node 1 – Get both endpoints, and issue connect request
|
57 |
|
|
*
|
58 |
|
|
*************************************************************************/
|
59 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_1)
|
60 |
|
|
{
|
61 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
62 |
|
|
size_t rx_len;
|
63 |
|
|
mcapi_status_t status;
|
64 |
|
|
mcapi_endpoint_t tx_endp, rx_endp;
|
65 |
|
|
|
66 |
|
|
/* Don't let any other test run while this test is running. */
|
67 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
68 |
|
|
|
69 |
|
|
/* Indicate that a remote endpoint should be created. */
|
70 |
|
|
mcapi_struct->status =
|
71 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
72 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
73 |
|
|
|
74 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
75 |
|
|
{
|
76 |
|
|
/* Wait for a response. */
|
77 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
78 |
|
|
|
79 |
|
|
/* If the endpoint was created. */
|
80 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
81 |
|
|
{
|
82 |
|
|
/* Indicate that a second remote endpoint should be created. */
|
83 |
|
|
mcapi_struct->status =
|
84 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1025,
|
85 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
86 |
|
|
|
87 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
88 |
|
|
{
|
89 |
|
|
/* Wait for a response. */
|
90 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
91 |
|
|
|
92 |
|
|
/* If the endpoint was created. */
|
93 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
94 |
|
|
{
|
95 |
|
|
/* Get the first endpoint. */
|
96 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
97 |
|
|
|
98 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
99 |
|
|
{
|
100 |
|
|
/* Get the second endpoint. */
|
101 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1025, &mcapi_struct->status);
|
102 |
|
|
|
103 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
104 |
|
|
{
|
105 |
|
|
/* Connect the two endpoints. */
|
106 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp, &mcapi_struct->request,
|
107 |
|
|
&mcapi_struct->status);
|
108 |
|
|
|
109 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
110 |
|
|
{
|
111 |
|
|
/* Wait for the connection to return successfully. */
|
112 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
113 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
114 |
|
|
}
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
/* Tell the other side to delete the second endpoint. */
|
119 |
|
|
status =
|
120 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP,
|
121 |
|
|
1025, mcapi_struct->local_endp, 0,
|
122 |
|
|
MCAPI_DEFAULT_PRIO);
|
123 |
|
|
|
124 |
|
|
if (status == MCAPI_SUCCESS)
|
125 |
|
|
{
|
126 |
|
|
/* Wait for the response. */
|
127 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
128 |
|
|
}
|
129 |
|
|
}
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
/* Tell the other side to delete the first endpoint. */
|
133 |
|
|
status =
|
134 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
135 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
136 |
|
|
|
137 |
|
|
if (status == MCAPI_SUCCESS)
|
138 |
|
|
{
|
139 |
|
|
/* Wait for the response. */
|
140 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
141 |
|
|
}
|
142 |
|
|
}
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
/* Set the state of the test to completed. */
|
146 |
|
|
mcapi_struct->state = 0;
|
147 |
|
|
|
148 |
|
|
/* Allow the next test to run. */
|
149 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
150 |
|
|
|
151 |
|
|
} /* MCAPI_FTS_Tx_2_25_1 */
|
152 |
|
|
|
153 |
|
|
/************************************************************************
|
154 |
|
|
*
|
155 |
|
|
* FUNCTION
|
156 |
|
|
*
|
157 |
|
|
* MCAPI_FTS_Tx_2_25_2
|
158 |
|
|
*
|
159 |
|
|
* DESCRIPTION
|
160 |
|
|
*
|
161 |
|
|
* Testing mcapi_connect_sclchan_i - connection performed by
|
162 |
|
|
* receiver node.
|
163 |
|
|
*
|
164 |
|
|
* Node 0 – Create an endpoint, get the endpoint on Node 1, open
|
165 |
|
|
* the endpoint as a receiver, issue connection
|
166 |
|
|
*
|
167 |
|
|
* Node 1 – Create an endpoint, open the endpoint as a sender
|
168 |
|
|
*
|
169 |
|
|
*************************************************************************/
|
170 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_2)
|
171 |
|
|
{
|
172 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
173 |
|
|
size_t rx_len;
|
174 |
|
|
mcapi_status_t status;
|
175 |
|
|
mcapi_endpoint_t tx_endp;
|
176 |
|
|
mcapi_request_t request;
|
177 |
|
|
|
178 |
|
|
/* Don't let any other test run while this test is running. */
|
179 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
180 |
|
|
|
181 |
|
|
/* Indicate that a remote endpoint should be created. */
|
182 |
|
|
mcapi_struct->status =
|
183 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
184 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
185 |
|
|
|
186 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
187 |
|
|
{
|
188 |
|
|
/* Wait for a response. */
|
189 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
190 |
|
|
|
191 |
|
|
/* If the endpoint was created. */
|
192 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
193 |
|
|
{
|
194 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
195 |
|
|
mcapi_struct->status =
|
196 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL, 1024,
|
197 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
198 |
|
|
|
199 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
200 |
|
|
{
|
201 |
|
|
/* Wait for a response. */
|
202 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
203 |
|
|
|
204 |
|
|
/* If the send side was opened. */
|
205 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
206 |
|
|
{
|
207 |
|
|
/* Get the send side endpoint. */
|
208 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
209 |
|
|
|
210 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
211 |
|
|
{
|
212 |
|
|
/* Open the local endpoint as the receiver. */
|
213 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
|
214 |
|
|
mcapi_struct->local_endp,
|
215 |
|
|
&request, &mcapi_struct->status);
|
216 |
|
|
|
217 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
218 |
|
|
{
|
219 |
|
|
/* Connect the two endpoints. */
|
220 |
|
|
mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
|
221 |
|
|
&mcapi_struct->request,
|
222 |
|
|
&mcapi_struct->status);
|
223 |
|
|
|
224 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
225 |
|
|
{
|
226 |
|
|
/* Wait for the open to return successfully. */
|
227 |
|
|
mcapi_wait(&request, &rx_len,
|
228 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
229 |
|
|
|
230 |
|
|
/* Close the receive side. */
|
231 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
232 |
|
|
&request, &status);
|
233 |
|
|
}
|
234 |
|
|
}
|
235 |
|
|
}
|
236 |
|
|
}
|
237 |
|
|
}
|
238 |
|
|
|
239 |
|
|
/* Tell the other side to close the send side. */
|
240 |
|
|
status =
|
241 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
242 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
243 |
|
|
|
244 |
|
|
if (status == MCAPI_SUCCESS)
|
245 |
|
|
{
|
246 |
|
|
/* Wait for the response. */
|
247 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
248 |
|
|
|
249 |
|
|
/* Tell the other side to delete the endpoint. */
|
250 |
|
|
status =
|
251 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
252 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
253 |
|
|
|
254 |
|
|
if (status == MCAPI_SUCCESS)
|
255 |
|
|
{
|
256 |
|
|
/* Wait for the response. */
|
257 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
258 |
|
|
}
|
259 |
|
|
}
|
260 |
|
|
}
|
261 |
|
|
}
|
262 |
|
|
|
263 |
|
|
/* Set the state of the test to completed. */
|
264 |
|
|
mcapi_struct->state = 0;
|
265 |
|
|
|
266 |
|
|
/* Allow the next test to run. */
|
267 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
268 |
|
|
|
269 |
|
|
} /* MCAPI_FTS_Tx_2_25_2 */
|
270 |
|
|
|
271 |
|
|
/************************************************************************
|
272 |
|
|
*
|
273 |
|
|
* FUNCTION
|
274 |
|
|
*
|
275 |
|
|
* MCAPI_FTS_Tx_2_25_3
|
276 |
|
|
*
|
277 |
|
|
* DESCRIPTION
|
278 |
|
|
*
|
279 |
|
|
* Testing mcapi_connect_sclchan_i - connection performed by
|
280 |
|
|
* sender node.
|
281 |
|
|
*
|
282 |
|
|
* Node 0 – Create an endpoint, get the endpoint on Node 1, open
|
283 |
|
|
* the endpoint as a sender, issue connection
|
284 |
|
|
*
|
285 |
|
|
* Node 1 – Create an endpoint, open the endpoint as a receiver
|
286 |
|
|
*
|
287 |
|
|
*************************************************************************/
|
288 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_3)
|
289 |
|
|
{
|
290 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
291 |
|
|
size_t rx_len;
|
292 |
|
|
mcapi_status_t status;
|
293 |
|
|
mcapi_endpoint_t rx_endp;
|
294 |
|
|
mcapi_request_t request;
|
295 |
|
|
|
296 |
|
|
/* Don't let any other test run while this test is running. */
|
297 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
298 |
|
|
|
299 |
|
|
/* Indicate that a remote endpoint should be created. */
|
300 |
|
|
mcapi_struct->status =
|
301 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
302 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
303 |
|
|
|
304 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
305 |
|
|
{
|
306 |
|
|
/* Wait for a response. */
|
307 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
308 |
|
|
|
309 |
|
|
/* If the endpoint was created. */
|
310 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
311 |
|
|
{
|
312 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
313 |
|
|
mcapi_struct->status =
|
314 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL, 1024,
|
315 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
316 |
|
|
|
317 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
318 |
|
|
{
|
319 |
|
|
/* Wait for a response. */
|
320 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
321 |
|
|
|
322 |
|
|
/* If the send side was opened. */
|
323 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
324 |
|
|
{
|
325 |
|
|
/* Get the receive side endpoint. */
|
326 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
327 |
|
|
|
328 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
329 |
|
|
{
|
330 |
|
|
/* Open the local endpoint as the sender. */
|
331 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
332 |
|
|
mcapi_struct->local_endp,
|
333 |
|
|
&request, &mcapi_struct->status);
|
334 |
|
|
|
335 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
336 |
|
|
{
|
337 |
|
|
/* Connect the two endpoints. */
|
338 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
339 |
|
|
&mcapi_struct->request,
|
340 |
|
|
&mcapi_struct->status);
|
341 |
|
|
|
342 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
343 |
|
|
{
|
344 |
|
|
/* Wait for the open to return successfully. */
|
345 |
|
|
mcapi_wait(&request, &rx_len,
|
346 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
347 |
|
|
|
348 |
|
|
/* Close the send side. */
|
349 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
350 |
|
|
&request, &status);
|
351 |
|
|
}
|
352 |
|
|
}
|
353 |
|
|
}
|
354 |
|
|
}
|
355 |
|
|
}
|
356 |
|
|
|
357 |
|
|
/* Tell the other side to close the receive side. */
|
358 |
|
|
status =
|
359 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_RX_SIDE_SCL, 1024,
|
360 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
361 |
|
|
|
362 |
|
|
if (status == MCAPI_SUCCESS)
|
363 |
|
|
{
|
364 |
|
|
/* Wait for the response. */
|
365 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
366 |
|
|
|
367 |
|
|
/* Tell the other side to delete the endpoint. */
|
368 |
|
|
status =
|
369 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
370 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
371 |
|
|
|
372 |
|
|
if (status == MCAPI_SUCCESS)
|
373 |
|
|
{
|
374 |
|
|
/* Wait for the response. */
|
375 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
376 |
|
|
}
|
377 |
|
|
}
|
378 |
|
|
}
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
/* Set the state of the test to completed. */
|
382 |
|
|
mcapi_struct->state = 0;
|
383 |
|
|
|
384 |
|
|
/* Allow the next test to run. */
|
385 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
386 |
|
|
|
387 |
|
|
} /* MCAPI_FTS_Tx_2_25_3 */
|
388 |
|
|
|
389 |
|
|
/************************************************************************
|
390 |
|
|
*
|
391 |
|
|
* FUNCTION
|
392 |
|
|
*
|
393 |
|
|
* MCAPI_FTS_Tx_2_25_4
|
394 |
|
|
*
|
395 |
|
|
* DESCRIPTION
|
396 |
|
|
*
|
397 |
|
|
* Testing mcapi_connect_sclchan_i - connect two remote endpoints on
|
398 |
|
|
* the same foreign node - already connected
|
399 |
|
|
*
|
400 |
|
|
* Node 0 – Create two endpoints
|
401 |
|
|
*
|
402 |
|
|
* Node 1 – Get both endpoints, and issue connect request, issue
|
403 |
|
|
* connect request again
|
404 |
|
|
*
|
405 |
|
|
*************************************************************************/
|
406 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_4)
|
407 |
|
|
{
|
408 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
409 |
|
|
size_t rx_len;
|
410 |
|
|
mcapi_status_t status;
|
411 |
|
|
mcapi_endpoint_t tx_endp, rx_endp;
|
412 |
|
|
|
413 |
|
|
/* Don't let any other test run while this test is running. */
|
414 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
415 |
|
|
|
416 |
|
|
/* Indicate that a remote endpoint should be created. */
|
417 |
|
|
mcapi_struct->status =
|
418 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
419 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
420 |
|
|
|
421 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
422 |
|
|
{
|
423 |
|
|
/* Wait for a response. */
|
424 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
425 |
|
|
|
426 |
|
|
/* If the endpoint was created. */
|
427 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
428 |
|
|
{
|
429 |
|
|
/* Indicate that a second remote endpoint should be created. */
|
430 |
|
|
mcapi_struct->status =
|
431 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1025,
|
432 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
433 |
|
|
|
434 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
435 |
|
|
{
|
436 |
|
|
/* Wait for a response. */
|
437 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
438 |
|
|
|
439 |
|
|
/* If the endpoint was created. */
|
440 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
441 |
|
|
{
|
442 |
|
|
/* Get the first endpoint. */
|
443 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
444 |
|
|
|
445 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
446 |
|
|
{
|
447 |
|
|
/* Get the second endpoint. */
|
448 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1025, &mcapi_struct->status);
|
449 |
|
|
|
450 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
451 |
|
|
{
|
452 |
|
|
/* Connect the two endpoints. */
|
453 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp, &mcapi_struct->request,
|
454 |
|
|
&mcapi_struct->status);
|
455 |
|
|
|
456 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
457 |
|
|
{
|
458 |
|
|
/* Wait for the connection to return successfully. */
|
459 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
460 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
461 |
|
|
|
462 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
463 |
|
|
{
|
464 |
|
|
/* Connect the two endpoints again. */
|
465 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
466 |
|
|
&mcapi_struct->request,
|
467 |
|
|
&mcapi_struct->status);
|
468 |
|
|
|
469 |
|
|
/* If both endpoints are local, the routine will return
|
470 |
|
|
* an error.
|
471 |
|
|
*/
|
472 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_CONNECTED)
|
473 |
|
|
{
|
474 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
475 |
|
|
}
|
476 |
|
|
|
477 |
|
|
/* Otherwise, the routine will return success until
|
478 |
|
|
* the remote endpoints can return an error.
|
479 |
|
|
*/
|
480 |
|
|
else if (mcapi_struct->status == MCAPI_SUCCESS)
|
481 |
|
|
{
|
482 |
|
|
/* Wait for the connection to return successfully. */
|
483 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
484 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
485 |
|
|
|
486 |
|
|
/* An error should have been returned. */
|
487 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_CONNECTED)
|
488 |
|
|
{
|
489 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
490 |
|
|
}
|
491 |
|
|
|
492 |
|
|
else
|
493 |
|
|
{
|
494 |
|
|
mcapi_struct->status = -1;
|
495 |
|
|
}
|
496 |
|
|
}
|
497 |
|
|
|
498 |
|
|
else
|
499 |
|
|
{
|
500 |
|
|
mcapi_struct->status = -1;
|
501 |
|
|
}
|
502 |
|
|
}
|
503 |
|
|
}
|
504 |
|
|
}
|
505 |
|
|
}
|
506 |
|
|
|
507 |
|
|
/* Tell the other side to delete the second endpoint. */
|
508 |
|
|
status =
|
509 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP,
|
510 |
|
|
1025, mcapi_struct->local_endp, 0,
|
511 |
|
|
MCAPI_DEFAULT_PRIO);
|
512 |
|
|
|
513 |
|
|
if (status == MCAPI_SUCCESS)
|
514 |
|
|
{
|
515 |
|
|
/* Wait for the response. */
|
516 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
517 |
|
|
}
|
518 |
|
|
}
|
519 |
|
|
}
|
520 |
|
|
|
521 |
|
|
/* Tell the other side to delete the first endpoint. */
|
522 |
|
|
status =
|
523 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
524 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
525 |
|
|
|
526 |
|
|
if (status == MCAPI_SUCCESS)
|
527 |
|
|
{
|
528 |
|
|
/* Wait for the response. */
|
529 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
530 |
|
|
}
|
531 |
|
|
}
|
532 |
|
|
}
|
533 |
|
|
|
534 |
|
|
/* Set the state of the test to completed. */
|
535 |
|
|
mcapi_struct->state = 0;
|
536 |
|
|
|
537 |
|
|
/* Allow the next test to run. */
|
538 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
539 |
|
|
|
540 |
|
|
} /* MCAPI_FTS_Tx_2_25_4 */
|
541 |
|
|
|
542 |
|
|
/************************************************************************
|
543 |
|
|
*
|
544 |
|
|
* FUNCTION
|
545 |
|
|
*
|
546 |
|
|
* MCAPI_FTS_Tx_2_25_5
|
547 |
|
|
*
|
548 |
|
|
* DESCRIPTION
|
549 |
|
|
*
|
550 |
|
|
* Testing mcapi_connect_sclchan_i - connection performed by
|
551 |
|
|
* receiver node - already connected.
|
552 |
|
|
*
|
553 |
|
|
* Node 0 – Create an endpoint, open the endpoint as a sender
|
554 |
|
|
*
|
555 |
|
|
* Node 1 – Create an endpoint, get the endpoint on Node 0, open
|
556 |
|
|
* the endpoint as a receiver, issue connection, issue
|
557 |
|
|
* connection again
|
558 |
|
|
*
|
559 |
|
|
*************************************************************************/
|
560 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_5)
|
561 |
|
|
{
|
562 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
563 |
|
|
size_t rx_len;
|
564 |
|
|
mcapi_status_t status;
|
565 |
|
|
mcapi_endpoint_t tx_endp;
|
566 |
|
|
mcapi_request_t request;
|
567 |
|
|
|
568 |
|
|
/* Don't let any other test run while this test is running. */
|
569 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
570 |
|
|
|
571 |
|
|
/* Indicate that a remote endpoint should be created. */
|
572 |
|
|
mcapi_struct->status =
|
573 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
574 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
575 |
|
|
|
576 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
577 |
|
|
{
|
578 |
|
|
/* Wait for a response. */
|
579 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
580 |
|
|
|
581 |
|
|
/* If the endpoint was created. */
|
582 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
583 |
|
|
{
|
584 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
585 |
|
|
mcapi_struct->status =
|
586 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL, 1024,
|
587 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
588 |
|
|
|
589 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
590 |
|
|
{
|
591 |
|
|
/* Wait for a response. */
|
592 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
593 |
|
|
|
594 |
|
|
/* If the send side was opened. */
|
595 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
596 |
|
|
{
|
597 |
|
|
/* Get the send side endpoint. */
|
598 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
599 |
|
|
|
600 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
601 |
|
|
{
|
602 |
|
|
/* Open the local endpoint as the receiver. */
|
603 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
|
604 |
|
|
mcapi_struct->local_endp,
|
605 |
|
|
&request, &mcapi_struct->status);
|
606 |
|
|
|
607 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
608 |
|
|
{
|
609 |
|
|
/* Connect the two endpoints. */
|
610 |
|
|
mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
|
611 |
|
|
&mcapi_struct->request,
|
612 |
|
|
&mcapi_struct->status);
|
613 |
|
|
|
614 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
615 |
|
|
{
|
616 |
|
|
/* Wait for the open call to return successfully. */
|
617 |
|
|
mcapi_wait(&request, &rx_len,
|
618 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
619 |
|
|
|
620 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
621 |
|
|
{
|
622 |
|
|
/* Connect the two endpoints again. */
|
623 |
|
|
mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
|
624 |
|
|
&mcapi_struct->request,
|
625 |
|
|
&mcapi_struct->status);
|
626 |
|
|
|
627 |
|
|
/* If both endpoints are local, the routine will return
|
628 |
|
|
* an error.
|
629 |
|
|
*/
|
630 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_CONNECTED)
|
631 |
|
|
{
|
632 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
633 |
|
|
}
|
634 |
|
|
|
635 |
|
|
/* Otherwise, the routine will return success until
|
636 |
|
|
* the remote endpoints can return an error.
|
637 |
|
|
*/
|
638 |
|
|
else if (mcapi_struct->status == MCAPI_SUCCESS)
|
639 |
|
|
{
|
640 |
|
|
/* Wait for the connection to return successfully. */
|
641 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
642 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
643 |
|
|
|
644 |
|
|
/* An error should have been returned. */
|
645 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_CONNECTED)
|
646 |
|
|
{
|
647 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
648 |
|
|
}
|
649 |
|
|
|
650 |
|
|
else
|
651 |
|
|
{
|
652 |
|
|
mcapi_struct->status = -1;
|
653 |
|
|
}
|
654 |
|
|
}
|
655 |
|
|
|
656 |
|
|
else
|
657 |
|
|
{
|
658 |
|
|
mcapi_struct->status = -1;
|
659 |
|
|
}
|
660 |
|
|
}
|
661 |
|
|
|
662 |
|
|
/* Close the receive side. */
|
663 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
664 |
|
|
&request, &status);
|
665 |
|
|
}
|
666 |
|
|
}
|
667 |
|
|
}
|
668 |
|
|
}
|
669 |
|
|
}
|
670 |
|
|
|
671 |
|
|
/* Tell the other side to close the send side. */
|
672 |
|
|
status =
|
673 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
674 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
675 |
|
|
|
676 |
|
|
if (status == MCAPI_SUCCESS)
|
677 |
|
|
{
|
678 |
|
|
/* Wait for the response. */
|
679 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
680 |
|
|
|
681 |
|
|
/* Tell the other side to delete the endpoint. */
|
682 |
|
|
status =
|
683 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
684 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
685 |
|
|
|
686 |
|
|
if (status == MCAPI_SUCCESS)
|
687 |
|
|
{
|
688 |
|
|
/* Wait for the response. */
|
689 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
690 |
|
|
}
|
691 |
|
|
}
|
692 |
|
|
}
|
693 |
|
|
}
|
694 |
|
|
|
695 |
|
|
/* Set the state of the test to completed. */
|
696 |
|
|
mcapi_struct->state = 0;
|
697 |
|
|
|
698 |
|
|
/* Allow the next test to run. */
|
699 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
700 |
|
|
|
701 |
|
|
} /* MCAPI_FTS_Tx_2_25_5 */
|
702 |
|
|
|
703 |
|
|
/************************************************************************
|
704 |
|
|
*
|
705 |
|
|
* FUNCTION
|
706 |
|
|
*
|
707 |
|
|
* MCAPI_FTS_Tx_2_25_6
|
708 |
|
|
*
|
709 |
|
|
* DESCRIPTION
|
710 |
|
|
*
|
711 |
|
|
* Testing mcapi_connect_sclchan_i - connection performed by
|
712 |
|
|
* sender node - already connected.
|
713 |
|
|
*
|
714 |
|
|
* Node 0 – Create an endpoint, open the endpoint as a receiver
|
715 |
|
|
*
|
716 |
|
|
* Node 1 – Create an endpoint, get the endpoint on Node 0, open
|
717 |
|
|
* the endpoint as a sender, issue connection, issue
|
718 |
|
|
* connection again
|
719 |
|
|
*
|
720 |
|
|
*************************************************************************/
|
721 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_6)
|
722 |
|
|
{
|
723 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
724 |
|
|
size_t rx_len;
|
725 |
|
|
mcapi_status_t status;
|
726 |
|
|
mcapi_endpoint_t rx_endp;
|
727 |
|
|
mcapi_request_t request;
|
728 |
|
|
|
729 |
|
|
/* Don't let any other test run while this test is running. */
|
730 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
731 |
|
|
|
732 |
|
|
/* Indicate that a remote endpoint should be created. */
|
733 |
|
|
mcapi_struct->status =
|
734 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
735 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
736 |
|
|
|
737 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
738 |
|
|
{
|
739 |
|
|
/* Wait for a response. */
|
740 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
741 |
|
|
|
742 |
|
|
/* If the endpoint was created. */
|
743 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
744 |
|
|
{
|
745 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
746 |
|
|
mcapi_struct->status =
|
747 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL, 1024,
|
748 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
749 |
|
|
|
750 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
751 |
|
|
{
|
752 |
|
|
/* Wait for a response. */
|
753 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
754 |
|
|
|
755 |
|
|
/* If the send side was opened. */
|
756 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
757 |
|
|
{
|
758 |
|
|
/* Get the receive side endpoint. */
|
759 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
760 |
|
|
|
761 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
762 |
|
|
{
|
763 |
|
|
/* Open the local endpoint as the sender. */
|
764 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
765 |
|
|
mcapi_struct->local_endp,
|
766 |
|
|
&request, &mcapi_struct->status);
|
767 |
|
|
|
768 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
769 |
|
|
{
|
770 |
|
|
/* Connect the two endpoints. */
|
771 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
772 |
|
|
&mcapi_struct->request,
|
773 |
|
|
&mcapi_struct->status);
|
774 |
|
|
|
775 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
776 |
|
|
{
|
777 |
|
|
/* Wait for the open call to return successfully. */
|
778 |
|
|
mcapi_wait(&request, &rx_len,
|
779 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
780 |
|
|
|
781 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
782 |
|
|
{
|
783 |
|
|
/* Connect the two endpoints. */
|
784 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
785 |
|
|
&mcapi_struct->request,
|
786 |
|
|
&mcapi_struct->status);
|
787 |
|
|
|
788 |
|
|
/* If both endpoints are local, the routine will return
|
789 |
|
|
* an error.
|
790 |
|
|
*/
|
791 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_CONNECTED)
|
792 |
|
|
{
|
793 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
794 |
|
|
}
|
795 |
|
|
|
796 |
|
|
/* Otherwise, the routine will return success until
|
797 |
|
|
* the remote endpoints can return an error.
|
798 |
|
|
*/
|
799 |
|
|
else if (mcapi_struct->status == MCAPI_SUCCESS)
|
800 |
|
|
{
|
801 |
|
|
/* Wait for the connection to return successfully. */
|
802 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
803 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
804 |
|
|
|
805 |
|
|
/* An error should have been returned. */
|
806 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_CONNECTED)
|
807 |
|
|
{
|
808 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
809 |
|
|
}
|
810 |
|
|
|
811 |
|
|
else
|
812 |
|
|
{
|
813 |
|
|
mcapi_struct->status = -1;
|
814 |
|
|
}
|
815 |
|
|
}
|
816 |
|
|
|
817 |
|
|
else
|
818 |
|
|
{
|
819 |
|
|
mcapi_struct->status = -1;
|
820 |
|
|
}
|
821 |
|
|
}
|
822 |
|
|
|
823 |
|
|
/* Close the send side. */
|
824 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
825 |
|
|
&request, &status);
|
826 |
|
|
}
|
827 |
|
|
}
|
828 |
|
|
}
|
829 |
|
|
}
|
830 |
|
|
}
|
831 |
|
|
|
832 |
|
|
/* Tell the other side to close the receive side. */
|
833 |
|
|
status =
|
834 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_RX_SIDE_SCL, 1024,
|
835 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
836 |
|
|
|
837 |
|
|
if (status == MCAPI_SUCCESS)
|
838 |
|
|
{
|
839 |
|
|
/* Wait for the response. */
|
840 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
841 |
|
|
|
842 |
|
|
/* Tell the other side to delete the endpoint. */
|
843 |
|
|
status =
|
844 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
845 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
846 |
|
|
|
847 |
|
|
if (status == MCAPI_SUCCESS)
|
848 |
|
|
{
|
849 |
|
|
/* Wait for the response. */
|
850 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
851 |
|
|
}
|
852 |
|
|
}
|
853 |
|
|
}
|
854 |
|
|
}
|
855 |
|
|
|
856 |
|
|
/* Set the state of the test to completed. */
|
857 |
|
|
mcapi_struct->state = 0;
|
858 |
|
|
|
859 |
|
|
/* Allow the next test to run. */
|
860 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
861 |
|
|
|
862 |
|
|
} /* MCAPI_FTS_Tx_2_25_6 */
|
863 |
|
|
|
864 |
|
|
/************************************************************************
|
865 |
|
|
*
|
866 |
|
|
* FUNCTION
|
867 |
|
|
*
|
868 |
|
|
* MCAPI_FTS_Tx_2_25_7
|
869 |
|
|
*
|
870 |
|
|
* DESCRIPTION
|
871 |
|
|
*
|
872 |
|
|
* Testing mcapi_connect_sclchan_i - open send side / open receive
|
873 |
|
|
* side / connect
|
874 |
|
|
*
|
875 |
|
|
* Node 0 – Create endpoint, open endpoint as sender
|
876 |
|
|
*
|
877 |
|
|
* Node 1 – Create endpoint, wait for Node 0 to open as sender,
|
878 |
|
|
* open as a receiver, get endpoint on Node 0, issue
|
879 |
|
|
* connection
|
880 |
|
|
*
|
881 |
|
|
*************************************************************************/
|
882 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_7)
|
883 |
|
|
{
|
884 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
885 |
|
|
size_t rx_len;
|
886 |
|
|
mcapi_status_t status;
|
887 |
|
|
mcapi_endpoint_t tx_endp;
|
888 |
|
|
mcapi_request_t request;
|
889 |
|
|
|
890 |
|
|
/* Don't let any other test run while this test is running. */
|
891 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
892 |
|
|
|
893 |
|
|
/* Indicate that a remote endpoint should be created. */
|
894 |
|
|
mcapi_struct->status =
|
895 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
896 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
897 |
|
|
|
898 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
899 |
|
|
{
|
900 |
|
|
/* Wait for a response. */
|
901 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
902 |
|
|
|
903 |
|
|
/* If the endpoint was created. */
|
904 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
905 |
|
|
{
|
906 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
907 |
|
|
mcapi_struct->status =
|
908 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL, 1024,
|
909 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
910 |
|
|
|
911 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
912 |
|
|
{
|
913 |
|
|
/* Wait for a response. */
|
914 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
915 |
|
|
|
916 |
|
|
/* If the send side was opened. */
|
917 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
918 |
|
|
{
|
919 |
|
|
/* Open the local endpoint as the receiver. */
|
920 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
|
921 |
|
|
mcapi_struct->local_endp,
|
922 |
|
|
&request, &mcapi_struct->status);
|
923 |
|
|
|
924 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
925 |
|
|
{
|
926 |
|
|
/* Get the send side endpoint. */
|
927 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
928 |
|
|
|
929 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
930 |
|
|
{
|
931 |
|
|
/* Connect the two endpoints. */
|
932 |
|
|
mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
|
933 |
|
|
&mcapi_struct->request,
|
934 |
|
|
&mcapi_struct->status);
|
935 |
|
|
|
936 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
937 |
|
|
{
|
938 |
|
|
/* Wait for the open call to return successfully. */
|
939 |
|
|
mcapi_wait(&request, &rx_len,
|
940 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
941 |
|
|
|
942 |
|
|
/* Close the receive side. */
|
943 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
944 |
|
|
&request, &status);
|
945 |
|
|
}
|
946 |
|
|
}
|
947 |
|
|
}
|
948 |
|
|
|
949 |
|
|
/* Tell the other side to close the send side. */
|
950 |
|
|
status =
|
951 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
952 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
953 |
|
|
|
954 |
|
|
if (status == MCAPI_SUCCESS)
|
955 |
|
|
{
|
956 |
|
|
/* Wait for the response. */
|
957 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
958 |
|
|
}
|
959 |
|
|
}
|
960 |
|
|
}
|
961 |
|
|
|
962 |
|
|
/* Tell the other side to delete the endpoint. */
|
963 |
|
|
status =
|
964 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
965 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
966 |
|
|
|
967 |
|
|
if (status == MCAPI_SUCCESS)
|
968 |
|
|
{
|
969 |
|
|
/* Wait for the response. */
|
970 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
971 |
|
|
}
|
972 |
|
|
}
|
973 |
|
|
}
|
974 |
|
|
|
975 |
|
|
/* Set the state of the test to completed. */
|
976 |
|
|
mcapi_struct->state = 0;
|
977 |
|
|
|
978 |
|
|
/* Allow the next test to run. */
|
979 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
980 |
|
|
|
981 |
|
|
} /* MCAPI_FTS_Tx_2_25_7 */
|
982 |
|
|
|
983 |
|
|
/************************************************************************
|
984 |
|
|
*
|
985 |
|
|
* FUNCTION
|
986 |
|
|
*
|
987 |
|
|
* MCAPI_FTS_Tx_2_25_8
|
988 |
|
|
*
|
989 |
|
|
* DESCRIPTION
|
990 |
|
|
*
|
991 |
|
|
* Testing mcapi_connect_sclchan_i - connect / open receive side /
|
992 |
|
|
* open send side
|
993 |
|
|
*
|
994 |
|
|
* Node 0 – Create endpoint, wait for Node 1 to open, open
|
995 |
|
|
* endpoint as sender
|
996 |
|
|
*
|
997 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, issue
|
998 |
|
|
* connection and open as a receiver
|
999 |
|
|
*
|
1000 |
|
|
*************************************************************************/
|
1001 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_8)
|
1002 |
|
|
{
|
1003 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
1004 |
|
|
size_t rx_len;
|
1005 |
|
|
mcapi_status_t status;
|
1006 |
|
|
mcapi_endpoint_t tx_endp;
|
1007 |
|
|
mcapi_request_t request;
|
1008 |
|
|
mcapi_endpoint_t rx_endp;
|
1009 |
|
|
|
1010 |
|
|
/* Don't let any other test run while this test is running. */
|
1011 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
1012 |
|
|
|
1013 |
|
|
/* An extra endpoint is required for the connection. */
|
1014 |
|
|
rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
|
1015 |
|
|
|
1016 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1017 |
|
|
{
|
1018 |
|
|
/* Indicate that a remote endpoint should be created. */
|
1019 |
|
|
mcapi_struct->status =
|
1020 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
1021 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1022 |
|
|
|
1023 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1024 |
|
|
{
|
1025 |
|
|
/* Wait for a response. */
|
1026 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1027 |
|
|
|
1028 |
|
|
/* If the endpoint was created. */
|
1029 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1030 |
|
|
{
|
1031 |
|
|
/* Get the send side endpoint. */
|
1032 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
1033 |
|
|
|
1034 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1035 |
|
|
{
|
1036 |
|
|
/* Connect the two endpoints. */
|
1037 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
1038 |
|
|
&mcapi_struct->request,
|
1039 |
|
|
&mcapi_struct->status);
|
1040 |
|
|
|
1041 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1042 |
|
|
{
|
1043 |
|
|
/* Wait for the connection to complete. */
|
1044 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
1045 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1046 |
|
|
|
1047 |
|
|
/* Open the local endpoint as the receiver. */
|
1048 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle, rx_endp,
|
1049 |
|
|
&request, &mcapi_struct->status);
|
1050 |
|
|
|
1051 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1052 |
|
|
{
|
1053 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
1054 |
|
|
mcapi_struct->status =
|
1055 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
|
1056 |
|
|
1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1057 |
|
|
|
1058 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1059 |
|
|
{
|
1060 |
|
|
/* Wait for a response. */
|
1061 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1062 |
|
|
|
1063 |
|
|
/* If the send side was opened. */
|
1064 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1065 |
|
|
{
|
1066 |
|
|
/* Wait for the open call to return successfully. */
|
1067 |
|
|
mcapi_wait(&request, &rx_len,
|
1068 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1069 |
|
|
|
1070 |
|
|
/* Close the receive side. */
|
1071 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
1072 |
|
|
&request, &status);
|
1073 |
|
|
|
1074 |
|
|
/* Tell the other side to close the send side. */
|
1075 |
|
|
status =
|
1076 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1077 |
|
|
MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
|
1078 |
|
|
1024, mcapi_struct->local_endp,
|
1079 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
1080 |
|
|
|
1081 |
|
|
if (status == MCAPI_SUCCESS)
|
1082 |
|
|
{
|
1083 |
|
|
/* Wait for the response. */
|
1084 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1085 |
|
|
}
|
1086 |
|
|
}
|
1087 |
|
|
}
|
1088 |
|
|
}
|
1089 |
|
|
}
|
1090 |
|
|
}
|
1091 |
|
|
|
1092 |
|
|
/* Tell the other side to delete the endpoint. */
|
1093 |
|
|
status =
|
1094 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
1095 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1096 |
|
|
|
1097 |
|
|
if (status == MCAPI_SUCCESS)
|
1098 |
|
|
{
|
1099 |
|
|
/* Wait for the response. */
|
1100 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1101 |
|
|
}
|
1102 |
|
|
}
|
1103 |
|
|
}
|
1104 |
|
|
|
1105 |
|
|
/* Delete the endpoint used in the connection. */
|
1106 |
|
|
mcapi_delete_endpoint(rx_endp, &status);
|
1107 |
|
|
}
|
1108 |
|
|
|
1109 |
|
|
/* Set the state of the test to completed. */
|
1110 |
|
|
mcapi_struct->state = 0;
|
1111 |
|
|
|
1112 |
|
|
/* Allow the next test to run. */
|
1113 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
1114 |
|
|
|
1115 |
|
|
} /* MCAPI_FTS_Tx_2_25_8 */
|
1116 |
|
|
|
1117 |
|
|
/************************************************************************
|
1118 |
|
|
*
|
1119 |
|
|
* FUNCTION
|
1120 |
|
|
*
|
1121 |
|
|
* MCAPI_FTS_Tx_2_25_9
|
1122 |
|
|
*
|
1123 |
|
|
* DESCRIPTION
|
1124 |
|
|
*
|
1125 |
|
|
* Testing mcapi_connect_sclchan_i - connect / open send side /
|
1126 |
|
|
* open receive side
|
1127 |
|
|
*
|
1128 |
|
|
* Node 0 – Create endpoint, wait for Node 1 to open, open
|
1129 |
|
|
* endpoint as receiver
|
1130 |
|
|
*
|
1131 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, issue
|
1132 |
|
|
* connection and open as sender
|
1133 |
|
|
*
|
1134 |
|
|
*************************************************************************/
|
1135 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_9)
|
1136 |
|
|
{
|
1137 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
1138 |
|
|
size_t rx_len;
|
1139 |
|
|
mcapi_status_t status;
|
1140 |
|
|
mcapi_endpoint_t rx_endp, tx_endp;
|
1141 |
|
|
mcapi_request_t request;
|
1142 |
|
|
|
1143 |
|
|
/* Don't let any other test run while this test is running. */
|
1144 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
1145 |
|
|
|
1146 |
|
|
/* Create a new endpoint for the send side. */
|
1147 |
|
|
tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
|
1148 |
|
|
|
1149 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1150 |
|
|
{
|
1151 |
|
|
/* Indicate that a remote endpoint should be created. */
|
1152 |
|
|
mcapi_struct->status =
|
1153 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
1154 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1155 |
|
|
|
1156 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1157 |
|
|
{
|
1158 |
|
|
/* Wait for a response. */
|
1159 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1160 |
|
|
|
1161 |
|
|
/* If the endpoint was created. */
|
1162 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1163 |
|
|
{
|
1164 |
|
|
/* Get the receive side endpoint. */
|
1165 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
1166 |
|
|
|
1167 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1168 |
|
|
{
|
1169 |
|
|
/* Connect the two endpoints. */
|
1170 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
1171 |
|
|
&mcapi_struct->request,
|
1172 |
|
|
&mcapi_struct->status);
|
1173 |
|
|
|
1174 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1175 |
|
|
{
|
1176 |
|
|
/* Wait for the connection to complete. */
|
1177 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
1178 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1179 |
|
|
|
1180 |
|
|
/* Open the local endpoint as the sender. */
|
1181 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
1182 |
|
|
tx_endp, &request,
|
1183 |
|
|
&mcapi_struct->status);
|
1184 |
|
|
|
1185 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1186 |
|
|
{
|
1187 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
1188 |
|
|
mcapi_struct->status =
|
1189 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1190 |
|
|
MCAPID_MGMT_OPEN_RX_SIDE_SCL, 1024,
|
1191 |
|
|
mcapi_struct->local_endp, 0,
|
1192 |
|
|
MCAPI_DEFAULT_PRIO);
|
1193 |
|
|
|
1194 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1195 |
|
|
{
|
1196 |
|
|
/* Wait for a response. */
|
1197 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1198 |
|
|
|
1199 |
|
|
/* If the send side was opened. */
|
1200 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1201 |
|
|
{
|
1202 |
|
|
/* Wait for the open call to return successfully. */
|
1203 |
|
|
mcapi_wait(&request, &rx_len,
|
1204 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1205 |
|
|
|
1206 |
|
|
/* Close the send side. */
|
1207 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
1208 |
|
|
&request, &status);
|
1209 |
|
|
|
1210 |
|
|
/* Tell the other side to close the receive side. */
|
1211 |
|
|
status =
|
1212 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1213 |
|
|
MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
|
1214 |
|
|
1024, mcapi_struct->local_endp,
|
1215 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
1216 |
|
|
|
1217 |
|
|
if (status == MCAPI_SUCCESS)
|
1218 |
|
|
{
|
1219 |
|
|
/* Wait for the response. */
|
1220 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1221 |
|
|
}
|
1222 |
|
|
}
|
1223 |
|
|
}
|
1224 |
|
|
}
|
1225 |
|
|
}
|
1226 |
|
|
}
|
1227 |
|
|
|
1228 |
|
|
/* Tell the other side to delete the endpoint. */
|
1229 |
|
|
status =
|
1230 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
1231 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1232 |
|
|
|
1233 |
|
|
if (status == MCAPI_SUCCESS)
|
1234 |
|
|
{
|
1235 |
|
|
/* Wait for the response. */
|
1236 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1237 |
|
|
}
|
1238 |
|
|
}
|
1239 |
|
|
}
|
1240 |
|
|
|
1241 |
|
|
/* Delete the endpoint created for this session. */
|
1242 |
|
|
mcapi_delete_endpoint(tx_endp, &status);
|
1243 |
|
|
}
|
1244 |
|
|
|
1245 |
|
|
/* Set the state of the test to completed. */
|
1246 |
|
|
mcapi_struct->state = 0;
|
1247 |
|
|
|
1248 |
|
|
/* Allow the next test to run. */
|
1249 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
1250 |
|
|
|
1251 |
|
|
} /* MCAPI_FTS_Tx_2_25_9 */
|
1252 |
|
|
|
1253 |
|
|
/************************************************************************
|
1254 |
|
|
*
|
1255 |
|
|
* FUNCTION
|
1256 |
|
|
*
|
1257 |
|
|
* MCAPI_FTS_Tx_2_25_10
|
1258 |
|
|
*
|
1259 |
|
|
* DESCRIPTION
|
1260 |
|
|
*
|
1261 |
|
|
* Testing mcapi_connect_sclchan_i - open send / connect /
|
1262 |
|
|
* open receive
|
1263 |
|
|
*
|
1264 |
|
|
* Node 0 – Create endpoint, open endpoint as sender
|
1265 |
|
|
*
|
1266 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, wait for
|
1267 |
|
|
* Node 0 to open as sender, issue connection, open
|
1268 |
|
|
* as a receiver
|
1269 |
|
|
*
|
1270 |
|
|
*************************************************************************/
|
1271 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_10)
|
1272 |
|
|
{
|
1273 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
1274 |
|
|
size_t rx_len;
|
1275 |
|
|
mcapi_status_t status;
|
1276 |
|
|
mcapi_endpoint_t tx_endp;
|
1277 |
|
|
mcapi_request_t request;
|
1278 |
|
|
|
1279 |
|
|
/* Don't let any other test run while this test is running. */
|
1280 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
1281 |
|
|
|
1282 |
|
|
/* Indicate that a remote endpoint should be created. */
|
1283 |
|
|
mcapi_struct->status =
|
1284 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
1285 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1286 |
|
|
|
1287 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1288 |
|
|
{
|
1289 |
|
|
/* Wait for a response. */
|
1290 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1291 |
|
|
|
1292 |
|
|
/* If the endpoint was created. */
|
1293 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1294 |
|
|
{
|
1295 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
1296 |
|
|
mcapi_struct->status =
|
1297 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1298 |
|
|
MCAPID_MGMT_OPEN_TX_SIDE_SCL, 1024,
|
1299 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1300 |
|
|
|
1301 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1302 |
|
|
{
|
1303 |
|
|
/* Wait for a response. */
|
1304 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1305 |
|
|
|
1306 |
|
|
/* If the send side was opened. */
|
1307 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
1308 |
|
|
{
|
1309 |
|
|
/* Get the send side endpoint. */
|
1310 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
1311 |
|
|
|
1312 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1313 |
|
|
{
|
1314 |
|
|
/* Connect the two endpoints. */
|
1315 |
|
|
mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
|
1316 |
|
|
&mcapi_struct->request,
|
1317 |
|
|
&mcapi_struct->status);
|
1318 |
|
|
|
1319 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1320 |
|
|
{
|
1321 |
|
|
/* Wait for the connection to complete. */
|
1322 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
1323 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1324 |
|
|
|
1325 |
|
|
/* Open the local endpoint as the receiver. */
|
1326 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
|
1327 |
|
|
mcapi_struct->local_endp, &request,
|
1328 |
|
|
&mcapi_struct->status);
|
1329 |
|
|
|
1330 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1331 |
|
|
{
|
1332 |
|
|
/* Wait for the open call to return successfully. */
|
1333 |
|
|
mcapi_wait(&request, &rx_len,
|
1334 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1335 |
|
|
|
1336 |
|
|
/* Close the receive side. */
|
1337 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
1338 |
|
|
&request, &status);
|
1339 |
|
|
}
|
1340 |
|
|
}
|
1341 |
|
|
}
|
1342 |
|
|
|
1343 |
|
|
/* Tell the other side to close the send side. */
|
1344 |
|
|
status =
|
1345 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
1346 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1347 |
|
|
|
1348 |
|
|
if (status == MCAPI_SUCCESS)
|
1349 |
|
|
{
|
1350 |
|
|
/* Wait for the response. */
|
1351 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1352 |
|
|
}
|
1353 |
|
|
}
|
1354 |
|
|
}
|
1355 |
|
|
|
1356 |
|
|
/* Tell the other side to delete the endpoint. */
|
1357 |
|
|
status =
|
1358 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
1359 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1360 |
|
|
|
1361 |
|
|
if (status == MCAPI_SUCCESS)
|
1362 |
|
|
{
|
1363 |
|
|
/* Wait for the response. */
|
1364 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1365 |
|
|
}
|
1366 |
|
|
}
|
1367 |
|
|
}
|
1368 |
|
|
|
1369 |
|
|
/* Set the state of the test to completed. */
|
1370 |
|
|
mcapi_struct->state = 0;
|
1371 |
|
|
|
1372 |
|
|
/* Allow the next test to run. */
|
1373 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
1374 |
|
|
|
1375 |
|
|
} /* MCAPI_FTS_Tx_2_25_10 */
|
1376 |
|
|
|
1377 |
|
|
/************************************************************************
|
1378 |
|
|
*
|
1379 |
|
|
* FUNCTION
|
1380 |
|
|
*
|
1381 |
|
|
* MCAPI_FTS_Tx_2_25_11
|
1382 |
|
|
*
|
1383 |
|
|
* DESCRIPTION
|
1384 |
|
|
*
|
1385 |
|
|
* Testing mcapi_connect_sclchan_i - open receive / connect /
|
1386 |
|
|
* open send
|
1387 |
|
|
*
|
1388 |
|
|
* Node 0 – Create endpoint, open endpoint as receiver
|
1389 |
|
|
*
|
1390 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, wait for
|
1391 |
|
|
* Node 0 to open as receiver, issue connection,
|
1392 |
|
|
* open as a sender
|
1393 |
|
|
*
|
1394 |
|
|
*************************************************************************/
|
1395 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_11)
|
1396 |
|
|
{
|
1397 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
1398 |
|
|
size_t rx_len;
|
1399 |
|
|
mcapi_status_t status;
|
1400 |
|
|
mcapi_endpoint_t rx_endp;
|
1401 |
|
|
mcapi_request_t request;
|
1402 |
|
|
|
1403 |
|
|
/* Don't let any other test run while this test is running. */
|
1404 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
1405 |
|
|
|
1406 |
|
|
/* Indicate that a remote endpoint should be created. */
|
1407 |
|
|
mcapi_struct->status =
|
1408 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
1409 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1410 |
|
|
|
1411 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1412 |
|
|
{
|
1413 |
|
|
/* Wait for a response. */
|
1414 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1415 |
|
|
|
1416 |
|
|
/* If the endpoint was created. */
|
1417 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1418 |
|
|
{
|
1419 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
1420 |
|
|
mcapi_struct->status =
|
1421 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1422 |
|
|
MCAPID_MGMT_OPEN_RX_SIDE_SCL, 1024,
|
1423 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1424 |
|
|
|
1425 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1426 |
|
|
{
|
1427 |
|
|
/* Wait for a response. */
|
1428 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1429 |
|
|
|
1430 |
|
|
/* If the send receive was opened. */
|
1431 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
1432 |
|
|
{
|
1433 |
|
|
/* Get the receive side endpoint. */
|
1434 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
1435 |
|
|
|
1436 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1437 |
|
|
{
|
1438 |
|
|
/* Connect the two endpoints. */
|
1439 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
1440 |
|
|
&mcapi_struct->request,
|
1441 |
|
|
&mcapi_struct->status);
|
1442 |
|
|
|
1443 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1444 |
|
|
{
|
1445 |
|
|
/* Wait for the open call to return successfully. */
|
1446 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
1447 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1448 |
|
|
|
1449 |
|
|
/* Open the local endpoint as the sender. */
|
1450 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
1451 |
|
|
mcapi_struct->local_endp, &request,
|
1452 |
|
|
&mcapi_struct->status);
|
1453 |
|
|
|
1454 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1455 |
|
|
{
|
1456 |
|
|
/* Wait for the open call to return successfully. */
|
1457 |
|
|
mcapi_wait(&request, &rx_len,
|
1458 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1459 |
|
|
|
1460 |
|
|
/* Close the send side. */
|
1461 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
1462 |
|
|
&request, &status);
|
1463 |
|
|
}
|
1464 |
|
|
}
|
1465 |
|
|
}
|
1466 |
|
|
}
|
1467 |
|
|
|
1468 |
|
|
/* Tell the other side to close the receive side. */
|
1469 |
|
|
status =
|
1470 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_RX_SIDE_SCL, 1024,
|
1471 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1472 |
|
|
|
1473 |
|
|
if (status == MCAPI_SUCCESS)
|
1474 |
|
|
{
|
1475 |
|
|
/* Wait for the response. */
|
1476 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1477 |
|
|
}
|
1478 |
|
|
}
|
1479 |
|
|
|
1480 |
|
|
/* Tell the other side to delete the endpoint. */
|
1481 |
|
|
status =
|
1482 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
1483 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1484 |
|
|
|
1485 |
|
|
if (status == MCAPI_SUCCESS)
|
1486 |
|
|
{
|
1487 |
|
|
/* Wait for the response. */
|
1488 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1489 |
|
|
}
|
1490 |
|
|
}
|
1491 |
|
|
}
|
1492 |
|
|
|
1493 |
|
|
/* Set the state of the test to completed. */
|
1494 |
|
|
mcapi_struct->state = 0;
|
1495 |
|
|
|
1496 |
|
|
/* Allow the next test to run. */
|
1497 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
1498 |
|
|
|
1499 |
|
|
} /* MCAPI_FTS_Tx_2_25_11 */
|
1500 |
|
|
|
1501 |
|
|
/************************************************************************
|
1502 |
|
|
*
|
1503 |
|
|
* FUNCTION
|
1504 |
|
|
*
|
1505 |
|
|
* MCAPI_FTS_Tx_2_25_12
|
1506 |
|
|
*
|
1507 |
|
|
* DESCRIPTION
|
1508 |
|
|
*
|
1509 |
|
|
* Testing mcapi_connect_sclchan_i - open receive / connect /
|
1510 |
|
|
* open send
|
1511 |
|
|
*
|
1512 |
|
|
* Node 0 – Create endpoint, open endpoint as receiver
|
1513 |
|
|
*
|
1514 |
|
|
* Node 1 – Create endpoint, get endpoint on Node 0, wait for
|
1515 |
|
|
* Node 0 to open as receiver, open as a sender,
|
1516 |
|
|
* issue connection
|
1517 |
|
|
*
|
1518 |
|
|
*************************************************************************/
|
1519 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_12)
|
1520 |
|
|
{
|
1521 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
1522 |
|
|
size_t rx_len;
|
1523 |
|
|
mcapi_status_t status;
|
1524 |
|
|
mcapi_endpoint_t rx_endp;
|
1525 |
|
|
mcapi_request_t request;
|
1526 |
|
|
|
1527 |
|
|
/* Don't let any other test run while this test is running. */
|
1528 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
1529 |
|
|
|
1530 |
|
|
/* Indicate that a remote endpoint should be created. */
|
1531 |
|
|
mcapi_struct->status =
|
1532 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
1533 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1534 |
|
|
|
1535 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1536 |
|
|
{
|
1537 |
|
|
/* Wait for a response. */
|
1538 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1539 |
|
|
|
1540 |
|
|
/* If the endpoint was created. */
|
1541 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1542 |
|
|
{
|
1543 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
1544 |
|
|
mcapi_struct->status =
|
1545 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1546 |
|
|
MCAPID_MGMT_OPEN_RX_SIDE_SCL, 1024,
|
1547 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1548 |
|
|
|
1549 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1550 |
|
|
{
|
1551 |
|
|
/* Wait for a response. */
|
1552 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1553 |
|
|
|
1554 |
|
|
/* If the receive was opened. */
|
1555 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
1556 |
|
|
{
|
1557 |
|
|
/* Open the local endpoint as the sender. */
|
1558 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
1559 |
|
|
mcapi_struct->local_endp, &request,
|
1560 |
|
|
&mcapi_struct->status);
|
1561 |
|
|
|
1562 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
1563 |
|
|
{
|
1564 |
|
|
/* Get the receive side endpoint. */
|
1565 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
1566 |
|
|
|
1567 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1568 |
|
|
{
|
1569 |
|
|
/* Connect the two endpoints. */
|
1570 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
1571 |
|
|
&mcapi_struct->request,
|
1572 |
|
|
&mcapi_struct->status);
|
1573 |
|
|
|
1574 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1575 |
|
|
{
|
1576 |
|
|
/* Wait for the open call to return successfully. */
|
1577 |
|
|
mcapi_wait(&request, &rx_len,
|
1578 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1579 |
|
|
|
1580 |
|
|
/* Close the send side. */
|
1581 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
1582 |
|
|
&request, &status);
|
1583 |
|
|
}
|
1584 |
|
|
}
|
1585 |
|
|
}
|
1586 |
|
|
|
1587 |
|
|
/* Tell the other side to close the receive side. */
|
1588 |
|
|
status =
|
1589 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_RX_SIDE_SCL, 1024,
|
1590 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1591 |
|
|
|
1592 |
|
|
if (status == MCAPI_SUCCESS)
|
1593 |
|
|
{
|
1594 |
|
|
/* Wait for the response. */
|
1595 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1596 |
|
|
}
|
1597 |
|
|
}
|
1598 |
|
|
}
|
1599 |
|
|
|
1600 |
|
|
/* Tell the other side to delete the endpoint. */
|
1601 |
|
|
status =
|
1602 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
1603 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1604 |
|
|
|
1605 |
|
|
if (status == MCAPI_SUCCESS)
|
1606 |
|
|
{
|
1607 |
|
|
/* Wait for the response. */
|
1608 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1609 |
|
|
}
|
1610 |
|
|
}
|
1611 |
|
|
}
|
1612 |
|
|
|
1613 |
|
|
/* Set the state of the test to completed. */
|
1614 |
|
|
mcapi_struct->state = 0;
|
1615 |
|
|
|
1616 |
|
|
/* Allow the next test to run. */
|
1617 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
1618 |
|
|
|
1619 |
|
|
} /* MCAPI_FTS_Tx_2_25_12 */
|
1620 |
|
|
|
1621 |
|
|
/************************************************************************
|
1622 |
|
|
*
|
1623 |
|
|
* FUNCTION
|
1624 |
|
|
*
|
1625 |
|
|
* MCAPI_FTS_Tx_2_25_13
|
1626 |
|
|
*
|
1627 |
|
|
* DESCRIPTION
|
1628 |
|
|
*
|
1629 |
|
|
* Testing mcapi_connect_sclchan_i - connect two remote endpoints on
|
1630 |
|
|
* the same foreign node reusing endpoints from a previous connection
|
1631 |
|
|
*
|
1632 |
|
|
* Node 0 – Create two endpoints, wait for connect, open send
|
1633 |
|
|
* open receive, close send, close receive, wait for
|
1634 |
|
|
* connect
|
1635 |
|
|
*
|
1636 |
|
|
* Node 1 – Get both endpoints, and issue connect request, wait
|
1637 |
|
|
* for connection to close, issue connect request
|
1638 |
|
|
*
|
1639 |
|
|
*************************************************************************/
|
1640 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_13)
|
1641 |
|
|
{
|
1642 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
1643 |
|
|
size_t rx_len;
|
1644 |
|
|
mcapi_status_t status;
|
1645 |
|
|
mcapi_endpoint_t tx_endp, rx_endp;
|
1646 |
|
|
|
1647 |
|
|
/* Don't let any other test run while this test is running. */
|
1648 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
1649 |
|
|
|
1650 |
|
|
/* Indicate that a remote endpoint should be created. */
|
1651 |
|
|
mcapi_struct->status =
|
1652 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
1653 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1654 |
|
|
|
1655 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1656 |
|
|
{
|
1657 |
|
|
/* Wait for a response. */
|
1658 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1659 |
|
|
|
1660 |
|
|
/* If the endpoint was created. */
|
1661 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1662 |
|
|
{
|
1663 |
|
|
/* Indicate that a second remote endpoint should be created. */
|
1664 |
|
|
mcapi_struct->status =
|
1665 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1025,
|
1666 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1667 |
|
|
|
1668 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1669 |
|
|
{
|
1670 |
|
|
/* Wait for a response. */
|
1671 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1672 |
|
|
|
1673 |
|
|
/* If the endpoint was created. */
|
1674 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1675 |
|
|
{
|
1676 |
|
|
/* Get the first endpoint. */
|
1677 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
1678 |
|
|
|
1679 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1680 |
|
|
{
|
1681 |
|
|
/* Get the second endpoint. */
|
1682 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1025, &mcapi_struct->status);
|
1683 |
|
|
|
1684 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1685 |
|
|
{
|
1686 |
|
|
/* Connect the two endpoints. */
|
1687 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp, &mcapi_struct->request,
|
1688 |
|
|
&mcapi_struct->status);
|
1689 |
|
|
|
1690 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1691 |
|
|
{
|
1692 |
|
|
/* Wait for the connection to return successfully. */
|
1693 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
1694 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1695 |
|
|
|
1696 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1697 |
|
|
{
|
1698 |
|
|
/* Indicate that the first endpoint should be opened as a
|
1699 |
|
|
* sender.
|
1700 |
|
|
*/
|
1701 |
|
|
mcapi_struct->status =
|
1702 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1703 |
|
|
MCAPID_MGMT_OPEN_TX_SIDE_SCL,
|
1704 |
|
|
1024, mcapi_struct->local_endp,
|
1705 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
1706 |
|
|
|
1707 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1708 |
|
|
{
|
1709 |
|
|
/* Wait for a response. */
|
1710 |
|
|
mcapi_struct->status =
|
1711 |
|
|
MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1712 |
|
|
|
1713 |
|
|
/* If the sender was opened. */
|
1714 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1715 |
|
|
{
|
1716 |
|
|
/* Indicate that the second endpoint should be opened
|
1717 |
|
|
* as a receiver.
|
1718 |
|
|
*/
|
1719 |
|
|
mcapi_struct->status =
|
1720 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1721 |
|
|
MCAPID_MGMT_OPEN_RX_SIDE_SCL,
|
1722 |
|
|
1025, mcapi_struct->local_endp,
|
1723 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
1724 |
|
|
|
1725 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1726 |
|
|
{
|
1727 |
|
|
/* Wait for a response. */
|
1728 |
|
|
mcapi_struct->status =
|
1729 |
|
|
MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1730 |
|
|
|
1731 |
|
|
/* If the receive side was opened. */
|
1732 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1733 |
|
|
{
|
1734 |
|
|
/* Let the open packets get processed. */
|
1735 |
|
|
MCAPID_Sleep(1000);
|
1736 |
|
|
|
1737 |
|
|
/* Tell the other side to close the receive side. */
|
1738 |
|
|
status =
|
1739 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1740 |
|
|
MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
|
1741 |
|
|
1025,
|
1742 |
|
|
mcapi_struct->local_endp, 0,
|
1743 |
|
|
MCAPI_DEFAULT_PRIO);
|
1744 |
|
|
|
1745 |
|
|
if (status == MCAPI_SUCCESS)
|
1746 |
|
|
{
|
1747 |
|
|
/* Wait for the response. */
|
1748 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1749 |
|
|
|
1750 |
|
|
/* Tell the other side to close the send side. */
|
1751 |
|
|
status =
|
1752 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1753 |
|
|
MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
|
1754 |
|
|
1024, mcapi_struct->local_endp, 0,
|
1755 |
|
|
MCAPI_DEFAULT_PRIO);
|
1756 |
|
|
|
1757 |
|
|
if (status == MCAPI_SUCCESS)
|
1758 |
|
|
{
|
1759 |
|
|
/* Wait for the response. */
|
1760 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1761 |
|
|
|
1762 |
|
|
/* Let the close packets get processed. */
|
1763 |
|
|
MCAPID_Sleep(1000);
|
1764 |
|
|
|
1765 |
|
|
/* Reconnect the two endpoints. */
|
1766 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
1767 |
|
|
&mcapi_struct->request,
|
1768 |
|
|
&mcapi_struct->status);
|
1769 |
|
|
|
1770 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1771 |
|
|
{
|
1772 |
|
|
/* Wait for the connection to return successfully. */
|
1773 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
1774 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1775 |
|
|
}
|
1776 |
|
|
}
|
1777 |
|
|
}
|
1778 |
|
|
}
|
1779 |
|
|
|
1780 |
|
|
else
|
1781 |
|
|
{
|
1782 |
|
|
/* Tell the other side to close the send side. */
|
1783 |
|
|
status =
|
1784 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct,
|
1785 |
|
|
MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
1786 |
|
|
mcapi_struct->local_endp, 0,
|
1787 |
|
|
MCAPI_DEFAULT_PRIO);
|
1788 |
|
|
|
1789 |
|
|
if (status == MCAPI_SUCCESS)
|
1790 |
|
|
{
|
1791 |
|
|
/* Wait for the response. */
|
1792 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1793 |
|
|
}
|
1794 |
|
|
}
|
1795 |
|
|
}
|
1796 |
|
|
}
|
1797 |
|
|
}
|
1798 |
|
|
}
|
1799 |
|
|
}
|
1800 |
|
|
}
|
1801 |
|
|
}
|
1802 |
|
|
|
1803 |
|
|
/* Tell the other side to delete the second endpoint. */
|
1804 |
|
|
status =
|
1805 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP,
|
1806 |
|
|
1025, mcapi_struct->local_endp, 0,
|
1807 |
|
|
MCAPI_DEFAULT_PRIO);
|
1808 |
|
|
|
1809 |
|
|
if (status == MCAPI_SUCCESS)
|
1810 |
|
|
{
|
1811 |
|
|
/* Wait for the response. */
|
1812 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1813 |
|
|
}
|
1814 |
|
|
}
|
1815 |
|
|
}
|
1816 |
|
|
|
1817 |
|
|
/* Tell the other side to delete the first endpoint. */
|
1818 |
|
|
status =
|
1819 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
1820 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1821 |
|
|
|
1822 |
|
|
if (status == MCAPI_SUCCESS)
|
1823 |
|
|
{
|
1824 |
|
|
/* Wait for the response. */
|
1825 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1826 |
|
|
}
|
1827 |
|
|
}
|
1828 |
|
|
}
|
1829 |
|
|
|
1830 |
|
|
/* Set the state of the test to completed. */
|
1831 |
|
|
mcapi_struct->state = 0;
|
1832 |
|
|
|
1833 |
|
|
/* Allow the next test to run. */
|
1834 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
1835 |
|
|
|
1836 |
|
|
} /* MCAPI_FTS_Tx_2_25_13 */
|
1837 |
|
|
|
1838 |
|
|
/************************************************************************
|
1839 |
|
|
*
|
1840 |
|
|
* FUNCTION
|
1841 |
|
|
*
|
1842 |
|
|
* MCAPI_FTS_Tx_2_25_14
|
1843 |
|
|
*
|
1844 |
|
|
* DESCRIPTION
|
1845 |
|
|
*
|
1846 |
|
|
* Testing mcapi_connect_sclchan_i - connection performed by
|
1847 |
|
|
* receiver node - reusing endpoints from a previous connection
|
1848 |
|
|
*
|
1849 |
|
|
* Node 0 – Create an endpoint, open the endpoint as a sender,
|
1850 |
|
|
* wait for connect request, close endpoint, open the
|
1851 |
|
|
* endpoint as a sender
|
1852 |
|
|
*
|
1853 |
|
|
* Node 1 – Create an endpoint, get the endpoint on Node 0,
|
1854 |
|
|
* open the endpoint as a receiver, issue connection,
|
1855 |
|
|
* close the receiver, open the receive, issue connection
|
1856 |
|
|
*
|
1857 |
|
|
*************************************************************************/
|
1858 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_14)
|
1859 |
|
|
{
|
1860 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
1861 |
|
|
size_t rx_len;
|
1862 |
|
|
mcapi_status_t status;
|
1863 |
|
|
mcapi_endpoint_t tx_endp;
|
1864 |
|
|
mcapi_request_t request;
|
1865 |
|
|
|
1866 |
|
|
/* Don't let any other test run while this test is running. */
|
1867 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
1868 |
|
|
|
1869 |
|
|
/* Indicate that a remote endpoint should be created. */
|
1870 |
|
|
mcapi_struct->status =
|
1871 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
1872 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1873 |
|
|
|
1874 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1875 |
|
|
{
|
1876 |
|
|
/* Wait for a response. */
|
1877 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1878 |
|
|
|
1879 |
|
|
/* If the endpoint was created. */
|
1880 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1881 |
|
|
{
|
1882 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
1883 |
|
|
mcapi_struct->status =
|
1884 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL, 1024,
|
1885 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1886 |
|
|
|
1887 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1888 |
|
|
{
|
1889 |
|
|
/* Wait for a response. */
|
1890 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1891 |
|
|
|
1892 |
|
|
/* If the send side was opened. */
|
1893 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
1894 |
|
|
{
|
1895 |
|
|
/* Get the send side endpoint. */
|
1896 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
1897 |
|
|
|
1898 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1899 |
|
|
{
|
1900 |
|
|
/* Open the local endpoint as the receiver. */
|
1901 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
|
1902 |
|
|
mcapi_struct->local_endp,
|
1903 |
|
|
&request, &mcapi_struct->status);
|
1904 |
|
|
|
1905 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
1906 |
|
|
{
|
1907 |
|
|
/* Connect the two endpoints. */
|
1908 |
|
|
mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
|
1909 |
|
|
&mcapi_struct->request,
|
1910 |
|
|
&mcapi_struct->status);
|
1911 |
|
|
|
1912 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1913 |
|
|
{
|
1914 |
|
|
/* Wait for the open call to return successfully. */
|
1915 |
|
|
mcapi_wait(&request, &rx_len,
|
1916 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1917 |
|
|
|
1918 |
|
|
/* Close the receive side. */
|
1919 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
1920 |
|
|
&request, &status);
|
1921 |
|
|
}
|
1922 |
|
|
}
|
1923 |
|
|
}
|
1924 |
|
|
}
|
1925 |
|
|
}
|
1926 |
|
|
|
1927 |
|
|
/* Tell the other side to close the send side. */
|
1928 |
|
|
status =
|
1929 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
1930 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1931 |
|
|
|
1932 |
|
|
if (status == MCAPI_SUCCESS)
|
1933 |
|
|
{
|
1934 |
|
|
/* Wait for the response. */
|
1935 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1936 |
|
|
}
|
1937 |
|
|
|
1938 |
|
|
/* Let the close packet get processed. */
|
1939 |
|
|
MCAPID_Sleep(1000);
|
1940 |
|
|
|
1941 |
|
|
/* Indicate that the endpoint should be re-opened as a sender. */
|
1942 |
|
|
mcapi_struct->status =
|
1943 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL, 1024,
|
1944 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1945 |
|
|
|
1946 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1947 |
|
|
{
|
1948 |
|
|
/* Wait for a response. */
|
1949 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1950 |
|
|
|
1951 |
|
|
/* If the send side was opened. */
|
1952 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
1953 |
|
|
{
|
1954 |
|
|
/* Open the local endpoint as the receiver. */
|
1955 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
|
1956 |
|
|
mcapi_struct->local_endp,
|
1957 |
|
|
&request, &mcapi_struct->status);
|
1958 |
|
|
|
1959 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
1960 |
|
|
{
|
1961 |
|
|
/* Connect the two endpoints. */
|
1962 |
|
|
mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
|
1963 |
|
|
&mcapi_struct->request,
|
1964 |
|
|
&mcapi_struct->status);
|
1965 |
|
|
|
1966 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
1967 |
|
|
{
|
1968 |
|
|
/* Wait for the open call to return successfully. */
|
1969 |
|
|
mcapi_wait(&request, &rx_len,
|
1970 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
1971 |
|
|
|
1972 |
|
|
/* Close the receive side. */
|
1973 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
1974 |
|
|
&request, &status);
|
1975 |
|
|
}
|
1976 |
|
|
}
|
1977 |
|
|
}
|
1978 |
|
|
}
|
1979 |
|
|
|
1980 |
|
|
/* Tell the other side to close the send side. */
|
1981 |
|
|
status =
|
1982 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
1983 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1984 |
|
|
|
1985 |
|
|
if (status == MCAPI_SUCCESS)
|
1986 |
|
|
{
|
1987 |
|
|
/* Wait for the response. */
|
1988 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1989 |
|
|
|
1990 |
|
|
/* Tell the other side to delete the endpoint. */
|
1991 |
|
|
status =
|
1992 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
1993 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
1994 |
|
|
|
1995 |
|
|
if (status == MCAPI_SUCCESS)
|
1996 |
|
|
{
|
1997 |
|
|
/* Wait for the response. */
|
1998 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
1999 |
|
|
}
|
2000 |
|
|
}
|
2001 |
|
|
}
|
2002 |
|
|
}
|
2003 |
|
|
|
2004 |
|
|
/* Set the state of the test to completed. */
|
2005 |
|
|
mcapi_struct->state = 0;
|
2006 |
|
|
|
2007 |
|
|
/* Allow the next test to run. */
|
2008 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
2009 |
|
|
|
2010 |
|
|
} /* MCAPI_FTS_Tx_2_25_14 */
|
2011 |
|
|
|
2012 |
|
|
/************************************************************************
|
2013 |
|
|
*
|
2014 |
|
|
* FUNCTION
|
2015 |
|
|
*
|
2016 |
|
|
* MCAPI_FTS_Tx_2_25_15
|
2017 |
|
|
*
|
2018 |
|
|
* DESCRIPTION
|
2019 |
|
|
*
|
2020 |
|
|
* Testing mcapi_connect_sclchan_i - connection performed by
|
2021 |
|
|
* sender node - reusing endpoints from a previous connection.
|
2022 |
|
|
*
|
2023 |
|
|
* Node 0 – Create an endpoint, open the endpoint as a receiver,
|
2024 |
|
|
* wait for connect request, close endpoint, open the
|
2025 |
|
|
* endpoint as a receiver
|
2026 |
|
|
*
|
2027 |
|
|
* Node 1 – Create an endpoint, get endpoint on Node 0, open the
|
2028 |
|
|
* endpoint as a sender, issue connection, close the
|
2029 |
|
|
* send side, open the send side, issue connection
|
2030 |
|
|
*
|
2031 |
|
|
*************************************************************************/
|
2032 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_25_15)
|
2033 |
|
|
{
|
2034 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
2035 |
|
|
size_t rx_len;
|
2036 |
|
|
mcapi_status_t status;
|
2037 |
|
|
mcapi_endpoint_t rx_endp;
|
2038 |
|
|
mcapi_request_t request;
|
2039 |
|
|
|
2040 |
|
|
/* Don't let any other test run while this test is running. */
|
2041 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
2042 |
|
|
|
2043 |
|
|
/* Indicate that a remote endpoint should be created. */
|
2044 |
|
|
mcapi_struct->status =
|
2045 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
2046 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
2047 |
|
|
|
2048 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
2049 |
|
|
{
|
2050 |
|
|
/* Wait for a response. */
|
2051 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
2052 |
|
|
|
2053 |
|
|
/* If the endpoint was created. */
|
2054 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
2055 |
|
|
{
|
2056 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
2057 |
|
|
mcapi_struct->status =
|
2058 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL, 1024,
|
2059 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
2060 |
|
|
|
2061 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
2062 |
|
|
{
|
2063 |
|
|
/* Wait for a response. */
|
2064 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
2065 |
|
|
|
2066 |
|
|
/* If the send side was opened. */
|
2067 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
2068 |
|
|
{
|
2069 |
|
|
/* Get the receive side endpoint. */
|
2070 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
2071 |
|
|
|
2072 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
2073 |
|
|
{
|
2074 |
|
|
/* Open the local endpoint as the sender. */
|
2075 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
2076 |
|
|
mcapi_struct->local_endp,
|
2077 |
|
|
&request, &mcapi_struct->status);
|
2078 |
|
|
|
2079 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
2080 |
|
|
{
|
2081 |
|
|
/* Connect the two endpoints. */
|
2082 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
2083 |
|
|
&mcapi_struct->request,
|
2084 |
|
|
&mcapi_struct->status);
|
2085 |
|
|
|
2086 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
2087 |
|
|
{
|
2088 |
|
|
/* Wait for the open call to return successfully. */
|
2089 |
|
|
mcapi_wait(&request, &rx_len,
|
2090 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
2091 |
|
|
|
2092 |
|
|
/* Close the send side. */
|
2093 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
2094 |
|
|
&request, &status);
|
2095 |
|
|
}
|
2096 |
|
|
}
|
2097 |
|
|
}
|
2098 |
|
|
}
|
2099 |
|
|
}
|
2100 |
|
|
|
2101 |
|
|
/* Tell the other side to close the receive side. */
|
2102 |
|
|
status =
|
2103 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_RX_SIDE_SCL, 1024,
|
2104 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
2105 |
|
|
|
2106 |
|
|
if (status == MCAPI_SUCCESS)
|
2107 |
|
|
{
|
2108 |
|
|
/* Wait for the response. */
|
2109 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
2110 |
|
|
|
2111 |
|
|
/* Let the close packet get processed. */
|
2112 |
|
|
MCAPID_Sleep(1000);
|
2113 |
|
|
|
2114 |
|
|
/* Indicate that the endpoint should be opened as a receiver. */
|
2115 |
|
|
mcapi_struct->status =
|
2116 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL, 1024,
|
2117 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
2118 |
|
|
|
2119 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
2120 |
|
|
{
|
2121 |
|
|
/* Wait for a response. */
|
2122 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
2123 |
|
|
|
2124 |
|
|
/* If the send side was opened. */
|
2125 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
2126 |
|
|
{
|
2127 |
|
|
/* Get the receive side endpoint. */
|
2128 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
2129 |
|
|
|
2130 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
2131 |
|
|
{
|
2132 |
|
|
/* Open the local endpoint as the sender. */
|
2133 |
|
|
mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
|
2134 |
|
|
mcapi_struct->local_endp,
|
2135 |
|
|
&request, &mcapi_struct->status);
|
2136 |
|
|
|
2137 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
2138 |
|
|
{
|
2139 |
|
|
/* Connect the two endpoints. */
|
2140 |
|
|
mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
|
2141 |
|
|
&mcapi_struct->request,
|
2142 |
|
|
&mcapi_struct->status);
|
2143 |
|
|
|
2144 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
2145 |
|
|
{
|
2146 |
|
|
/* Wait for the open call to return successfully. */
|
2147 |
|
|
mcapi_wait(&request, &rx_len,
|
2148 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
2149 |
|
|
|
2150 |
|
|
/* Close the send side. */
|
2151 |
|
|
mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
|
2152 |
|
|
&request, &status);
|
2153 |
|
|
}
|
2154 |
|
|
}
|
2155 |
|
|
}
|
2156 |
|
|
}
|
2157 |
|
|
}
|
2158 |
|
|
|
2159 |
|
|
/* Tell the other side to close the receive side. */
|
2160 |
|
|
status =
|
2161 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_RX_SIDE_SCL, 1024,
|
2162 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
2163 |
|
|
|
2164 |
|
|
if (status == MCAPI_SUCCESS)
|
2165 |
|
|
{
|
2166 |
|
|
/* Wait for the response. */
|
2167 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
2168 |
|
|
|
2169 |
|
|
/* Tell the other side to delete the endpoint. */
|
2170 |
|
|
status =
|
2171 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
2172 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
2173 |
|
|
|
2174 |
|
|
if (status == MCAPI_SUCCESS)
|
2175 |
|
|
{
|
2176 |
|
|
/* Wait for the response. */
|
2177 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
2178 |
|
|
}
|
2179 |
|
|
}
|
2180 |
|
|
}
|
2181 |
|
|
}
|
2182 |
|
|
}
|
2183 |
|
|
|
2184 |
|
|
/* Set the state of the test to completed. */
|
2185 |
|
|
mcapi_struct->state = 0;
|
2186 |
|
|
|
2187 |
|
|
/* Allow the next test to run. */
|
2188 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
2189 |
|
|
|
2190 |
|
|
} /* MCAPI_FTS_Tx_2_25_15 */
|