diff --git a/system/GD32F30x_firmware/GD32F30x_usbd_library/device/Include/usbd_core.h b/system/GD32F30x_firmware/GD32F30x_usbd_library/device/Include/usbd_core.h index 4e675f00..d890268b 100644 --- a/system/GD32F30x_firmware/GD32F30x_usbd_library/device/Include/usbd_core.h +++ b/system/GD32F30x_firmware/GD32F30x_usbd_library/device/Include/usbd_core.h @@ -181,6 +181,11 @@ struct _usb_dev __IO uint8_t cur_status; __IO uint8_t backup_status; + __IO uint8_t nreset; + __IO uint8_t nsusp; + __IO uint8_t nresume; + __IO uint8_t nsuspsusp; + __IO uint8_t nerror; usb_pm pm; #ifdef LPM_ENABLED diff --git a/system/GD32F30x_firmware/GD32F30x_usbd_library/usbd/Source/usbd_lld_int.c b/system/GD32F30x_firmware/GD32F30x_usbd_library/usbd/Source/usbd_lld_int.c index a714f5ac..9f449d45 100644 --- a/system/GD32F30x_firmware/GD32F30x_usbd_library/usbd/Source/usbd_lld_int.c +++ b/system/GD32F30x_firmware/GD32F30x_usbd_library/usbd/Source/usbd_lld_int.c @@ -181,11 +181,13 @@ void usbd_isr (void) if (INTF_ERRIF & int_flag) { udev->drv_handler->err(); + udev->nerror++; CLR(ERRIF); } if (INTF_WKUPIF & int_flag) { /* restore the old cur_status */ udev->cur_status = udev->backup_status; + udev->nresume++; #ifdef LPM_ENABLED if ((0U == udev->pm.remote_wakeup_on) && (0U == udev->lpm.L1_resume)) { @@ -253,6 +255,7 @@ void usbd_isr (void) CLR(RSTIF); udev->drv_handler->ep_reset(udev); + udev->nreset++; } #ifdef LPM_ENABLED @@ -305,7 +308,10 @@ static void usbd_int_suspend (usb_dev *udev) */ if (udev->cur_status != USBD_SUSPENDED) { udev->backup_status = udev->cur_status; + } else { + udev->nsuspsusp++; } + udev->nsusp++; /* set device in suspended state */ udev->cur_status = (uint8_t)USBD_SUSPENDED;