X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fao_flash.c;h=01d371bbeeb12ed6b8b89629393949cfd94a8ed2;hp=86b94765e984909878bfb8c78e0f1b2ad2172901;hb=05e5bb2d330b755967d06fb859585c81f5f5fbb5;hpb=dc8d18736239b14c2ec48a40a01515912c5c25e6 diff --git a/src/ao_flash.c b/src/ao_flash.c index 86b94765..01d371bb 100644 --- a/src/ao_flash.c +++ b/src/ao_flash.c @@ -404,6 +404,7 @@ ao_ee_write_config(uint8_t *buf, uint16_t len) __reentrant if (len > FLASH_BLOCK_SIZE) return 0; ao_mutex_get(&ao_flash_mutex); { + printf("FLASH_CONFIG_BLOCK: %d\n", FLASH_CONFIG_BLOCK); ao_flash_fill(FLASH_CONFIG_BLOCK); memcpy(ao_flash_data, buf, len); ao_flash_block_dirty = 1; @@ -480,9 +481,28 @@ flash_store(void) __reentrant ao_ee_flush(); } +static void +flash_status(void) __reentrant +{ + uint8_t status; + + ao_flash_setup(); + ao_mutex_get(&ao_flash_mutex); { + status = ao_flash_read_status(); + printf ("Flash status: 0x%02x\n", status); + printf ("Flash block shift: %d\n", FLASH_BLOCK_SHIFT); + printf ("Flash block size: %d\n", FLASH_BLOCK_SIZE); + printf ("Flash block mask: %d\n", FLASH_BLOCK_MASK); + printf ("Flash device size: %ld\n", FLASH_DEVICE_SIZE); + printf ("Flash data size: %ld\n", FLASH_DATA_SIZE); + printf ("Flash config block: %d\n", FLASH_CONFIG_BLOCK); + } ao_mutex_put(&ao_flash_mutex); +} + __code struct ao_cmds ao_flash_cmds[] = { { 'e', flash_dump, "e Dump a block of flash data" }, { 'w', flash_store, "w ... Write data to flash" }, + { 'f', flash_status, "f Show flash status register" }, { 0, flash_store, NULL }, };