"The two BD entries allows for an EVEN BD and ODD BD entry for each endpoint direction.This allows the microprocessor to process one BD while the USB-FS is processing the other BD"这句话要如何理解咧!为什么BD提供两个entry就能做到在USB-FS同时处理两个BD呢?
在RM里面,你可以在"The two BD entries allows for an EVEN BD and ODD BD entry for each endpoint direction.This allows the microprocessor to process one BD while the USB-FS is processing the other BD"前面看到“The BDT resides on a 512 byte boundary in system memory and is pointed to by the BDT Page Registers. Every endpoint direction
requires two eight-byte Buffer Descriptor entries. Therefore, a system with 16 fully bidirectional endpoints would require 512 bytes of system memory to implement the BDT.”结合起来就好理解了,一个BD占用8字节,每个endpoint(IN or OUT)占用两个BD,USB模块最多用到16个endpoint,因此整个BDT占用了16*2*16=512个字节,所以这个BDT的起始地址要放在512字节对齐的地方,因此BDT的结构可理解为:
BD0//EP0 IN
BD1//EP0 IN
BD2//EP0 OUT
BD3//EP0 OUT
...
BD30//EP15 OUT
BD31//EP15 OUT
所以EVEN BD是指BD0,BD2,...,BD30, ODD BD是指BD1.BD3,...,BD31,当应用程序要发送数据是,比方说EP0 IN方向,USB device模式,发送信息给HOST(PC),那么将用到BD0和BD1,MCU初始化BD0后,把控制权交给USB-FS引擎处理发送,然后不用等待其发送完毕,就可以直接初始化BD1,为下一次发送做好准备,从而达到“Double buffering BDs in this way allows the USB-FS to easily transfer data at the maximum throughput provided by USB.”这样的效果。
我也问几个BDT相关的问题:
1,BDT里面的32bit控制位部分(CtrlReg),25:16是BC,即Byte Count,RM的说明是:
The Byte Count bits represent the 10-bit Byte Count. The USB-FS SIE changes this field upon the completion of a RX transfer with the byte count of the data received.
请问,TX操作也需要BC吗?