Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
...
...
#define UX_DCD_STM32_H
#include "ux_stm32_config.h"
#define UX_DCD_STM32_SLAVE_CONTROLLER
#define UX_DCD_STM32_MAX_ED
#define UX_DCD_STM32_IN_FIFO
#define UX_DCD_STM32_FLUSH_RX_FIFO
#define UX_DCD_STM32_FLUSH_TX_FIFO
#define UX_DCD_STM32_FLUSH_FIFO_ALL
#define UX_DCD_STM32_ENDPOINT_SPACE_SIZE
#define UX_DCD_STM32_ENDPOINT_CHANNEL_SIZE
#define UX_DCD_STM32_ED_STATUS_UNUSED
#define UX_DCD_STM32_ED_STATUS_USED
#define UX_DCD_STM32_ED_STATUS_TRANSFER
#define UX_DCD_STM32_ED_STATUS_STALLED
#define UX_DCD_STM32_ED_STATUS_DONE
#define UX_DCD_STM32_ED_STATUS_SETUP_IN
#define UX_DCD_STM32_ED_STATUS_SETUP_STATUS
#define UX_DCD_STM32_ED_STATUS_SETUP_OUT
#define UX_DCD_STM32_ED_STATUS_SETUP
#define UX_DCD_STM32_ED_STATUS_TASK_PENDING
#define UX_DCD_STM32_ED_STATE_IDLE
#define UX_DCD_STM32_ED_STATE_DATA_TX
#define UX_DCD_STM32_ED_STATE_DATA_RX
#define UX_DCD_STM32_ED_STATE_STATUS_TX
#define UX_DCD_STM32_ED_STATE_STATUS_RX
#define UX_DCD_STM32_ED_TRANSFER_STATUS_IDLE
#define UX_DCD_STM32_ED_TRANSFER_STATUS_SETUP
#define UX_DCD_STM32_ED_TRANSFER_STATUS_IN_COMPLETION
#define UX_DCD_STM32_ED_TRANSFER_STATUS_OUT_COMPLETION
UX_DCD_STM32_ED_STRUCT
UX_DCD_STM32_STRUCT
_stm32_ed_get(UX_DCD_STM32 *, ULONG)
_ux_dcd_stm32_endpoint_create(UX_DCD_STM32 *, UX_SLAVE_ENDPOINT *);
_ux_dcd_stm32_endpoint_destroy(UX_DCD_STM32 *, UX_SLAVE_ENDPOINT *);
_ux_dcd_stm32_endpoint_reset(UX_DCD_STM32 *, UX_SLAVE_ENDPOINT *);
_ux_dcd_stm32_endpoint_stall(UX_DCD_STM32 *, UX_SLAVE_ENDPOINT *);
_ux_dcd_stm32_endpoint_status(UX_DCD_STM32 *, ULONG);
_ux_dcd_stm32_frame_number_get(UX_DCD_STM32 *, ULONG *);
_ux_dcd_stm32_function(UX_SLAVE_DCD *, UINT, void *);
_ux_dcd_stm32_initialize_complete();
_ux_dcd_stm32_interrupt_handler();
_ux_dcd_stm32_transfer_abort(UX_DCD_STM32 *, UX_SLAVE_TRANSFER *);
_ux_dcd_stm32_transfer_request(UX_DCD_STM32 *, UX_SLAVE_TRANSFER *);
_ux_dcd_stm32_initialize(ULONG, ULONG);
_ux_dcd_stm32_uninitialize(ULONG, ULONG);
#define ux_dcd_stm32_initialize
#define ux_dcd_stm32_interrupt_handler
Files
loading...
CodeScopeSTM32 Libraries and Samplesusbxcommon/usbx_stm32_device_controllers/ux_dcd_stm32.h
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* 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 */ /** */... /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ /* */ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_dcd_stm32.h PORTABLE C */ /* 6.1.10 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This file defines the USB OTG device equivalences for the STM32 */ /* controller. */ /* */ /* 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, */ /* added bi-dir EP support, */ /* resulting in version 6.1.10 */ /* */... /**************************************************************************/ #ifndef UX_DCD_STM32_H #define UX_DCD_STM32_H #include "ux_stm32_config.h" /* Define STM32 generic equivalences. */ #define UX_DCD_STM32_SLAVE_CONTROLLER 0x80 #ifndef UX_DCD_STM32_MAX_ED #define UX_DCD_STM32_MAX_ED 4 #endif /* UX_DCD_STM32_MAX_ED */ #define UX_DCD_STM32_IN_FIFO 3 #define UX_DCD_STM32_FLUSH_RX_FIFO 0x00000010 #define UX_DCD_STM32_FLUSH_TX_FIFO 0x00000020 #define UX_DCD_STM32_FLUSH_FIFO_ALL 0x00000010 #define UX_DCD_STM32_ENDPOINT_SPACE_SIZE 0x00000020 #define UX_DCD_STM32_ENDPOINT_CHANNEL_SIZE 0x00000020 /* Define USB STM32 physical endpoint status definition. */ #define UX_DCD_STM32_ED_STATUS_UNUSED 0u #define UX_DCD_STM32_ED_STATUS_USED 1u #define UX_DCD_STM32_ED_STATUS_TRANSFER 2u #define UX_DCD_STM32_ED_STATUS_STALLED 4u #define UX_DCD_STM32_ED_STATUS_DONE 8u #define UX_DCD_STM32_ED_STATUS_SETUP_IN (1u<<8) #define UX_DCD_STM32_ED_STATUS_SETUP_STATUS (2u<<8) #define UX_DCD_STM32_ED_STATUS_SETUP_OUT (3u<<8) #define UX_DCD_STM32_ED_STATUS_SETUP (3u<<8) #define UX_DCD_STM32_ED_STATUS_TASK_PENDING (1u<<10) /* Define USB STM32 physical endpoint state machine definition. */ #define UX_DCD_STM32_ED_STATE_IDLE 0 #define UX_DCD_STM32_ED_STATE_DATA_TX 1 #define UX_DCD_STM32_ED_STATE_DATA_RX 2 #define UX_DCD_STM32_ED_STATE_STATUS_TX 3 #define UX_DCD_STM32_ED_STATE_STATUS_RX 4 /* Define USB STM32 endpoint transfer status definition. */ #define UX_DCD_STM32_ED_TRANSFER_STATUS_IDLE 0 #define UX_DCD_STM32_ED_TRANSFER_STATUS_SETUP 1 #define UX_DCD_STM32_ED_TRANSFER_STATUS_IN_COMPLETION 2 #define UX_DCD_STM32_ED_TRANSFER_STATUS_OUT_COMPLETION 3 25 defines /* Define USB STM32 physical endpoint structure. */ typedef struct UX_DCD_STM32_ED_STRUCT { struct UX_SLAVE_ENDPOINT_STRUCT *ux_dcd_stm32_ed_endpoint; ULONG ux_dcd_stm32_ed_status; UCHAR ux_dcd_stm32_ed_state; UCHAR ux_dcd_stm32_ed_index; UCHAR ux_dcd_stm32_ed_direction; UCHAR reserved; ...} UX_DCD_STM32_ED; /* Define USB STM32 DCD structure definition. */ typedef struct UX_DCD_STM32_STRUCT { struct UX_SLAVE_DCD_STRUCT *ux_dcd_stm32_dcd_owner; struct UX_DCD_STM32_ED_STRUCT ux_dcd_stm32_ed[UX_DCD_STM32_MAX_ED]; #if defined(UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT) struct UX_DCD_STM32_ED_STRUCT ux_dcd_stm32_ed_in[UX_DCD_STM32_MAX_ED];/* ... */ #endif /* defined(UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT) */ PCD_HandleTypeDef *pcd_handle; ...} UX_DCD_STM32; static inline struct UX_DCD_STM32_ED_STRUCT *_stm32_ed_get(UX_DCD_STM32 *dcd_stm32, ULONG ep_addr) { #if defined(UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT) ULONG ep_dir = ep_addr & 0x80u; #endif /* defined(UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT) */ ULONG ep_num = ep_addr & 0x7Fu; if (ep_num >= UX_DCD_STM32_MAX_ED || ep_num >= dcd_stm32->pcd_handle->Init.dev_endpoints) return(UX_NULL); #if defined(UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT) if (ep_dir) return(&dcd_stm32->ux_dcd_stm32_ed_in[ep_num]);/* ... */ #endif /* defined(UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT) */ return(&dcd_stm32->ux_dcd_stm32_ed[ep_num]); }{ ... } /* Define USB STM32 DCD prototypes. */ UINT _ux_dcd_stm32_endpoint_create(UX_DCD_STM32 *dcd_stm32, UX_SLAVE_ENDPOINT *endpoint); UINT _ux_dcd_stm32_endpoint_destroy(UX_DCD_STM32 *dcd_stm32, UX_SLAVE_ENDPOINT *endpoint); UINT _ux_dcd_stm32_endpoint_reset(UX_DCD_STM32 *dcd_stm32, UX_SLAVE_ENDPOINT *endpoint); UINT _ux_dcd_stm32_endpoint_stall(UX_DCD_STM32 *dcd_stm32, UX_SLAVE_ENDPOINT *endpoint); UINT _ux_dcd_stm32_endpoint_status(UX_DCD_STM32 *dcd_stm32, ULONG endpoint_index); UINT _ux_dcd_stm32_frame_number_get(UX_DCD_STM32 *dcd_stm32, ULONG *frame_number); UINT _ux_dcd_stm32_function(UX_SLAVE_DCD *dcd, UINT function, VOID *parameter); UINT _ux_dcd_stm32_initialize_complete(VOID); VOID _ux_dcd_stm32_interrupt_handler(VOID); UINT _ux_dcd_stm32_transfer_abort(UX_DCD_STM32 *dcd_stm32, UX_SLAVE_TRANSFER *transfer_request); #if !defined(UX_DEVICE_STANDALONE) UINT _ux_dcd_stm32_transfer_request(UX_DCD_STM32 *dcd_stm32, UX_SLAVE_TRANSFER *transfer_request); #else UINT _ux_dcd_stm32_transfer_run(UX_DCD_STM32 *dcd_stm32, UX_SLAVE_TRANSFER *transfer_request); #endif /* !defined(UX_DEVICE_STANDALONE) */ UINT _ux_dcd_stm32_initialize(ULONG dcd_io, ULONG parameter); UINT _ux_dcd_stm32_uninitialize(ULONG dcd_io, ULONG parameter); #define ux_dcd_stm32_initialize _ux_dcd_stm32_initialize #define ux_dcd_stm32_interrupt_handler _ux_dcd_stm32_interrupt_handler /* ... */ #endif /* UX_DCD_STM32_H */...