When a TD is complete (with or without an error) it is unlinked from the queue that it is on and linked to the Done Queue. The Host Controller maintains a physical pointer to the last TD that was placed on the done queue (HcDoneHead.) When a TD is put on the done queue, the value in HcDoneHead is written to NextTD of the just completed TD and HcDoneHead is changed to contain the address of the TD just competed. This causes TDs to be linked at the head of the done queue. Linking at the head of the queue allows the hardware to maintain only one pointer for the Done Queue and also allows the linking to the Done Queue to be done at the same time as the ConditionCode update in a completed TD saving a memory access (i.e., the same write that updates the ConditionCode of a TD can be extended to cause the NextTD value of the TD to point to the TD that was previously at the head of the Done Queue.)

    当传输描述符(TD)完成时(无论是否有错误),它会从其所在的队列中解除链接,并链接到完成队列。主机控制器(HC)维护一个指向最后一个被放入完成队列的TD的物理指针(HcDoneHead)。当一个TD被放入完成队列时,HcDoneHead中的值会被写入刚完成的TD的NextTD字段,然后HcDoneHead的内容被更新为该刚完成的TD的地址。这导致TD被链接在完成队列的头部。在队列头部进行链接使得硬件只需为完成队列维护一个指针,并且允许在更新完成TD中的ConditionCode(条件代码)的同时完成向完成队列的链接,从而节省一次内存访问(即,更新TD的ConditionCode的同一写入操作可被扩展,使该TD的NextTD字段指向之前在完成队列头部的TD)。

    Periodically, the Host Controller writes the current value of its HcDoneHead register into a memory location (HccaDoneHead) so that host software can process completed TDs. Nominally, HcDoneHead is written to memory at the beginning of a frame when the deferred interrupt count is zero. After HcDoneHead is written to HccaDoneHead, the Host Controller sets HcDoneHead to 0 and sets the WD bit in the HcInterruptStatus register. The Host Controller can begin to build a new Done Queue immediately after writing to HccaDoneHead but it cannot write the new list to memory until the Host Controller Driver has cleared the WD bit. This protocol provides an interlocked exchange of the Done Queue.

    主机控制器会周期性地将其HcDoneHead寄存器的当前值写入一个内存位置(HccaDoneHead),以便主机软件能够处理已完成的传输描述符(TD)。正常情况下,当延迟中断计数为零时,HcDoneHead会在帧开始时被写入内存。在HcDoneHead被写入HccaDoneHead后,主机控制器会将HcDoneHead清零,并在HcInterruptStatus寄存器中设置WD位。主机控制器在写入HccaDoneHead后即可立即开始构建一个新的完成队列,但在主机控制器驱动程序清除WD位之前,它不能将新列表写入内存。此协议提供了完成队列的互锁交换机制。

    The LSb of this value is used to inform the Host Controller Driver that an interrupt condition exists for both the done list and for another event recorded in the HcInterruptStatus register. On an interrupt from the HC, the Host Controller Driver checks the HccaDoneHead Value. If this value is 0, then the interrupt was caused by other than the HccaDoneHead update and the HcInterruptStatus register needs to be accessed to determine that exact interrupt cause. If HccaDoneHead is nonzero, then a done list update interrupt is indicated and if the LSb of the Dword is nonzero, then an additional interrupt event is indicated and HcInterruptStatus should be checked to determine its cause.

    该值的最低有效位(LSb)用于通知主机控制器驱动程序(HCD),已完成列表的中断条件与HcInterruptStatus寄存器中记录的另一事件的中断条件同时存在。当收到来自主机控制器(HC)的中断时,HCD会检查HccaDoneHead的值。如果该值为0,则说明中断是由HccaDoneHead更新之外的其他原因引起的,此时需要访问HcInterruptStatus寄存器来确定确切的中断原因。如果HccaDoneHead非零,则表示发生了完成列表更新中断;如果该双字的最低有效位非零,则还指示了另一个中断事件,此时应检查HcInterruptStatus以确定其具体原因。