1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
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 /* RELEASE HISTORY */
80 /* */
81 /* DATE NAME DESCRIPTION */
82 /* */
83 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
84 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
85 /* resulting in version 6.1 */
86 /* 02-02-2021 Chaoqiong Xiao Modified comment(s), */
87 /* used internal function call */
88 /* to scan interfaces, */
89 /* resulting in version 6.1.4 */
90 /* */
91 /**************************************************************************/
_ux_host_stack_class_interface_scan(UX_DEVICE * device)92 UINT _ux_host_stack_class_interface_scan(UX_DEVICE *device)
93 {
94
95 UX_CONFIGURATION *configuration;
96 UINT status;
97
98
99 /* Get the 1st and only configuration. If the device has multiple
100 configurations, we simply use the first one as default. */
101 configuration = device -> ux_device_first_configuration;
102 if (configuration == UX_NULL)
103 return(UX_ERROR);
104
105 /* Scan interfaces for this configuration. */
106 status = _ux_host_stack_configuration_interface_scan(configuration);
107
108 /* Return operation result. */
109 return(status);
110 }
111
112