mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
Merge pull request #20173 from fabian18/pr/mtd_flashpage_improve_write_page
drivers/mtd_flashpage: improve _write_page
This commit is contained in:
commit
ece8a12f81
@ -114,9 +114,9 @@ static int _write_page(mtd_dev_t *dev, const void *buf, uint32_t page, uint32_t
|
||||
__attribute__ ((aligned (FLASHPAGE_WRITE_BLOCK_ALIGNMENT)));
|
||||
|
||||
offset = addr % FLASHPAGE_WRITE_BLOCK_ALIGNMENT;
|
||||
size = MIN(size, FLASHPAGE_WRITE_BLOCK_ALIGNMENT - offset);
|
||||
size = MIN(size, FLASHPAGE_WRITE_BLOCK_SIZE - offset);
|
||||
|
||||
DEBUG("flashpage: write %"PRIu32" unaligned bytes\n", size);
|
||||
DEBUG("flashpage: write %"PRIu32" at %p - ""%"PRIu32"\n", size, (void *)addr, offset);
|
||||
|
||||
memcpy(&tmp[0], (uint8_t *)addr - offset, sizeof(tmp));
|
||||
memcpy(&tmp[offset], buf, size);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user