|
|
|
@ -23,8 +23,6 @@ static size_t stdio_flash_read(struct flash_dev *dev, uint32_t addr, void *data, |
|
|
|
|
size_t len); |
|
|
|
|
static size_t stdio_flash_write(struct flash_dev *dev, uint32_t addr, |
|
|
|
|
const void *data, size_t len); |
|
|
|
|
static int stdio_flash_copy(struct flash_dev *dev, uint32_t dst, uint32_t src, |
|
|
|
|
size_t len); |
|
|
|
|
static int stdio_flash_erase(struct flash_dev *dev, uint32_t addr); |
|
|
|
|
static void stdio_flash_release(struct flash_dev *dev); |
|
|
|
|
|
|
|
|
@ -33,7 +31,7 @@ static struct flash_ops stdio_flash_ops = { |
|
|
|
|
.get_size = stdio_flash_get_size, |
|
|
|
|
.read = stdio_flash_read, |
|
|
|
|
.write = stdio_flash_write, |
|
|
|
|
.copy = stdio_flash_copy, |
|
|
|
|
.copy = default_flash_copy, |
|
|
|
|
.is_erased = default_flash_is_erased, |
|
|
|
|
.erase = stdio_flash_erase, |
|
|
|
|
}; |
|
|
|
@ -85,29 +83,6 @@ static size_t stdio_flash_write(struct flash_dev *dev, uint32_t addr, |
|
|
|
|
return len; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int stdio_flash_copy(struct flash_dev *dev, uint32_t dst, uint32_t src, |
|
|
|
|
size_t len) |
|
|
|
|
{ |
|
|
|
|
uint8_t data[64]; |
|
|
|
|
size_t nbytes; |
|
|
|
|
|
|
|
|
|
while (len) { |
|
|
|
|
nbytes = min(sizeof data, len); |
|
|
|
|
|
|
|
|
|
if (stdio_flash_read(dev, src, data, nbytes) == 0) |
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
if (stdio_flash_write(dev, dst, data, nbytes) == 0) |
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
dst += nbytes; |
|
|
|
|
src += nbytes; |
|
|
|
|
len -= nbytes; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int stdio_flash_erase(struct flash_dev *dev, uint32_t addr) |
|
|
|
|
{ |
|
|
|
|
struct stdio_flash_priv *priv = dev->priv; |
|
|
|
|