ticks_t start = timer_clock();
while (true)
{
+ cpu_relax();
if (!(EMB_FLASH->SR & FLASH_FLAG_BSY))
break;
LOG_ERR("Timeout..\n");
return false;
}
-
- cpu_relax();
}
return true;
return true;
}
+#if 0
+// not used for now
static bool stm32_eraseAll(struct KBlock *blk)
{
EMB_FLASH->CR |= CR_MER_SET;
return true;
}
+#endif
static int stm32_flash_error(struct KBlock *blk)
{
static size_t stm32_flash_readDirect(struct KBlock *blk, block_idx_t idx, void *buf, size_t offset, size_t size)
{
- memcpy(buf, (void *)(idx * blk->blk_size), size);
+ memcpy(buf, (void *)(idx * blk->blk_size + offset), size);
return size;
}
}
-void flash_hw_init(Flash *fls, int flags)
+void flash_hw_init(Flash *fls, UNUSED_ARG(int, flags))
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_buffered_vt;
- fls->blk.priv.flags |= KB_BUFFERED | KB_PARTIAL_WRITE | flags;
+ fls->blk.priv.flags |= KB_BUFFERED | KB_PARTIAL_WRITE;
fls->blk.priv.buf = flash_buf;
/* Load the first block in the cache */
memcpy(fls->blk.priv.buf, flash_start, fls->blk.blk_size);
}
-void flash_hw_initUnbuffered(Flash *fls, int flags)
+void flash_hw_initUnbuffered(Flash *fls, UNUSED_ARG(int, flags))
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_unbuffered_vt;
- fls->blk.priv.flags |= flags;
}