mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
pkg/spiffs: add multi-partitions support
Two new fileds added in spiffs descriptor: - base_addr: base address of the partition - part_block_count: number of sectors in the partition If part_block_count is 0, the whole underlying MTD is used
This commit is contained in:
parent
c227ec8790
commit
ced65bbf5b
@ -136,10 +136,16 @@ static int prepare(spiffs_desc_t *fs_desc)
|
||||
#if SPIFFS_SINGLETON == 0
|
||||
DEBUG("spiffs: mount: mtd page_size=%" PRIu32 ", pages_per_sector=%" PRIu32
|
||||
", sector_count=%" PRIu32 "\n", dev->page_size, dev->pages_per_sector, dev->sector_count);
|
||||
fs_desc->config.phys_size = dev->page_size * dev->pages_per_sector * dev->sector_count;
|
||||
uint32_t sector_count = (fs_desc->block_count == 0) ? dev->sector_count : fs_desc->block_count;
|
||||
/* inside memory area */
|
||||
assert(((fs_desc->base_addr / (dev->page_size * dev->pages_per_sector)) + sector_count)
|
||||
<= dev->sector_count);
|
||||
/* base addr is aligned on a sector */
|
||||
assert(fs_desc->base_addr % (dev->pages_per_sector * dev->page_size) == 0);
|
||||
fs_desc->config.phys_size = dev->page_size * dev->pages_per_sector * sector_count;
|
||||
fs_desc->config.log_block_size = dev->page_size * dev->pages_per_sector;
|
||||
fs_desc->config.log_page_size = dev->page_size;
|
||||
fs_desc->config.phys_addr = 0;
|
||||
fs_desc->config.phys_addr = fs_desc->base_addr;
|
||||
fs_desc->config.phys_erase_block = dev->page_size * dev->pages_per_sector;
|
||||
#endif
|
||||
|
||||
|
@ -116,6 +116,11 @@ typedef struct spiffs_desc {
|
||||
#if (SPIFFS_HAL_CALLBACK_EXTRA == 1) || defined(DOXYGEN)
|
||||
mtd_dev_t *dev; /**< The underlying mtd device, must be set by user */
|
||||
#endif
|
||||
#if (SPIFFS_SINGLETON == 0) || defined(DOXYGEN)
|
||||
uint32_t base_addr; /**< Base address of partition */
|
||||
uint32_t block_count; /**< Number of blocks in current partition,
|
||||
* if 0, the mtd number of sector is used */
|
||||
#endif
|
||||
} spiffs_desc_t;
|
||||
|
||||
/** The SPIFFS vfs driver, a pointer to a spiffs_desc_t must be provided as vfs_mountp::private_data */
|
||||
|
Loading…
Reference in New Issue
Block a user