void SendOneByteToCh376(Uint08 Data)
{
????USART_ClearFlag(USART1,USART_FLAG_TC);
????USART_SendData(USART1,Data);
????while(USART_GetFlagStatus(USART1,USART_FLAG_TC)==RESET);
}
void SendCmdToCh376(Uint08 Cmd)
{
????SendOneByteToCh376(0x57);
????SendOneByteToCh376(0xAB);
????SendOneByteToCh376(Cmd);
}
Uint16 WriteReqDataBlock(Uint08 *Buf)
{
????Uint16 BlockLen,BlockLenBak;
????SendCmdToCh376(WriteReqData);
????BlockLenBak=BlockLen=GetCh376IntStatus();
????if(BlockLen)
????{
????????do
????????{
????????//??SendOneByteToCh376(*Buf++);
????????????SendOneByteToCh376('1');
????????}while(--BlockLen);
????}
????return(BlockLenBak);
}
void ByteWriteCh376(Uint08 *Buf,Uint32 Len)
{
????Uint16 BlockLen;
????SendCmdToCh376(Byte_Write);
????SendOneByteToCh376((Uint08)Len);
????SendOneByteToCh376((Uint08)(Len>>8));
????while(1)
????{
????????if(GetCh376IntStatus() == USB_DISK_WRITE)
????????{
????????????BlockLen=WriteReqDataBlock(Buf);
????????????SendCmdToCh376(Byte_Write_Go);
????????????Buf = Buf + BlockLen;
????????}
????????else
????????{
????????????break;
????????}
????}
}
創(chuàng)建文件,打開(kāi)文件都正常,444個(gè)字節(jié)的數(shù)據(jù)要寫(xiě)入文件;“if(GetCh376IntStatus() == USB_DISK_WRITE)”第一二次都是0x1E,第三次是0x14,“BlockLen=WriteReqDataBlock(Buf);”第一次返回0xFF,第二次返回0xBD,合計(jì)也是444字節(jié),這些都顯示向文件寫(xiě)數(shù)據(jù)是成功的,但是在PC上打開(kāi)文件看不到寫(xiě)入的數(shù)據(jù)。請(qǐng)專(zhuān)家指導(dǎo),謝謝!
另:文件的創(chuàng)建時(shí)間怎么解決?