Skip to content

Commit a35b98e

Browse files
konkerstravisg
authored andcommitted
[stm32f0xx] Support multi-packet setup transactions.
1 parent ab273b4 commit a35b98e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

platform/stm32f0xx/usbc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,12 @@ void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
143143
LTRACEF("epnum %u, xfer count %u len %u\n", epnum, ep->xfer_count, ep->xfer_len);
144144

145145
if (epnum == 0) {
146-
// TODO(konkers): implement multi packet.
147-
struct ep_status *ep = &usbc.ep_in[0];
148-
if (ep->ack_ep0_in) {
146+
struct ep_status *ep_stat = &usbc.ep_in[0];
147+
if (ep->xfer_len > 0) {
148+
// The STM32 Cube PCD lib does not handle multi-packet EP0 IN
149+
// transactions. Handle them here ourselves.
150+
HAL_PCD_EP_Transmit(&usbc.handle, 0, ep->xfer_buff, ep->xfer_len);
151+
} else if (ep_stat->ack_ep0_in) {
149152
// in transfer done, ready for receive status
150153
HAL_PCD_EP_Receive(&usbc.handle, 0, 0, 0);
151154
}

0 commit comments

Comments
 (0)