Loading...
Searching...
No Matches
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,
.write_size = WRITE_SIZE,
},
.parent = &parent,
.sector = SECTOR_COUNT / 2
};
mtd_dev_t *dev = &region.mtd;
#define MTD_0
MTD device for the 8 MByte QSPI Flash.
Definition board.h:68
#define MTD_PARENT_INIT(_parent)
Shortcut macro for initializing the members of an mtd_mapper_parent_t struct.
Definition mtd_mapper.h:78
const mtd_desc_t mtd_mapper_driver
Mapper MTD device operations table.
MTD device descriptor.
Definition mtd.h:112
const mtd_desc_t * driver
MTD driver.
Definition mtd.h:113
MTD mapper backing device context.
Definition mtd_mapper.h:88
MTD mapped region.
Definition mtd_mapper.h:97
mtd_dev_t mtd
MTD context
Definition mtd_mapper.h:98

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.
 

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:224

Shortcut macro for initializing the members of an mtd_mapper_parent_t struct.

Definition at line 78 of file mtd_mapper.h.