1
0
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:
benpicco 2024-01-02 13:21:51 +00:00 committed by GitHub
commit ece8a12f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);