summaryrefslogtreecommitdiff
path: root/drivers/dfu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dfu')
-rw-r--r--drivers/dfu/Kconfig6
-rw-r--r--drivers/dfu/dfu.c15
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index 75fe0a12c6..9709b6277d 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -23,6 +23,12 @@ config DFU_TFTP
Detailed description of this feature can be found at ./doc/README.dfutftp
+config DFU_TIMEOUT
+ bool "Timeout waiting for DFU"
+ help
+ This option adds an optional timeout parameter for DFU which, if set,
+ will cause DFU to only wait for that many seconds before exiting.
+
config DFU_MMC
bool "MMC back end for DFU"
help
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 38aecd3a05..df50196dfd 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -21,6 +21,9 @@ static LIST_HEAD(dfu_list);
static int dfu_alt_num;
static int alt_num_cnt;
static struct hash_algo *dfu_hash_algo;
+#ifdef CONFIG_DFU_TIMEOUT
+static unsigned long dfu_timeout = 0;
+#endif
/*
* The purpose of the dfu_flush_callback() function is to
@@ -58,6 +61,18 @@ __weak bool dfu_usb_get_reset(void)
#endif
}
+#ifdef CONFIG_DFU_TIMEOUT
+void dfu_set_timeout(unsigned long timeout)
+{
+ dfu_timeout = timeout;
+}
+
+unsigned long dfu_get_timeout(void)
+{
+ return dfu_timeout;
+}
+#endif
+
static int dfu_find_alt_num(const char *s)
{
int i = 0;