1
10
13
14
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
...
...
...
#define UX_SOURCE_CODE
#define UX_DCD_STM32_SOURCE_CODE
#include "ux_api.h"
#include "ux_dcd_stm32.h"
#include "ux_device_stack.h"
...
...
UINT _ux_dcd_stm32_endpoint_create(UX_DCD_STM32 *dcd_stm32, UX_SLAVE_ENDPOINT *endpoint)
{
UX_DCD_STM32_ED *ed;
ULONG stm32_endpoint_index;
stm32_endpoint_index = endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & ~UX_ENDPOINT_DIRECTION;
ed = _stm32_ed_get(dcd_stm32, endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress);
if (ed == UX_NULL)
return(UX_NO_ED_AVAILABLE);
if ((ed -> ux_dcd_stm32_ed_status & UX_DCD_STM32_ED_STATUS_USED) == 0)
{
ed -> ux_dcd_stm32_ed_status |= UX_DCD_STM32_ED_STATUS_USED;
endpoint -> ux_slave_endpoint_ed = (VOID *) ed;
ed -> ux_dcd_stm32_ed_endpoint = endpoint;
ed -> ux_dcd_stm32_ed_index = stm32_endpoint_index;
ed -> ux_dcd_stm32_ed_direction = endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION;
if (stm32_endpoint_index != 0)
{
HAL_PCD_EP_Open(dcd_stm32 -> pcd_handle, endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress,
endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize,
endpoint -> ux_slave_endpoint_descriptor.bmAttributes & UX_MASK_ENDPOINT_TYPE);
}if (stm32_endpoint_index != 0) { ... }
return(UX_SUCCESS);
}if ((ed -> ux_dcd_stm32_ed_status & UX_DCD_STM32_ED_STATUS_USED) == 0) { ... }
return(UX_NO_ED_AVAILABLE);
}{ ... }