diff options
| author | William D. Jones <[email protected]> | 2019-01-22 23:57:25 -0500 |
|---|---|---|
| committer | William D. Jones <[email protected]> | 2019-01-23 00:12:33 -0500 |
| commit | d1150432fe89750f49b5a36dbc08838dcf5214ec (patch) | |
| tree | e54355ce0c999cf9a772b294063194db83097eaf /src | |
| parent | 51c0ce3f6b8d2dd88bd9f696a8c179bd20ff0568 (diff) | |
stm32f4: Remove assumption that EP 0 is only control endpoint.
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/stm/stm32f4/dcd_stm32f4.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/portable/stm/stm32f4/dcd_stm32f4.c b/src/portable/stm/stm32f4/dcd_stm32f4.c index dfd9a78e0..b2d308d72 100644 --- a/src/portable/stm/stm32f4/dcd_stm32f4.c +++ b/src/portable/stm/stm32f4/dcd_stm32f4.c @@ -385,7 +385,6 @@ void OTG_FS_IRQHandler(void) { USB_OTG_INEndpointTypeDef * in_ep = IN_EP_BASE; uint32_t * rx_fifo = FIFO_BASE(0); - uint32_t int_status = USB_OTG_FS->GINTSTS; if(int_status & USB_OTG_GINTSTS_USBRST) { @@ -415,6 +414,7 @@ void OTG_FS_IRQHandler(void) { // we only pop one ctl word each interrupt). uint32_t ctl_word = USB_OTG_FS->GRXSTSP; uint8_t pktsts = (ctl_word & USB_OTG_GRXSTSP_PKTSTS_Msk) >> USB_OTG_GRXSTSP_PKTSTS_Pos; + uint8_t epnum = (ctl_word & USB_OTG_GRXSTSP_EPNUM_Msk) >> USB_OTG_GRXSTSP_EPNUM_Pos; switch(pktsts) { case 0x01: // Global OUT NAK (Interrupt) @@ -424,12 +424,12 @@ void OTG_FS_IRQHandler(void) { case 0x03: // Out packet done (Interrupt) break; case 0x04: // Setup packet done (Interrupt) - _setup_offs = 2 - ((out_ep[0].DOEPTSIZ & USB_OTG_DOEPTSIZ_STUPCNT_Msk) >> USB_OTG_DOEPTSIZ_STUPCNT_Pos); - out_ep[0].DOEPTSIZ |= (3 << USB_OTG_DOEPTSIZ_STUPCNT_Pos); + _setup_offs = 2 - ((out_ep[epnum].DOEPTSIZ & USB_OTG_DOEPTSIZ_STUPCNT_Msk) >> USB_OTG_DOEPTSIZ_STUPCNT_Pos); + out_ep[epnum].DOEPTSIZ |= (3 << USB_OTG_DOEPTSIZ_STUPCNT_Pos); break; case 0x06: // Setup packet recvd { - uint8_t setup_left = ((out_ep[0].DOEPTSIZ & USB_OTG_DOEPTSIZ_STUPCNT_Msk) >> USB_OTG_DOEPTSIZ_STUPCNT_Pos); + uint8_t setup_left = ((out_ep[epnum].DOEPTSIZ & USB_OTG_DOEPTSIZ_STUPCNT_Msk) >> USB_OTG_DOEPTSIZ_STUPCNT_Pos); // We can receive up to three setup packets in succession, but // only the last one is valid. _setup_packet[4 - 2*setup_left] = (* rx_fifo); |
