Add 'f' command to display flash status register contents
authorKeith Packard <keithp@keithp.com>
Sun, 10 Jan 2010 01:57:52 +0000 (17:57 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 10 Jan 2010 01:57:52 +0000 (17:57 -0800)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_flash.c

index 86b9476..153015c 100644 (file)
@@ -480,9 +480,21 @@ flash_store(void) __reentrant
        ao_ee_flush();
 }
 
+static void
+flash_status(void) __reentrant
+{
+       uint8_t status;
+
+       ao_mutex_get(&ao_flash_mutex); {
+               status = ao_flash_read_status();
+               printf ("Flash status: 0x%02x\n", status);
+       } ao_mutex_put(&ao_flash_mutex);
+}
+
 __code struct ao_cmds ao_flash_cmds[] = {
        { 'e', flash_dump,      "e <block>                          Dump a block of flash data" },
        { 'w', flash_store,     "w <block> <start> <len> <data> ... Write data to flash" },
+       { 'f', flash_status,    "f                                  Show flash status register" },
        { 0,   flash_store, NULL },
 };