我為什么調(diào)用s = CH376ByteRead(buf, 255, &RealCount ); 函數(shù)的時(shí)候返回?cái)?shù)據(jù)比較短。
UINT8CH376ByteRead( PUINT8 buf, UINT16 ReqCount, PUINT16 RealCount )? /* 以字節(jié)為單位從當(dāng)前位置讀取數(shù)據(jù)塊 */
{
UINT8s;
xWriteCH376Cmd( CMD2H_BYTE_READ );
xWriteCH376Data( (UINT8)ReqCount );
xWriteCH376Data( (UINT8)(ReqCount>>8) );
xEndCH376Cmd( );
if ( RealCount ) *RealCount = 0;
while ( 1 ) {
s = Wait376Interrupt( );
if ( s == USB_INT_DISK_READ ) {
s = CH376ReadBlock( buf );? /* 從當(dāng)前主機(jī)端點(diǎn)的接收緩沖區(qū)讀取數(shù)據(jù)塊,返回長度 */
xWriteCH376Cmd( CMD0H_BYTE_RD_GO );
xEndCH376Cmd( );
buf += s;
if ( RealCount ) *RealCount += s;
}
/*else if ( s == USB_INT_SUCCESS ) return( s );*/? /* 結(jié)束 */
else return( s );? /* 錯誤 */
}
}
是不是這個地方有問題!
我這樣改動就偶爾讀取數(shù)據(jù)超時(shí),具體改動余下。
?do{
s = CH376ReadBlock( buf );? /* 從當(dāng)前主機(jī)端點(diǎn)的接收緩沖區(qū)讀取數(shù)據(jù)塊,返回長度 */
? ? ? ? ? ? ? ? ?buf += s;
RealCount += s;
s = CH376GetIntStatus();
}while(s!=0X1D);
希望技術(shù)解決疑惑!