Skip to content

Commit 9f41abd

Browse files
author
Vincent Dupont
committed
squash spiffs: use mtd user api instead of function pointers
1 parent a7c3ea0 commit 9f41abd

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Makefile.dep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,4 +581,5 @@ ifneq (,$(filter spiffs,$(USEMODULE)))
581581
USEPKG += spiffs
582582
USEMODULE += vfs
583583
USEMODULE += spiffs_fs
584+
USEMODULE += mtd
584585
endif

pkg/spiffs/fs/spiffs_fs.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static int32_t _dev_read(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *dst)
2626

2727
//DEBUG("spiffs: read: from addr 0x%" PRIx32 " size 0x%" PRIx32 "\n", addr, size);
2828

29-
return dev->driver->read(dev, dst, addr, size);
29+
return mtd_read(dev, dst, addr, size);
3030
}
3131

3232
static int32_t _dev_write(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *src)
@@ -35,7 +35,7 @@ static int32_t _dev_write(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *src
3535

3636
DEBUG("spiffs: write: from addr 0x%" PRIx32 " size 0x%" PRIx32 "\n", addr, size);
3737

38-
return dev->driver->write(dev, src, addr, size);
38+
return mtd_write(dev, src, addr, size);
3939
}
4040

4141
static int32_t _dev_erase(struct spiffs_t *fs, u32_t addr, u32_t size)
@@ -44,7 +44,7 @@ static int32_t _dev_erase(struct spiffs_t *fs, u32_t addr, u32_t size)
4444

4545
DEBUG("spiffs: erase: from addr 0x%" PRIx32" size 0x%" PRIx32 "\n", addr, size);
4646

47-
return dev->driver->erase(dev, addr, size);
47+
return mtd_erase(dev, addr, size);
4848
}
4949
#else
5050
#error "SPIFFS needs SPIFFS_HAL_CALLBACK_EXTRA"
@@ -82,9 +82,7 @@ static int _mount(vfs_mount_t *mountp)
8282
fs_desc->config.phys_addr = 0;
8383
fs_desc->config.phys_erase_block = dev->page_size * dev->pages_per_sector;
8484

85-
if (dev->driver->init) {
86-
dev->driver->init(dev);
87-
}
85+
mtd_init(dev);
8886

8987
s32_t ret = SPIFFS_mount(&fs_desc->fs,
9088
&fs_desc->config,

0 commit comments

Comments
 (0)