[fdb] Support 128bit write granularity for kvdb (#250)
* Support 128bit write granularity The new stm32h5xx chips can only write quad words, i.e. 128bits. * Update fdb_tsdb.c to include 128bit option * Update fdb_cfg.h to include 64bit and 128bit option.
This commit is contained in:
parent
12f3960307
commit
7bdef5eab7
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#ifdef FDB_USING_FAL_MODE
|
#ifdef FDB_USING_FAL_MODE
|
||||||
/* the flash write granularity, unit: bit
|
/* the flash write granularity, unit: bit
|
||||||
* only support 1(nor flash)/ 8(stm32f2/f4)/ 32(stm32f1) */
|
* only support 1(nor flash)/ 8(stm32f2/f4)/ 32(stm32f1)/ 64(stm32f7)/ 128(stm32h5) */
|
||||||
#define FDB_WRITE_GRAN /* @note you must define it for a value */
|
#define FDB_WRITE_GRAN /* @note you must define it for a value */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
#error "Please configure flash write granularity (in fdb_cfg.h)"
|
#error "Please configure flash write granularity (in fdb_cfg.h)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FDB_WRITE_GRAN != 1 && FDB_WRITE_GRAN != 8 && FDB_WRITE_GRAN != 32 && FDB_WRITE_GRAN != 64
|
#if FDB_WRITE_GRAN != 1 && FDB_WRITE_GRAN != 8 && FDB_WRITE_GRAN != 32 && FDB_WRITE_GRAN != 64 && FDB_WRITE_GRAN != 128
|
||||||
#error "the write gran can be only setting as 1, 8, 32 and 64"
|
#error "the write gran can be only setting as 1, 8, 32, 64 and 128"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* magic word(`F`, `D`, `B`, `1`) */
|
/* magic word(`F`, `D`, `B`, `1`) */
|
||||||
@ -105,8 +105,8 @@ struct sector_hdr_data {
|
|||||||
uint32_t magic; /**< magic word(`E`, `F`, `4`, `0`) */
|
uint32_t magic; /**< magic word(`E`, `F`, `4`, `0`) */
|
||||||
uint32_t combined; /**< the combined next sector number, default: not combined */
|
uint32_t combined; /**< the combined next sector number, default: not combined */
|
||||||
uint32_t reserved;
|
uint32_t reserved;
|
||||||
#if (FDB_WRITE_GRAN == 64)
|
#if (FDB_WRITE_GRAN == 64) || (FDB_WRITE_GRAN == 128)
|
||||||
uint8_t padding[4]; /**< align padding for 64bit write granularity */
|
uint8_t padding[4]; /**< align padding for 64bit and 128bit write granularity */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
typedef struct sector_hdr_data *sector_hdr_data_t;
|
typedef struct sector_hdr_data *sector_hdr_data_t;
|
||||||
@ -121,6 +121,9 @@ struct kv_hdr_data {
|
|||||||
#if (FDB_WRITE_GRAN == 64)
|
#if (FDB_WRITE_GRAN == 64)
|
||||||
uint8_t padding[4]; /**< align padding for 64bit write granularity */
|
uint8_t padding[4]; /**< align padding for 64bit write granularity */
|
||||||
#endif
|
#endif
|
||||||
|
#if (FDB_WRITE_GRAN == 128)
|
||||||
|
uint8_t padding[12]; /**< align padding for 128bit write granularity */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
typedef struct kv_hdr_data *kv_hdr_data_t;
|
typedef struct kv_hdr_data *kv_hdr_data_t;
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
#if defined(FDB_USING_TSDB)
|
#if defined(FDB_USING_TSDB)
|
||||||
|
|
||||||
#if (FDB_WRITE_GRAN == 64)
|
#if (FDB_WRITE_GRAN == 64) || (FDB_WRITE_GRAN == 128)
|
||||||
#error "Flash 64 bits write granularity is not supported in TSDB yet!"
|
#error "Flash 64 or 128 bits write granularity is not supported in TSDB yet!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* magic word(`T`, `S`, `L`, `0`) */
|
/* magic word(`T`, `S`, `L`, `0`) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user