我采用如下代码(基本按照fifo的例子)实现FIFO Read Transaction,但是发现
1)若FIFO Read执行一次(TC为1280(0x500)),上位机读到1024字节;
2)若FIFO Read执行两次(TC为1280*2(0x500*2)),上位机读到2048字节;
3)若FIFO Read执行三次(TC为1280*3(0x500*3)),上位机读到2560字节;
4)若FIFO Read执行四次(TC为1280*4(0x500*4)),上位机读到3072字节
总是不能全部读到,为什么?请大家帮忙看一下,谢谢。
关于gpif的决定点,我是判断如果TCExpire为真,就进入IDLE,否则原地跳转到原来的状态
if(in_enable) // if IN transfers are enabled
{
if ( GPIFTRIG & 0x80 ) // if GPIF interface IDLE
{
if ( EXTFIFONOTEMPTY ) // if external FIFO is not empty
{
if ( !( EP24FIFO**S & 0x01 ) ) // if EP2 FIFO is not full
{
if(enum_high_speed)
{
SYNCDELAY;
GPIFTCB1 = 0x05;
SYNCDELAY;
GPIFTCB0 = 0x00;
SYNCDELAY;
}
else
{
SYNCDELAY;
GPIFTCB1 = 0x05;
SYNCDELAY;
GPIFTCB0 = 0x00;
SYNCDELAY;
}
Setup_FLOWSTATE_Read(); // setup FLOWSTATE registers for FIFO Read operation
SYNCDELAY;
GPIFTRIG = GPIFTRIGRD | GPIF_EP2; // launch GPIF FIFO READ Transaction to EP2 FIFO
SYNCDELAY;
while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 GPIF Done bit
{
;
}
SYNCDELAY;
}
}
}
}
|