From: Keith Packard Date: Tue, 23 Jun 2020 23:15:28 +0000 (-0700) Subject: altos/ao_storage: allow erased byte value to be set by application X-Git-Tag: 1.9.5~1^2~47 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=45b00da14ea814cf8f14dcb2cfaccaddd0fbb38d;p=fw%2Faltos altos/ao_storage: allow erased byte value to be set by application External flash is usually 0xff for erased bytes, but other memory may use different values Signed-off-by: Keith Packard --- diff --git a/src/kernel/ao_storage.c b/src/kernel/ao_storage.c index 1554cee7..213ec2d6 100644 --- a/src/kernel/ao_storage.c +++ b/src/kernel/ao_storage.c @@ -86,6 +86,10 @@ ao_storage_write(ao_pos_t pos, void *v_buf, uint16_t len) return 1; } +#ifndef AO_STORAGE_ERASED_BYTE +#define AO_STORAGE_ERASED_BYTE 0xff +#endif + uint8_t ao_storage_is_erased(uint32_t pos) { @@ -107,7 +111,7 @@ ao_storage_is_erased(uint32_t pos) goto done; } for (i = 0; i < this_time; i++) - if (storage_data[i] != 0xff) { + if (storage_data[i] != AO_STORAGE_ERASED_BYTE) { ret = 0; goto done; }