OpenCores
URL https://opencores.org/ocsvn/funbase_ip_library/funbase_ip_library/trunk

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.swp.api/] [openmcapi/] [1.0/] [test/] [func/] [fts_mcapi_pktchan_free.c] - Blame information for rev 145

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.