How to start with developing UHCI?

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
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

How to start with developing UHCI?

Post by Klakap »

Good day!

I want write driver for USB and I want start with UHCI. But I have problem. I dont know where I should start. OsDev, LowLevel and BenLunt USB book contain many informations and I dont know how it use. My code for UHCI interface is here: https://github.com/Klaykap/LightningOS/ ... usb_uhci.c but I dont know how start initalize usb and do transfers.

Please where I can found "first step with USB"?
Please how is right initalization of usb port?

I thank you in advance.
SanderR
Member
Member
Posts: 70
Joined: Tue Aug 30, 2016 1:31 pm
Libera.chat IRC: SDR

Re: How to start with developing UHCI?

Post by SanderR »

I had the same problem.

first you stop the controller by turning the running bit on 0. (at USBCMD)
then you call a reset by turning the reset bit on 1 (at USBCMD)
then you wait, and turn the reset bit off again.
then you fill all the registers with how you want to have it, then you put the running bit on again (USBCMD).
now it should detect usbsticks. on emulators he does this but on real hardware im not able to make it work yet.
nullplan
Member
Member
Posts: 1798
Joined: Wed Aug 30, 2017 8:24 am

Re: How to start with developing UHCI?

Post by nullplan »

https://lmgtfy.com/?q=uhci+design+guide&p=1&iie=1

The spec tells you exactly which bits to set and how long to wait for the reset. As for transfers, you will have to read up on the Frame List. Essentially, you create a TD pointing to the buffer required, then tell the UHCI to run and wait for the frame to get sent or received.
Carpe diem!
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: How to start with developing UHCI?

Post by Klakap »

Thank for answers!
Post Reply