最終更新:2015-07-13 (月) 17:42:04 (3200d)  

インタラプト転送
Top / インタラプト転送

比較的少量のデータを定期的(FSだと1ms~255msごと)に送るのに使われる

  • マウスキーボードなどのデータのように、少量のデータを確実に一定の周期で転送したい場合に使う。
    • USB/フレームのスケジューリング時に優先的に割り当てられるためリアルタイム性が確保されるが、1フレーム内でのトランザクション数は 1 つに制限される (USB 1.1)
    • 広帯域エンドポイントでは1フレームに最大3トランザクションまで実行可能 (USB 2.0)
  • ホストからの周期的なポーリングによって処理される。

レポートディスクリプタ

速度

データサイズ

  • 速度最大データパケットサイズ最大保証パケット/インターバル
    ロースピード1~81/10フレーム
    フルスピード1~641/フレーム
    ハイスピード1~10241/マイクロフレーム
    513~10242/マイクロフレーム
    683~10243/マイクロフレーム

広帯域エンドポイント

デフォルトインターフェイスの制限

  • ハイスピードのデフォルトのインターフェイスで、インタラプト転送のパケットサイズ(wMaxPacketSize)に64バイト以上は指定できない。(USB 2.0仕様P49)
  • 指定するにはUSB/代替設定が必要。
  • All high-speed device default interface settings must not include any interrupt endpoints with a data payload size (specified via wMaxPacketSize in the endpoint descriptor) greater than 64 bytes.
  • USB 2.0 and USB 3.0 require interrupt endpoints in a default interface to have a maximum packet size of 64 bytes or less.
  • If the data doesn’t fit in a single transaction, the host uses multiple transactions to complete the transfer.

USB 2.0の仕様書(Universal Serial Bus Specification Revision 2.0)のP51

  • A full-speed endpoint can specify a desired period from 1 ms to 255 ms.
  • Low-speed endpoints are limited to specifying only 10 ms to 255 ms.
  • High-speed endpoints can specify a desired period (2^(bInterval-1))x125 μs,

HID

  • HIDコントロール転送のデフォルトパイプかインタラプト転送のパイプを使う。
  • HIDの場合は1フレーム1トランザクション
  • トランザクションのサイス制限
    • ハイスピードの時は64バイト - 64バイト x (8 x 1000)マイクロフレーム = 512,000B/s
    • フルスピードの時は64バイト - 64バイト x 1000フレーム = 64,000B/s - HIDの仕様書にフルスピードのことは書いてない。。
    • ロースピードの時は8バイト - 8バイトx 100フレーム = 800B/s
    • Using USB terminology, a device may send or receive a transaction every USB frame (1 millisecond). A transaction may be made up of multiple packets (token,data, handshake) but is limited in size to 8 bytes for low-speed devices and 64 bytes for high-speed devices.
  • Windowsハイスピードフルスピードで代替HIDインターフェイス(ベンダ提供ドライバ)をサポートしてないと64KB/sになる

USB 3.0

  • USB 3.0においても、インタラプト転送そのものはHost側がその必要性を判断して、必要ならば転送をかけるというシーケンスになる。これもあり、ProtocolそのものはBulk Transferと殆ど変わらない

USB/スケジューリング

  • The host can begin each transaction at any time up to the specified maximum latency since the previous transaction began. So, for example, on a full-speed bus with a 10 ms maximum latency, five transfers could take as long as 50 ms or as little as 5 ms.
  • OHCI host controllers for low and full speeds schedule transactions in periods of 1, 2, 4, 8, 16, or 32 ms.
    • For a full-speed device that requests a maximum anywhere from 8 to 15 ms, an OHCI host will begin a transaction every 8 ms, while a maximum latency from 32 to 255 will cause a transaction attempt every 32 ms.
  • However, devices shouldn’t rely on behavior that is specific to a type of host controller and should assume only that the host complies with the specification.
  • An OHCI controller can schedule more than one stage of a control transfer in a single frame, while a UHCI controller always schedules each stage in a different frame. For bulk endpoints with a maximum packet size less than 64 bytes, a UHCI driver attempts no more than one transaction per frame, while an OHCI driver may schedule additional transactions in a frame.
  • An OHCI controller will poll an interrupt endpoint at least once every 32 ms even if the endpoint descriptor requests a maximum latency of 255 ms, while UHCI controllers can, but don’t have to, support less-frequent polling.
  • Developers who use UHCI hosts are sometimes surprised when their devices fail when connected to an OHCI host. The failure occurs because the device isn’t expecting to see multiple stages of a control transfer in a frame. Every device should work with both controller types.

EHCI

  • USBCMD 23:16 - Interrupt Threshold Control  R/W. Default 08h.
    • This field is used by system software to select the maximum rate at which the host controller will issue interrupts. The only valid values are defined below. If software writes an invalid value to this register, the results are undefined.
    ValueMaximum Interrupt Interval
    00hReserved
    01h1 micro-frame
    02h2 micro-frames
    04h4 micro-frames
    08h8 micro-frames (default, equates to 1 ms)
    10h16 micro-frames (2 ms)
    20h32 micro-frames (4 ms)
    40h64 micro-frames (8 ms)

関連