summaryrefslogtreecommitdiff
path: root/drivers/dfu/dfu.c
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2013-09-11 12:53:35 (GMT)
committerMarek Vasut <marex@denx.de>2013-09-24 15:51:35 (GMT)
commit765c5ae5bc913d9f06c518a9491d97c35ea00735 (patch)
treebc35b4c73157b3db833fa840733dcddaba5761a2 /drivers/dfu/dfu.c
parent3668ce3c8008705f271bb55ee863638de3bf8067 (diff)
downloadu-boot-765c5ae5bc913d9f06c518a9491d97c35ea00735.tar.xz
dfu: Extract common DFU code to handle "dfu_alt_info" environment variable
New dfu_init_env_entities() function has been extracted from cmd_dfu.c and stored at dfu core. This is a dfu centric code, so it shall be processed in the core. Change-Id: I756c5de922fa31399d8804eaadc004ee98844ec2 Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers/dfu/dfu.c')
-rw-r--r--drivers/dfu/dfu.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 2f1e2af..689f5db 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -41,6 +41,29 @@ static int dfu_find_alt_num(const char *s)
return ++i;
}
+int dfu_init_env_entities(char *interface, int dev)
+{
+ const char *str_env;
+ char *env_bkp;
+ int ret;
+
+ str_env = getenv("dfu_alt_info");
+ if (!str_env) {
+ error("\"dfu_alt_info\" env variable not defined!\n");
+ return -EINVAL;
+ }
+
+ env_bkp = strdup(str_env);
+ ret = dfu_config_entities(env_bkp, interface, dev);
+ if (ret) {
+ error("DFU entities configuration failed!\n");
+ return ret;
+ }
+
+ free(env_bkp);
+ return 0;
+}
+
static unsigned char *dfu_buf;
static unsigned long dfu_buf_size = CONFIG_SYS_DFU_DATA_BUF_SIZE;