Loading...
Searching...
No Matches
MTD wrapper for emulated MTD devices

MTD device that is emulated in RAM for test purposes. More...

Detailed Description

MTD device that is emulated in RAM for test purposes.

Helpers for using emulated MTDs.

Author
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Data Structures

struct  mtd_emulated_t
 Device descriptor for a MTD device that is emulated in RAM. More...
 

Macros

#define MTD_EMULATED_DEV(n, sc, pps, ps)
 Macro to define an emulated MTD.
 
#define MTD_EMULATED_DEV_FS(n, m, fs)    VFS_AUTO_MOUNT(fs, VFS_MTD(mtd_emulated_dev ## n), "/mtde" # n, m)
 Macro to define an automatic VFS mount point for an emulated MTD.
 

Variables

const mtd_desc_t _mtd_emulated_driver
 Emulated MTD device operations table for mtd.
 

Macro Definition Documentation

◆ MTD_EMULATED_DEV

#define MTD_EMULATED_DEV (   n,
  sc,
  pps,
  ps 
)
Value:
uint8_t _mtd_emulated_memory ## n[sc * pps * ps]; \
\
mtd_emulated_t mtd_emulated_dev ## n = { \
.base = { \
.sector_count = sc, \
.pages_per_sector = pps, \
.page_size = ps, \
.write_size = 1, \
}, \
.size = sc * pps * ps, \
.memory = _mtd_emulated_memory ## n, \
.init_done = false, \
}; \
\
XFA_CONST(mtd_dev_t, mtd_dev_xfa, 99) CONCAT(*mtd_emulated, n) = (mtd_dev_t *)&mtd_emulated_dev ## n
#define CONCAT(a, b)
Concatenate the tokens a and b.
Definition utils.h:29
const mtd_desc_t _mtd_emulated_driver
Emulated MTD device operations table for mtd.
mtd_dev_t *const mtd_dev_xfa[]
MTD device array as XFA.
Definition mtd.h:139
void ps(void)
Print information to all active threads to stdout.
MTD device descriptor.
Definition mtd.h:112
const mtd_desc_t * driver
MTD driver.
Definition mtd.h:113
Device descriptor for a MTD device that is emulated in RAM.
mtd_dev_t base
inherit from mtd_dev_t object

Macro to define an emulated MTD.

This macro creates a MTD device that is emulated in RAM. For example, using

MTD_EMULATED_DEV(0, 16, 4, 64)
#define MTD_EMULATED_DEV(n, sc, pps, ps)
Macro to define an emulated MTD.

creates the emulated MTD device mtd_emulated_dev0 with 16 sectors, 4 pages per sector and a page size of 64 bytes. The write size is always 1 byte.

Note
The emulated devices are added to the XFA of MTD device pointers mtd_dev_xfa with priority 99 to place them at the end of the XFA.
Parameters
nindex of the emulated MTD (results into symbol mtd_emulated_dev<n>)
scsectors of the emulated MTD
ppspages per sector of the emulated MTD
pspage size in bytes

Definition at line 50 of file mtd_emulated.h.

◆ MTD_EMULATED_DEV_FS

#define MTD_EMULATED_DEV_FS (   n,
  m,
  fs 
)     VFS_AUTO_MOUNT(fs, VFS_MTD(mtd_emulated_dev ## n), "/mtde" # n, m)

Macro to define an automatic VFS mount point for an emulated MTD.

For example, using

MTD_EMULATED_DEV_FS(0, 2, fatfs);
#define MTD_EMULATED_DEV_FS(n, m, fs)
Macro to define an automatic VFS mount point for an emulated MTD.

automatically mounts the emulated MTD mtd_emulated_dev0 with FAT file system under mount point /mtde0 with unique index 2.

Parameters
nindex of the emulated MTD (symbol mtd_emulated_dev<n>, mount point /mtde0)
munique overall index of VFS mount point
fsfilesystem type used

Definition at line 83 of file mtd_emulated.h.