http://wiki.osdev.org/USB
For USB UHCI/EHCI Universal Host Controller Driver Development:
*****************************************************************
[1] "Universal Serial Bus Mass Storage Class Bulk Only Transport",
rev 1.0 Sept 1999 Usb Implementors Forum
[2] "Universal Serial Bus Specification", rev 1.1 1998 and rev 2.0, ch9 is most important
[3] "USB Device Class Definition for Human Interface Device (HID) ver 1.11
[4] "USB HID Usage Tables" ver 1.11
[5] Intel "82371AB PCI-ISA Xcelerator (PIIX4)" Controller Manual and
"Universal Host Controller Interface (UHCI) Design Guide" rev 1.1,
these are your hardware manuals
[6] "Working Draft American National Standard SCSI Block Commands (SBC-2)"
Nov 2004 and the "SCSI Primary Commands (SPC-2)"
[7] "PCI Bios Spec" rev2.1
[8] "Intel 82801EB (ICH5) Enhanced Host Controller Interface (EHCI),
Programmers Reference Manual", April 2003
[9] "Enhanced Host Controller Specification for the Universal Seriel Bus",
rev 1.0, March 2002, Intel
[10] Datasheet, VT6212, Pci Usb 2.0 Controller, Dec 2005, Via Technologies
I bought this pci addon card for $25 to give my old computer the EHCI controller
[11] "Simplified EHCI Data Structures for the High-End ColdFire Family USB Modules"
Freescale Semiconductor. Shows how to fill in a QH and TD.
;tatOS/usb/interrupt.s
;code to conduct mouse interrupt transactions
;and get the 4 or 5 or whatever byte report from the mouse interrupt IN endpoint
;for uhci controller only
;the interrupt transaction is nothing but data transport on the IN pipe
;no command transport and no status transport
;you have to constantly queue up a request
;then poll the device for a response
;NAK=0x048807ff indicates the user has not clicked a button or moved the mouse
;since the request was queued up
;the way we check for mouse activity is to set the mousereport buffer to
;something the mouse can not possibly give (09090909)
;the mouse report is written to "mousereportbuf"
;after a report is given you have to queue up a new request
;and "zero" out the mousereport buffer
;the mouse report bytes are similar for both ps2 and usb mice
;the only differance is the deltaY is in the opposite direction
;note also that the Manhattan mouse gives a 5 byte report with leading 01 byte
;the microsoft and Logitech mouse give a traditional 4 byte report
;also the bytes given depend on protocol boot or report (we use report protocol)
;for this reason and because we do not have any code to parse the messy mouse
;report descriptor, you have to run usbShowMouseReport and "calibrate" the usb mouse driver
;by entering the index of your button click byte. For Logitech and Microsoft
;the button click byte is the first byte of the mouse report so you enter 00.
;For my odd Manhattan mouse the second byte is the button click byte so you enter 01.
;mouse report:
;bb dx dy dz
;the first byte is a bitmask of button clicks
;bit0=left button (bit set=down, clear=up)
;bit1=right button
;bit2=middle button
;the next byte is delta X movement (+X right)
;the next byte is delta Y movement (+Y down)
;the next byte is delta Z movement (wheel either 1 or 0xff)
;Manhattan Mouse with SetProtocol=boot
;****************************************
;this mouse is giving 3 bytes (TD = 0x04000002 or NAK=0x048807ff)
;01 11 22
;the 01 byte never changes
;the 11 byte indicates button up/down events
;the 22 byte indicates movement 2=right, fe=left, ff=up, 1=dn (x & y in 1 byte ??)
;cant seem to get any wheel rotation indicator
;Manhattan Mouse with SetProtocol=report
;****************************************
;Manhattan mouse is giving 6 bytes (TD = 0x04000005 or NAK)
;01 11 22 33 44 55
;the 01 byte never changes - whats the point of this byte ???
;the 11 byte is button clicks same as above
;the 22 byte gives 1,2,3,4... for +delta_X and fe,fd,fc... for -delta_X
;the 33 byte gives same for delta_Y movement
;the 44 byte gives 1 to roll wheel forward and ff to roll backward
;the 55 byte is 00 always
;the coordinate system for mouse movement follows vga graphics
;+x to right and +y down
;Logitech & Microsoft Mouse w/ SetProtocol=report
;***************************************************
;the byte order is as above except no leading 01 byte
;11 22 33 44
;11 = mouse clicks same as above
;22 = X movement
;33 = Y movement
;44 = wheel movement
TomT
http://code.google.com/p/tatos/