我为什么调用s = CH376ByteRead(buf, 255, &RealCount ); 函数的时候返回数据比较短。
UINT8CH376ByteRead( PUINT8 buf, UINT16 ReqCount, PUINT16 RealCount ) /* 以字节为单位从当前位置读取数据块 */
{
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 ); /* 从当前主机端点的接收缓冲区读取数据块,返回长度 */
xWriteCH376Cmd( CMD0H_BYTE_RD_GO );
xEndCH376Cmd( );
buf += s;
if ( RealCount ) *RealCount += s;
}
/*else if ( s == USB_INT_SUCCESS ) return( s );*/ /* 结束 */
else return( s ); /* 错误 */
}
}
是不是这个地方有问题!
我这样改动就偶尔读取数据超时,具体改动余下。
do{
s = CH376ReadBlock( buf ); /* 从当前主机端点的接收缓冲区读取数据块,返回长度 */
buf += s;
RealCount += s;
s = CH376GetIntStatus();
}while(s!=0X1D);
希望技术解决疑惑!