diff --git a/drivers/include/mtd_mapper.h b/drivers/include/mtd_mapper.h index 9f2ddbc32d514..025ea95dc81b1 100644 --- a/drivers/include/mtd_mapper.h +++ b/drivers/include/mtd_mapper.h @@ -39,6 +39,7 @@ * .sector_count = SECTOR_COUNT / 2, * .pages_per_sector = PAGE_PER_SECTOR, * .page_size = PAGE_SIZE, + * .write_size = WRITE_SIZE, * }, * .parent = &parent, * .sector = SECTOR_COUNT / 2 diff --git a/drivers/mtd_mapper/mtd_mapper.c b/drivers/mtd_mapper/mtd_mapper.c index bca4bcc98ad1d..e02b35e0e5781 100644 --- a/drivers/mtd_mapper/mtd_mapper.c +++ b/drivers/mtd_mapper/mtd_mapper.c @@ -78,6 +78,7 @@ static int _init(mtd_dev_t *mtd) assert(backing_mtd->page_size == region->mtd.page_size); assert(backing_mtd->pages_per_sector == region->mtd.pages_per_sector); assert(backing_mtd->sector_count >= region->mtd.sector_count); + assert(backing_mtd->write_size == region->mtd.write_size); /* offset + region size must not exceed the backing device */ assert(region->sector + region->mtd.sector_count <= backing_mtd->sector_count); diff --git a/tests/mtd_mapper/main.c b/tests/mtd_mapper/main.c index 5b073a6ab84c9..ef88a0f380a79 100644 --- a/tests/mtd_mapper/main.c +++ b/tests/mtd_mapper/main.c @@ -37,6 +37,9 @@ #ifndef PAGE_SIZE #define PAGE_SIZE 64 #endif +#ifndef WRITE_SIZE +#define WRITE_SIZE 4 +#endif #define MEMORY_SIZE PAGE_SIZE * PAGE_PER_SECTOR * SECTOR_COUNT @@ -176,6 +179,7 @@ static mtd_dev_t dev = { .sector_count = SECTOR_COUNT, .pages_per_sector = PAGE_PER_SECTOR, .page_size = PAGE_SIZE, + .write_size = WRITE_SIZE, }; static mtd_mapper_parent_t _parent = MTD_PARENT_INIT(&dev); @@ -186,6 +190,7 @@ static mtd_mapper_region_t _region_a = { .sector_count = SECTOR_COUNT / 2, .pages_per_sector = PAGE_PER_SECTOR, .page_size = PAGE_SIZE, + .write_size = WRITE_SIZE, }, .parent = &_parent, .sector = 0, @@ -197,6 +202,7 @@ static mtd_mapper_region_t _region_b = { .sector_count = SECTOR_COUNT / 2, .pages_per_sector = PAGE_PER_SECTOR, .page_size = PAGE_SIZE, + .write_size = WRITE_SIZE, }, .parent = &_parent, .sector = SECTOR_COUNT / 2,