summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerzy Kasenberg <[email protected]>2022-01-16 16:13:21 +0100
committerJerzy Kasenberg <[email protected]>2022-01-17 17:59:51 +0100
commit168c7095e849e448cb7d3b755ea3b6e236f502ed (patch)
tree3df42a0b29d1f8578357c66bd7076c06967b9db7
parent976405dea3bc421cd3631b3af93380bdb122af66 (diff)
pic32mz: Fix remote_wakeup without OS
Remote wakeup requires 10ms of delay when RESUME bit is toggled. It was covered for OS build. For non-OS build simple delay based on board_millis() is used to wait required amount of time. Without this remote wakup may not work.
-rw-r--r--src/portable/microchip/pic32mz/dcd_pic32mz.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/portable/microchip/pic32mz/dcd_pic32mz.c b/src/portable/microchip/pic32mz/dcd_pic32mz.c
index 323d01a71..740e5edbb 100644
--- a/src/portable/microchip/pic32mz/dcd_pic32mz.c
+++ b/src/portable/microchip/pic32mz/dcd_pic32mz.c
@@ -163,6 +163,10 @@ void dcd_remote_wakeup(uint8_t rhport)
USB_REGS->POWERbits.RESUME = 1;
#if CFG_TUSB_OS != OPT_OS_NONE
osal_task_delay(10);
+#else
+ // TODO: Wait in non blocking mode
+ unsigned cnt = 2000;
+ while (cnt--) __asm__("nop");
#endif
USB_REGS->POWERbits.RESUME = 0;
}