usblog ([info]usblog) wrote,
@ 2004-11-17 10:37:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Linux USB SubSystem (2)
Hello,

Linux USB SubSystem (2)
--------------------------

The following text is based on 2.67 kernel.
I assume that the current posting was better to be
the first in the USB SubSystem series since it
is better as an introduction. I apologize on
that.

The most important header files which define the USB interface
are include/linux/usb.h and include/linux/usb_ch9.h.

The header file called usb_ch9.h
hold constants and structures for usb.
The name came from chapter 9 of the USB 2.0 specification.

There are 2 specs for USB: 2.0 and 1.1.

We have USB 2.0 , which operates at "High Speed" : 60 Mbyte/sec (480 Mbit/sec)
(40 times faster than USB full speed),

and USB 1.1 ,which operates at "Full Speed" 12 Mbit/sec (1.5 MByte/sec)
or - "Low Speed" 1.5 Mbit/sec

The USB_SPEED_LOW,USB_SPEED_FULL, and USB_SPEED_HIGH (usb 2.0) are defined in
usb_ch9.h. You'll encounter them in the USB sources (but not to much).

When you connect High speed devices to USB 1.1 systems ,
they slow down to USB 1.1 speeds.

The USB subsystem is based on message passing transactions.
The messages are called URB.
URB stands for USB Request Block.
you send URBS by calling usb_submit_urb(struct urb *urb, int mem_flags);
This is ans asynchronous calls; it returns immediately. The URB is put
in a queue; later, it reaches a completion handler; the completion
handler is a member of the URB structure , called complete (a pointer
to a function).
In the completion handler, you can check the urb->status
for errors.

You can cancel pending requests by using usb_unlink_urb().
URBs are allocated by calling usb_alloc_urb() ;
they are freed with a call to usb_free_urb().

There are 3 helper method which help to fill URBs:
usb_fill_control_urb() (control_urb)
usb_fill_bulk_urb (bulk urb)
usb_fill_int_urb (interrupt urb)

More on completion handlers and submitting URBs in the future.

There are 4 types of transfers:
Control transfers , bulk transfers,
interrupt transfers transfers,
and High Speed Isochronous (ISO) transfer.

Usually USB WebCams use ISO transfer. You can rarely
find use of bulk transfers in USB WebCams.

The URB struct resides in usb.h.


Links:

Maybe this link should be termed : the USB portal: http://www.linux-usb.org

USeful Information about linux decvice drivers: http://www.qbik.ch/usb/devices

http://www.usb.org

mailing lists:
linux-usb-users archive : http://marc.theaimsgroup.com/?l=linux-usb-users&r=1&w=2
linux-usb-develepoer archive: http://marc.theaimsgroup.com/?l=linux-usb-devel&r=1&w=2

USB Host Controlleres:
========================
In the kernel source tree (under /drivers/usb/host)
, you will find 5 types of USB Host Controlleres:

1) ehci - for USB2.0.
ehci stands for : Enhanced Host Controller Interface.


2) ohci - implements OpenHCI -- Open Host Controller Interface
According to /usb/host/Kconfig ,"It does more in hardware than Intel's
UHCI specification."
TODO: find out more details (what exactly it does more).

3) uhci - Universal Host Controller Interface
The Linux kernel maintainer of usb-uhci is Alan Stern
It is originated from Intel:
see http://developer.intel.com/technology/usb/uhci11d.htm
Usually boards with Intel PCI chipsets use this standard.

4) sl811 host controller:
manufactured by cypress.
http://www.cypress.com/products/datasheet.cfm?partnum=SL811HS
(has 256 bytes Internal SRAM buffer).

5)SA-1111 host controller:
http://www.intel.com/design/pca/applicationsprocessors/1111_brf.htm


You can find the drivers for theses controllers under
/drivers/usb/host (sometimes they are referred to HCD = Host Controller Driver).

You are welocamed to question/ask/remark eahtecer you think.

Cheers,
RRX



Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…