usb: data flow

15
USB: Data Flow USB: Data Flow Sukesh Shenoy Sukesh Shenoy

Upload: herb

Post on 05-Jan-2016

23 views

Category:

Documents


0 download

DESCRIPTION

USB: Data Flow. Sukesh Shenoy. USB implementation areas. USB Communication Concepts. Bus Topology Communication Flow Models Bus Access Management Special Consideration for Isochronous Transfers. Bus Topology. There are four main parts to USB Bus topology Host and Devices - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: USB: Data Flow

USB: Data Flow USB: Data Flow

Sukesh ShenoySukesh Shenoy

Page 2: USB: Data Flow

USB implementation areas

Page 3: USB: Data Flow

USB Communication Concepts

Bus Topology

Communication Flow Models

Bus Access Management

Special Consideration for Isochronous Transfers

Page 4: USB: Data Flow

Bus TopologyThere are four main parts to USB Bus topology

Host and Devices

Physical Topology

Logical Topology

Client Software-to-function Relationships Client Software-to-function Relationships

Page 5: USB: Data Flow

Physical Topology

USB elements connected via a tiered star topology.Connections are provided by special USB devices known as hubs.Hub provides attachment points knows as ports.

Page 6: USB: Data Flow

Logical Topology

The host communicates with each logical device as if it were directly connected to the root port..

Page 7: USB: Data Flow

Client Software-to-function Relationships

Client software for USB functions must use USB software programming interfaces to Client software for USB functions must use USB software programming interfaces to manipulate their functions manipulate their functions

Client software should be independent of other devices that may be connected to the USB. Client software should be independent of other devices that may be connected to the USB.

Page 8: USB: Data Flow

USB Communication FlowThe USB provides a communication service between software on the host and its USB function. Software on the host communicates with a logical device via a set of communication flows.Communication flows are carried over pipes between endpoints and host side memory buffers.

Page 9: USB: Data Flow

Device End points

Terminus of a communication flowEach USB device consists of a set of independent device end points.Each end point is identified by an end point number.Each end point has a device determined direction of data flow.Combination of end point number and direction allow an end point on a device to be uniquely referenced.An end point determines the transfer type between the client software and the end point

End point zero requirementsThis requirement needs to be satisfied for the USB system software to initialize and generically manipulate the logical deviceThe endpoints with endpoint number zero are always accessible once a device is attached, powered, and has received a bus reset.

Non-End point zero requirementsThese end points cannot be used until the device is configured.

Page 10: USB: Data Flow

PipesA USB pipe is an association between an endpoint on a device and software on the host Pipes represent the ability to move data between software on the host via a memory buffer and an endpoint on a device.There are two mutually exclusive pipe communication modes:There are two mutually exclusive pipe communication modes:

Stream:Stream:

Data moving through a pipe has no USB-defined structure.Data moving through a pipe has no USB-defined structure.

Data flows in at one end of a stream pipe and out the other Data flows in at one end of a stream pipe and out the other end in the same end in the same order. order.

Stream pipes are always unidirectional in their communication Stream pipes are always unidirectional in their communication flow.flow.

Support bulk, isochronous and interrupt transfer types.Support bulk, isochronous and interrupt transfer types.

Message:Message:

Data moving through a pipe has some USB-defined structure.Data moving through a pipe has some USB-defined structure.

Message pipes allow communication flow in both directions, Message pipes allow communication flow in both directions, although the communication flow may be predominately one way.although the communication flow may be predominately one way.

Support control transfer type.Support control transfer type.

Page 11: USB: Data Flow

Transfer TypesControl TransfersControl Transfers Isochronous Isochronous

TransfersTransfersInterrupt Interrupt

TransfersTransfersBulk TransfersBulk Transfers

DevicesDevices support support configuration/command/configuration/command/status type status type communication flows communication flows

Support those Support those devices types that devices types that require data at a require data at a constant rateconstant rate

support those support those devices devices

types that types that send/receive send/receive

data infrequently data infrequently

support devices that support devices that need to need to communicate communicate relatively large relatively large amounts of data amounts of data

Transfer data Transfer data

format format USB defined structure USB defined structure No imposed data No imposed data

structure structure No imposed data No imposed data

structure structure No imposed data No imposed data

structure structure

Transfer Transfer

direction direction Bidirectional Bidirectional

communication flow communication flow over message pipes over message pipes

Unidirectional Unidirectional

communication flow communication flow over stream pipes over stream pipes

Unidirectional Unidirectional

communication flow communication flow over stream pipes over stream pipes

Unidirectional Unidirectional

communication flow communication flow over stream pipes over stream pipes

Transfer Transfer

packet size packet size

constraints constraints

Full speed devicesFull speed devices

8,16,32 or 64 bytes8,16,32 or 64 bytes

High speed devicesHigh speed devices

64 bytes64 bytes

Low speed devicesLow speed devices

8 bytes8 bytes

Full speed devicesFull speed devices

1023 bytes1023 bytes

High speed devicesHigh speed devices

1024 bytes1024 bytes

Full speed devicesFull speed devices

64 bytes64 bytes

High speed devicesHigh speed devices

1024 bytes1024 bytes

Low speed devicesLow speed devices

8 bytes8 bytes

Full speed devicesFull speed devices

8,16,32, or 64 bytes8,16,32, or 64 bytes

High speed devicesHigh speed devices

512 bytes512 bytes

Bus access Bus access

constraints constraints can be used by high can be used by high

speed, full speed and speed, full speed and

low speed USB devices low speed USB devices

can be used by high can be used by high

speed, full speed speed, full speed USB USB

devices devices

can be used by high can be used by high

speed, full speed speed, full speed and and

low speed USB low speed USB devices devices

can be used by high can be used by high

speed, full speed speed, full speed USB USB

devices devices

Data Data sequence sequence

Setup bus transaction Setup bus transaction

Data transactionData transaction

Status transactionStatus transaction

No retransmission of No retransmission of data allowed in case data allowed in case of errors.of errors.

No handshakes No handshakes allowed.allowed.

Use data toggle bits Use data toggle bits that are toggled only that are toggled only upon upon

successful successful completion.completion.

Retransmission of Retransmission of datadata

allowed.allowed.

Use data toggle bits Use data toggle bits that are toggled only that are toggled only upon upon

successful successful completion.completion.

Retransmission of Retransmission of datadata

allowed.allowed.

Page 12: USB: Data Flow

Bus Access for Transfers

Data transfer between the host and a USB device requires some use of the USB bandwidth..

The process of assigning bus bandwidth to devices is called transfer The process of assigning bus bandwidth to devices is called transfer management. management.

The key concepts related to bus access:The key concepts related to bus access:

1.1. Transfer Management Transfer Management

2.2. Transaction Tracking Transaction Tracking

3.3. Bus Time Bus Time

4.4. Device/Software Buffer Size Device/Software Buffer Size

5.5. Bus Bandwidth Reclamation Bus Bandwidth Reclamation

Page 13: USB: Data Flow

Transfer managementTransfer management involves several entities that operate on different objects

in order to move transactions over the bus:

Client Software: Consumes/generates function-specific data to/from a function endpoint via calls and callbacks requesting IRP with the USBD interface. USB Driver (USBD): Converts data in client IRP to/from device endpoint via USB Driver (USBD): Converts data in client IRP to/from device endpoint via calls/callbacks with the appropriate HCD. calls/callbacks with the appropriate HCD. Host Controller Driver (HCD): Converts IRP to/from transactions (as Host Controller Driver (HCD): Converts IRP to/from transactions (as required by a Host Controller implementation) and organizes them for required by a Host Controller implementation) and organizes them for manipulation by the Host Controller. manipulation by the Host Controller. Host Controller: Takes transactions and generates bus activity via packets Host Controller: Takes transactions and generates bus activity via packets to move function-specific data across the bus for each transaction. to move function-specific data across the bus for each transaction.

Transfer TrackingHost controller has access to the transaction list (stores information regarding pending transactions).Host controller also provides information regarding status of each Host controller also provides information regarding status of each transaction (done, pending, halted, etc) transaction (done, pending, halted, etc) The Host Controller uses some implementation-dependent The Host Controller uses some implementation-dependent representation to track representation to track what packets to transfer to/from what endpoints at what time or in what what packets to transfer to/from what endpoints at what time or in what order. order.

Page 14: USB: Data Flow

Calculating bus transaction timesCalculating bus transaction times USB system software needs to calculate the bus time required for each transaction.USB system software needs to calculate the bus time required for each transaction.

Bus time is based on the maximum packet size; dependent on the transfer Bus time is based on the maximum packet size; dependent on the transfer typetype

Calculating buffer sizes in functions and softwareCalculating buffer sizes in functions and software Client software and functions both need to provide buffer space for Client software and functions both need to provide buffer space for pending data transactions awaiting their turn on the bus.pending data transactions awaiting their turn on the bus.

If more than one transaction request is pending for a given endpoint, the If more than one transaction request is pending for a given endpoint, the buffering for each transaction must be supplied. buffering for each transaction must be supplied.

Bus bandwidth reclamationBus bandwidth reclamation Bus transmission time is dependent on the transfer types. Bus transmission time is dependent on the transfer types.

Bus transmission time is a calculated constant.Bus transmission time is a calculated constant.

However in actual scenario during each transaction there will be some bus However in actual scenario during each transaction there will be some bus time time remaining. Therefore to use bandwidth efficiently, transfer types remaining. Therefore to use bandwidth efficiently, transfer types such as control and bulk maybe used. This is called bus bandwidth such as control and bulk maybe used. This is called bus bandwidth reclamation. reclamation.

Page 15: USB: Data Flow

Special considerations for isochronous Special considerations for isochronous transferstransfers

Transmitter and receiver must be time and data synchronized to deliver Transmitter and receiver must be time and data synchronized to deliver datadata correctly. correctly.

Time in USB is represented by three clocks:Time in USB is represented by three clocks:

Sample Clock: This clock determines the natural data rate of samples Sample Clock: This clock determines the natural data rate of samples moving between moving between client software on the host and the function. client software on the host and the function.

Bus Clock: 1 kHz frequency on full-speed segments and 8 kHz frequency on Bus Clock: 1 kHz frequency on full-speed segments and 8 kHz frequency on highhigh speed segments of the bus and is indicated by the rate of SOF speed segments of the bus and is indicated by the rate of SOF packets on the bus. packets on the bus.

Service Clock: This clock is determined by the rate at which client software Service Clock: This clock is determined by the rate at which client software runs toruns to service IRP that may have accumulated between executions. service IRP that may have accumulated between executions.

Synchronization of the above mentioned clocks is necessary for correct Synchronization of the above mentioned clocks is necessary for correct data delivery.data delivery.

If transmission errors occur then the receiver reports the errors to the If transmission errors occur then the receiver reports the errors to the function and appropriate corrective measures are taken. function and appropriate corrective measures are taken.