13#include "bd/lfs2_rambd.h"
14#include "bd/lfs2_filebd.h"
23#ifdef LFS2_TESTBD_YES_TRACE
24#define LFS2_TESTBD_TRACE(...) LFS2_TRACE(__VA_ARGS__)
26#define LFS2_TESTBD_TRACE(...)
35enum lfs2_testbd_badblock_behavior {
36 LFS2_TESTBD_BADBLOCK_PROGERROR,
37 LFS2_TESTBD_BADBLOCK_ERASEERROR,
38 LFS2_TESTBD_BADBLOCK_READERROR,
39 LFS2_TESTBD_BADBLOCK_PROGNOOP,
40 LFS2_TESTBD_BADBLOCK_ERASENOOP,
44typedef uint32_t lfs2_testbd_wear_t;
45typedef int32_t lfs2_testbd_swear_t;
56 uint32_t erase_cycles;
59 uint8_t badblock_behavior;
63 uint32_t power_cycles;
86 uint32_t power_cycles;
87 lfs2_testbd_wear_t *wear;
99int lfs2_testbd_create(
const struct lfs2_config *cfg,
const char *path);
100int lfs2_testbd_createcfg(
const struct lfs2_config *cfg,
const char *path,
104int lfs2_testbd_destroy(
const struct lfs2_config *cfg);
107int lfs2_testbd_read(
const struct lfs2_config *cfg, lfs2_block_t block,
108 lfs2_off_t off,
void *buffer, lfs2_size_t size);
113int lfs2_testbd_prog(
const struct lfs2_config *cfg, lfs2_block_t block,
114 lfs2_off_t off,
const void *buffer, lfs2_size_t size);
120int lfs2_testbd_erase(
const struct lfs2_config *cfg, lfs2_block_t block);
123int lfs2_testbd_sync(
const struct lfs2_config *cfg);
129lfs2_testbd_swear_t lfs2_testbd_getwear(
const struct lfs2_config *cfg,
133int lfs2_testbd_setwear(
const struct lfs2_config *cfg,
134 lfs2_block_t block, lfs2_testbd_wear_t wear);