Skip to content

Commit

Permalink
add debug counters
Browse files Browse the repository at this point in the history
  • Loading branch information
tlyu committed Dec 1, 2022
1 parent e810339 commit 80bc571
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -253,6 +255,7 @@ void usbd_isr (void)
CLR(RSTIF);

udev->drv_handler->ep_reset(udev);
udev->nreset++;
}

#ifdef LPM_ENABLED
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 80bc571

Please sign in to comment.