#ifndef _LIB_EFLASH_H
#define _LIB_EFLASH_H

#include "type.h"

#define EFLASH_WRITEABLE	  TRUE
#define EFLASH_READABLE	    TRUE
#define EFLASH_DISWRITEABLE	FALSE
#define EFLASH_DISREADABLE	FALSE

#define PAGE_SIZE		        (0x200)


extern uint8_t LIB_EFLASH_RecoveryToBoot(void);
extern uint8_t LIB_EFLASH_Disboot(void);

extern void LIB_EFLASH_SetWritePermission(void);
extern void LIB_EFLASH_ClrWritePermission(void);

extern void LIB_EFLASH_Init(uint32_t f_eflash_khz);
extern uint8_t LIB_EFLASH_PageErase(uint32_t addr);
extern uint8_t LIB_EFLASH_BulkProgram(uint32_t addr, uint32_t num_words, uint32_t *data);
extern uint8_t LIB_EFLASH_WordProg(uint32_t addr, uint32_t dat);
extern void LIB_GetSerialNumber(uint8_t *buffer);

#endif
