USB Host Controller Access to System Memory
14-85
Universal Serial Bus Host
The USB host controller driver software must also be able to examine the list
of completed transfer descriptors that the host controller creates as it retires
transfer descriptors. This list is pointed to by the HcDoneHead register, which
contains a local bus virtual address that points to the most recent transfer
descriptor that has been retired. As such, the host controller driver software
must be able to convert from the local bus virtual address back to a MPU virtual
address.
Several address conversion functions are helpful to enable proper addressing
by the MPU software and the USB host controller. The functionality required
for proper addressing depends on the settings used in the MPU MMU and local
bus MMU; that is, functionality is system-dependent. The conversion functions
are described in general terms in the next section.
14.6.3.1
MPUVAtoLBVA()—MPU Virtual Address to Local Bus Virtual Address Conversion
Function
This function converts a MPU virtual address to the local bus virtual address
that points to the same physical address in system memory. This output from
this function is needed in programming the USB host controller registers that
point to data structures in system memory and in programming pointers within
the ED, TD, and HCCA data structures.
This function must understand the MPU MMU and local bus MMU program-
ming and local bus virtual address restrictions. This routine is generally imple-
mented in a two-step process—MPU virtual address to physical address, then
physical address to local bus virtual address. Those two steps are described
in section 14.6.3.3, MPUVAtoPA()—MPU Virtual Address to Physical Address
Conversion Function and section 14.6.3.5, PAtoLBVA()—Physical Address to
Local Bus Virtual Address Conversion Function.
It is advisable to implement a checking function in this routine that verifies that
the resulting local bus virtual address is in the usable local bus virtual address
range of 0x30000000 to 0x3FFFFFFF. If the USB host controller attempts to
access a local bus virtual address outside of the valid range, an OHCI unrecov-
erable error occurs if the USB host controller local bus time-out feature is
enabled. If the time-out feature is disabled and the USB host controller
attempts an access outside of the valid range, the USB host controller local
bus interface locks up and the USB host controller is not able to access the
system memory data structures needed to issue USB packets.
Take care when converting null pointers. The OHCI USB host controller uses
null pointers to indicate the end of lists. Some convention must be used to indi-
cate an MPU null pointer and properly convert that MPU null pointer to a local
bus virtual address of 0x00000000.