Source code for the Trusted Boot Module.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tbm-mcu/source/shell/ftl.c

48 lines
790 B

#include <ctype.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <flash.h>
#include <ftl.h>
#include <macros.h>
#include <shell.h>
static void do_ftl_probe(const char *s);
static struct cmd ftl_cmds[] = {
{ "probe", do_ftl_probe },
{ NULL, NULL },
};
extern struct flash_dev *flash;
static void do_ftl_probe(const char *s)
{
(void)s;
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 flash translation layer.\n");
return;
}
}
void do_ftl_cmd(const char *line)
{
cmd_exec(ftl_cmds, line);
}