X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fstm32l0%2Fao_flash_stm32l0.c;fp=src%2Fstm32l0%2Fao_flash_stm32l0.c;h=ba3274422ef969797bb50b0e28e7eb3b6868fa15;hp=68c21c825c9abbcc985dafed7fb1a813731c61f8;hb=476fd2f2c23da427b6b2a68f7d285767a924041e;hpb=7b1f4177d42e5e951a7db4289c847d355a785c2a diff --git a/src/stm32l0/ao_flash_stm32l0.c b/src/stm32l0/ao_flash_stm32l0.c index 68c21c82..ba327442 100644 --- 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 -void -ao_storage_setup(void) -{ -} - 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; } -/* 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; }