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_interface_instance_delete PORTABLE C */
37 /* 6.1.12 */
38 /* AUTHOR */
39 /* */
40 /* Chaoqiong Xiao, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function will delete an interface instance. It does not delete */
45 /* the interface container, but it removes all the endpoints */
46 /* associated with alternate setting. */
47 /* */
48 /* INPUT */
49 /* */
50 /* interface Pointer to interface */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* None */
55 /* */
56 /* CALLS */
57 /* */
58 /* _ux_host_stack_endpoint_instance_delete Delete endpoint */
59 /* */
60 /* CALLED BY */
61 /* */
62 /* USBX Components */
63 /* */
64 /* RELEASE HISTORY */
65 /* */
66 /* DATE NAME DESCRIPTION */
67 /* */
68 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
69 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
70 /* resulting in version 6.1 */
71 /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
72 /* fixed parameter/variable */
73 /* names conflict C++ keyword, */
74 /* resulting in version 6.1.12 */
75 /* */
76 /**************************************************************************/
_ux_host_stack_interface_instance_delete(UX_INTERFACE * interface_ptr)77 VOID _ux_host_stack_interface_instance_delete(UX_INTERFACE *interface_ptr)
78 {
79
80 UX_ENDPOINT *endpoint;
81
82 /* If trace is enabled, insert this event into the trace buffer. */
83 UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_DELETE, interface_ptr, 0, 0, 0, UX_TRACE_HOST_STACK_EVENTS, 0, 0)
84
85 /* If trace is enabled, register this object. */
86 UX_TRACE_OBJECT_UNREGISTER(interface_ptr);
87
88 /* Obtain the first endpoint for this alternate setting. */
89 endpoint = interface_ptr -> ux_interface_first_endpoint;
90
91 /* Loop to delete each endpoint. */
92 while (endpoint != UX_NULL)
93 {
94
95 /* Delete endpoint. */
96 _ux_host_stack_endpoint_instance_delete(endpoint);
97
98 /* Move to next endpoint. */
99 endpoint = endpoint -> ux_endpoint_next_endpoint;
100 }
101
102 /* Return to caller. */
103 return;
104 }
105
106