The USB Book

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

The USB Book

Post by bigbob »

Currently I am implementing the USB according to the book "Benjamin David Lunt - USB: The Universal Serial Bus".
It's a great book. Probably the only problem is that it uses DOS (and DPMI).
It mentions that the EHCI controller contains the OHCI or UHCI controller(s), if they are on the same bus:device.
For example, below the two EHCI controllers contain one OHCI controller each, because they are on the same bus: device (00:12 and 00:13).
LAPTOP (lspci on Linux):
00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller

I found that executing gd_ohci.exe enumerates the USB devices only after executing gd_ehci.exe first.
I translated the C source-code of UHCI and OHCI to assembly and it tuned out that the EHCI controller also need to be reseted, just like the contained OHCI in order the attached devices to be enumerated (gd_ehci.exe does that). I don't remember the book mentioning this.
Additionaly, for me a 10-ms delay had to be added right at the beginning of ohci_reset_port, otherwise timeout occured.

I have a question regarding UHCI:
there is a 10-second timeout for the IOC to be set and it seems too much (in function uhci_get_descriptor and uhci_set_address). I tried with only 2-seconds but always timeout occured. Commercial Operating Systems find the USB devices almost immediately on the this computer.
What can be the reason for this slowness (10seconds) ?
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

Re: The USB Book

Post by bigbob »

I asked this question on alt.os.development too, and the author of the book himself replied:
https://groups.google.com/forum/#!forum ... evelopment
search for "The USB Book"

I think it is instructive.
Post Reply