mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/sam0_common: mtd_sdhc: ensure source address alignment
The source / destination address of the SDHC transfer needs to be word-aligned. Use the mtd buffer to fix the alignment if `mtd_write_page` is used, otherwise return -ENOTSUP.
This commit is contained in:
parent
809f9ed174
commit
e8fd493f41
@ -69,7 +69,7 @@ static int _read_page(mtd_dev_t *dev, void *buff, uint32_t page,
|
||||
DEBUG("%s(%lu, %lu, %lu)\n", __func__, page, offset, size);
|
||||
|
||||
/* emulate unaligned / sub-page read */
|
||||
if (pages == 0 || offset) {
|
||||
if (pages == 0 || offset || ((uintptr_t)buff & 0x3)) {
|
||||
#if IS_USED(MODULE_MTD_WRITE_PAGE)
|
||||
if (dev->work_area == NULL) {
|
||||
DEBUG("mtd_sdhc: no work area\n");
|
||||
@ -105,7 +105,7 @@ static int _write_page(mtd_dev_t *dev, const void *buff, uint32_t page,
|
||||
DEBUG("%s(%lu, %lu, %lu)\n", __func__, page, offset, size);
|
||||
|
||||
/* emulate unaligned / sub-page write */
|
||||
if (pages == 0 || offset) {
|
||||
if (pages == 0 || offset || ((uintptr_t)buff & 0x3)) {
|
||||
#if IS_USED(MODULE_MTD_WRITE_PAGE)
|
||||
if (dev->work_area == NULL) {
|
||||
DEBUG("mtd_sdhc: no work area\n");
|
||||
|
Loading…
Reference in New Issue
Block a user