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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
* Copyright (c) 2026-present 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
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** USBX Component */
/** */
/** HUB Class */
/** */
/**************************************************************************/
/**************************************************************************/
/* Include necessary system files. */
#define UX_SOURCE_CODE
#include "ux_api.h"
#include "ux_host_class_hub.h"
#include "ux_host_stack.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hub_change_detect PORTABLE C */
/* 6.1.12 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function is called by the enumeration thread when there has */
/* been activity on the HUB. */
/* */
/* In standalone mode there is nothing to do here, activities are */
/* processed in hub tasks function. */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* _ux_host_class_hub_change_process Process HUB change */
/* _ux_host_stack_class_get Get class */
/* _ux_host_stack_class_instance_get Get class instance */
/* */
/* CALLED BY */
/* */
/* HUB Class */
/* */
/**************************************************************************/
VOID _ux_host_class_hub_change_detect(VOID)
{
#if defined(UX_HOST_STANDALONE)
/* Things are done in hub task nothing to do here. */
#else
UX_HOST_CLASS *class;
UX_HOST_CLASS_HUB *hub;
UINT status;
UINT class_index;
/* Get the class container first. */
_ux_host_stack_class_get(_ux_system_host_class_hub_name, &class);
/* We start with the first index of the class instance. */
class_index = 0;
/* We have found the class, now parse the instances. */
do
{
/* Get class instance. */
status = _ux_host_stack_class_instance_get(class, class_index++, (VOID **) &hub);
/* Check completion status. */
if (status == UX_SUCCESS)
{
/* We have found an instance of a HUB, check if it is live and if the HUB has
detected a change before we proceed. */
if (hub -> ux_host_class_hub_change_semaphore != 0)
{
/* If trace is enabled, insert this event into the trace buffer. */
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_HUB_CHANGE_DETECT, hub, 0, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
/* Call the HUB function that will diagnose the origin of the change. */
_ux_host_class_hub_change_process(hub);
/* Decrement the HUB instance semaphore change so we don't get awaken again. */
hub -> ux_host_class_hub_change_semaphore--;
}
}
} while (status == UX_SUCCESS);
/* We have parsed all the HUB instances. */
return;
#endif
}
|