Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
...
#define UX_SOURCE_CODE
#define UX_DCD_STM32_SOURCE_CODE
#include "ux_api.h"
#include "ux_dcd_stm32.h"
#include "ux_device_stack.h"
...
...
_ux_dcd_stm32_function(UX_SLAVE_DCD *, UINT, void *)
Files
SourceVuSTM32 Libraries and Samplesusbxcommon/usbx_stm32_device_controllers/ux_dcd_stm32_function.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ ... /**************************************************************************/ /**************************************************************************/ /** */ /** USBX Component */ /** */ /** STM32 Controller Driver */ /** */... /**************************************************************************/ /**************************************************************************/ #define UX_SOURCE_CODE #define UX_DCD_STM32_SOURCE_CODE /* Include necessary system files. */ #include "ux_api.h" #include "ux_dcd_stm32.h" #include "ux_device_stack.h" #if defined(UX_DEVICE_STANDALONE) extern VOID _ux_dcd_stm32_setup_isr_pending(UX_DCD_STM32 *); #endif ... /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _ux_dcd_stm32_function PORTABLE C */ /* 6.1.10 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function dispatches the DCD function internally to the STM32 */ /* controller. */ /* */ /* INPUT */ /* */ /* dcd Pointer to device controller */ /* function Function requested */ /* parameter Pointer to function parameters*/ /* */ /* OUTPUT */ /* */ /* Completion Status */ /* */ /* CALLS */ /* */ /* _ux_dcd_stm32_endpoint_create Create endpoint */ /* _ux_dcd_stm32_endpoint_destroy Destroy endpoint */ /* _ux_dcd_stm32_endpoint_reset Reset endpoint */ /* _ux_dcd_stm32_endpoint_stall Stall endpoint */ /* _ux_dcd_stm32_endpoint_status Get endpoint status */ /* _ux_dcd_stm32_frame_number_get Get frame number */ /* _ux_dcd_stm32_transfer_request Request data transfer */ /* */ /* CALLED BY */ /* */ /* USBX Device Stack */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), used ST */ /* HAL library to drive the */ /* controller, */ /* resulting in version 6.1 */ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ /* */... /**************************************************************************/ UINT _ux_dcd_stm32_function(UX_SLAVE_DCD *dcd, UINT function, VOID *parameter) { UINT status; UX_DCD_STM32 *dcd_stm32; /* Check the status of the controller. */ if (dcd -> ux_slave_dcd_status == UX_UNUSED) { /* Error trap. */ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_DCD, UX_CONTROLLER_UNKNOWN); /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_CONTROLLER_UNKNOWN, 0, 0, 0, UX_TRACE_ERRORS, 0, 0) return(UX_CONTROLLER_UNKNOWN); }if (dcd -> ux_slave_dcd_status == UX_UNUSED) { ... } /* Get the pointer to the STM32 DCD. */ dcd_stm32 = (UX_DCD_STM32 *) dcd -> ux_slave_dcd_controller_hardware; /* Look at the function and route it. */ switch(function) { case UX_DCD_GET_FRAME_NUMBER: status = _ux_dcd_stm32_frame_number_get(dcd_stm32, (ULONG *) parameter); break; case UX_DCD_GET_FRAME_NUMBER: case UX_DCD_TRANSFER_REQUEST: #if defined(UX_DEVICE_STANDALONE) status = _ux_dcd_stm32_transfer_run(dcd_stm32, (UX_SLAVE_TRANSFER *) parameter); #else status = _ux_dcd_stm32_transfer_request(dcd_stm32, (UX_SLAVE_TRANSFER *) parameter); #endif /* defined(UX_DEVICE_STANDALONE) */ break; case UX_DCD_TRANSFER_REQUEST: case UX_DCD_TRANSFER_ABORT: status = _ux_dcd_stm32_transfer_abort(dcd_stm32, parameter); break; case UX_DCD_TRANSFER_ABORT: case UX_DCD_CREATE_ENDPOINT: status = _ux_dcd_stm32_endpoint_create(dcd_stm32, parameter); break; case UX_DCD_CREATE_ENDPOINT: case UX_DCD_DESTROY_ENDPOINT: status = _ux_dcd_stm32_endpoint_destroy(dcd_stm32, parameter); break; case UX_DCD_DESTROY_ENDPOINT: case UX_DCD_RESET_ENDPOINT: status = _ux_dcd_stm32_endpoint_reset(dcd_stm32, parameter); break; case UX_DCD_RESET_ENDPOINT: case UX_DCD_STALL_ENDPOINT: status = _ux_dcd_stm32_endpoint_stall(dcd_stm32, parameter); break; case UX_DCD_STALL_ENDPOINT: case UX_DCD_SET_DEVICE_ADDRESS: status = HAL_PCD_SetAddress(dcd_stm32 -> pcd_handle, (uint8_t)(ULONG) parameter); break; case UX_DCD_SET_DEVICE_ADDRESS: case UX_DCD_CHANGE_STATE: if ((ULONG) parameter == UX_DEVICE_FORCE_DISCONNECT) { /* Disconnect the USB device */ status = HAL_PCD_Stop(dcd_stm32 -> pcd_handle); }if ((ULONG) parameter == UX_DEVICE_FORCE_DISCONNECT) { ... } else { status = UX_SUCCESS; }else { ... } break; case UX_DCD_CHANGE_STATE: case UX_DCD_ENDPOINT_STATUS: status = _ux_dcd_stm32_endpoint_status(dcd_stm32, (ULONG) parameter); break; #if defined(UX_DEVICE_STANDALONE)case UX_DCD_ENDPOINT_STATUS: case UX_DCD_ISR_PENDING: _ux_dcd_stm32_setup_isr_pending(dcd_stm32); status = UX_SUCCESS; break;/* ... */ #endif /* defined(UX_DEVICE_STANDALONE) */ case UX_DCD_ISR_PENDING: default: /* Error trap. */ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_DCD, UX_FUNCTION_NOT_SUPPORTED); /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_FUNCTION_NOT_SUPPORTED, 0, 0, 0, UX_TRACE_ERRORS, 0, 0) status = UX_FUNCTION_NOT_SUPPORTED; break;default }switch (function) { ... } /* Return completion status. */ return(status); }{ ... }
Details