FreeCalypso > hg > freecalypso-sw
diff ffstools/tiffs-rd/main.c @ 229:24ed817dd25d
tiffs IVA: reads image via mmap and displays block headers
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 25 Jan 2014 23:56:47 +0000 |
parents | c04aa85559ed |
children | ffaa033e7643 |
line wrap: on
line diff
--- a/ffstools/tiffs-rd/main.c Sat Jan 25 18:16:52 2014 +0000 +++ b/ffstools/tiffs-rd/main.c Sat Jan 25 23:56:47 2014 +0000 @@ -11,16 +11,11 @@ #include <strings.h> #include "types.h" -u8 tiffs_header[6] = {'F', 'f', 's', '#', 0x10, 0x02}; -u8 blank_flash_line[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - char *imgfile; u32 eraseblk_size; int total_blocks; u32 total_ffs_size; int index_blk_num = -1, root_node_no; -int offset_blocks; int verbose; parse_org_arg(arg) @@ -35,7 +30,9 @@ exit(1); } *cp++ = '\0'; - if (!strcmp(arg, "16")) + if (!strcmp(arg, "8")) + eraseblk_size = 0x2000; + else if (!strcmp(arg, "16")) eraseblk_size = 0x4000; else if (!strcmp(arg, "32")) eraseblk_size = 0x8000; @@ -61,10 +58,13 @@ total_ffs_size = eraseblk_size * total_blocks; } +extern int cmd_blkhdr(); + static struct cmdtab { char *cmd; int (*func)(); } cmdtab[] = { + {"blkhdr", cmd_blkhdr}, {"cat", NULL}, {"fsck", NULL}, {"ls", NULL}, @@ -81,14 +81,11 @@ char *cmd; struct cmdtab *tp; - while ((c = getopt(argc, argv, "+a:o:r:v")) != EOF) + while ((c = getopt(argc, argv, "+a:r:v")) != EOF) switch (c) { case 'a': index_blk_num = atoi(optarg); continue; - case 'o': - offset_blocks = atoi(optarg); - continue; case 'r': root_node_no = atoi(optarg); continue;