#ifndef BSP_FMC_FLASH_H
#define BSP_FMC_FLASH_H

#include <stdbool.h>
#include <stdint.h>


#define BSP_FLASH_PAGE_SIZE      ((uint32_t)0x400U)    // 1KB per page
#define BSP_FLASH_PROGRAM_UNIT   ((uint32_t)4U)         // 4 bytes per program unit (word)
#define BSP_FLASH_ERASE_VALUE    ((uint8_t)0xFFU)       // Value of erased flash bytes


typedef struct
{
    uint32_t page_size;
    uint32_t program_unit;
    uint8_t erased_value;
} bsp_flash_info_t;

const bsp_flash_info_t *bsp_flash_get_info(void);
uint8_t bsp_flash_read(uint32_t addr, void *buffer, uint32_t size);
uint8_t bsp_flash_erased(uint32_t addr, uint32_t size);
uint8_t bsp_flash_write(uint32_t addr, const void *data, uint32_t size);
uint8_t bsp_flash_is_erased(uint32_t addr, uint32_t size);



#endif /* BSP_FMC_FLASH_H */
