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_8_1
|
48 |
|
|
*
|
49 |
|
|
* DESCRIPTION
|
50 |
|
|
*
|
51 |
|
|
* Testing mcapi_set_endpoint_attribute get MCAPI_ATTR_ENDP_PRIO for
|
52 |
|
|
* unconnected endpoint.
|
53 |
|
|
*
|
54 |
|
|
* Node 1 – Create endpoint, set MCAPI_ATTR_ENDP_PRIO.
|
55 |
|
|
*
|
56 |
|
|
*************************************************************************/
|
57 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_8_1)
|
58 |
|
|
{
|
59 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
60 |
|
|
mcapi_priority_t set_priority = (MCAPI_PRIO_COUNT - 1), get_priority;
|
61 |
|
|
|
62 |
|
|
/* Don't let any other test run while this test is running. */
|
63 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
64 |
|
|
|
65 |
|
|
/* Set the priority of the endpoint. */
|
66 |
|
|
mcapi_set_endpoint_attribute(mcapi_struct->local_endp, MCAPI_ATTR_ENDP_PRIO,
|
67 |
|
|
(void*)&set_priority, sizeof(set_priority),
|
68 |
|
|
&mcapi_struct->status);
|
69 |
|
|
|
70 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
71 |
|
|
{
|
72 |
|
|
/* Get the priority. */
|
73 |
|
|
mcapi_get_endpoint_attribute(mcapi_struct->local_endp, MCAPI_ATTR_ENDP_PRIO,
|
74 |
|
|
(void*)&get_priority, sizeof(get_priority),
|
75 |
|
|
&mcapi_struct->status);
|
76 |
|
|
|
77 |
|
|
/* Ensure the proper value was returned. */
|
78 |
|
|
if ( (mcapi_struct->status != MCAPI_SUCCESS) ||
|
79 |
|
|
(get_priority != set_priority) )
|
80 |
|
|
{
|
81 |
|
|
mcapi_struct->status = -1;
|
82 |
|
|
}
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
/* Set the state of the test to completed. */
|
86 |
|
|
mcapi_struct->state = 0;
|
87 |
|
|
|
88 |
|
|
/* Allow the next test to run. */
|
89 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
90 |
|
|
|
91 |
|
|
} /* MCAPI_FTS_Tx_2_8_1 */
|