shell: flash: display capacity and usage

tags/0.1.0
S.J.R. van Schaik 8 years ago
parent 58ae4bb2ea
commit b55fea5379
  1. 11
      source/shell/flash.c

@ -105,13 +105,14 @@ static void do_flash_probe(const char *s)
}
if (!(flash = flash_probe())) {
fprintf(stderr, "error: unable to probe flash device.\n");
fprintf(stderr, "error: unable to probe the flash device.\n");
return;
}
}
static void do_flash_info(const char *s)
{
size_t size;
size_t size, capacity;
(void)s;
@ -121,10 +122,10 @@ static void do_flash_info(const char *s)
}
size = flash_get_size(flash);
capacity = flash_get_capacity(flash);
printf("Capacity: %" PRSZu " blocks (", size / (4 * KIB));
print_size(size);
printf(")\n");
printf(" size: %" PRSZu "/%" PRSZu " bytes (%" PRSZu "%% usage)\n",
size, capacity, 100 * size / capacity);
}
static void do_flash_read(const char *s)

Loading…
Cancel
Save