#ifndef INTERNAL_FALSH_H
#define INTERNAL_FALSH_H

#define FLASH_USER_FONT_24X24   					ADDR_FLASH_SECTOR_2_BANK2      //
#define FLASH_USER_FONT_24X24_SECTOR_NUM 	4

#define FLASH_USER_FACTORY_PRM						ADDR_FLASH_SECTOR_6_BANK2      //
#define FLASH_USER_FACTORY_PRM_SECTOR_NUM 1

#define FLASH_USER_PIC 										ADDR_FLASH_SECTOR_7_BANK2

#define FLASH_USER_PIC_16X16   						FLASH_USER_PIC      //one sector 128 pic, use half
#define FLASH_USER_PIC_16X16_UINT 				1024//16*16*4 byte
#define FLASH_USER_PIC_16X16_COUNT_MAX   	32    
//#define FLASH_USER_PIC_16X16_SECTOR_NUM 	1

#define FLASH_USER_PIC_24X24   						FLASH_USER_PIC_16X16 + (FLASH_USER_PIC_16X16_UINT * FLASH_USER_PIC_16X16_COUNT_MAX)  //one sector 56 pic
#define FLASH_USER_PIC_24X24_UINT 				2304//24*24*4 byte
#define FLASH_USER_PIC_24X24_COUNT_MAX   	24
//#define FLASH_USER_PIC_24X24_SECTOR_NUM 	2

#define FLASH_USER_PIC_32X32   						FLASH_USER_PIC_24X24 + (FLASH_USER_PIC_24X24_UINT * FLASH_USER_PIC_24X24_COUNT_MAX)      //one sector 32 pic
#define FLASH_USER_PIC_32X32_UINT 				4096//32*32*4 byte
#define FLASH_USER_PIC_32X32_COUNT_MAX   	4
//#define FLASH_USER_PIC_32X32_SECTOR_NUM 	1

#define FLASH_USER_PIC_LOGO   						FLASH_USER_PIC_32X32 + (FLASH_USER_PIC_32X32_UINT * FLASH_USER_PIC_32X32_COUNT_MAX) 
#define FLASH_USER_PIC_LOGO24_UINT 				8640//24*90*4 byte
#define FLASH_USER_PIC_LOGO32_UINT 				15616//32*122*4 byte
#define FLASH_USER_PIC_LOGO24   					FLASH_USER_PIC_LOGO
#define FLASH_USER_PIC_LOGO32   					(FLASH_USER_PIC_LOGO + FLASH_USER_PIC_LOGO24_UINT)

typedef struct{//32byte
	unsigned int open_password_isenable;
	unsigned int rsv1;
	unsigned int auth_function_isenable;
	unsigned char pid[12];
	unsigned int ctl_type;
	unsigned int pwr;
}T_Factory_Prm;

extern T_Factory_Prm factory_prm;

extern void reset_factory_prm(void);
extern void write_factory_prm(void);
extern void read_factory_prm(void);

extern void erase_internal_one_sector(unsigned int Address);
extern void write_internal_flash(unsigned int Address,	unsigned int val_addr);
extern void read_internal_flash(unsigned int start_address,	unsigned int * val_addr, unsigned int num);

#endif
