各位21IC USB技术专区的大哥们,小弟想实现PC通过USB读写SD卡(像U盘)。现在被卡在USB批量传输这里了,想大哥们支支招。
希望有这一块源码的大哥给我指点一下,或是发个源码给我参考一下。
谢谢。
project01.rar
(197.03 KB)
上图是用BUS Hound抓出来的图片。
void Ep3Handler(void)
{
U8 out_csr3,in_csr1,i;
int fifoCnt;
rINDEX_REG=3;
out_csr3=rOUT_CSR1_REG;
if(out_csr3 & EPO_OUT_PKT_READY)
{
fifoCnt=rOUT_FIFO_CNT1_REG;
RdPktEp3(ep3Buf,fifoCnt);
PrintEpoPkt(ep3Buf,fifoCnt);
rINDEX_REG=1;
in_csr1=rOUT_CSR1_REG;
for(i=0;i<sizeof(InquiryTbl);i++)
{
rEP1_FIFO = InquiryTbl;
}
SET_EP1_IN_PKT_READY();
///////////
rEP1_FIFO = 0x55;
rEP1_FIFO = 0x53;
rEP1_FIFO = 0x42;
rEP1_FIFO = 0x53;
rEP1_FIFO = ep3Buf[4];
rEP1_FIFO = ep3Buf[5];
rEP1_FIFO = ep3Buf[6];
rEP1_FIFO = ep3Buf[7];
rEP1_FIFO = 0x00;
rEP1_FIFO = 0x00;
rEP1_FIFO = 0x00;
rEP1_FIFO = 0x00;
SET_EP1_IN_PKT_READY();
CLR_EP3_OUT_PKT_READY();
return;
}
void Ep1Handler(void)
{
U8 in_csr1;
rINDEX_REG=1;
in_csr1=rIN_CSR1_REG;
//I think that EPI_SENT_STALL will not be set to 1.
if(in_csr1 & EPI_SENT_STALL)
{
CLR_EP1_SENT_STALL();
return;
}
PrepareEp1Fifo();
//IN_PKT_READY is set
//This packit will be used for next IN packit.
return;
}
这是为什么? |