projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ao_tracker: Fix tracker_interval type to match config type (plus -Wconversion)
[fw/altos]
/
src
/
kernel
/
ao_storage.h
diff --git
a/src/kernel/ao_storage.h
b/src/kernel/ao_storage.h
index 6cc6fcb70797bfa5dbc66fed6979925e58d44c50..ff8548eb150d71bb73a92ddf4457e7079a7a760f 100644
(file)
--- a/
src/kernel/ao_storage.h
+++ b/
src/kernel/ao_storage.h
@@
-3,7
+3,8
@@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-30,18
+31,26
@@
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 */
-extern __pdata ao_pos_t ao_storage_total;
+#ifndef 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 */
-extern __pdata ao_pos_t ao_storage_block;
+#ifndef ao_storage_block
+extern ao_pos_t ao_storage_block;
+#endif
#ifndef USE_STORAGE_CONFIG
#define USE_STORAGE_CONFIG 1
#endif
#ifndef USE_STORAGE_CONFIG
#define USE_STORAGE_CONFIG 1
#endif
+#ifndef AO_STORAGE_ERASED_BYTE
+#define AO_STORAGE_ERASED_BYTE 0xff
+#endif
+
#if USE_STORAGE_CONFIG
/* Byte offset of config block. Will be ao_storage_block bytes long */
#if USE_STORAGE_CONFIG
/* Byte offset of config block. Will be ao_storage_block bytes long */
-extern
__pdata
ao_pos_t ao_storage_config;
+extern ao_pos_t ao_storage_config;
#define ao_storage_log_max ao_storage_config
#else
#define ao_storage_log_max ao_storage_config
#else
@@
-49,27
+58,35
@@
extern __pdata 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. */
-extern __pdata uint16_t ao_storage_unit;
+#ifndef 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
-ao_storage_setup(void)
__reentrant
;
+ao_storage_setup(void);
/* Write data. Returns 0 on failure, 1 on success */
uint8_t
/* Write data. Returns 0 on failure, 1 on success */
uint8_t
-ao_storage_write(ao_pos_t pos,
__xdata void *buf, uint16_t len) __reentrant
;
+ao_storage_write(ao_pos_t pos,
void *buf, uint16_t len)
;
/* Read data. Returns 0 on failure, 1 on success */
uint8_t
/* Read data. Returns 0 on failure, 1 on success */
uint8_t
-ao_storage_read(ao_pos_t pos,
__xdata void *buf, uint16_t len) __reentrant
;
+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) __reentrant;
+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
-ao_storage_flush(void)
__reentrant
;
+ao_storage_flush(void);
/* Initialize the storage code */
void
/* Initialize the storage code */
void
@@
-81,11
+98,15
@@
ao_storage_init(void);
/* Read data within a storage unit */
uint8_t
/* Read data within a storage unit */
uint8_t
-ao_storage_device_read(ao_pos_t pos,
__xdata void *buf, uint16_t len) __reentrant
;
+ao_storage_device_read(ao_pos_t pos,
void *buf, uint16_t len)
;
/* Write data within a storage unit */
uint8_t
/* Write data within a storage unit */
uint8_t
-ao_storage_device_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant;
+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
/* Initialize low-level device bits */
void
@@
-93,6
+114,6
@@
ao_storage_device_init(void);
/* Print out information about flash chips */
void
/* Print out information about flash chips */
void
-ao_storage_device_info(void)
__reentrant
;
+ao_storage_device_info(void);
#endif /* _AO_STORAGE_H_ */
#endif /* _AO_STORAGE_H_ */