/***********************************************************************
* 以字节为单位从当前位置读取数据块
***********************************************************************/
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 )
{
//* 从当前主机端点的接收缓冲区读取数据块,返回长度
s = CH376ReadBlock( buf );
xWriteCH376Cmd( CMD0H_BYTE_RD_GO );
buf += s;
if ( RealCount ) *RealCount += s;
}
else return( s ); /* 错误 */
}
}
程序是用的是范例,打开文件成功,但是在读取字节时,每次运行到"s = Wait376Interrupt( );"这行时,返回值 s = B4H,得不到"1DH",然后不能读出数据,就错误返回了。不知道是哪里出错了。