Universal Serial Bus: Difference between revisions

finished up, moved old information into more specific wiki entry stubs
[unchecked revision][unchecked revision]
(finished framework section)
(finished up, moved old information into more specific wiki entry stubs)
Line 2,009:
|}
 
*== Typical organization of system software ==
== TODO ==
This section discusses how system software is typically, reasonably organized. This section also serves as an index to the wiki entries which provide, or will provide, farther information and perhaps programming examples.
Currently the above article is missing the following topics:
* Typical organization of system software
* Hubs (including Split Transactions)
 
== Original= USB WikiDevice ContentDrivers ===
As with any device driver, a USB device driver abstracts away from the low-level details on just how a specific device is being accessed, and provides the rest of the system and applications with a common interface (e.g, a file manager shouldn't have to know whether it is dealing with an external versus internal hard drive).
Until the above sections are complete, the original content of this wiki entry that has not been covered in more depth is placed here.
 
USB device drivers typically implement a certain class of device as per the appropriate specifications. Such classes of USB devices include, but are not limited to:
=== USB keyboards/mice ===
* [[USB Mass Storage Class Devices]]
* [[USB Human Input Devices]]
 
=== USB keyboards/miceDriver ===
Keyboards and mice are what the USB standard calls HID (Human Interface Device) class devices, and follow a special superset of the USB standard. Once you have a driver for a HID device, all USB HID devices will work with it, including mice, keyboards, joysticks, game controllers, and so forth. The HID standard is built on top of lower-level USB API's to send and receive data packets across the wire, but provides a translation layer that interprets the USB data so that the HID layer could conceivably be implemented on top of other protocols (Like PS/2 or serial).
Even a USB device driver need not be concerned with some of the lower-level details. For instance, it shouldn't matter to the device driver if a device is connected directly to the root hub, or if it lies behind 3 hubs. The device driver shouldn't worry about how much power the device needs from the bus. This is where the USB driver comes in.
 
The USB driver essentially provides the USB framework interface to device drivers. The USB driver also handles connect and disconnect events on the USB, as well as determining which device driver is needed (according to the Class, Subclass, and Protocol codes), and if that device driver even exists.
For early stages, you can probably ignore the fact that those devices are USB. Virtually every chipsets will offer a good old PS/2 emulation of the USB human interface devices, so you can use I/O port 0x60 like the rest of us ...
 
=== Booting off of a USB flashHub diskDriver ===
Although the USB Driver knows some details about the USB topography, the responsibility of hub-specific communication (including split-transactions) is often separated from the USB Driver into another module called the USB Hub Driver.
 
Depending on the design of the system, the USB Driver might bypass the USB Hub Driver when communicating with devices on the root hub, or the system may use the reserved address of 0 to indicate the root hub to the USB Hub Driver (it appears that Linux does this).
If the [[BIOS]] supports it is it as simple as selecting USB-FDD in the boot order and putting a simple bootloader (grub might do, I rolled my own) into the first 512 bytes of the device. The BIOS will handle all the fancy PCI / USB stuff via int 0x13. Note that there is no need for any specific filesystem or partitions (which means you can just "dd" a 2.2 linux kernel (which used to contain a simple floppy loader) to /dev/sda and it will easily come up).
 
Details on USB Hubs will eventually be discussed in the [[USB Hubs]] wiki entry.
 
=== Host Controller Driver ===
As a request for a data transfer moves from the device driver, through the USB Driver, and through the USB Hub Driver, the request gains all the information needed for the host controller to generate the appropriate transactions on the bus. However, depending on the host controller, this information needs to be formatted in a certain way and added for scheduling by the host controller.
 
This task if given to the host controller driver. Requests reach the host controller driver in a system-defined format, often called a USB Request Block (URB), or an I/O Request Packet (IRP).
 
Additionally, host controller drivers are loaded by the PCI subsystem when a corresponding host controller is discovered during PCI enumeration. The host controller driver is thus also responsible for initializing the host controller and perhaps loading the USB Hub Driver and the USB driver. Combined, the USB driver, USB hub driver, and the host controller driver make up a USB subsystem.
 
Details on implementing host controller drivers for a specific host controller may eventually be found at the following wiki entries:
* [[Programming the EHCI]]
* [[Programming the UHCI]]
* [[Programming the OHCI]]
 
== See Also ==
Line 2,031 ⟶ 2,047:
=== Links ===
* [http://www.usb.org/home USB.org]
* [http://www.usb.org/developers/docs/usb_20_052709.zip USB 2.0 Specifications]
* [http://www.usb.org/developers/docs The USB 2.0 Specification]. Here you can download the official '''Universal Serial Bus Revision 2.0 specification''', which defines the hardware and software. This is by far the best place to start, although not a light reading.
* [http://www.usb.org/developers/hidpage/ information about the HID standard].
* [http://www.kernel.org/ The Linux kernel] (though things tends to be confusing there, and you have to be careful with educating yourself from Linux sources if your project isn't GPL'ed).
* In [http://developer.intel.com/ Intel] chipsets manuals.
* [http://www.beyondlogic.org/usbnutshell/usb1.htm USB in a Nutshell] may also interest you. It looks like a really good tutorial giving all the required knowledge to understand any other USB documentation/source code in a couple of HTML pages ...
 
:''any link to a description of USBstorage, USBprinter, HID, USB vendor list, etc. is of course welcome ;)''
 
=== Forum Topics ===
 
* [[Topic:9334|USB stick]] - discusses the feasability of booting from an USB memory stick
* [[Topic:8096|USB driver]] - suggests a few startup links about USB
* [[Topic:8692|support USB keyboard]] explained by Schol-R-Lea
Anonymous user