/***********************************************************************
?* 以字節(jié)為單位從當(dāng)前位置讀取數(shù)據(jù)塊
?***********************************************************************/
UINT8CH376ByteRead( PUINT8 buf, UINT16 ReqCount, PUINT16 RealCount )
{
UINT8s;
xWriteCH376Cmd( CMD2H_BYTE_READ );
xWriteCH376Data( (UINT8)ReqCount );
xWriteCH376Data( (UINT8)(ReqCount>>8) );
if ( RealCount ) *RealCount = 0;
while ( 1 )
{
s = Wait376Interrupt( );
if ( s == USB_INT_DISK_READ )
{
//* 從當(dāng)前主機(jī)端點(diǎn)的接收緩沖區(qū)讀取數(shù)據(jù)塊,返回長度
s = CH376ReadBlock( buf );
xWriteCH376Cmd( CMD0H_BYTE_RD_GO );
buf += s;
if ( RealCount ) *RealCount += s;
}
else return( s ); ?/* 錯(cuò)誤 */
}
}
程序是用的是范例,打開文件成功,但是在讀取字節(jié)時(shí),每次運(yùn)行到"s = Wait376Interrupt( );"這行時(shí),返回值 s = B4H,得不到"1DH",然后不能讀出數(shù)據(jù),就錯(cuò)誤返回了。不知道是哪里出錯(cuò)了。