1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** USBX Component */
16 /** */
17 /** Host Stack */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22
23 /* Include necessary system files. */
24
25 #define UX_SOURCE_CODE
26
27 #include "ux_api.h"
28 #include "ux_host_stack.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _ux_host_stack_endpoint_transfer_abort PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Chaoqiong Xiao, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function cancel all the transfer_requests attached to an */
44 /* endpoint. The endpoint is not reset and its toggle state is left */
45 /* the same. */
46 /* */
47 /* In this version of USBX, there can only be one transfer request */
48 /* pending for an endpoint. It is not known at this stage if having */
49 /* multiple transfer request is a benefit for USBX but this function */
50 /* may be changed one day to add such functionality. */
51 /* */
52 /* INPUT */
53 /* */
54 /* endpoint Endpoint to abort transfer */
55 /* */
56 /* OUTPUT */
57 /* */
58 /* Completion Status */
59 /* */
60 /* CALLS */
61 /* */
62 /* _ux_host_stack_transfer_request_abort Transfer request abort */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* Application */
67 /* USBX Components */
68 /* */
69 /* RELEASE HISTORY */
70 /* */
71 /* DATE NAME DESCRIPTION */
72 /* */
73 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
74 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
75 /* resulting in version 6.1 */
76 /* */
77 /**************************************************************************/
_ux_host_stack_endpoint_transfer_abort(UX_ENDPOINT * endpoint)78 UINT _ux_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint)
79 {
80
81 UINT status;
82
83 /* If trace is enabled, insert this event into the trace buffer. */
84 UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_STACK_ENDPOINT_TRANSFER_ABORT, endpoint, 0, 0, 0, UX_TRACE_HOST_STACK_EVENTS, 0, 0)
85
86 /* Since we only have one transfer_request per endpoint, use the regular
87 abort transfer request function. */
88 status = _ux_host_stack_transfer_request_abort(&endpoint -> ux_endpoint_transfer_request);
89
90 /* Return completion status. */
91 return(status);
92 }
93
94
95 /**************************************************************************/
96 /* */
97 /* FUNCTION RELEASE */
98 /* */
99 /* _uxe_host_stack_endpoint_transfer_abort PORTABLE C */
100 /* 6.3.0 */
101 /* AUTHOR */
102 /* */
103 /* Chaoqiong Xiao, Microsoft Corporation */
104 /* */
105 /* DESCRIPTION */
106 /* */
107 /* This function checks errors in host stack endpoint transfer abort */
108 /* function call. */
109 /* */
110 /* INPUT */
111 /* */
112 /* endpoint Endpoint to abort transfer */
113 /* */
114 /* OUTPUT */
115 /* */
116 /* None */
117 /* */
118 /* CALLS */
119 /* */
120 /* _ux_host_stack_endpoint_transfer_abort */
121 /* Endpoint transfer abort */
122 /* */
123 /* CALLED BY */
124 /* */
125 /* Application */
126 /* */
127 /* RELEASE HISTORY */
128 /* */
129 /* DATE NAME DESCRIPTION */
130 /* */
131 /* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */
132 /* */
133 /**************************************************************************/
_uxe_host_stack_endpoint_transfer_abort(UX_ENDPOINT * endpoint)134 UINT _uxe_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint)
135 {
136
137 /* Sanity check. */
138 if (endpoint == UX_NULL)
139 return(UX_INVALID_PARAMETER);
140
141 /* Invoke transfer abort function. */
142 return(_ux_host_stack_endpoint_transfer_abort(endpoint));
143 }
144