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 /** Device Stack */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define UX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "ux_api.h"
28 #include "ux_device_stack.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _ux_device_stack_transfer_all_request_abort PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Chaoqiong Xiao, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function cancels 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 /* INPUT */
48 /* */
49 /* transfer_request Pointer to transfer request */
50 /* completion_code Completion code */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* Completion Status */
55 /* */
56 /* CALLS */
57 /* */
58 /* _ux_device_stack_transfer_abort Transfer abort */
59 /* */
60 /* CALLED BY */
61 /* */
62 /* Device Stack */
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 /* */
72 /**************************************************************************/
_ux_device_stack_transfer_all_request_abort(UX_SLAVE_ENDPOINT * endpoint,ULONG completion_code)73 UINT _ux_device_stack_transfer_all_request_abort(UX_SLAVE_ENDPOINT *endpoint, ULONG completion_code)
74 {
75
76 UX_SLAVE_TRANSFER *transfer_request;
77
78 /* If trace is enabled, insert this event into the trace buffer. */
79 UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_STACK_TRANSFER_ALL_REQUEST_ABORT, endpoint, completion_code, 0, 0, UX_TRACE_DEVICE_STACK_EVENTS, 0, 0)
80
81 /* Get the transfer request for this endpoint. */
82 transfer_request = &endpoint -> ux_slave_endpoint_transfer_request;
83
84 /* Abort this request. */
85 _ux_device_stack_transfer_abort(transfer_request, completion_code);
86
87 /* Return successful completion. */
88 return(UX_SUCCESS);
89 }
90
91