Documenting the IRIX USB Subsystem
#4
RE: Documenting the IRIX USB Subsystem
(03-08-2021, 06:28 PM)bsdero Wrote:  That's an achievement I tried to do with my kernel modules.

In fact the easiest part is to detect the PCI card. AFAIK, to detect new USB devices connect/unconnect/ is also very easy. We just read some PCI registers in the corresponding interfaceUHCI or EHCI depending on the device type we are connecting (Mouse, Keyboards and other low speedies will be taken by the UHCI controller. Hi speed devices will be taken by the EHCI controllers. The VIA8212 has 1 controller for UHCI and 2 for EHCI).

The funny part comes here: USB device enumeration, which we use to know which kind of device is connected, if it's a mouse, a keyboard, a game controller, or whatever, and with that, we get the device type. Fo this, once the new device is detected, we need to do some data exchange with the device. For this, we setup some data structures -a linked list- in the machine's DMA. The DMA chunk must be aligned to... 32k? don't remeber very well, all is in the UHCI/EHCI standard doc. In these linked lists, some data about the transfers is stored and of course, data from the devices are stored there by the UHCI/EHCI interface. If we accomplish this with the controllers UHCI/EHCI/xHCI, we are almost done with the hardest part of a decent USB stack and from here all will just go like a ride in the park.
So I just got the built and loaded partly! All I needed to do was edit:cpuboard=cputype I guess my cpu type wasn't in the table anyway I changed cputype to ip32 and it built. Now for a reason I am not sure of when loaded it loves to kernel panic when uhci is loaded. So I deleted usbuhci.o before loading it and after a few usb bus errors and panics it loaded and showed up in /hw as /hw/usb. When I do hinv tho nothing has changed probably because of not loading the usbuhci.o Also my usb2.0 controller doesn't seem to get loaded I had to put my ohci controller in ehci. Anyway after It loaded I plugged in a couple usb devices and they would light up for a second. since there is no enumeration or anything I assume its turing off after a handshake attempt?
mamed
Octane

Trade Count: (0)
Posts: 112
Threads: 29
Joined: Jan 2021
Location: Canada
Find Reply
03-17-2021, 03:27 PM


Messages In This Thread
Documenting the IRIX USB Subsystem - by Raion - 02-25-2021, 05:58 PM
RE: Documenting the IRIX USB Subsystem - by mamed - 03-08-2021, 03:27 PM
RE: Documenting the IRIX USB Subsystem - by bsdero - 03-08-2021, 06:28 PM
RE: Documenting the IRIX USB Subsystem - by mamed - 03-17-2021, 03:27 PM
RE: Documenting the IRIX USB Subsystem - by Raion - 03-17-2021, 05:43 PM
RE: Documenting the IRIX USB Subsystem - by mamed - 03-18-2021, 05:13 PM
RE: Documenting the IRIX USB Subsystem - by bsdero - 03-21-2021, 07:08 PM
RE: Documenting the IRIX USB Subsystem - by mamed - 03-24-2021, 10:54 PM
RE: Documenting the IRIX USB Subsystem - by robespierre - 03-24-2021, 11:57 PM
RE: Documenting the IRIX USB Subsystem - by mamed - 03-27-2021, 08:07 PM
RE: Documenting the IRIX USB Subsystem - by Raion - 03-18-2021, 06:31 PM
RE: Documenting the IRIX USB Subsystem - by zizban - 08-06-2022, 06:34 PM
RE: Documenting the IRIX USB Subsystem - by Raion - 08-06-2022, 06:39 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)