|
|
|
@ -12,26 +12,31 @@ |
|
|
|
|
#include <macros.h> |
|
|
|
|
#include <shell.h> |
|
|
|
|
|
|
|
|
|
static void do_ftl_mount(const char *s); |
|
|
|
|
static void do_ftl_probe(const char *s); |
|
|
|
|
|
|
|
|
|
static struct cmd ftl_cmds[] = { |
|
|
|
|
{ "mount", do_ftl_mount }, |
|
|
|
|
{ "probe", do_ftl_probe }, |
|
|
|
|
{ NULL, NULL }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
extern struct flash_dev *flash; |
|
|
|
|
|
|
|
|
|
static void do_ftl_mount(const char *s) |
|
|
|
|
static void do_ftl_probe(const char *s) |
|
|
|
|
{ |
|
|
|
|
(void)s; |
|
|
|
|
|
|
|
|
|
if (!flash) { |
|
|
|
|
fprintf(stderr, "error: no flash device probed.\n"); |
|
|
|
|
if (flash) { |
|
|
|
|
flash_release(flash); |
|
|
|
|
flash = NULL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!(flash = flash_probe())) { |
|
|
|
|
fprintf(stderr, "error: unable to probe the flash device.\n"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!(flash = ftl_mount(flash))) { |
|
|
|
|
fprintf(stderr, "error: unable to mount the device.\n"); |
|
|
|
|
fprintf(stderr, "error: unable to mount the flash translation layer.\n"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|