if (InitCH376Host() == USB_INT_SUCCESS) { if (CH376DiskConnect()== USB_INT_SUCCESS) { while(1); } else { if(CH376DiskMount() != USB_INT_SUCCESS) { Dlayms(100); while(1); } else { strcpy(buf, "\ABC.TXT"); if(CH376FileOpen(buf)==USB_INT_SUCCESS) { CH376ByteRead( buf, 30, &RealCount ); } } } } 前面都正常,運(yùn)行 CH376ByteRead( buf, 30, &RealCount );時(shí),s = Wait376Interrupt( );s=0x14,不是USB_INT_DISK_READ ,一直進(jìn)不去,不知什么原因。下面是CH376ByteRead函數(shù)。
UINT8 CH376ByteRead( PUINT8 buf, UINT16 ReqCount, PUINT16 RealCount ) /* 以字節(jié)為單位從當(dāng)前位置讀取數(shù)據(jù)塊 */ { UINT8 s; WriteCH376Cmd(CMD2H_BYTE_READ); WriteCH376Data((UINT8)ReqCount); WriteCH376Data((UINT8)(ReqCount>>8)); 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ù)塊,返回長(zhǎng)度 WriteCH376Cmd( CMD0H_BYTE_RD_GO ); buf += s; if ( RealCount ) { *RealCount += s; } } else { return( s ); /* 錯(cuò)誤 */ } } }