1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** USBX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Host Stack */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
/**************************************************************************/ |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#define UX_SOURCE_CODE |
27 |
|
|
|
28 |
|
|
#include "ux_api.h" |
29 |
|
|
#include "ux_host_stack.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _ux_host_stack_class_interface_scan PORTABLE C */ |
37 |
|
|
/* 6.1.4 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Chaoqiong Xiao, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function will scan all default interfaces for a single */ |
45 |
|
|
/* configuration and call the registered class with the */ |
46 |
|
|
/* Class/SubClass/Protocol of the interface. */ |
47 |
|
|
/* */ |
48 |
|
|
/* If the device has multiple configurations (like the Apple iPod), */ |
49 |
|
|
/* the first configuration is treated as the default configuration. */ |
50 |
|
|
/* If a device which has multiple configurations wants to control the */ |
51 |
|
|
/* configuration selection, it must ensure that the PID/VID based */ |
52 |
|
|
/* class at the device level claims the entire device. */ |
53 |
|
|
/* */ |
54 |
|
|
/* */ |
55 |
|
|
/* For the interface, there is no reason to use the PID/VID has a */ |
56 |
|
|
/* binding element as classes that trigger on PID/VID will be called */ |
57 |
|
|
/* by the device descriptor scanning process. */ |
58 |
|
|
/* */ |
59 |
|
|
/* INPUT */ |
60 |
|
|
/* */ |
61 |
|
|
/* device Device pointer */ |
62 |
|
|
/* */ |
63 |
|
|
/* OUTPUT */ |
64 |
|
|
/* */ |
65 |
|
|
/* Result of operation */ |
66 |
|
|
/* */ |
67 |
|
|
/* CALLS */ |
68 |
|
|
/* */ |
69 |
|
|
/* _ux_host_stack_class_call Call class command */ |
70 |
|
|
/* _ux_host_stack_device_configuration_select */ |
71 |
|
|
/* Select configuration */ |
72 |
|
|
/* (ux_host_stack_class_call) Call class from host stack */ |
73 |
|
|
/* (ux_host_class_entry_function) Class entry function */ |
74 |
|
|
/* */ |
75 |
|
|
/* CALLED BY */ |
76 |
|
|
/* */ |
77 |
|
|
/* USBX Components */ |
78 |
|
|
/* */ |
79 |
|
|
/**************************************************************************/ |
80 |
|
840 |
UINT _ux_host_stack_class_interface_scan(UX_DEVICE *device) |
81 |
|
|
{ |
82 |
|
|
|
83 |
|
|
UX_CONFIGURATION *configuration; |
84 |
|
|
UINT status; |
85 |
|
|
|
86 |
|
|
|
87 |
|
|
/* Get the 1st and only configuration. If the device has multiple |
88 |
|
|
configurations, we simply use the first one as default. */ |
89 |
|
840 |
configuration = device -> ux_device_first_configuration; |
90 |
✓✓ |
840 |
if (configuration == UX_NULL) |
91 |
|
1 |
return(UX_ERROR); |
92 |
|
|
|
93 |
|
|
/* Scan interfaces for this configuration. */ |
94 |
|
839 |
status = _ux_host_stack_configuration_interface_scan(configuration); |
95 |
|
|
|
96 |
|
|
/* Return operation result. */ |
97 |
|
838 |
return(status); |
98 |
|
|
} |
99 |
|
|
|