Information

Universal Serial Bus Interface
MPC8308 PowerQUICC II Pro Processor Reference Manual, Rev. 1
Freescale Semiconductor 13-83
-- pQHeadPrevious is a pointer to a queue head that
-- references the queue head to remove
-- pQHeadToUnlink is a pointer to the queue head to be
-- removed
-- pQheadNext is a pointer to a queue head still in the
-- schedule. Software provides this pointer with the
-- following strict rules:
-- if the host software is one queue head, then
-- pQHeadNext must be the same as
-- QueueheadToUnlink.HorizontalPointer. If the host
-- software is unlinking a consecutive series of
-- queue heads, QHeadNext must be set by software to
-- the queue head remaining in the schedule.
--
-- This algorithm unlinks a queue head from a circular list
--
pQueueHeadPrevious.HorizontalPointer = pQueueHeadToUnlink.HorizontalPointer
pQueueHeadToUnlink.HorizontalPointer = pQHeadNext
End UnlinkQueueHead
If software removes the queue head with the H-bit set, it must select another queue head still linked into
the schedule and set its H-bit. This should be completed before removing the queue head. The requirement
is that software keep one queue head in the asynchronous schedule, with its H-bit set. At the point software
has removed one or more queue heads from the asynchronous schedule, it is unknown whether the host
controller has a cached pointer to them. Similarly, it is unknown how long the host controller might retain
the cached information, as it is implementation dependent and may be affected by the actual dynamics of
the schedule load. Therefore, once software has removed a queue head from the asynchronous list, it must
retain the coherency of the queue head (link pointers). It cannot disturb the removed queue heads until it
knows that the host controller does not have a local copy of a pointer to any of the removed data structures.
The method software uses to determine when it is safe to modify a removed queue head is to handshake
with the host controller. The handshake mechanism allows software to remove items from the
asynchronous schedule, then execute a simple, lightweight handshake that is used by software as a key that
it can free (or reuse) the memory associated the data structures it has removed from the asynchronous
schedule.
The handshake is implemented with three bits in the host controller. The first bit is a command bit
(USBCMD[IAA]—interrupt on async advance doorbell) that allows software to inform the host controller
that something has been removed from its asynchronous schedule. The second bit is a status bit
(USBSTS[AAI]—interrupt on async advance) that the host controller sets after it has released all on-chip
state that may potentially reference one of the data structures just removed. When the host controller sets
this status bit, it also clears the command bit. The third bit is an interrupt enable
(USBINTR[AAE]—interrupt on async advance enable) that is matched with the status bit. If the status bit
is set and the interrupt enable bit is set, then the host controller asserts a hardware interrupt.
Figure 13-49 illustrates a general example where consecutive queue heads (B and C) are unlinked from
the schedule using the algorithm above. Before the unlink operation, the host controller has a copy of
queue head A.
The unlink algorithm requires that as software unlinks each queue head, the unlinked queue head is loaded
with the address of a queue head that will remain in the asynchronous schedule.