為什么使用CH375讀U盤扇區(qū)時(shí)只有從0扇區(qū)讀的時(shí)候才有數(shù)據(jù)?
從10,100等開始讀的時(shí)候,只顯示0.
u8 CH375_ReadDisk(u8* buf, u32 iLbaStart, u8 iSectorCount )
{
unsigned char i=0,j;
unsigned char status,len;
CH375_Write_Cmd( CMD5H_DISK_READ ); ?/* 從USB存儲(chǔ)器讀扇區(qū) */
CH375_Write_Data( (u8)iLbaStart ); ?/* LBA的最低8位 */
CH375_Write_Data( (u8)( (u16)iLbaStart >> 8 ) );
CH375_Write_Data( (u8)( iLbaStart >> 16 ) );
CH375_Write_Data( (u8)( iLbaStart >> 24 ) ); ?/* LBA的最高8位 */
CH375_Write_Data( iSectorCount ); ?/* 扇區(qū)數(shù) */
//xEndCH375Cmd( );
for(i=0;i<8;i++)
{
status=Wait375Interrupt();//等待中斷,返回中斷狀態(tài)碼
if (status==USB_INT_DISK_READ)
{
?CH375_Write_Cmd( CMD01_RD_USB_DATA ); ?/* 繼續(xù)執(zhí)行USB存儲(chǔ)器的讀操作 */
?len=CH375_Read_Data();
?for(j=0;j
?{
?* buf= CH375_Read_Data();
?buf++;
?}
?CH375_Write_Cmd( CMD0H_DISK_RD_GO ); ?/* 繼續(xù)執(zhí)行USB存儲(chǔ)器的讀操作 */
}
else
{
return status;
}
}
status=Wait375Interrupt();//等待中斷,返回中斷狀態(tài)碼
if (status==USB_INT_SUCCESS)
{
return 0;
}
else
{
return status;
}
}