Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
USB System Architecture (USB 2.0).pdf
Скачиваний:
172
Добавлен:
03.05.2015
Размер:
7.03 Mб
Скачать

Chapter 7: Packets & Transactions

Figure 7-24: OUT Transaction During Isochronous Transfer

OUT Packet

 

 

 

Data Packet

 

 

 

 

from Host

 

 

 

to USB Device

 

 

Sync

 

OUT Token

 

EOP

 

Sync

 

Data Packet (up to 1023 bytes

 

EOP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Isochronous endpoint does not return a handshake pack et

Setup Transactions/Control Transfers

Control transfers are used to issue commands (also called requests) to USB devices. For example, control transfers are performed during USB device configuration to read the standard descriptors and assign a unique address to a device. Control transfers always begin with a setup transaction, called the setup stage. The setup stage defines the nature of the control transfer. Some control transfers include a data stage consisting of one or more IN or OUT transactions that are used to deliver the payload of the control transfer. Whether data is sent to or received from the device is defined by the setup stage. The final stage of a control transfer is the status stage. This stage confirms that the requested operation has been completed successfully. Control transfers exist in two basic forms:

Transfers consisting of a setup stage and status stage.

Transfers consisting of a setup stage, data stage, and status stage.

The data phase of a setup transaction contains 8 bytes of information as defined in Table 7-3. This information defines the request being issued to the device and provide all the information needed by the device to fulfill the request.

163

USB System Architecture

Table 7-3: Format of Setup Transaction Data Phase

Offset

Field

Size

Value

 

Description

 

 

 

 

 

 

 

 

 

 

0

Request-

1

Bit-map

Characteristics of Request

 

Type

 

 

D7

Data xfer direction

 

 

 

 

 

0 = Host to device

 

 

 

 

 

1 = Device to host

 

 

 

 

D6:5

Type

 

 

 

 

 

0 = Standard

 

 

 

 

 

1 = Class

 

 

 

 

 

2 = Vendor

 

 

 

 

 

3 = Reserved

 

 

 

 

D4:0

Recipient

 

 

 

 

 

0 = Device

 

 

 

 

 

1 = Interface

 

 

 

 

 

2 = Endpoint

 

 

 

 

 

3 = Other

 

 

 

 

 

4:31 = Reserved

 

 

 

 

 

1

Request

1

Value

Specific Request.

 

 

 

 

 

2

Value

2

Value

Word-sized field that varies according

 

 

 

 

to request.

 

 

 

 

 

 

4

Index

2

Index or

Word-sized field that varies according

 

 

 

Offset

to request. Typically used to pass an

 

 

 

 

index or offset.

 

 

 

 

 

6

Length

2

Count

Number of bytes to transfer if there is a

 

 

 

 

data stage required for this transfer.

 

 

 

 

 

 

Two Stage Control Transfer

A two stage control transfer consists solely of the setup and status stages as illustrated in Figure 7-25. In this instance the 8 bytes delivered during the setup transaction contains all the information needed to perform the specified request (e.g., remote wake-up request). The status stage consists of an IN transaction to verify that the request has been successfully processed.

164

Chapter 7: Packets & Transactions

Figure 7-25: Format of a Two Stage Control Transfer

 

6HWXS 6WDJH

 

 

6WDWXV 6WDJH

 

 

6HWXS 7UDQ

 

 

,1 7UDQVDFWLRQ

 

 

 

 

V

 

VHWXS

E\WHV

DFN

,1

E\WHV

DFN

Three Stage Control Transfer with IN Data Stage

Figure 7-26 illustrates a control transfer that requires data be returned from the target device back to the host. As an example, a control transfer may be performed when the host system issues a request to read a device descriptor. The first stage of the transfer consists of the setup transaction that defines the nature of the control transfer. The setup transaction consists of the setup token, data packet, and handshake. During setup transactions data is always sent to the target device to specify the type of request. Following the setup phase, the host initiates one or more IN transactions, prompting the target to return the requested data. The host completes the control transfer by using an OUT transaction to request verification that the device endpoint has successfully returned the contents of the descriptor. Note that the target device indicates successful completion of the request by issuing an ACK handshake during the OUT transaction. The OUT data packet issued by the host has a length of zero.

Figure 7-26: Control Transfer Requesting Data from Target

Setup Stage

 

Data Stage (one or more IN transactions)

 

Status Stage

Setup Transaction

 

IN Transaction

 

IN Transaction

 

IN Transaction

 

OUT Transaction

 

 

 

 

 

 

 

 

 

 

 

 

 

Three Stage Read Control Transfer

165

USB System Architecture

Three Stage Control Transfer with OUT Data Stage

Figure 7-27 illustrates the format of a control transfer in which a command is issued to a control endpoint. The setup transaction defines the request being issued and is followed by the data stage (one or more OUT transactions). The host then issues an IN token to the control endpoint to obtain completion status. The target returns a data packet with a length of zero to indicate that it has successfully processed the initial control request.

Figure 7-27: Control Transfer Issuing a Command to a Target’s Control Endpoint

Setup Stage

Data Stage (one or more OUT transactions

Status Stage

)

Setup Transaction

OUT Trans.

OUT Trans.

OUT Trans.

IN Transaction

 

 

Three Stage Write Control Transfer

 

 

Control Transfers With Errors

The host system attempts retries to ensure that a control transfer completes successfully. The action taken by the target and host depends on the nature of the error condition and when the error occurs during the transfer. See Chapter 8, entitled "Error Recovery," on page 167 for further details.

166

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]