diff options
author | Tom Rini <trini@konsulko.com> | 2020-01-09 08:51:57 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-01-09 08:51:57 -0500 |
commit | a74a2134b245d19a999c796d29285597a22954ed (patch) | |
tree | 0838cf4adc01fe969bbcf7dc53d41611546429a2 /common | |
parent | 7086de4948ba2bc46cdd3001f7d845535f05f7fe (diff) | |
parent | 3a117e721cc5b4a366dbd5fbbf8df0a80cbb0fa2 (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-usb
- DFU updates
Diffstat (limited to 'common')
-rw-r--r-- | common/dfu.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/dfu.c b/common/dfu.c index 44d1484d3d..da6289b218 100644 --- a/common/dfu.c +++ b/common/dfu.c @@ -35,6 +35,10 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) return CMD_RET_FAILURE; } +#ifdef CONFIG_DFU_TIMEOUT + unsigned long start_time = get_timer(0); +#endif + while (1) { if (g_dnl_detach()) { /* @@ -79,6 +83,19 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) } } +#ifdef CONFIG_DFU_TIMEOUT + unsigned long wait_time = dfu_get_timeout(); + + if (wait_time) { + unsigned long current_time = get_timer(start_time); + + if (current_time > wait_time) { + debug("Inactivity timeout, abort DFU\n"); + goto exit; + } + } +#endif + WATCHDOG_RESET(); usb_gadget_handle_interrupts(usbctrl_index); } |