From e9011a1ae42333fdcbebf9b85ced6ea942f3547c Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Sun, 19 Feb 2017 19:23:18 -0500 Subject: Remove unnecessary delays in flash code. --- stm-keystore.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'stm-keystore.c') diff --git a/stm-keystore.c b/stm-keystore.c index d5d8adb..633d554 100644 --- a/stm-keystore.c +++ b/stm-keystore.c @@ -40,7 +40,7 @@ SPI_HandleTypeDef hspi_keystore; struct spiflash_ctx keystore_ctx = {&hspi_keystore, KSM_PROM_CS_N_GPIO_Port, KSM_PROM_CS_N_Pin}; -int keystore_check_id() +int keystore_check_id(void) { return n25q128_check_id(&keystore_ctx); } @@ -64,15 +64,6 @@ static int keystore_erase_something(uint32_t start, uint32_t stop, uint32_t limi if (stop > limit || stop < start) return -3; for (something = start; something <= stop; something++) { - int timeout = 200; /* times 10ms = 2 seconds timeout */ - while (timeout--) { - int i = n25q128_get_wip_flag(&keystore_ctx); - if (i < 0) return 0; - if (! i) break; - HAL_Delay(10); - } - if (! timeout) return 0; - if (! eraser(&keystore_ctx, something)) { return -1; } @@ -91,3 +82,8 @@ int keystore_erase_subsectors(uint32_t start, uint32_t stop) return keystore_erase_something(start, stop, N25Q128_NUM_SUBSECTORS, n25q128_erase_subsector); } + +int keystore_erase_bulk(void) +{ + return n25q128_erase_bulk(&keystore_ctx); +} -- cgit v1.2.3