MTD address mapper

Driver for address remap for flash devices. More...

Detailed Description

Driver for address remap for flash devices.

This MTD module allows for remapping multiple different regions on a single MTD device and present them as separate MTD devices. This is similar to partitions on a hard drive, although this system only allows hardcoded partitions and lacks a partition table.

The use case for this module is to be able to split a single MTD device, for example a SPI NOR flash chip into multiple separate regions which all can contain their own content or file systems.

Usage

To use this module include it in your makefile:

USEMODULE += mtd_mapper

To define new regions with an existing MTD device the following is required:

.mtd = {
.sector_count = SECTOR_COUNT / 2,
.pages_per_sector = PAGE_PER_SECTOR,
.page_size = PAGE_SIZE,
},
.parent = &parent,
.sector = SECTOR_COUNT / 2
};
mtd_dev_t *dev = &region.mtd;

The snippet here defines a region within an existing MTD_0 device of half the size of MTD_0 and starting in the middle of the device.

Warning
Please ensure that the different configured regions do not overlap.

Interface definitions for mtd mapper support

Author
Koen Zandberg koen@.nosp@m.berg.nosp@m.zand..nosp@m.net

Data Structures

struct  mtd_mapper_parent_t
 MTD mapper backing device context. More...
 
struct  mtd_mapper_region_t
 MTD mapped region. More...
 

Macros

#define MTD_PARENT_INIT(_parent)
 Shortcut macro for initializing the members of an mtd_mapper_parent_t struct. More...
 

Variables

const mtd_desc_t mtd_mapper_driver
 Mapper MTD device operations table.
 

Macro Definition Documentation

◆ MTD_PARENT_INIT

#define MTD_PARENT_INIT (   _parent)
Value:
{ \
.mtd = _parent, \
.lock = MUTEX_INIT, \
.init = false, \
}
#define MUTEX_INIT
Static initializer for mutex_t.
Definition: mutex.h:148

Shortcut macro for initializing the members of an mtd_mapper_parent_t struct.

Definition at line 77 of file mtd_mapper.h.