你好。
Vavc
谢谢你的回复。
我使用EP2PF并将EP2FIFOFX值设置为FLAGB,当512字节的批量已经准备提交时,将设置该值。
所以,我认为PC到68013的数据是正确的。
我的PC和68013的代码关联到FPGA如下:
68013 init:
虚空(虚空)
{//在启动时调用一次
CPUCs=0x10;//CkkSPD[1:0]=10,对于48 MHz操作,输出输出
pFrAgAsAb=0x4a;//FLAB-EP2PF,FLAGE-EP6EF
同步延迟;
pFrAgCSCD= 0x08;//FLAG-EP2EF
同步延迟;
PoACACFG=0x80;
同步延迟;
IFCONFIG=0x03;/ /对于异步?同步吗?
同步延迟;
FIFOP极性=0x3F;
同步延迟;
CPUCS=0x02;
同步延迟;
RVCTL=0x01;
同步延迟;
EP4CFG= 0x01;//清除有效位
同步延迟;
EP8CFG= 0x01;//清除有效位
同步延迟;
EP2CFG= 0xA0;//OUT 512字节,4X,散装
同步延迟;
EP6CFG= 0xE0;//在512字节,4X,散装
同步延迟;
FiPosit=0x80;/ /激活NAC-ALL以避免竞争条件
同步延迟;//参见TRM第15.14节
FIFSET=0x02;//复位,FIFO 2
同步延迟;
FIFSET=0x04;//RESET,FIFO 4
同步延迟;
FIFSET=0x06;//RESET,FIFO 6
同步延迟;
FIFSET=0x08;//RESET,FIFO 8
同步延迟;
FiPosit=0x00;/ /去激活NACK-ALL
同步延迟;
EP2FIFOCFG=0x00;
同步延迟;
EP2FIFOCFG=0x10;/ /自动输出=1,字宽=0
同步延迟;
EP6FIFOCFG=0x00;
同步延迟;
EP6FIFOCFG=0x09;//Outin=1,ZeloLein=1,WordNew=1
同步延迟;
EP6AutoLunh=0x02;
同步延迟;
EP6AutoLeNLL=0x00;
同步延迟;
EP2FIFOFFH=0x88;
同步延迟;
EP2FIFOFL= 0x00;
同步延迟;
IpkTalk=0x84;
同步延迟;
IpkTalk=0x84;
同步延迟;
IpkTalk=0x84;
同步延迟;
IpkTalk=0x84;
同步延迟;
}
68013重置(错误时调用,EP0供应商):
布尔-斯塔尔(空)
{
FippET= 0x80;
同步延迟;
FiPosit=0x02;
同步延迟;
FippET= 0x06;
同步延迟;
FippET= 0x00;
同步延迟;
EP2FIFOCFG=0x00;
同步延迟;
EP2FIFOCFG=0x10;//8位
同步延迟;
EP6FIFOCFG=0x00;
同步延迟;
EP6FIFOCFG=0x09
;
同步延迟;
EP6AutoLunh=0x02;
同步延迟;
EP6AutoLeNLL=0x00;
同步延迟;
IpkTalk=0x84;
同步延迟;
IpkTalk=0x84;
同步延迟;
IpkTalk=0x84;
同步延迟;
IpkTalk=0x84;
同步延迟;
返回(真);
}
FPGA,从68013读:
--------------------
当满= & gt;
箱满
当0=gt时;
UBSDATAGEN和LT;
FIFO-UTRAILUTION & LT;
懒惰=‘0’;
SLRD=‘0’;
FIFOADR & lt=“00”;
如果UBSLULL =“1”,那么
CONULLUN: = CONNULL + 1;
其他的
康满:=0;
如果结束;
当1=gt时;
懒惰=‘1’;
CONULLUN: = CONNULL + 1;
当2=gt时;
CONULLUN: = CONNULL + 1;
当3=gt时;
SLRD=‘1’;
FIFO-UTRAILUTION & LT;
CONULLUN: = CONNULL + 1;
当别人= & gt;
案例FIFOU-UTRANUMYWORKWHULL是
当“000111111101”=gt;
康满:=0;
当“001111111101”=gt;
康满:=0;
当“010111111101”=gt;
康满:=0;
当“011111111101”=gt;
UBSCHECK(15下降到8)& lt=UBS2 DATAZIN(7下降到0);
当“011111111110”=gt;
UBSCHECK(7下降到0)& lt=UBS2 DATAZIN(7下降到0);
懒惰=‘0’;
SLRD=‘0’;
FIFO-UTRAILUTION & LT;
当“100000000000”=gt;
判决;
康满:=0;
当别人= & gt;
FIFO-UTRAILUTION & LT;= FIFOUTUTRAIL写;
结束情况;
结束情况;
当做,
维卡斯
以上来自于百度翻译
以下为原文
HI.
VAVC.
Thanks for your reply.
I used the EP2PF and set the EP2FIFOPFX value to the FLAGB will be set when a 512bytes bulk has been ready to commit.
So, i think the data that PC to 68013 is right.
My codes associated PC to 68013 to fpga is as follows:
68013 init:
void TD_Init( void )
{ // Called once at startup
CPUCS = 0x10; // CLKSPD[1:0]=10, for 48MHz operation, output CLKOUT
PINFLAGSAB = 0x4A; // FLAGB - EP2PF ,FLAGA - EP6EF
SYNCDELAY;
PINFLAGSCD = 0x08; // FLAGC - EP2EF
SYNCDELAY;
PORTACFG |= 0x80;
SYNCDELAY;
IFCONFIG = 0x03; // for async? for sync?
SYNCDELAY;
FIFOPINPOLAR |= 0x3F;
SYNCDELAY;
CPUCS |= 0x02;
SYNCDELAY;
REVCTL = 0x01;
SYNCDELAY;
EP4CFG = 0x01; //clear valid bit
SYNCDELAY;
EP8CFG = 0x01; //clear valid bit
SYNCDELAY;
EP2CFG = 0xA0; //out 512 bytes, 4x, bulk
SYNCDELAY;
EP6CFG = 0xE0; // in 512 bytes, 4x, bulk
SYNCDELAY;
FIFORESET = 0x80; // activate NAK-ALL to avoid race conditions
SYNCDELAY; // see TRM section 15.14
FIFORESET = 0x02; // reset, FIFO 2
SYNCDELAY; //
FIFORESET = 0x04; // reset, FIFO 4
SYNCDELAY; //
FIFORESET = 0x06; // reset, FIFO 6
SYNCDELAY; //
FIFORESET = 0x08; // reset, FIFO 8
SYNCDELAY; //
FIFORESET = 0x00; // deactivate NAK-ALL
SYNCDELAY;
EP2FIFOCFG = 0x00;
SYNCDELAY;
EP2FIFOCFG = 0x10; // AUTOOUT=1, WORDWIDE=0
SYNCDELAY;
EP6FIFOCFG = 0x00;
SYNCDELAY;
EP6FIFOCFG = 0x09; // AUTOIN=1, ZEROLENIN=1, WORDWIDE=1
SYNCDELAY;
EP6AUTOINLENH = 0x02;
SYNCDELAY;
EP6AUTOINLENL = 0x00;
SYNCDELAY;
EP2FIFOPFH = 0x88;
SYNCDELAY;
EP2FIFOPFL = 0x00;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
}
68013 reset(called when error,a EP0 vendor):
BOOL RstAll(void)
{
FIFORESET = 0x80;
SYNCDELAY;
FIFORESET = 0X02;
SYNCDELAY;
FIFORESET = 0x06;
SYNCDELAY;
FIFORESET = 0x00;
SYNCDELAY;
EP2FIFOCFG = 0x00;
SYNCDELAY;
EP2FIFOCFG = 0x10; //8bits
SYNCDELAY;
EP6FIFOCFG = 0x00;
SYNCDELAY;
EP6FIFOCFG = 0x09
;
SYNCDELAY;
EP6AUTOINLENH = 0x02;
SYNCDELAY;
EP6AUTOINLENL = 0x00;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
return( TRUE );
}
FPGA, read from 68013:
-----------FULL------------
when full =>
case con_full is
when 0 =>
u***_data_en<='0';
fifo_utr_write<='0';
sloe<='0';
slrd<='0';
fifoadr<="00";
if u***_full='1' then
con_full:=con_full+1;
else
con_full:=0;
end if;
when 1 =>
sloe<='1';
con_full:=con_full+1;
when 2 =>
con_full:=con_full+1;
when 3 =>
slrd<='1';
fifo_utr_write<='1';
con_full:=con_full+1;
when others =>
case fifo_utr_num_w_buffer is
when "000111111101" =>
con_full:=0;
when "001111111101" =>
con_full:=0;
when "010111111101" =>
con_full:=0;
when "011111111101" =>
u***_check(15 downto 8)<=u***_data_in(7 downto 0);
when "011111111110" =>
u***_check(7 downto 0)<=u***_data_in(7 downto 0);
sloe<='0';
slrd<='0';
fifo_utr_write<='0';
when "100000000000" =>
u***_state<=judge;
con_full:=0;
when others =>
fifo_utr_write<=fifo_utr_write;
end case;
end case;
Regards,
Vikas