我用375串口連接單片機(jī)做USB主設(shè)備,連接入U(xiǎn)盤可以讀取數(shù)據(jù),但嘗試用命令DISK_WRITE 寫數(shù)據(jù)到U盤的時(shí)候就收不到375的中斷回復(fù)了,誰能幫忙看下,謝謝?。。?/p>
u8 mWriteSector( unsigned long iLbaStart, unsigned char iSectorCount , u8 * ubuffer ) { unsigned char mIntStatus ; unsigned char *mBufferPoint; unsigned int mBlockCount; unsigned char mLength ; //??′?D′è?64×??úμ?êy?Y CH375_WR_CMD( CMD_DISK_WRITE ); CH375_WR_DAT( (unsigned char)iLbaStart ); CH375_WR_DAT( (unsigned char)( iLbaStart >> 8 ) ); CH375_WR_DAT( (unsigned char)( iLbaStart >> 16 ) ); CH375_WR_DAT( (unsigned char)( iLbaStart >> 24 ) ); CH375_WR_DAT( iSectorCount ); for ( mBlockCount = iSectorCount * CH375_BLK_PER_SEC; mBlockCount != 0; mBlockCount -- ) { mLength = 0x40 ; mIntStatus = mWaitInterrupt( ); if ( mIntStatus == USB_INT_DISK_WRITE ) { CH375_WR_CMD( CMD_WR_USB_DATA7 ); CH375_WR_DAT( mLength ); while ( mLength -- ) CH375_WR_DAT( *ubuffer++ ); CH375_WR_CMD( CMD_DISK_WR_GO ); } else break; } if ( mBlockCount == 0 ) { mIntStatus = mWaitInterrupt( ); if ( mIntStatus == USB_INT_SUCCESS ) return( 0 ); } return( mIntStatus ); }