From d709c44fa460e51a97b65a7ef4ebca4473a53c56 Mon Sep 17 00:00:00 2001 From: "S.J.R. van Schaik" Date: Wed, 14 Jun 2017 13:16:36 +0200 Subject: [PATCH] shell: flash: add command to release the current flash device --- source/shell/flash.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/shell/flash.c b/source/shell/flash.c index 5c491c1..b407d8b 100644 --- a/source/shell/flash.c +++ b/source/shell/flash.c @@ -12,6 +12,7 @@ #include static void do_flash_probe(const char *s); +static void do_flash_release(const char *s); static void do_flash_info(const char *s); static void do_flash_read(const char *s); static void do_flash_write(const char *s); @@ -19,6 +20,7 @@ static void do_flash_erase(const char *s); static struct cmd flash_cmds[] = { { "probe", do_flash_probe }, + { "release", do_flash_release }, { "info", do_flash_info }, { "read", do_flash_read }, { "write", do_flash_write }, @@ -110,6 +112,17 @@ static void do_flash_probe(const char *s) } } +static void do_flash_release(const char *s) +{ + (void)s; + + if (!flash) + return; + + flash_release(flash); + flash = NULL; +} + static void do_flash_info(const char *s) { size_t size, capacity;