

#include  "flash.h"

#define	FCP5			(FLASH_BASE_ADDR+(0x555ul))		//flash command port 5
#define	FCPA			(FLASH_BASE_ADDR+(0x2aaul))		//flash command port A
#define	FCW5			0x55u
#define	FCWA			0xAAu
#define	FWORDWRITE		0xA0u
#define	FRESET			0xF0u
#define	FCHIPERASE0		0x80u
#define	FCHIPERASE1		0x10u
#define	FSECTORERASE0	0x80u
#define	FSECTORERASE1	0x30u
#define	FCHIPID			0x90u

#define	DQ7				(1u<<7)
#define	DQ6				(1u<<6)
#define	DQ5				(1u<<5)
#define	DQ3				(1u<<3)
#define	DQ2				(1u<<2)



　Vo idW riteWo rd (un signed in t A ddr, un signed sho rt V al)
　　{
　　　3 (vo lat ile un signed sho rt3 ) (F lashBaseA ddr+ 0x55553 4) = 0xaa;
　　　3 (vo lat ile un signed sho rt3 ) (F lashBaseA ddr+ 0x2aaa3 4) = 0x55;
　　　3 (vo lat ile un signed sho rt3 ) (F lashBaseA ddr+ 0x55553 4) = 0xa0;
　　　3 (vo lat ile un signed sho rt3 ) (F lashBaseA ddr+ A ddr3 4) = V al;
　　　W rite IsO ver0;
　　}
　　vo idW rite IsO ver (vo id)
　　{
　　　un signed sho rt L astToggleB it, Cu rren tToggleB it;
　　　L astToggleB it= (3 (vo lat ile un signed sho rt3 ) F lashBaseA ddr)& 0x40;
　　　Cu rren tToggleB it= (3 (vo lat ile un signed char3 ) F lashBaseA ddr)& 0x40;
　　　fo r (; ; )
　　　{
　　　L astToggleB it= Cu rren tToggleB it;
　　　Cu rren tToggleB it= (3 (vo lat ile un signed sho rt3 ) F lashBaseA ddr) & 0x40;
　　　if (L astToggleB it= Cu ren tToggleB it) b reak;
　　　}
　　}