/******************************************************************/
/*AC Timing Characteristics define for Command / Address / Data Input
/*for cpu frequency 48MHZ,
/******************************************************************/
/******************************************************************/
/*function: erase flash
/*input: addrH: flash row address,16 bit width refer to datasheet
/*return: I/O status
/* I/O No. Page Program Block Erase Cache Prorgam Read Definition
/* I/O 0 Pass/Fail Pass/Fail Pass/Fail(N) Not use Pass : "0" Fail : "1"
/* I/O 1 Not use Not use Pass/Fail(N-1) Not use Pass : "0" Fail : "1"
/* I/O 2 Not use Not use Not use Not use "0"
/* I/O 3 Not Use Not Use Not Use Not Use "0"
/* I/O 4 Not Use Not Use Not Use Not Use "0"
/* I/O 5 Ready/Busy Ready/Busy True Ready/Busy Ready/Busy Busy : "0" Ready : "1"
/* I/O 6 Ready/Busy Ready/Busy Ready/Busy Ready/Busy Busy : "0" Ready : "1"
/* I/O 7 Write Protect Write Protect Write Protect Write Protect Protected: "0" Not Protected:"1"
/******************************************************************/
unsigned char flash_erase(unsigned int addrH)
{
ss_comm_latch(0x60,0);
ss_addr_latch(LOWBYTE(addrH));
ss_addr_latch(HIGHBYTE(addrH));
ss_comm_latch(0xd0,1); //twb
return ss_status_read(1); //status is 0x60h(write protect is set)/0xe0h(non wp) is good
}
/******************************************************************/
/*function: read flash
/*input: addrH: flash row address,16 bit width refer to datasheet
/* addrL: flash column address,12 bit width
/* databuf: out data buffer pointer
/* buflen: unsigned char num from flash
/******************************************************************/
unsigned char flash_read_PAG(unsigned int addrH,
unsigned int addrL,
unsigned char *databuf,
unsigned int buflen)
{
ss_comm_latch(0x00,0);
ss_addr_latch(LOWBYTE(addrL));
ss_addr_latch(HIGHBYTE(addrL));
ss_addr_latch(LOWBYTE(addrH));
ss_addr_latch(HIGHBYTE(addrH));