projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/ao_storage: Allow apps to #define storage parameters
[fw/altos]
/
src
/
kernel
/
ao_storage.h
diff --git
a/src/kernel/ao_storage.h
b/src/kernel/ao_storage.h
index cf37a824db0a1c986603fd0b267d9cce59bcaaf4..026074b5d2db4c2bd30768a2e1fcd2de780bc636 100644
(file)
--- a/
src/kernel/ao_storage.h
+++ b/
src/kernel/ao_storage.h
@@
-31,10
+31,14
@@
typedef ao_storage_pos_t ao_pos_t;
/* Total bytes of available storage */
typedef ao_storage_pos_t ao_pos_t;
/* Total bytes of available storage */
+#ifndef ao_storage_total
extern ao_pos_t ao_storage_total;
extern ao_pos_t ao_storage_total;
+#endif
/* Block size - device is erased in these units. At least 256 bytes */
/* Block size - device is erased in these units. At least 256 bytes */
+#ifndef ao_storage_block
extern ao_pos_t ao_storage_block;
extern ao_pos_t ao_storage_block;
+#endif
#ifndef USE_STORAGE_CONFIG
#define USE_STORAGE_CONFIG 1
#ifndef USE_STORAGE_CONFIG
#define USE_STORAGE_CONFIG 1
@@
-50,7
+54,9
@@
extern ao_pos_t ao_storage_config;
#endif
/* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */
#endif
/* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */
+#ifndef ao_storage_unit
extern uint16_t ao_storage_unit;
extern uint16_t ao_storage_unit;
+#endif
/* Initialize above values. Can only be called once the OS is running */
void
/* Initialize above values. Can only be called once the OS is running */
void
@@
-66,7
+72,13
@@
ao_storage_read(ao_pos_t pos, void *buf, uint16_t len);
/* Erase a block of storage. This always clears ao_storage_block bytes */
uint8_t
/* Erase a block of storage. This always clears ao_storage_block bytes */
uint8_t
-ao_storage_erase(ao_pos_t pos);
+ao_storage_erase(ao_pos_t pos, uint32_t len);
+
+/* Check storage starting at pos to see if the chunk there
+ * is erased
+ */
+uint8_t
+ao_storage_is_erased(uint32_t pos);
/* Flush any pending writes to stable storage */
void
/* Flush any pending writes to stable storage */
void
@@
-88,6
+100,10
@@
ao_storage_device_read(ao_pos_t pos, void *buf, uint16_t len);
uint8_t
ao_storage_device_write(ao_pos_t pos, void *buf, uint16_t len);
uint8_t
ao_storage_device_write(ao_pos_t pos, void *buf, uint16_t len);
+/* Erase device from pos through pos + ao_storage_block */
+uint8_t
+ao_storage_device_erase(uint32_t pos);
+
/* Initialize low-level device bits */
void
ao_storage_device_init(void);
/* Initialize low-level device bits */
void
ao_storage_device_init(void);