48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
#ifndef BSP_FDB_H_
|
|
#define BSP_FDB_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "kit_macro.h"
|
|
#include "drv_flash.h"
|
|
|
|
typedef struct
|
|
{
|
|
uint8_t data_cnt;
|
|
uint32_t area_size;
|
|
uint32_t *data_addr;
|
|
|
|
uint32_t main_area;
|
|
uint32_t sub_area;
|
|
|
|
uint32_t write_addr;
|
|
|
|
}FdbItem;
|
|
|
|
#define FDB_STATIC_INIT(_name, _data_cnt, _area_size, _main_area, _sub_area) \
|
|
uint32_t _name##_data_addr[_data_cnt]; \
|
|
FdbItem _name = \
|
|
{ \
|
|
(_data_cnt), \
|
|
(_area_size), \
|
|
(_name##_data_addr), \
|
|
(_main_area), \
|
|
(_sub_area), \
|
|
}
|
|
|
|
|
|
void bsp_fdb_init(FdbItem *item);
|
|
uint32_t bsp_fdb_get_data_addr(FdbItem *item, uint8_t data_idx);
|
|
uint16_t bsp_fdb_read_data(FdbItem *item, uint8_t data_idx, uint8_t *buf);
|
|
bool bsp_fdb_write_data(FdbItem *item, uint8_t data_idx, uint8_t *buf, uint16_t len);
|
|
uint16_t bsp_fdb_read_raw_data(FdbItem *item, uint8_t data_idx, uint8_t *buf);
|
|
bool bsp_fdb_write_raw_data(FdbItem *item, uint8_t data_idx, uint8_t *buf, uint16_t len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|