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_30_1
|
48 |
|
|
*
|
49 |
|
|
* DESCRIPTION
|
50 |
|
|
*
|
51 |
|
|
* Testing mcapi_sclchan_available - zero scalars available.
|
52 |
|
|
*
|
53 |
|
|
* Node 0 – Create endpoint, open send side, wait for connection
|
54 |
|
|
*
|
55 |
|
|
* Node 1 – Create endpoint, open receive side, get endpoint on
|
56 |
|
|
* Node 0, open connection, check for scalar count on
|
57 |
|
|
* endpoint.
|
58 |
|
|
*
|
59 |
|
|
*************************************************************************/
|
60 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_30_1)
|
61 |
|
|
{
|
62 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
63 |
|
|
size_t rx_len;
|
64 |
|
|
mcapi_status_t status;
|
65 |
|
|
mcapi_endpoint_t tx_endp;
|
66 |
|
|
mcapi_request_t request;
|
67 |
|
|
|
68 |
|
|
/* Don't let any other test run while this test is running. */
|
69 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
70 |
|
|
|
71 |
|
|
/* Indicate that a remote endpoint should be created. */
|
72 |
|
|
mcapi_struct->status =
|
73 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
74 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
75 |
|
|
|
76 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
77 |
|
|
{
|
78 |
|
|
/* Wait for a response. */
|
79 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
80 |
|
|
|
81 |
|
|
/* If the endpoint was created. */
|
82 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
83 |
|
|
{
|
84 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
85 |
|
|
mcapi_struct->status =
|
86 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
|
87 |
|
|
1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
88 |
|
|
|
89 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
90 |
|
|
{
|
91 |
|
|
/* Wait for a response. */
|
92 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
93 |
|
|
|
94 |
|
|
/* If the send side was opened. */
|
95 |
|
|
if (mcapi_struct->status ==MGC_MCAPI_ERR_NOT_CONNECTED)
|
96 |
|
|
{
|
97 |
|
|
/* Get the send side endpoint. */
|
98 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
99 |
|
|
|
100 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
101 |
|
|
{
|
102 |
|
|
/* Connect the two endpoints. */
|
103 |
|
|
mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
|
104 |
|
|
&mcapi_struct->request,
|
105 |
|
|
&mcapi_struct->status);
|
106 |
|
|
|
107 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
108 |
|
|
{
|
109 |
|
|
/* Wait for the connection to complete. */
|
110 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
111 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
112 |
|
|
|
113 |
|
|
/* Open the local endpoint as the receiver. */
|
114 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
|
115 |
|
|
mcapi_struct->local_endp,
|
116 |
|
|
&request, &mcapi_struct->status);
|
117 |
|
|
|
118 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
119 |
|
|
{
|
120 |
|
|
/* Wait for the open to return successfully. */
|
121 |
|
|
mcapi_wait(&request, &rx_len,
|
122 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
123 |
|
|
|
124 |
|
|
/* Check the number of scalars available for
|
125 |
|
|
* receiving. It should be zero.
|
126 |
|
|
*/
|
127 |
|
|
if (mcapi_sclchan_available(mcapi_struct->scl_rx_handle,
|
128 |
|
|
&status) != 0)
|
129 |
|
|
{
|
130 |
|
|
mcapi_struct->status = -1;
|
131 |
|
|
}
|
132 |
|
|
|
133 |
|
|
else
|
134 |
|
|
{
|
135 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
/* Close the receive side. */
|
139 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
140 |
|
|
&request, &status);
|
141 |
|
|
}
|
142 |
|
|
}
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
/* Tell the other side to close the send side. */
|
146 |
|
|
status =
|
147 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
148 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
149 |
|
|
|
150 |
|
|
if (status == MCAPI_SUCCESS)
|
151 |
|
|
{
|
152 |
|
|
/* Wait for the response. */
|
153 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
154 |
|
|
}
|
155 |
|
|
}
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
/* Tell the other side to delete the endpoint. */
|
159 |
|
|
status =
|
160 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
161 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
162 |
|
|
|
163 |
|
|
if (status == MCAPI_SUCCESS)
|
164 |
|
|
{
|
165 |
|
|
/* Wait for the response. */
|
166 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
167 |
|
|
}
|
168 |
|
|
}
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
/* Set the state of the test to completed. */
|
172 |
|
|
mcapi_struct->state = 0;
|
173 |
|
|
|
174 |
|
|
/* Allow the next test to run. */
|
175 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
176 |
|
|
|
177 |
|
|
} /* MCAPI_FTS_Tx_2_30_1 */
|
178 |
|
|
|
179 |
|
|
/************************************************************************
|
180 |
|
|
*
|
181 |
|
|
* FUNCTION
|
182 |
|
|
*
|
183 |
|
|
* MCAPI_FTS_Tx_2_30_2
|
184 |
|
|
*
|
185 |
|
|
* DESCRIPTION
|
186 |
|
|
*
|
187 |
|
|
* Testing mcapi_sclchan_available - One scalar available.
|
188 |
|
|
*
|
189 |
|
|
* For each scalar size:
|
190 |
|
|
*
|
191 |
|
|
* Node 0 – Create endpoint, open send side, wait for connection,
|
192 |
|
|
* send a scalar of each size.
|
193 |
|
|
*
|
194 |
|
|
* Node 1 – Create endpoint, open receive side, get endpoint on
|
195 |
|
|
* Node 0, open connection, check for scalar count
|
196 |
|
|
* on endpoint.
|
197 |
|
|
*
|
198 |
|
|
*************************************************************************/
|
199 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_30_2)
|
200 |
|
|
{
|
201 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
202 |
|
|
size_t rx_len;
|
203 |
|
|
mcapi_status_t status;
|
204 |
|
|
mcapi_endpoint_t tx_endp, rx_endp;
|
205 |
|
|
mcapi_request_t request;
|
206 |
|
|
int i;
|
207 |
|
|
mcapi_uint64_t recv_64bit;
|
208 |
|
|
mcapi_uint32_t recv_32bit;
|
209 |
|
|
mcapi_uint16_t recv_16bit;
|
210 |
|
|
mcapi_uint8_t recv_8bit;
|
211 |
|
|
|
212 |
|
|
/* Don't let any other test run while this test is running. */
|
213 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
214 |
|
|
|
215 |
|
|
/* An extra endpoint is required for the connection. */
|
216 |
|
|
rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
|
217 |
|
|
|
218 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
219 |
|
|
{
|
220 |
|
|
/* Indicate that a remote endpoint should be created. */
|
221 |
|
|
mcapi_struct->status =
|
222 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
223 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
224 |
|
|
|
225 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
226 |
|
|
{
|
227 |
|
|
/* Wait for a response. */
|
228 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
229 |
|
|
|
230 |
|
|
/* If the endpoint was created. */
|
231 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
232 |
|
|
{
|
233 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
234 |
|
|
mcapi_struct->status =
|
235 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
|
236 |
|
|
1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
237 |
|
|
|
238 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
239 |
|
|
{
|
240 |
|
|
/* Wait for a response. */
|
241 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
242 |
|
|
|
243 |
|
|
/* If the receive side was opened. */
|
244 |
|
|
if (mcapi_struct->status ==MGC_MCAPI_ERR_NOT_CONNECTED)
|
245 |
|
|
{
|
246 |
|
|
/* Get the send side endpoint. */
|
247 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
248 |
|
|
|
249 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
250 |
|
|
{
|
251 |
|
|
/* Connect the two endpoints. */
|
252 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
253 |
|
|
&mcapi_struct->request,
|
254 |
|
|
&mcapi_struct->status);
|
255 |
|
|
|
256 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
257 |
|
|
{
|
258 |
|
|
/* Wait for the connection to complete. */
|
259 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
260 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
261 |
|
|
|
262 |
|
|
/* Open the local endpoint as the receiver. */
|
263 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle, rx_endp,
|
264 |
|
|
&request, &mcapi_struct->status);
|
265 |
|
|
|
266 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
267 |
|
|
{
|
268 |
|
|
/* Wait for the open to return successfully. */
|
269 |
|
|
mcapi_wait(&request, &rx_len,
|
270 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
271 |
|
|
|
272 |
|
|
/* Test each scalar size. */
|
273 |
|
|
for (i = MCAPID_TX_64_BIT_SCL; i <= MCAPID_TX_8_BIT_SCL; i ++)
|
274 |
|
|
{
|
275 |
|
|
/* Tell the other side to send some data. */
|
276 |
|
|
mcapi_struct->status =
|
277 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, i, 1024,
|
278 |
|
|
mcapi_struct->local_endp,
|
279 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
280 |
|
|
|
281 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
282 |
|
|
{
|
283 |
|
|
/* Wait for the response. */
|
284 |
|
|
mcapi_struct->status =
|
285 |
|
|
MCAPID_RX_Mgmt_Response(mcapi_struct);
|
286 |
|
|
|
287 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
288 |
|
|
{
|
289 |
|
|
/* Check the number of scalars available for
|
290 |
|
|
* receiving. It should be one.
|
291 |
|
|
*/
|
292 |
|
|
if (mcapi_sclchan_available(mcapi_struct->scl_rx_handle,
|
293 |
|
|
&status) != 1)
|
294 |
|
|
{
|
295 |
|
|
mcapi_struct->status = -1;
|
296 |
|
|
break;
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
else
|
300 |
|
|
{
|
301 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
302 |
|
|
}
|
303 |
|
|
|
304 |
|
|
/* Receive the proper scalar size. */
|
305 |
|
|
switch (i)
|
306 |
|
|
{
|
307 |
|
|
case MCAPID_TX_64_BIT_SCL:
|
308 |
|
|
|
309 |
|
|
recv_64bit =
|
310 |
|
|
mcapi_sclchan_recv_uint64(mcapi_struct->scl_rx_handle,
|
311 |
|
|
&mcapi_struct->status);
|
312 |
|
|
|
313 |
|
|
/* If success was returned, ensure the proper scalar
|
314 |
|
|
* was received.
|
315 |
|
|
*/
|
316 |
|
|
if ( (mcapi_struct->status == MCAPI_SUCCESS) &&
|
317 |
|
|
(recv_64bit != MCAPI_FTS_64BIT_SCALAR) )
|
318 |
|
|
{
|
319 |
|
|
mcapi_struct->status = -1;
|
320 |
|
|
}
|
321 |
|
|
|
322 |
|
|
break;
|
323 |
|
|
|
324 |
|
|
case MCAPID_TX_32_BIT_SCL:
|
325 |
|
|
|
326 |
|
|
recv_32bit =
|
327 |
|
|
mcapi_sclchan_recv_uint32(mcapi_struct->scl_rx_handle,
|
328 |
|
|
&mcapi_struct->status);
|
329 |
|
|
|
330 |
|
|
/* If success was returned, ensure the proper scalar
|
331 |
|
|
* was received.
|
332 |
|
|
*/
|
333 |
|
|
if ( (mcapi_struct->status == MCAPI_SUCCESS) &&
|
334 |
|
|
(recv_32bit != MCAPI_FTS_32BIT_SCALAR) )
|
335 |
|
|
{
|
336 |
|
|
mcapi_struct->status = -1;
|
337 |
|
|
}
|
338 |
|
|
|
339 |
|
|
break;
|
340 |
|
|
|
341 |
|
|
case MCAPID_TX_16_BIT_SCL:
|
342 |
|
|
|
343 |
|
|
recv_16bit =
|
344 |
|
|
mcapi_sclchan_recv_uint16(mcapi_struct->scl_rx_handle,
|
345 |
|
|
&mcapi_struct->status);
|
346 |
|
|
|
347 |
|
|
/* If success was returned, ensure the proper scalar
|
348 |
|
|
* was received.
|
349 |
|
|
*/
|
350 |
|
|
if ( (mcapi_struct->status == MCAPI_SUCCESS) &&
|
351 |
|
|
(recv_16bit != MCAPI_FTS_16BIT_SCALAR) )
|
352 |
|
|
{
|
353 |
|
|
mcapi_struct->status = -1;
|
354 |
|
|
}
|
355 |
|
|
|
356 |
|
|
break;
|
357 |
|
|
|
358 |
|
|
case MCAPID_TX_8_BIT_SCL:
|
359 |
|
|
|
360 |
|
|
recv_8bit =
|
361 |
|
|
mcapi_sclchan_recv_uint8(mcapi_struct->scl_rx_handle,
|
362 |
|
|
&mcapi_struct->status);
|
363 |
|
|
|
364 |
|
|
/* If success was returned, ensure the proper scalar
|
365 |
|
|
* was received.
|
366 |
|
|
*/
|
367 |
|
|
if ( (mcapi_struct->status == MCAPI_SUCCESS) &&
|
368 |
|
|
(recv_8bit != MCAPI_FTS_8BIT_SCALAR) )
|
369 |
|
|
{
|
370 |
|
|
mcapi_struct->status = -1;
|
371 |
|
|
}
|
372 |
|
|
|
373 |
|
|
break;
|
374 |
|
|
|
375 |
|
|
default:
|
376 |
|
|
|
377 |
|
|
break;
|
378 |
|
|
}
|
379 |
|
|
|
380 |
|
|
if (mcapi_struct->status != MCAPI_SUCCESS)
|
381 |
|
|
break;
|
382 |
|
|
}
|
383 |
|
|
|
384 |
|
|
else
|
385 |
|
|
break;
|
386 |
|
|
}
|
387 |
|
|
|
388 |
|
|
else
|
389 |
|
|
break;
|
390 |
|
|
}
|
391 |
|
|
|
392 |
|
|
/* Close the receive side. */
|
393 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
394 |
|
|
&request, &status);
|
395 |
|
|
}
|
396 |
|
|
}
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
/* Tell the other side to close the send side. */
|
400 |
|
|
status =
|
401 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
402 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
403 |
|
|
|
404 |
|
|
if (status == MCAPI_SUCCESS)
|
405 |
|
|
{
|
406 |
|
|
/* Wait for the response. */
|
407 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
408 |
|
|
}
|
409 |
|
|
}
|
410 |
|
|
}
|
411 |
|
|
|
412 |
|
|
/* Tell the other side to delete the endpoint. */
|
413 |
|
|
status =
|
414 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
415 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
416 |
|
|
|
417 |
|
|
if (status == MCAPI_SUCCESS)
|
418 |
|
|
{
|
419 |
|
|
/* Wait for the response. */
|
420 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
421 |
|
|
}
|
422 |
|
|
}
|
423 |
|
|
}
|
424 |
|
|
|
425 |
|
|
/* Delete the endpoint used in the connection. */
|
426 |
|
|
mcapi_delete_endpoint(rx_endp, &status);
|
427 |
|
|
}
|
428 |
|
|
|
429 |
|
|
/* Set the state of the test to completed. */
|
430 |
|
|
mcapi_struct->state = 0;
|
431 |
|
|
|
432 |
|
|
/* Allow the next test to run. */
|
433 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
434 |
|
|
|
435 |
|
|
} /* MCAPI_FTS_Tx_2_30_2 */
|
436 |
|
|
|
437 |
|
|
/************************************************************************
|
438 |
|
|
*
|
439 |
|
|
* FUNCTION
|
440 |
|
|
*
|
441 |
|
|
* MCAPI_FTS_Tx_2_30_3
|
442 |
|
|
*
|
443 |
|
|
* DESCRIPTION
|
444 |
|
|
*
|
445 |
|
|
* Testing mcapi_sclchan_available - Four scalars available, one of
|
446 |
|
|
* each size.
|
447 |
|
|
*
|
448 |
|
|
* For each scalar size:
|
449 |
|
|
*
|
450 |
|
|
* Node 0 – Create endpoint, open send side, wait for connection,
|
451 |
|
|
* send a scalar of each size.
|
452 |
|
|
*
|
453 |
|
|
* Node 1 – Create endpoint, open receive side, get endpoint on
|
454 |
|
|
* Node 0, open connection, check for scalar count
|
455 |
|
|
* on endpoint.
|
456 |
|
|
*
|
457 |
|
|
*************************************************************************/
|
458 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_30_3)
|
459 |
|
|
{
|
460 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
461 |
|
|
size_t rx_len;
|
462 |
|
|
mcapi_status_t status;
|
463 |
|
|
mcapi_endpoint_t tx_endp, rx_endp;
|
464 |
|
|
mcapi_request_t request;
|
465 |
|
|
int i;
|
466 |
|
|
|
467 |
|
|
/* Don't let any other test run while this test is running. */
|
468 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
469 |
|
|
|
470 |
|
|
/* An extra endpoint is required for the connection. */
|
471 |
|
|
rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
|
472 |
|
|
|
473 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
474 |
|
|
{
|
475 |
|
|
/* Indicate that a remote endpoint should be created. */
|
476 |
|
|
mcapi_struct->status =
|
477 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
478 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
479 |
|
|
|
480 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
481 |
|
|
{
|
482 |
|
|
/* Wait for a response. */
|
483 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
484 |
|
|
|
485 |
|
|
/* If the endpoint was created. */
|
486 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
487 |
|
|
{
|
488 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
489 |
|
|
mcapi_struct->status =
|
490 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
|
491 |
|
|
1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
492 |
|
|
|
493 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
494 |
|
|
{
|
495 |
|
|
/* Wait for a response. */
|
496 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
497 |
|
|
|
498 |
|
|
/* If the receive side was opened. */
|
499 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
500 |
|
|
{
|
501 |
|
|
/* Get the send side endpoint. */
|
502 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
503 |
|
|
|
504 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
505 |
|
|
{
|
506 |
|
|
/* Connect the two endpoints. */
|
507 |
|
|
mcapi_connect_sclchan_i(tx_endp, rx_endp,
|
508 |
|
|
&mcapi_struct->request,
|
509 |
|
|
&mcapi_struct->status);
|
510 |
|
|
|
511 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
512 |
|
|
{
|
513 |
|
|
/* Wait for the connection to complete. */
|
514 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
515 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
516 |
|
|
|
517 |
|
|
/* Open the local endpoint as the receiver. */
|
518 |
|
|
mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle, rx_endp,
|
519 |
|
|
&request, &mcapi_struct->status);
|
520 |
|
|
|
521 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
522 |
|
|
{
|
523 |
|
|
/* Wait for the open to return successfully. */
|
524 |
|
|
mcapi_wait(&request, &rx_len,
|
525 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
526 |
|
|
|
527 |
|
|
/* Test each scalar size. */
|
528 |
|
|
for (i = MCAPID_TX_64_BIT_SCL; i <= MCAPID_TX_8_BIT_SCL; i ++)
|
529 |
|
|
{
|
530 |
|
|
/* Tell the other side to send some data. */
|
531 |
|
|
mcapi_struct->status =
|
532 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, i, 1024,
|
533 |
|
|
mcapi_struct->local_endp,
|
534 |
|
|
0, MCAPI_DEFAULT_PRIO);
|
535 |
|
|
|
536 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
537 |
|
|
{
|
538 |
|
|
/* Wait for the response. */
|
539 |
|
|
mcapi_struct->status =
|
540 |
|
|
MCAPID_RX_Mgmt_Response(mcapi_struct);
|
541 |
|
|
|
542 |
|
|
if (mcapi_struct->status != MCAPI_SUCCESS)
|
543 |
|
|
{
|
544 |
|
|
break;
|
545 |
|
|
}
|
546 |
|
|
}
|
547 |
|
|
}
|
548 |
|
|
|
549 |
|
|
/* Check the number of scalars available for
|
550 |
|
|
* receiving. It should be four.
|
551 |
|
|
*/
|
552 |
|
|
if (mcapi_sclchan_available(mcapi_struct->scl_rx_handle,
|
553 |
|
|
&status) != 4)
|
554 |
|
|
{
|
555 |
|
|
mcapi_struct->status = -1;
|
556 |
|
|
}
|
557 |
|
|
|
558 |
|
|
else
|
559 |
|
|
{
|
560 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
561 |
|
|
}
|
562 |
|
|
|
563 |
|
|
/* Close the receive side. */
|
564 |
|
|
mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
|
565 |
|
|
&request, &status);
|
566 |
|
|
}
|
567 |
|
|
}
|
568 |
|
|
}
|
569 |
|
|
|
570 |
|
|
/* Tell the other side to close the send side. */
|
571 |
|
|
status =
|
572 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1024,
|
573 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
574 |
|
|
|
575 |
|
|
if (status == MCAPI_SUCCESS)
|
576 |
|
|
{
|
577 |
|
|
/* Wait for the response. */
|
578 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
579 |
|
|
}
|
580 |
|
|
}
|
581 |
|
|
}
|
582 |
|
|
|
583 |
|
|
/* Tell the other side to delete the endpoint. */
|
584 |
|
|
status =
|
585 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
586 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
587 |
|
|
|
588 |
|
|
if (status == MCAPI_SUCCESS)
|
589 |
|
|
{
|
590 |
|
|
/* Wait for the response. */
|
591 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
592 |
|
|
}
|
593 |
|
|
}
|
594 |
|
|
}
|
595 |
|
|
|
596 |
|
|
/* Delete the endpoint used in the connection. */
|
597 |
|
|
mcapi_delete_endpoint(rx_endp, &status);
|
598 |
|
|
}
|
599 |
|
|
|
600 |
|
|
/* Set the state of the test to completed. */
|
601 |
|
|
mcapi_struct->state = 0;
|
602 |
|
|
|
603 |
|
|
/* Allow the next test to run. */
|
604 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
605 |
|
|
|
606 |
|
|
} /* MCAPI_FTS_Tx_2_30_3 */
|