neato wrote:madeofstaples wrote:Software (device drivers) could set the Interrupt On Complete bit if it did want the host controller to issue an IRQ when a specific USB transaction has completed successfully.
You can't actually hook this interrupt, you poll for it. Is that correct?
? No... eddyb has enabled all interrupts according to the OP:
eddyb wrote:...I coded the restart and basic register initialization (0x3f for USBINTR - meaning all interrupts enabled, even if get none - and 1 for CONFIGFLAG)...
If a transaction whose
Interrupt On Complete bit was set is completed (or a short packet is received), EHCI's USBSTS register's least-significant bit reflects this fact (the
USBINT field). On the next interrupt threshold, if the USBINTR register enables USB interrupts (as eddyb has set),
and the
USBINT field is set (as a result of completing the transaction or receiving a short packet, which is often a sign of the completion of a transaction, by the way), then the host controller issues a hardware interrupt on the PCI bus. The EHCI documentation covers all the events which may cause a hardware interrupt (if enabled) in section 4.15.
At first I (think I) misunderstood that eddyb didn't actually intend to
handle interrupts (just yet), but is instead just trying to get some basic code working by
polling the state of the USBSTS register for the same changes that would cause the host controller to issue an interrupt, if the corresponding interrupt is enabled by the uSBINTR register. So you can certainly implement EHCI support by polling these events, but the host controller certainly can
raise interrupts for you, if you want.
neato wrote:madeofstaples wrote:Note that the host controller driver should ensure that the PCI configuration space's Command register does not disable the host controller from asserting a hardware interrupt (bit 10 of the Command register should be 0).
What hardware interrupt? Usage?
See the PCI Local Bus Specification, revision 2.3; you may specifically notice (physical) page 14, which contains an implementation note regarding interrupt routing.