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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
...
...
...
#define UX_SOURCE_CODE
#define UX_HCD_STM32_SOURCE_CODE
#include "ux_api.h"
#include "ux_hcd_stm32.h"
#include "ux_host_stack.h"
...
...
UINT _ux_hcd_stm32_request_bulk_transfer(UX_HCD_STM32 *hcd_stm32, UX_TRANSFER *transfer_request)
{
UX_ENDPOINT *endpoint;
UX_HCD_STM32_ED *ed;
UINT direction;
UINT length;
endpoint = (UX_ENDPOINT *) transfer_request -> ux_transfer_request_endpoint;
ed = endpoint -> ux_endpoint_ed;
ed -> ux_stm32_ed_transfer_request = transfer_request;
direction = (transfer_request -> ux_transfer_request_type & UX_REQUEST_DIRECTION) == UX_REQUEST_IN ? 1 : 0;
if ((direction == 0) && (transfer_request -> ux_transfer_request_requested_length > endpoint -> ux_endpoint_descriptor.wMaxPacketSize)
#ifndef USB_DRD_FS
&& (hcd_stm32 -> hcd_handle -> Init.dma_enable == 0)
#endif
)
{
length = endpoint -> ux_endpoint_descriptor.wMaxPacketSize;
}if ((direction == 0) && (transfer_request -> ux_transfer_request_requested_length > endpoint -> ux_endpoint_descriptor.wMaxPacketSize) #ifndef USB_DRD_FS && (hcd_stm32 -> hcd_handle -> Init.dma_enable == 0) #endif /* USB_DRD_FS */) { ... }
else
{
length = transfer_request -> ux_transfer_request_requested_length;
}else { ... }
ed -> ux_stm32_ed_status = direction == 0 ? UX_HCD_STM32_ED_STATUS_BULK_OUT : UX_HCD_STM32_ED_STATUS_BULK_IN;
transfer_request -> ux_transfer_request_packet_length = length;
HAL_HCD_HC_SubmitRequest(hcd_stm32 -> hcd_handle, ed -> ux_stm32_ed_channel,
direction,
EP_TYPE_BULK, USBH_PID_DATA,
transfer_request->ux_transfer_request_data_pointer,
length, 0);
return(UX_SUCCESS);
}{ ... }