From 743669861ed8ec0c199fb65d8c5b81928290621e Mon Sep 17 00:00:00 2001 From: Zhihong Chen Date: Tue, 20 Feb 2024 19:53:24 +0800 Subject: [PATCH] port: HPMicro: fix transfer_len not reset - fix transfer_len not reset Signed-off-by: Zhihong Chen --- port/hpm/usb_dc_hpm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/port/hpm/usb_dc_hpm.c b/port/hpm/usb_dc_hpm.c index 797961e0..ae7fe055 100644 --- a/port/hpm/usb_dc_hpm.c +++ b/port/hpm/usb_dc_hpm.c @@ -1,9 +1,8 @@ #include "usbd_core.h" #include "hpm_usb_device.h" -#include "board.h" #ifndef USB_NUM_BIDIR_ENDPOINTS -#define USB_NUM_BIDIR_ENDPOINTS USB_SOC_DCD_MAX_ENDPOINT_COUNT +#define USB_NUM_BIDIR_ENDPOINTS CONFIG_USBDEV_EP_NUM #endif /* USBSTS, USBINTR */ @@ -241,7 +240,7 @@ void USBD_IRQHandler(uint8_t busid) { uint32_t int_status; usb_device_handle_t *handle = g_hpm_udc[busid].handle; - uint32_t transfer_len = 0; + uint32_t transfer_len; /* Acknowledge handled interrupt */ int_status = usb_device_status_flags(handle); @@ -292,6 +291,8 @@ void USBD_IRQHandler(uint8_t busid) if (edpt_complete) { for (uint8_t ep_idx = 0; ep_idx < USB_SOS_DCD_MAX_QHD_COUNT; ep_idx++) { if (edpt_complete & (1 << ep_idx2bit(ep_idx))) { + transfer_len = 0; + /* Failed QTD also get ENDPTCOMPLETE set */ dcd_qtd_t *p_qtd = usb_device_qtd_get(handle, ep_idx); while (1) {