Home Networking Tutorials - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Home Networking Tutorials

Description:

3)Host learns of new device. 4)Hub resets the device. ... GET_Descriptor request to learn the maximum packet size ... 9) The host learns about device abilities: ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 25
Provided by: narendr
Category:

less

Transcript and Presenter's Notes

Title: Home Networking Tutorials


1
A Tour to USB Driver Development in Linux K.
Sebi Kumar Consultant Embedded Systems
Group Talent Transformation
2
OUTLINE
  • Introduction
  • Architecture Overview
  • USB Data Flow Model
  • USB Transfer Types
  • USB Electrical Model
  • Enumeration
  • Writing USB Drivers

3
Introduction to USB
  • Low Cost
  • Ease of use
  • Port expansion
  • Cable Power
  • Error Detection and Recovery
  • Support 4 types of transfers

4
USB Device View
A
B
Hub
USB connectors
Dongle
5
Architecture Overview
  • USB Bus Topology
  • 7 Tiers ( Include HOST )
  • Up to 127 Devices

6
USB Data Flow Model
  • Endpoints
  • Endpoint Zero
  • Non-Endpoint Zero
  • Pipes
  • Message pipe
  • Stream pipe
  • Frames and MicroFrames
  • Frame ? 1ms
  • MicroFrame ? 125 us ( High Speed )

7
USB Data Flow Model
Client Software
Host
Buffers
Data Flows
Pipes
Endpoints
USB Device
Interface
8
Transfer types
  • Isochronous (e.g. Audio, Telephony, Motion
    camera...)
  • Interrupt (e.g. Mouse, Joystick....)
  • Bulk (e.g. Printer, Scanner, Still Camera.....)
  • Control (e.g. Configuration, Messages)
  • Bursty, bi-directional, higher level protocol
  • Used for bus management, configuration, device
    control

9
USB scheduling and priority
  • up to 90 of bandwidth for isochronous and
    interrupt data
  • up to 10 for control
  • remaining go to bulk transfers
  • Priority-based scheduling
  • isochronous data has highest priority,
  • interrupt,
  • control,
  • bulk has lowest priority.

10
USB Electrical Model
11
Enumeration steps -
  • 1)The user plugs a device into USB port.
  • 2)Hub detects the device
  • 3)Host learns of new device
  • 4)Hub resets the device.
  • 5) Hub establishes a single path between device
    and a bus.

12
Enumeration (cont.)
  • 6) The hub detects the device speed
  • 7) The host sends a GET_Descriptor request to
    learn the maximum packet size of default pipe.
  • 8) The host assigns a unique address to device by
    sending a set_address request.
  • 9) The host learns about device abilities -
  • Hubs are also USB devices, and host enumerates
    the newly attached hub in the same way as device.

13
Linux USB Subsystem
14
Device Driver Framework
  • USB device drivers are registered and
    deregistered at the subsystem.
  • A driver must register 2 entry points and its
    name.
  • For certain USB devices, a driver registers file
    operation and minor number.

15
  • struct usb_driver
  • const char name
  • void (probe)(struct usb_device , unsigned
    int,
  • const struct usb_device_id id_table)
  • void (disconnect)(struct usb_device , void )
  • struct list_head driver_list
  • struct file_operations fops
  • int minor
  • struct semaphore serialize
  • int (ioctl) (struct usb_device dev, unsigned
    int code,
  • void buf)
  • const struct usb_device_id id_table

16
Entry Points Framework
  • USB driver has two entry points to normal
  • drivers -
  • void probe ( struct usb device dev, unsigned
  • int interface, const struct usb_device_id
    id table)
  • -This entry point is called whenever a new
    device is attached to the bus.
  • void disconnect ( struct usb device dev,
  • void drv context)
  • - This function is called whenever a device is
    disconnected.

17
Registering a USB Driver
  • We register our USB driver with USB
  • subsystem using
  • usb_register (struct usb_driver u_drv)
  • - This is usually invoked in our init_module().
  • Un-registering of the USB driver is usually
  • performed using -
  • usb_deregister (struct usb_driver drv)
  • -This is usually invoked in our
    cleanup_module().

18
Hot plug
  • static struct usb_device_id skel_table
  • USB_DEVICE(USB_SKEL_
    VENDOR_ID,
  • USB_SKEL_PRODUCT_ID)
    ,

  • / Terminating entry /
  • MODULE_DEVICE_TABLE (usb, skel_table)

19
Descriptor Explained
  • A USB device when attached will be
  • enumerated.
  • Enumeration means assigning the device a
  • unique number.
  • The unique number must range from 1-127.
  • A descriptor is basically a structure containing
    information about the device and its properties.

20
USB Descriptors
21
USB Request Block
  • A driver passes messages to the USB subsystem
    using URB
  • A URB consists of relevant information for
    executing a USB transaction.
  • It delivers the data and status back.
  • Execution of an URB is an asynchronous operation.
    Ongoing transfer for a particular URB can be
    cancelled at any time.
  • Each URB has a completion handler.
  • URBs can be linked.

22
Latest developments in USB
  • USB 2.0
  • Low Speed ( 1.5Mbps )
  • Full Speed ( 12Mbps )
  • High Speed ( 480 Mbps )
  • USB On-The-Go Supplement to 2.0
  • Defines a Point to Point communication protocol
    for USB

23
References
  • www.usb.org
  • Universal Serial Bus Specification Revision 2.0
    April 27, 2000
  • On-The-Go Supplement to the USB 2.0 Specification
    Revision 1.0
  • USB On-The-Go Implement / Software / Protocol /
    Electrical and Mechanical Feb, 2002

24
  • Thank You
  • Sebikumar.kuruvilla_at_wipro.com
Write a Comment
User Comments (0)
About PowerShow.com