unsigned char CH376ReadBlock( unsigned char * buf )
{
? ?unsigned char s, l;
? ?xWriteCH376Cmd( CMD01_RD_USB_DATA0 );//0x27
? ?s = l = xReadCH376Data( ); /* 后續(xù)數(shù)據(jù)長(zhǎng)度 */ ?
? ?if ( l )?
? ?{
? ? ? do?
? ? ? {
? ? ? ? ?*buf = xReadCH376Data( );
? ? ? ? ?buf ++;
? ? ? } while ( -- l );
? ?}
? ?xEndCH376Cmd( );
? ?return( s );
}
CH376ReadBlock(GlobalBuf);/* 從內(nèi)存緩沖區(qū)讀取FAT_DIR_INFO數(shù)據(jù)塊,返回長(zhǎng)度總是sizeof(FAT_DIR_INFO) */
CH376EndDirInfo( ); ? ? ? ? ? ?/* 獲取完FAT_DIR_INFO結(jié)構(gòu) */
if ( ( GlobalBuf[11] & ATTR_LONG_NAME_MASK ) != ATTR_LONG_NAME || GlobalBuf[13] != GlobalBuf[32] ) /* 類型錯(cuò)誤或者校驗(yàn)和錯(cuò)誤 */
{ ?
? ?s = ERR_LONG_NAME_ERR; ? ? ? ? ?
? ?//break; ? ?/* 沒(méi)有直接返回是因?yàn)槿绻谴蜷_(kāi)了根目錄那么必須要關(guān)閉后才能返回 */
}
PIC24EP256GU814 十六位單片機(jī)SPI方式調(diào)用CH376ReadBlock(GlobalBuf) 返回GlobalBuf[11] = 0x35,GlobalBuf[13] = 0x00,GlobalBuf[32] = 0x2c,類型錯(cuò)誤或者校驗(yàn)和錯(cuò)誤