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

USB System Architecture

Figure 7-14: Preamble Packet Format

 

 

 

 

 

 

 

Preamble PID

 

 

 

 

 

 

 

 

 

 

 

 

Type Field

 

 

 

Check Field

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Full-speed

 

lsb

 

 

msb

 

lsb

 

 

msb

 

Minimum 4 bit time dela

Begin low-speedy

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

transactions

 

0

0

1

1

 

1

1

0

0

 

while the hub enables

transaction

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

its low-speed ports

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Idle

Sync

 

 

 

 

 

 

 

 

 

 

 

IDLE

Sync

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Transactions

The following sections describe each type of transaction and specify the possible forms that each may take.

IN Transactions

A typical IN transaction consists of the token phase, data phase, and handshake phase. However, in some instances an IN transaction may not consist of all three phases. IN transactions are employed when performing all four types of transfers. Several conditions may occur during an IN transaction:

data is received without errors.

data is received with errors.

the target is temporarily unable to return data.

the target is unable to return data without an existing error condition being cleared.

an isochronous transfer is taking place; thus, data is returned by the target, but no handshake follows the data phase.

156

Chapter 7: Packets & Transactions

IN Transaction Without Errors

In Figure 7-15, the IN transaction could occur during an interrupt transfer, bulk transfer, or control transfer. In this example, data returned by the target device to the root hub is received without error, and an ACK handshake is returned to the target device. Note that the data packet is defined as a DATA0 packet is always used for single stage control transfers, and is typically used during the first transaction of a transfer requiring multiple IN transactions (e.g., bulk or control transfers from a USB device). In multiple transaction transfers, consecutive transactions will alternate between DATA0 and DATA1 transactions.

Figure 7-15: IN Transaction Without Errors

 

 

IN Packet

 

 

 

Data Packet

 

Acknowledge Packet

 

 

from Host

 

 

 

from USB Device

 

from Host

Sync

 

IN Token

 

EOP

 

Sync

 

Data Packet (up to 64 bytes)

 

EOP Sync

 

ACK

 

EOP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

IN Transaction with Errors

In Figure 7-16, the IN transaction with data packet errors consists of two packets: the IN token packet and the data packet. The handshake is not returned from the host controller to the target device because of the error detected by the host when it received the data packet. The target device will detect a time-out condition since the acknowledge is not returned by the host. The host is responsible for retrying the IN transaction at a later time.

157

USB System Architecture

Figure 7-16: IN Transaction With Data Phase Errors

 

 

IN Packet

 

 

 

Data Packet

 

 

 

 

from Host

 

 

 

from USB Device

 

 

Sync

 

IN Token

 

EOP

 

Sync

 

Data Packet (up to 64 bytes

 

EOP

 

 

 

 

 

 

 

 

 

 

 

 

 

Host detects error

 

 

 

 

 

 

 

 

 

 

 

 

and does not respond with handshake

IN Transaction with No Interrupt Pending/Target Busy

Figure 7-17 illustrates a condition in which the target device is temporarily unable to return data. Since the device is unable to return data during the data phase of the transaction, it returns a NAK during the data phase. This informs the root hub and host controller that the device is temporarily unable to return data. This form of IN transaction can occur during interrupt transfers if no interrupt is currently pending within the device, or during bulk or control transfers if a busy condition exists within the device, preventing it from returning data.

Figure 7-17: IN Transaction With Target Temporarily Unable to Return Data

 

 

IN Packet

 

 

 

Handshake Packet

 

 

 

 

from Host

 

 

 

Returned from USB Device

 

 

Sync

 

IN Token

 

EOP

 

Sync

 

NAK Packet

 

EOP

 

 

 

 

 

 

 

 

 

 

 

 

 

Target device currently cannot

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

return data

 

 

 

 

 

 

 

 

 

 

 

 

 

158

Chapter 7: Packets & Transactions

IN Transaction with Target Stalled

Figure 7-18 illustrates a condition in which the target device has incurred an error condition that prevents it from returning data. The target device returns a STALL handshake to the root hub to inform system software that the error condition must be cleared before data can be returned. Note that this error may be part of normal operation, rather than a serious USB device problem. For example, a scanner that inadvertently loses power during a scan would not be able to return data via the USB interface. Once power is restored, the transfer can continue.

Figure 7-18: IN Transaction with Target Stalled

 

IN Packet

Handshake Packet

 

 

from Host

Returned from USB Device

 

 

 

 

STALL Packet

 

Sync

IN Token

EOP

Sync

EOP

 

 

 

 

Target device cannot

 

 

 

 

 

 

 

 

 

 

return data due to an

 

 

 

 

 

internal error condition

 

IN Transaction During Isochronous Transfer

In Figure 7-19 the IN transaction results from an isochronous transfer. Both the host controller and the target device are aware that the transaction is part of an isochronous transfer. The target device has this knowledge because the endpoint address selects one of its isochronous endpoints. The host controller has knowledge that the transaction is isochronous because system software specifies the transfer type in the transfer descriptor that the host controller executes. The IN transaction consists of the token phase and the data phase only and does not include a handshake, since data delivery is not guaranteed with isochronous transfers.

159

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