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_endpoint_transfer_abort PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Chaoqiong Xiao, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function cancel all the transfer_requests attached to an */ |
45 |
|
|
/* endpoint. The endpoint is not reset and its toggle state is left */ |
46 |
|
|
/* the same. */ |
47 |
|
|
/* */ |
48 |
|
|
/* In this version of USBX, there can only be one transfer request */ |
49 |
|
|
/* pending for an endpoint. It is not known at this stage if having */ |
50 |
|
|
/* multiple transfer request is a benefit for USBX but this function */ |
51 |
|
|
/* may be changed one day to add such functionality. */ |
52 |
|
|
/* */ |
53 |
|
|
/* INPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* endpoint Endpoint to abort transfer */ |
56 |
|
|
/* */ |
57 |
|
|
/* OUTPUT */ |
58 |
|
|
/* */ |
59 |
|
|
/* Completion Status */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLS */ |
62 |
|
|
/* */ |
63 |
|
|
/* _ux_host_stack_transfer_request_abort Transfer request abort */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* Application */ |
68 |
|
|
/* USBX Components */ |
69 |
|
|
/* */ |
70 |
|
|
/**************************************************************************/ |
71 |
|
1925 |
UINT _ux_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint) |
72 |
|
|
{ |
73 |
|
|
|
74 |
|
|
UINT status; |
75 |
|
|
|
76 |
|
|
/* If trace is enabled, insert this event into the trace buffer. */ |
77 |
|
|
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_STACK_ENDPOINT_TRANSFER_ABORT, endpoint, 0, 0, 0, UX_TRACE_HOST_STACK_EVENTS, 0, 0) |
78 |
|
|
|
79 |
|
|
/* Since we only have one transfer_request per endpoint, use the regular |
80 |
|
|
abort transfer request function. */ |
81 |
|
1925 |
status = _ux_host_stack_transfer_request_abort(&endpoint -> ux_endpoint_transfer_request); |
82 |
|
|
|
83 |
|
|
/* Return completion status. */ |
84 |
|
1924 |
return(status); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
|
88 |
|
|
/**************************************************************************/ |
89 |
|
|
/* */ |
90 |
|
|
/* FUNCTION RELEASE */ |
91 |
|
|
/* */ |
92 |
|
|
/* _uxe_host_stack_endpoint_transfer_abort PORTABLE C */ |
93 |
|
|
/* 6.3.0 */ |
94 |
|
|
/* AUTHOR */ |
95 |
|
|
/* */ |
96 |
|
|
/* Chaoqiong Xiao, Microsoft Corporation */ |
97 |
|
|
/* */ |
98 |
|
|
/* DESCRIPTION */ |
99 |
|
|
/* */ |
100 |
|
|
/* This function checks errors in host stack endpoint transfer abort */ |
101 |
|
|
/* function call. */ |
102 |
|
|
/* */ |
103 |
|
|
/* INPUT */ |
104 |
|
|
/* */ |
105 |
|
|
/* endpoint Endpoint to abort transfer */ |
106 |
|
|
/* */ |
107 |
|
|
/* OUTPUT */ |
108 |
|
|
/* */ |
109 |
|
|
/* None */ |
110 |
|
|
/* */ |
111 |
|
|
/* CALLS */ |
112 |
|
|
/* */ |
113 |
|
|
/* _ux_host_stack_endpoint_transfer_abort */ |
114 |
|
|
/* Endpoint transfer abort */ |
115 |
|
|
/* */ |
116 |
|
|
/* CALLED BY */ |
117 |
|
|
/* */ |
118 |
|
|
/* Application */ |
119 |
|
|
/* */ |
120 |
|
|
/**************************************************************************/ |
121 |
|
|
UINT _uxe_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint) |
122 |
|
|
{ |
123 |
|
|
|
124 |
|
|
/* Sanity check. */ |
125 |
|
|
if (endpoint == UX_NULL) |
126 |
|
|
return(UX_INVALID_PARAMETER); |
127 |
|
|
|
128 |
|
|
/* Invoke transfer abort function. */ |
129 |
|
|
return(_ux_host_stack_endpoint_transfer_abort(endpoint)); |
130 |
|
|
} |