1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/mtd_mapper: Add write_size

This commit is contained in:
chrysn 2022-02-26 23:58:25 +01:00
parent 35b57af065
commit 52ea93ef03
3 changed files with 8 additions and 0 deletions

View File

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

View File

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

View File

@ -37,6 +37,9 @@
#ifndef PAGE_SIZE
#define PAGE_SIZE 64
#endif
#ifndef WRITE_SIZE
#define WRITE_SIZE 4
#endif
#define MEMORY_PAGE_COUNT PAGE_PER_SECTOR * SECTOR_COUNT
@ -180,6 +183,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);
@ -190,6 +194,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,
@ -201,6 +206,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,