X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fcore%2Fao_storage.c;h=6eddae7f84dcdd754b8c46d54972d352f19fc754;hp=6ffca0e5f10313f70f687701652abc6f6c8f0b11;hb=bb9fdef607728cc326a82aa632e59724f272e53b;hpb=f6f54d70b768dca1715ddddea64a4df00d82b09e diff --git a/src/core/ao_storage.c b/src/core/ao_storage.c index 6ffca0e5..6eddae7f 100644 --- a/src/core/ao_storage.c +++ b/src/core/ao_storage.c @@ -15,10 +15,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "ao.h" +#include +#include uint8_t -ao_storage_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant +ao_storage_read(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant { uint16_t this_len; uint16_t this_off; @@ -48,7 +49,7 @@ ao_storage_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant } uint8_t -ao_storage_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant +ao_storage_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant { uint16_t this_len; uint16_t this_off; @@ -103,7 +104,7 @@ ao_storage_dump(void) __reentrant } } -#if 0 +#if HAS_STORAGE_DEBUG /* not enough space for this today */ @@ -153,22 +154,23 @@ ao_storage_zapall(void) __reentrant ao_cmd_white(); if (!ao_match_word("DoIt")) return; - for (pos = 0; pos < ao_storage_config; pos += ao_storage_block) + for (pos = 0; pos < ao_storage_log_max; pos += ao_storage_block) ao_storage_erase(pos); } void ao_storage_info(void) __reentrant { - printf("Storage size: %ld\n", ao_storage_total); - printf("Storage erase unit: %ld\n", ao_storage_block); + ao_storage_setup(); + printf("Storage size: %ld\n", (long) ao_storage_total); + printf("Storage erase unit: %ld\n", (long) ao_storage_block); ao_storage_device_info(); } __code struct ao_cmds ao_storage_cmds[] = { { ao_storage_info, "f\0Show storage" }, { ao_storage_dump, "e \0Dump flash" }, -#ifdef HAS_STORAGE_DBG +#if HAS_STORAGE_DEBUG { ao_storage_store, "w ...\0Write data to flash" }, #endif { ao_storage_zap, "z \0Erase " },