42 lines
1001 B
C
42 lines
1001 B
C
#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;
|
|
}FlashItem;
|
|
|
|
#define FLASH_STATIC_INIT(_name, _start_page, _page_cnt) \
|
|
FlashItem _name = \
|
|
{ \
|
|
(_start_page), \
|
|
(_page_cnt), \
|
|
}
|
|
|
|
|
|
|
|
KitResult flash_read_u16(FlashItem *item, uint32_t addr, uint16_t *data);
|
|
KitResult flash_read_u32(FlashItem *item, uint32_t addr, uint32_t *data);
|
|
|
|
KitResult flash_write_u32(FlashItem *item, uint32_t addr, uint32_t value);
|
|
KitResult flash_series_erase_page(FlashItem *item, uint32_t addr, uint32_t cnt);
|
|
|
|
uint32_t flash_get_page_size(FlashItem *item);
|
|
void flash_jump(uint32_t dest_addr, NoArgCall call);
|
|
|
|
KitResult drv_flash_write_u32(uint32_t addr, uint32_t value);
|
|
KitResult drv_flash_series_write_u32(uint32_t addr, uint8_t* buf, uint32_t len);
|
|
KitResult drv_flash_series_erase_page(uint32_t addr, uint32_t cnt);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|