Page 1 of 1

detecting devices

Posted: Fri Oct 11, 2002 11:00 pm
by Stefan
How can I detect new devices?
Where from can I find out witch IRQ uses an device?
What for is "Plug And Play", and how does it work?

Thanks

RE:detecting devices

Posted: Fri Oct 11, 2002 11:00 pm
by Dave68
This question has multiple possible answers depending on what you are trying to do. I will assume however that you are writing your own OS (that is after all what this board is for !), in this case, allocating IRQs to devices is largely up to you. There are obviously conventions (LPT1 - IRQ7, COM1 - IRQ4 etc), but if the device can accept alternative IRQs (note some devices - especially ISA resources cannot), then it is not required to follow these conventions unless you want to.

As to detecting devices, you have partially answered this yourself - the answer is (mostly) plug and play, I'll cover this a little further down, but note that some devices (legacy ISA raises its head again here) are not plug and play, so if you want to detect such devices, you need to look for known configurations to see if they are there

Plug and Play is a method whereby a device identifies its requirements to an OS as to IO ports,memory locations, Interrupts, DMA and others. Pluga and Play is a generic term and covers PCI, AGP (same as PCI as far as plug and play is concerned), ISA (be aware that only some devices are PnP), USB and others.

Because PnP covers so many different interfaces, there is no one programming interface, but rather each specific interface has its own programming interface, so it is necessary to study the documentation for each device independantly. PCI documentation for PCI (and AGP) is available at pcisig.com, documentation for this standard is not free, but is reasonably priced (c. $100). USB documentation is available at usb.org and is free, however the usb spec covers device design more than programming interface, so also consider OHCI, UHCI and EHCI from intel.com (EHCI is for USB2.0, OHCI and UHCI for USB 1.1). ISA PnP is harder to find info on. Mindshare do have a very good book on it however)