CH376讀U盤里的文件。文件較大,設(shè)置的buf[2048];讀了2048個buf就通過串口發(fā)出,然后繼續(xù)讀下一個2048,直到文件全部讀完。現(xiàn)在僅第一個2048能讀出數(shù)據(jù),以后讀出的和第一次相同。程序如下:
u32 read_addr;
ee:
????if(RealCount)
????????????*RealCount=0;
????xWriteCH376Cmd(CMD2H_BYTE_READ);
????xWriteCH376Cmd((u8) ReqCount);
????xWriteCH376Cmd((u8) ReqCount>>8);
????while(1)
????{????
????????s=Wait376interrupt();
????????if(s==USB_INT_DISK_READ)
????????{
????????????s=CH376ReadBlock(buf);
????????????xWriteCH376Cmd(CMD0H_BYTE_RD_GO);
????????????buf+=s;
????????????if(RealCount)
????????????????*RealCount+=s;
????????}
????????else if(s==USB_INT_SUCCESS)
????????{
????????????//串口發(fā)送buf,此處省
????????????read_addr=read_addr+2048;
????????????s=CH376ByteLocate(read_addr);
????????????if(s!=USB_INT_SUCCESS)
????????????????return (s);
????????????else
????????????????goto ee;??
????????}
????}
是不是CH376ByteLocate發(fā)得不對?