1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/flashdb: have FAL MTD and defaults for partition 0 defined

This commit is contained in:
Fabian Hüßler 2023-04-29 14:41:44 +02:00
parent 034fd09e15
commit 6e1e78d126
3 changed files with 35 additions and 4 deletions

View File

@ -49,6 +49,34 @@ extern struct fal_flash_dev mtd_flash0;
&mtd_flash0, \
}
#if !defined(FAL_MTD)
/**
* @brief Default MTD to use for flashdb
*/
#define FAL_MTD MTD_0
#endif
#if !defined(FAL_PART_LABEL)
/**
* @brief Default FAL partition to use for flashdb
*/
#define FAL_PART_LABEL FAL_PART0_LABEL
#endif
#if !defined(FAL_PART0_LABEL)
/**
* @brief Have at least the label of partition 0 defined
*/
#define FAL_PART0_LABEL "part0"
#endif
#if !defined(FAL_PART0_LENGTH)
/**
* @brief Have at least the length of partition 0 defined
*/
#define FAL_PART0_LENGTH (2 * 4096u)
#endif
/**
* @brief Partition 0
*/
@ -83,7 +111,7 @@ extern struct fal_flash_dev mtd_flash0;
* @brief Partition 3
*/
#ifdef FAL_PART3_LABEL
#define FAL_ROW_PART3 { FAL_PART_MAGIC_WORD, FAL_PART2_LABEL, "fal_mtd",
#define FAL_ROW_PART3 { FAL_PART_MAGIC_WORD, FAL_PART3_LABEL, "fal_mtd",
FAL_PART2_LENGTH, FAL_PART3_LENGTH, 0 },
#else
#define FAL_ROW_PART3

View File

@ -75,7 +75,9 @@ struct fal_flash_dev mtd_flash0 = {
void fdb_mtd_init(mtd_dev_t *mtd)
{
unsigned sector_size;
if (_mtd) {
return;
}
mtd_init(mtd);
_mtd = mtd;

View File

@ -9,6 +9,7 @@
#include <sys/types.h>
#include <flashdb.h>
#include "fal_cfg.h"
#include "board.h"
#include "mutex.h"
#ifdef MODULE_VFS
@ -20,8 +21,8 @@
/**
* @brief Select MTD device to use for FlashDB
*/
#if !defined(FDB_MTD) && defined(MTD_0)
#define FDB_MTD MTD_0
#if !defined(FDB_MTD)
#define FDB_MTD FAL_MTD
#endif
#define FDB_LOG_TAG "[main]"