projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
USB: compile-time endpoints allocation
[bertos.git]
/
bertos
/
cpu
/
cortex-m3
/
drv
/
flash_stm32.c
diff --git
a/bertos/cpu/cortex-m3/drv/flash_stm32.c
b/bertos/cpu/cortex-m3/drv/flash_stm32.c
index 39f16182b2c15dea44ae2b4af572175227746727..62e448f3ab35dd9d201ba78756c89b3655247d9f 100644
(file)
--- a/
bertos/cpu/cortex-m3/drv/flash_stm32.c
+++ b/
bertos/cpu/cortex-m3/drv/flash_stm32.c
@@
-139,10
+139,7
@@
static void stm32_flash_clearerror(struct KBlock *blk)
static size_t stm32_flash_readDirect(struct KBlock *blk, block_idx_t idx, void *buf, size_t offset, size_t size)
{
static size_t stm32_flash_readDirect(struct KBlock *blk, block_idx_t idx, void *buf, size_t offset, size_t size)
{
- ASSERT(offset == 0);
- ASSERT(size == blk->blk_size);
-
- memcpy(buf, (void *)(idx * blk->blk_size), size);
+ memcpy(buf, (void *)(idx * blk->blk_size + offset), size);
return size;
}
return size;
}
@@
-174,7
+171,6
@@
static size_t stm32_flash_writeDirect(struct KBlock *blk, block_idx_t idx, const
uint32_t addr = idx * blk->blk_size;
const uint8_t *buf = (const uint8_t *)_buf;
uint32_t addr = idx * blk->blk_size;
const uint8_t *buf = (const uint8_t *)_buf;
- kprintf("idx[%ld],size[%u]\n", idx, size);
while (size)
{
uint16_t data = (*(buf + 1) << 8) | *buf;
while (size)
{
uint16_t data = (*(buf + 1) << 8) | *buf;
@@
-235,20
+231,21
@@
static void common_init(Flash *fls)
}
}
-void flash_hw_init(Flash *fls)
+void flash_hw_init(Flash *fls
, int flags
)
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_buffered_vt;
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_buffered_vt;
- fls->blk.priv.flags |= KB_BUFFERED | KB_PARTIAL_WRITE;
+ fls->blk.priv.flags |= KB_BUFFERED | KB_PARTIAL_WRITE
| flags
;
fls->blk.priv.buf = flash_buf;
/* Load the first block in the cache */
fls->blk.priv.buf = flash_buf;
/* Load the first block in the cache */
- void *
a =
0;
- memcpy(fls->blk.priv.buf,
a
, fls->blk.blk_size);
+ void *
flash_start = 0x
0;
+ memcpy(fls->blk.priv.buf,
flash_start
, fls->blk.blk_size);
}
}
-void flash_hw_initUnbuffered(Flash *fls)
+void flash_hw_initUnbuffered(Flash *fls
, int flags
)
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_unbuffered_vt;
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_unbuffered_vt;
+ fls->blk.priv.flags |= flags;
}
}