/* X600Demo.c: Demo program for X600 Compiler: BC++ 3.1 Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum) Compile mode: large Project: X600Demo.c ..\..\Lib\7188el.lib ..\..\Lib\Xboard\X600.lib Hardware: 7188EX + X600 command for x600.exe(x600demo) 1."D [page]" --> dump one page data(also dump the 16 bytes spare data.) page : 0-15, if not give the page number, it will dump the next page. just press ENTER has the same function as "D". 2."B block" --> set the block number. system will show the message "Do you want erase blcok xxx(HHH)?" must press 'y'('Y') to make sure. if want use hex value, please use "0x"+HEX, such as "0x1A". 3."erase block" --> erase block(one block=16 pages) 4."F page data" --> fill one page with the data. 5."T block" --> test block. Test function will save the block data first, then erase it, then check the erased data are 0xff or not. the write the random data to it and check again, then erase again & write back the saved data. "TA" --> test all block. */ #include #include #include #include #include #include #if !defined(__TURBOC__) || (__TURBOC__ >= 0x0400) #include #else #include #endif #include "..\..\lib\7188e.h" #include "..\..\lib\xboard\X600.h" char maker,device,status; char buf1[512], buf2[16]; /* --- main program ----------------------------------------------- */ void NewDemo(void); void main(void) { NewDemo(); } char Prompt[20]="\r\n[X600]"; char cmd[80]; int cmdlength=0; int block=0; int page=0; unsigned char PageBuf[512+16]; void ShowBlockPage(void) { Print("Block=%d(%03X), Page=%d(%X)", block, block, page, page); } void DumpData(void) { int i; unsigned char *data=PageBuf; ShowBlockPage(); for(i=0;i<512;i++) { if(!(i&0x0F)) Print("\r\n%03d(%03X):", i, i); Print(" %02X", *data++); } Print("\r\nSpare data are:"); for(i=0; i<16; i++) { Print(" %02X", *data++); } } void DumpPage(void) { int tmp; if(cmdlength>1 && sscanf(cmd+1, "%i", &tmp)) { if(tmp>=0 && tmp=MaxBlock) block=0; } } } void ChangeBlock(void) { int tmp; if(cmdlength>1 && sscanf(cmd+1, "%i",&tmp)) { if(tmp>=0 && tmp5 && sscanf(cmd+5, "%i",&tmp)) { if(tmp>=0 && tmp1) { j=sscanf(cmd+1, "%i %i", &tmp, &data); if(j>=1) { if(tmp>=0 && tmp=2) { if(cmd[1]=='a' || cmd[1]=='A') /* Test all block */ { for(tmp=0; tmp", tmp); err++; } } if(!err) Print("\r\nALL OK."); else Print("\r\n%d errors", err); } else { if(sscanf(cmd+1,"%i", &tmp) && (tmp>=0 && tmp