blob: 7fa996a32edb703fa65a3f81e36f81555201985c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/***************************************************************************/
/* Copyright (c) 2024 Microsoft Corporation */
/* Copyright (c) 2026 Eclipse ThreadX contributors */
/* */
/* This program and the accompanying materials are made available under */
/* the terms of the MIT License which is available at */
/* https://opensource.org/licenses/MIT. */
/* */
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* This tests the ux_host_class_hub_status_get.c API. */
#include "usbx_ux_test_hub.h"
#ifdef CTEST
void test_application_define(void *first_unused_memory)
#else
void usbx_ux_host_class_hub_status_get_test_application_define(void *first_unused_memory)
#endif
{
/* Inform user. */
printf("Running ux_host_class_hub_status_get Test........................... ");
stepinfo("\n");
initialize_hub(first_unused_memory);
}
static void post_init_host()
{
USHORT port_status;
USHORT port_change;
/** Test sending request to port 0 (hub itself). **/
/* Make get port status action for returning immediately. */
UX_TEST_SETUP get_port_status_setup = {0};
get_port_status_setup.ux_test_setup_request = UX_HOST_CLASS_HUB_GET_STATUS;
get_port_status_setup.ux_test_setup_type = UX_REQUEST_IN | UX_REQUEST_TYPE_CLASS | UX_REQUEST_TARGET_DEVICE;
get_port_status_setup.ux_test_setup_index = 0;
UX_TEST_ACTION get_port_status_match_action = {0};
get_port_status_match_action.usbx_function = UX_TEST_OVERRIDE_UX_HCD_SIM_HOST_ENTRY;
get_port_status_match_action.function = UX_HCD_TRANSFER_REQUEST;
get_port_status_match_action.req_action = UX_TEST_SETUP_MATCH_REQUEST | UX_TEST_SETUP_MATCH_INDEX;
get_port_status_match_action.req_setup = &get_port_status_setup;
get_port_status_match_action.no_return = 1;
ux_test_add_action_to_main_list(get_port_status_match_action);
UX_TEST_CHECK_SUCCESS(_ux_host_class_hub_status_get(g_hub_host, 0, &port_status, &port_change));
UX_TEST_ASSERT(ux_test_check_actions_empty() == UX_TRUE);
/** Test memory allocation failure. **/
ux_test_utility_sim_mem_allocate_until_flagged(0, UX_REGULAR_MEMORY);
ux_test_add_action_to_main_list(create_error_match_action(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_UTILITY, UX_MEMORY_INSUFFICIENT));
UX_TEST_CHECK_NOT_SUCCESS(_ux_host_class_hub_status_get(g_hub_host, 0, &port_status, &port_change));
}
static void post_init_device()
{
}
|