背景:函数CyU3PGpifSocketConfigure(... uint8_t burst)的注释对参数burst的解释不是十分明白。查看实现,burst有写入到GPIF_THREAD_CONFIG寄存器。
然后找到reference manual中对这个寄存器位域的描述
11:8 BURST_SIZE[3:0]
Log2 of burst size (1: 2 words, 2: 4 words, etc). Programmed to support systems that work with fixed
burst sizes. A burst is defined as a portion of transfer that unconditionally completes after it is initiated.
The system must always transfer an entire burst before responding to a change in a partial flag.
In transfers that involve short packet, the PIB hardware will automatically append zeros/truncate data
to do its part in preserving the above mentioned definition of burst. Burst size is a power of 2 and
must be programmed to a value greater than watermark when partial flag is used.Buffer sizes used
should be integral multiple of the burst size. Maximum value is 14. When value is >0, any socket
switching must occur on 8 byte boundaries.Besides, this field needs to be programmed to a non-zero
value to support bandwidth>200MBps on P-Port.
这段描述的提供了如下信息:
1. log2值,即保证burst size为2的n次方
2. p-port上对burst的定义:一旦发起一次传输,无条件将burst size传完。即保证burst周期的完整性
3. 遇到短包,PIB硬件会自动补0或截断。自动补0应该是针对外部读操作,截断应该是针对外部写操作
4. 如果使用了partial flag,burst size必须大于watermark值。watermark也由同样的函数编程到此寄存器
5. 如果burst size大于1,则任何socket切换(any soocket switching)必须在传输的8字节边界上
6. 对于p-port带宽 > 200MB/s的应用,burst size必须大于1
问题:
1. PIB通过补0或截断的方式来保证burst的完整性,那么读操作时如何界定哪些数据是多余的,即是由PIB自
动补0的?当然,通过应用层数据包定义可以确定有效数据长度,但作为接口芯片肯定不会有这样的假设。
2. partial flag只会在burst结束的同时update吗?如果partial flag更新是一个pipeline的流程,即经过
latency后每个访问周期都更新,那么就可以通过partial flag解决上述问题。这也可以解释如果要使用
partial flag, burst size必须大于watermark的规定。因为watermark的设置必须大于latency
3. slave fifo的应用文档(AN65974)和示例代码中,使用partial flag却并未遵守burst size > watermark
之规定
CyU3PgpifSocketConfigure(3, PIB_SOCKET_3, 4, CyFalse, 1)
此配置下,burs size = 2^1 = 2 < watermark = 4
这样的冲突现象,难道是有特别的说明我没看到吗?否则,都是官方文档,以哪种方法为准呢?
4. any socket switching must occur on 8 byte boundaries.
这里的any socket是只是thread之内,还是所有threads的所有sockets?因为thread实际是独立
的DMA控制器,socket共享同一thread内的资源,所以我觉得隶属不同thread的sockets之间切换
不应该有任何影响。
以上困惑,还望各位大虾不吝赐教,在此谢过。
|