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_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 |
|
|
/**************************************************************************/ |
65 |
|
334 |
VOID _ux_host_stack_interface_instance_delete(UX_INTERFACE *interface_ptr) |
66 |
|
|
{ |
67 |
|
|
|
68 |
|
|
UX_ENDPOINT *endpoint; |
69 |
|
|
|
70 |
|
|
/* If trace is enabled, insert this event into the trace buffer. */ |
71 |
|
|
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_DELETE, interface_ptr, 0, 0, 0, UX_TRACE_HOST_STACK_EVENTS, 0, 0) |
72 |
|
|
|
73 |
|
|
/* If trace is enabled, register this object. */ |
74 |
|
|
UX_TRACE_OBJECT_UNREGISTER(interface_ptr); |
75 |
|
|
|
76 |
|
|
/* Obtain the first endpoint for this alternate setting. */ |
77 |
|
334 |
endpoint = interface_ptr -> ux_interface_first_endpoint; |
78 |
|
|
|
79 |
|
|
/* Loop to delete each endpoint. */ |
80 |
✓✓ |
546 |
while (endpoint != UX_NULL) |
81 |
|
|
{ |
82 |
|
|
|
83 |
|
|
/* Delete endpoint. */ |
84 |
|
212 |
_ux_host_stack_endpoint_instance_delete(endpoint); |
85 |
|
|
|
86 |
|
|
/* Move to next endpoint. */ |
87 |
|
212 |
endpoint = endpoint -> ux_endpoint_next_endpoint; |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
/* Return to caller. */ |
91 |
|
334 |
return; |
92 |
|
|
} |
93 |
|
|
|