#ifndef _FMC_FLASH_H__
#define _FMC_FLASH_H__
#include <stdint.h>

#define one_page_size 2048

#define data_bk_page_index 4
#define data_page_index 3
#define sn_page_index 2
#define magic_page_index 1 //must is the last page in 256K eara

void fmc_write_sn(uint8_t *sn, int len);
void fmc_read_sn(uint8_t *sn, int len);

void fmc_write_data(int index, uint8_t *data, int len);
void fmc_read_data(int index, uint8_t *data, int len);
void fmc_write_magic(uint32_t magic);
uint32_t fmc_read_magic(void);
uint32_t fmc_get_addr(int page);
void fmc_write_trq_table_begin(int addr);
void fmc_write_trq_table_continue(const u8 *data, int len);
void fmc_write_trq_table_end(void);

#endif /* _FMC_FLASH_H__ */

