#ifndef _DRV_FLASH_
#define _DRV_FLASH_

#ifdef __cplusplus
extern "C" {
#endif

#include "kit_macro.h"

typedef struct
{
    uint32_t start_page;
    uint32_t page_cnt;
}flash_Item_t;

#define STATIC_FLASH_INIT(_name, _start_page, _page_cnt)  \
    flash_Item_t _name = \
    {   \
        (_start_page),     \
        (_page_cnt),    \
    }



kit_ret_e drv_flash_read_u16(flash_Item_t *item, uint32_t addr, uint16_t *data);
kit_ret_e drv_flash_read_u32(flash_Item_t *item, uint32_t addr, uint32_t *data);

kit_ret_e drv_flash_write_u32(flash_Item_t *item, uint32_t addr, uint32_t value);
kit_ret_e flash_series_erase_page(flash_Item_t *item, uint32_t addr, uint32_t cnt); 

uint32_t drv_flash_get_page_size(flash_Item_t *item);
void flash_jump(uint32_t dest_addr, NoArgFuncCall call);
    
kit_ret_e drv_drv_flash_write_u32(uint32_t addr, uint32_t value);
kit_ret_e drv_bsp_flash_write_data_u32(uint32_t addr, uint8_t* buf, uint32_t len);
kit_ret_e drv_flash_series_erase_page(uint32_t addr, uint32_t cnt); 
#ifdef __cplusplus
}
#endif

#endif
