projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Deal with cc1201 limitations
[fw/altos]
/
src
/
stm32l0
/
ao_flash_stm32l0.c
diff --git
a/src/stm32l0/ao_flash_stm32l0.c
b/src/stm32l0/ao_flash_stm32l0.c
index 68c21c825c9abbcc985dafed7fb1a813731c61f8..ba3274422ef969797bb50b0e28e7eb3b6868fa15 100644
(file)
--- a/
src/stm32l0/ao_flash_stm32l0.c
+++ b/
src/stm32l0/ao_flash_stm32l0.c
@@
-132,11
+132,6
@@
ao_flash_page(uint32_t *page, uint32_t *src)
}
#endif
}
#endif
-void
-ao_storage_setup(void)
-{
-}
-
static ao_pos_t write_pos;
static uint8_t write_pending;
static union {
static ao_pos_t write_pos;
static uint8_t write_pending;
static union {
@@
-210,23
+205,22
@@
ao_storage_device_write(ao_pos_t pos, void *buf, uint16_t len)
return 1;
}
return 1;
}
-/* Erase device from pos through pos + ao_storage_block */
-uint8_t
-ao_storage_device_erase(uint32_t pos)
+bool
+ao_storage_device_is_erased(uint32_t pos)
{
{
- ao_flash_erase_page(__storage + pos);
- return 1;
-}
+ uint8_t *m = ((uint8_t *) __storage) + pos;
+ uint32_t i;
-/* Initialize low-level device bits */
-void
-ao_storage_device_init(void)
-{
+ for (i = 0; i < STM_FLASH_PAGE_SIZE; i++)
+ if (*m++ != AO_STORAGE_ERASED_BYTE)
+ return false;
+ return true;
}
}
-/*
Print out information about flash chips
*/
-void
-ao_storage_device_
info(void
)
+/*
Erase device from pos through pos + ao_storage_block
*/
+uint8_t
+ao_storage_device_
erase(uint32_t pos
)
{
{
- printf("Detected chips 1 size %d\n", ao_storage_total);
+ ao_flash_erase_page(__storage + (pos >> 2));
+ return 1;
}
}