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_5_1
|
48 |
|
|
*
|
49 |
|
|
* DESCRIPTION
|
50 |
|
|
*
|
51 |
|
|
* Testing mcapi_get_endpoint for foreign endpoint, endpoint not
|
52 |
|
|
* created upon issuance of request.
|
53 |
|
|
*
|
54 |
|
|
* Node 0 – Waits for get endpoint request, then creates endpoint.
|
55 |
|
|
* Node 1 – Issues get endpoint request.
|
56 |
|
|
*
|
57 |
|
|
*************************************************************************/
|
58 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_5_1)
|
59 |
|
|
{
|
60 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
61 |
|
|
mcapi_endpoint_t endpoint = 0xffffffff;
|
62 |
|
|
mcapi_status_t status;
|
63 |
|
|
|
64 |
|
|
/* Don't let any other test run while this test is running. */
|
65 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
66 |
|
|
|
67 |
|
|
/* Indicate that the endpoint should be created. */
|
68 |
|
|
status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
|
69 |
|
|
1024, mcapi_struct->local_endp, 2000,
|
70 |
|
|
MCAPI_DEFAULT_PRIO);
|
71 |
|
|
status_assert(status);
|
72 |
|
|
|
73 |
|
|
/* Get the foreign endpoint. */
|
74 |
|
|
endpoint = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &status);
|
75 |
|
|
status_assert(status);
|
76 |
|
|
|
77 |
|
|
/* If the endpoint was created. */
|
78 |
|
|
if (endpoint != 0xffffffff)
|
79 |
|
|
{
|
80 |
|
|
/* Tell the other side to delete the endpoint. */
|
81 |
|
|
status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP,
|
82 |
|
|
1024, mcapi_struct->local_endp, 0,
|
83 |
|
|
MCAPI_DEFAULT_PRIO);
|
84 |
|
|
status_assert(status);
|
85 |
|
|
|
86 |
|
|
/* Wait for the response before releasing the mutex. */
|
87 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
/* Set the state of the test to completed. */
|
91 |
|
|
mcapi_struct->state = 0;
|
92 |
|
|
|
93 |
|
|
/* Allow the next test to run. */
|
94 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
95 |
|
|
|
96 |
|
|
} /* MCAPI_FTS_Tx_2_5_1 */
|
97 |
|
|
|
98 |
|
|
/************************************************************************
|
99 |
|
|
*
|
100 |
|
|
* FUNCTION
|
101 |
|
|
*
|
102 |
|
|
* MCAPI_FTS_Tx_2_5_2
|
103 |
|
|
*
|
104 |
|
|
* DESCRIPTION
|
105 |
|
|
*
|
106 |
|
|
* Testing mcapi_get_endpoint for foreign endpoint. Endpoint already
|
107 |
|
|
* exists upon issuance of request.
|
108 |
|
|
*
|
109 |
|
|
* Node 0 – Creates endpoint.
|
110 |
|
|
* Node 1 – Issues get endpoint request.
|
111 |
|
|
*
|
112 |
|
|
*************************************************************************/
|
113 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_5_2)
|
114 |
|
|
{
|
115 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
116 |
|
|
mcapi_endpoint_t endpoint = 0xffffffff;
|
117 |
|
|
mcapi_status_t status;
|
118 |
|
|
|
119 |
|
|
/* Don't let any other test run while this test is running. */
|
120 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
121 |
|
|
|
122 |
|
|
/* Indicate that the endpoint should be created. */
|
123 |
|
|
mcapi_struct->status =
|
124 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
125 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
126 |
|
|
|
127 |
|
|
/* Wait for a response. */
|
128 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
129 |
|
|
{
|
130 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
131 |
|
|
|
132 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
133 |
|
|
{
|
134 |
|
|
/* Get the foreign endpoint. */
|
135 |
|
|
endpoint = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
136 |
|
|
|
137 |
|
|
if ( (mcapi_struct->status == MCAPI_SUCCESS) && (endpoint != 0xffffffff) )
|
138 |
|
|
{
|
139 |
|
|
/* Tell the other side to delete the endpoint. */
|
140 |
|
|
status =
|
141 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
142 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
143 |
|
|
|
144 |
|
|
if (status == MCAPI_SUCCESS)
|
145 |
|
|
{
|
146 |
|
|
/* Wait for the response before releasing the mutex. */
|
147 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
148 |
|
|
}
|
149 |
|
|
}
|
150 |
|
|
}
|
151 |
|
|
}
|
152 |
|
|
|
153 |
|
|
/* Set the state of the test to completed. */
|
154 |
|
|
mcapi_struct->state = 0;
|
155 |
|
|
|
156 |
|
|
/* Allow the next test to run. */
|
157 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
158 |
|
|
|
159 |
|
|
} /* MCAPI_FTS_Tx_2_5_2 */
|