JP2004046392A - Usb host control circuit - Google Patents

Usb host control circuit Download PDF

Info

Publication number
JP2004046392A
JP2004046392A JP2002200792A JP2002200792A JP2004046392A JP 2004046392 A JP2004046392 A JP 2004046392A JP 2002200792 A JP2002200792 A JP 2002200792A JP 2002200792 A JP2002200792 A JP 2002200792A JP 2004046392 A JP2004046392 A JP 2004046392A
Authority
JP
Japan
Prior art keywords
transfer
pipe
control circuit
data
host control
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2002200792A
Other languages
Japanese (ja)
Inventor
Yoshihiro Konno
今野 欣弘
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Renesas Technology Corp
Renesas Design Corp
Original Assignee
Renesas Technology Corp
Renesas Design Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Technology Corp, Renesas Design Corp filed Critical Renesas Technology Corp
Priority to JP2002200792A priority Critical patent/JP2004046392A/en
Publication of JP2004046392A publication Critical patent/JP2004046392A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Bus Control (AREA)
  • Information Transfer Systems (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a USB host control circuit which can improve transfer efficiency while suppressing the load of a CPU. <P>SOLUTION: A USB control circuit is provided with a pipe control buffer 31, a pipe information buffer 32, a transfer information buffer 33, a pipe selection circuit 34 and a protocol engine 36. The pipe selection circuit 34 selects a pipe for transferring data between CPU 10 and a USB device 40 in accordance with information stored in the pipe control buffer 31 and the pipe information buffer 33. A response result to data transfer is acquired from the protocol engine 36 and the pipe for transferring data is switched while rewriting the content of the transfer information buffer 33 in accordance with the response result. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
この発明はデータ通信技術に関する。より詳しくは、USBを介した通信を制御する技術に関する。
【0002】
【従来の技術】
USBを介した通信においては、単一のUSBホストと単一または複数のUSBデバイスとの間で通信(データ転送)が行われる。複数のUSBデバイスとの間でデータ転送を行う場合、USBホストとUSBデバイスとはそれぞれのパイプと呼ばれる通信チャネル(論理チャネル)を用いて、時分割処理によりデータ転送を行う。
【0003】
USBホストは複数のUSBデバイスとの通信を行うために、予め転送スケジューリング(通信チャネルのルーチング)を行う。転送スケジューリングとは、フレームと呼ばれる単位時間内の転送有効期間において、どのUSBデバイスがどのパイプで通信を行うかを決定するとともに、各パイプの通信順序(優先順位)を決定することをいう。
【0004】
これにより、USBを用いたデータ転送におけるデータはフレームに分割されて転送され、フレームの中に各USBデバイス用のデータ転送時間を割り振ることで、USBホストは、各USBデバイスに対して公平にデータ転送の機会を与えるように動作することとなる。
【0005】
従来より、USBホストによる転送スケジューリングは、フレームごとに、トランスファ単位で行われ、複数のパイプを用いて通信が行われる場合には各パイプのデータ転送がフレーム内で平均するように構成される。
【0006】
【発明が解決しようとする課題】
ところが、上記のような従来のUSBホストでは、あるフレーム内でデータを送信するよう割り当てられたパイプがビジー状態であったとしても、転送スケジューリングがフレームごとに行われるため、当該フレームが終了しない限り転送スケジューリングの更新は行われない。したがって、フレームにおいてパイプのビジー状態が続くと、その間、当該フレームにおけるデータ転送は一切行われないことから、通信全体の転送効率が下がるという問題があった。
【0007】
この問題を解決するため、例えば、各パイプの状態を監視し、通信の状況に合わせて転送スケジューリングを更新しようとした場合、転送スケジューリングにはCPU処理が必要であることから、CPUに対する負荷が増大してしまうという問題があった。
【0008】
特に、1トランスファに含まれるトランザクション数が少ない場合には、1つのフレーム内に定義されるパイプの数が増加し、スケジューリングすべきパイプの数が増加するため、特にCPUの処理が増大するという問題があった。
【0009】
この発明は上記問題点を解決するためになされたもので、CPUに対する負荷を抑制しつつ、USBにおける転送効率を向上させるUSBホスト制御回路を得ることを目的とする。
【0010】
【課題を解決するための手段】
上記の課題を解決するため、請求項1の発明は、CPUと複数のUSBデバイスとの間のデータ転送を制御するUSBホスト制御回路であって、各USBデバイスのそれぞれが前記CPUとデータ転送を行うための複数の通信チャネルと、前記複数の通信チャネルのうちから前記データ転送を行う通信チャネルを選択するチャネル選択手段と、前記チャネル選択手段により選択された前記通信チャネルによって行われたデータ転送に対する応答結果を取得する取得手段とを備え、前記チャネル選択手段が、前記取得手段により取得された前記応答結果に応じて、前記通信チャネルの選択を切り替える。
【0011】
また、請求項2の発明は、請求項1の発明に係るUSBホスト制御回路であって、取得手段は、通信チャネルにより転送されるトランザクションごとに応答結果を取得する。
【0012】
また、請求項3の発明は、請求項1または2の発明に係るUSBホスト制御回路であって、チャネル選択手段は、応答結果が、エラーまたはNAKである場合に通信チャネルの選択を切り替える。
【0013】
また、請求項4の発明は、請求項1ないし3のいずれかの発明に係るUSBホスト制御回路であって、各通信チャネルの優先順位を記憶する記憶手段を備え、チャネル選択手段は、前記記憶手段に記憶されている前記優先順位に従って、前記通信チャネルの選択を切り替える。
【0014】
また、請求項5の発明は、請求項1ないし4のいずれかの発明に係るUSBホスト制御回路であって、チャネル選択手段は、現時点が、フレーム内の転送有効期間であるか否かを判定する可否判定手段を有し、応答結果に応じて選択が切り替えられた通信チャネルについては、前記可否判定手段により転送有効期間であると判定された時間内にデータの再転送をさせる。
【0015】
また、請求項6の発明は、請求項5の発明に係るUSBホスト制御回路であって、チャネル選択手段は、転送されるデータの転送タイプを各通信チャネルごとに判定する転送タイプ判定手段をさらに有し、前記転送タイプ判定手段により所定の転送タイプであると判定された通信チャネルに対してのみ前記データの再転送をさせる。
【0016】
また、請求項7の発明は、請求項6の発明に係るUSBホスト制御回路であって、所定の転送タイプが、コントロール転送、またはバルク転送である。
【0017】
【発明の実施の形態】
図1はこの発明の実施の形態であるUSBホスト1の構成を他の構成とともに示すブロック図である。USBホスト1は、バス38を介して各USBデバイス41,42,43(以下、総称する場合は「USBデバイス40」と称する)との間でデータ転送を行う。
【0018】
USBホスト1は、各種データの演算や制御信号の生成を行うCPU10、各種データを保存するメモリ20、およびCPU10とUSBデバイス40との間でUSBを介したデータ転送を制御するホスト制御回路30を備える。
【0019】
ホスト制御回路30は、パイプ制御バッファ31、パイプ情報バッファ32、転送情報バッファ33、パイプ選択回路34、データバッファ35、プロトコルエンジン36、フレームタイマ37、およびバス38を備え、後述する処理を実行する専用のハードウェアとして構成されている。
【0020】
また、USBを介したデータ転送では、前述のように、各USBデバイス41,42,43のそれぞれが、CPU10とデータ転送を行うための複数のパイプを定義することにより、時分割処理が行われる。
【0021】
パイプ制御バッファ31は、各パイプを制御するための情報(パイプ制御PC)を保持する記憶バッファであり、具体的には、各パイプにおける転送タイプ、パイプ情報の有効・無効、データバッファ35に記憶されているUSBデバイス40への送信データの有効・無効、データバッファ35におけるUSBデバイス40からの受信データを保存する領域の有無などが含まれる。なお、これらの情報は、各パイプごとに存在し、図1に示すように、それぞれパイプ制御PC0、パイプ制御PC1、・・・、パイプ制御PCnのように各パイプ番号をキーとして識別可能な状態で保持される(nは126以下の任意の整数)。
【0022】
パイプ情報バッファ32は、各パイプに関する情報(パイプ情報PI)を保持するための記憶バッファであり、具体的には、各パイプを使用する各USBデバイス41,42,43のアドレス、エンドポイント、最大パケットサイズ、転送方向、およびトランザクションの数などが含まれる。また、これらの情報も、パイプ制御PCと同様に、各パイプごとに存在し、それぞれパイプ情報PI0、パイプ情報PI1、・・・、パイプ情報PInのように識別可能な状態で保持される。
【0023】
なお、詳細は後述するが、本実施の形態におけるホスト制御回路30では、転送タイプおよびパイプ番号に基づいてパイプ選択における優先順位が決定される。すなわち、パイプ制御バッファ31およびパイプ情報バッファ32が通信チャネルの優先順位を記憶する記憶手段に相当する。
【0024】
転送情報バッファ33は、各パイプの通信結果に関する情報(転送情報TI)を保持する記憶バッファであり、転送完了、転送エラー、転送データ数などが含まれる。また、これらの情報も、各パイプごとに存在し、それぞれ転送情報TI0、転送情報TI1、・・・、転送情報TInのように識別可能な状態で保持される。
【0025】
パイプ選択回路34は、計時機能を有するフレームタイマ37の出力に基づいて、フレームの開始・終了、その時点が転送有効期間であるか否かの判定などのフレーム管理を行う。
【0026】
また、パイプ選択回路34は、パイプ制御バッファ31、パイプ情報バッファ32、および転送情報バッファ33にそれぞれアクセス可能とされており、それらに保持されている情報に基づいて、フレームの転送有効期間中に、データ転送を行うパイプを選択する。
【0027】
さらに、パイプ選択回路34は、選択したパイプに関するパイプ情報PIをデータバッファ35とプロトコルエンジン36とに伝達するとともに、データバッファ35からは転送したトランザクション数に関する情報、プロトコルエンジン36からは各トランザクションごとの各USBデバイス41,42,43の応答結果に関する情報をそれぞれ受け取り、転送情報バッファ33にアクセスして、転送情報TIを必要に応じて書き換える。
【0028】
データバッファ35は、パイプ選択回路34により選択されたパイプによって転送されるデータ(CPU10が送信するデータおよびUSBデバイス40が送信するデータ)を保持するための記憶バッファであり、プロトコルエンジン36とメモリ20との間のデータのやり取りの調停を行う。
【0029】
また、データバッファ35は、パイプ制御バッファ31にアクセスすることにより、USBデバイス40への送信データの有効・無効、USBデバイス40からの受信データを保存する領域の有無など、データバッファ35の状態をパイプ制御PCとして書き込む。
【0030】
さらに、転送したデータ数に基づいて、転送されたトランザクション数をカウントするトランザクションカウンタ350を備え、パイプ選択回路34に転送したトランザクション数を通知する。
【0031】
なお、データが現実に転送されたか否かの判定は、データバッファ35が、プロトコルエンジン36から通知される、当該転送データに対する応答結果に関する情報に基づいて行う。また、本実施形態では、トランザクションカウンタ350をデータバッファ35が備えているが、トランザクションカウンタ350の機能をパイプ選択回路34が有していてもよい。その場合、データバッファ35は、単に転送したデータ数をパイプ選択回路34に伝達し、当該データ数に基づいて、パイプ選択回路34が転送されたトランザクション数をカウントする。
【0032】
プロトコルエンジン36は、バス38上に接続されている各USBデバイス41,42,43のいずれかとパイプ選択回路34から供給されたパイプ情報PIに従ってトランザクション単位の応答動作を行い、取得した応答結果をパイプ選択回路34およびデータバッファ35に通知する。
【0033】
また、USBホスト1からデータを送信する場合は、送信データをデータバッファ35から取得し、USBデバイス40からデータを受信する場合は、受信データをデータバッファ35に伝達する。
【0034】
以上が実施の形態におけるホスト制御回路30の構成の説明である。
【0035】
図2は、ホスト制御回路30の動作を示す流れ図である。以下、図2を用いてホスト制御回路30の動作について説明する。まず、フレームによる転送に先立って、CPU10が転送スケジューリングを行って、パイプ制御PCおよびパイプ情報PIを作成し、パイプ制御バッファ31およびパイプ情報バッファ32にそれぞれ保存する。
【0036】
次に、パイプ選択回路34は、フレームタイマ37からの入力信号に基づいて、現時点がデータの転送有効期間であるか否かを判定し、転送有効期間になると図2の処理を開始し、選択中の転送タイプの初期化(ステップS11)およびパイプ番号の初期化(ステップS12)を行う。
【0037】
なお、USBによるデータ転送では、
(1)アイソクロナス(Isochronous)転送:エラー処理や再送信処理を行わず、リアルタイム性を重視した転送モードで転送時の優先順位が最も高い転送と、
(2)インタラプト(Interrupt)転送:キーボードなどのヒューマンインタフェースデバイスとの転送に使用される転送モードで、データ量は少量であるが一定周期で優先的にデータ転送を行う必要がある転送と、
(3)コントロール(Control)転送:USBホスト1とUSBデバイス40との間の制御コマンドなどの転送に使用される転送モードと、
(4)バルク(Bulk)転送:リアルタイム性はさほど重視されないがデータ量の多い転送に使用される転送モードで、転送時の優先順位が最も低い転送と、
の4つの転送タイプ(転送モード)があり、ホスト制御回路30では、アイソクロナス転送を転送タイプ「0」、インタラプト転送を転送タイプ「1」、コントロール転送を転送タイプ「2」、バルク転送を転送タイプ「3」として識別する。すなわち、ステップS11では、選択中の転送タイプを「0」に初期化することにより、まず、最も優先順位の高いアイソクロナス転送が選択される。
【0038】
初期化が終了すると、パイプ選択回路34は、パイプ制御バッファ31にアクセスすることによりパイプ制御PCを参照し、パイプ番号に示されるパイプについて、パイプ情報が有効(転送すべきデータが存在するパイプであることを示す)であり、かつ、転送タイプが選択中の転送タイプに一致するか否かを判定し(ステップS13)、パイプ情報が有効、かつ、転送タイプが選択中の転送タイプに一致する場合にのみトランザクション転送処理(ステップS14)を行う。
【0039】
図3は、ステップS14におけるトランザクション転送処理の詳細を示す流れ図である。トランザクション転送処理では、まず、トランザクションカウンタ350を「0」にクリアして(ステップS31)、フレームタイマ37からの入力に基づいてフレームが終了しているか否か、つまり現時点がフレーム内の転送有効期間であるか否かを判定する(ステップS32)。
【0040】
フレームが終了している場合は、転送情報バッファ33にアクセスすることにより、転送情報TIの当該パイプに関する部分を更新し(ステップS40)、図2のステップS21の処理に戻り、選択中の転送タイプがバルク転送(転送タイプ「3」)である場合にのみ、パイプ情報が有効なパイプ番号を保存し(ステップS21,S22)、処理を終了する。
【0041】
なお、転送情報TIの更新は、具体的には、トランザクションカウンタ350から入力される転送したトランザクション数に基づいて、パイプ選択回路34が転送したデータ数を算出し、転送情報TIの当該パイプについてのデータ転送数を書き換えることにより行う。
【0042】
一方、フレームが終了していない場合は選択されているパイプにより、トランザクションを1つ転送するようプロトコルエンジン36に指示を与え、さらに、プロトコルエンジン36から当該トランザクションの転送に対する応答結果を取得する(ステップS33)。
【0043】
ステップS33において、トランザクションが転送される処理を具体的に説明すると、まず、パイプ選択回路34が、パイプ情報PIのうちの選択されているパイプ番号に関する部分の情報をデータバッファ35およびプロトコルエンジン36に伝達する。
【0044】
データバッファ35は、受け取ったパイプ情報PIに示される転送方向に基づいて、USBホスト1とUSBデバイス40とのデータ転送が送信・受信のいずれであるかを判定する。
【0045】
当該データ転送が送信である場合には、必要な送信データをメモリ20から読み出して保持するとともに、パイプ制御バッファ31にアクセスして、USBデバイス40への送信データが有効であることを示す情報をパイプ制御PCに書き込む。さらに、プロトコルエンジン36からの要求に応じて、バッファに保持した送信データをトランザクションごとに伝達する。
【0046】
プロトコルエンジン36は、パイプ情報PIに示されるUSBデバイス40のアドレスおよび転送タイプに従って、データバッファ35から伝達されたトランザクション(転送データ)をUSBデバイス40に対して転送するとともに、当該データ転送の応答結果を取得して、パイプ選択回路34およびデータバッファ35に伝達する。
【0047】
一方、データ転送が受信である場合には、データバッファ35は、バッファ上に必要な記憶領域を確保し、パイプ制御バッファ31にアクセスして、USBデバイス40からの受信データを保存する領域が確保されたことを示す情報を書き込む。
【0048】
プロトコルエンジン36は、パイプ情報PIに示されるUSBデバイス40のアドレスおよび転送タイプに従って、当該USBデバイス40に対して送信要求を行い、トランザクションを受信してデータバッファ35に伝達する。さらに、当該データ転送の応答結果を取得して、パイプ選択回路34およびデータバッファ35に伝達する。
【0049】
データバッファ35は、トランザクション(転送データ)を正常に受信できた場合は、受信したトランザクションを一旦保持しつつ、メモリ20の所定の領域に書き込む。以上がステップS33の具体的な説明である。
【0050】
次に、データバッファ35はステップS34を実行し、ステップS33においてプロトコルエンジン36から取得した応答結果がACK(Acknowledgement:肯定応答)である場合は、転送したトランザクションが正常に転送されたことを示していることから、トランザクションカウンタ350をカウントアップし(ステップS35)、パイプ選択回路34に通知する。
【0051】
パイプ選択回路34は、データバッファ35のトランザクションカウンタ350からの入力信号とパイプ情報PIとに基づいて、転送を行うトランザクションの転送が終了しているか否かを判定し(ステップS36)、まだ終了していない場合は、さらに当該パイプによるトランザクションの転送を行うため、ステップS32に戻って処理を繰り返す。
【0052】
これにより、転送が正常に行われている場合(応答結果がACKである場合)は、転送すべきトランザクションの転送が終了する(ステップS36においてYes)か、もしくはフレームの転送有効期間が終了する(ステップS32においてYes)まで、ステップS32ないしS36の処理が繰り返され、当該選択されているパイプ(転送権を有するパイプ)によるトランザクションの転送(ステップS33)が繰り返し行われる。
【0053】
トランザクションの転送が終了した場合は(ステップS36においてYes)、その旨をCPU10に通知する(ステップS37)とともに、転送情報TIの当該パイプに関する部分を更新し(ステップS39)、選択中のパイプによるトランザクション転送処理を終了して、図2のステップS15に戻る。
【0054】
これにより、CPU10は、当該パイプによるトランザクションの転送が正常に終了したことを検知することができるとともに、転送情報TIにアクセスすることにより、必要な情報を得ることができる。
【0055】
プロトコルエンジン36から取得した応答結果がACKでなく(ステップS34においてNo)、エラーである場合は(ステップS38においてYes)、USBホスト1とUSBデバイス40との間で何らかの転送エラーが生じているため、その旨をCPU10に通知する(ステップS37)とともに、転送情報TIの当該パイプに関する部分を更新し(ステップS39)、選択中のパイプによるトランザクション転送処理を終了して、図2のステップS15に戻る。この場合、パイプ選択回路34は、それまでに転送することができた転送データ数のみならず、転送エラーを示すデータを転送情報TIの当該パイプに関する部分に含める。
【0056】
これにより、CPU10は、当該パイプによるデータ転送において転送エラーが発生していることを検知することができるとともに、転送情報TIにアクセスすることにより、それまでに転送できたデータ転送数などを確認することができる。
【0057】
プロトコルエンジン36から取得した応答結果が、ACKまたはエラーのいずれでもない場合は(ステップS38においてNo)、プロトコルエンジン36から取得した応答結果がNAK(Not Acknowledgement:否定応答)であると判断できる。したがって、この場合にはパイプ選択回路34は、CPU10への通知は行わず、転送情報TIのみ更新して(ステップS39)、選択中のパイプによるトランザクション転送処理を終了して、図2のステップS15に戻る。
【0058】
転送すべきトランザクションの転送終了、あるいは転送データに対する応答結果がエラーまたはNAKであることにより、選択中のパイプのトランザクション転送処理(ステップS14)が終了すると、パイプ選択回路34は、フレームタイマ37からの入力に基づいてフレームが終了しているか否かを判定する(ステップS15)。フレームが終了している場合は、ステップS21およびS22を実行して処理を終了する。
【0059】
一方、フレームが終了していない場合は、パイプ番号をインクリメントしてパイプを切り替えつつ(ステップS16)、すべてのパイプについてステップS13の判定が終了するまでステップS13ないしS17の処理を繰り返す(ステップS17)。すなわち、ステップS16は、データを転送する権利を次の優先順位に対応したパイプ番号を有するパイプに渡してパイプの選択を切り替える処理に相当する。
【0060】
このように、本実施の形態におけるホスト制御回路30は、トランザクションごとに取得される応答結果に応じて、データ転送を行うパイプを切り替えることができることから、例えば、CPU10との間でデータ転送を行っているUSBデバイス41がビジーである場合、つまりデータ転送を行うことができない状態に相当する場合に、USBデバイス41が使用しているパイプの選択を切り替えることにより、他のUSBデバイス(42または43)が使用するパイプによるデータ転送を開始することができ、USBデバイス41のビジー状態が解消されるまで他のUSBデバイスが待たされることがなく、転送効率を向上させることができる。
【0061】
また、当該パイプの選択の切り替え処理は、CPU10による処理がなくてもホスト制御回路30内で実行することができるため、CPU10の負荷を抑制しつつ、転送効率の向上を図ることができる。
【0062】
さらに、応答結果は、トランザクションごとに得られるため、データ転送における最小単位であるトランザクションごとにデータ転送を行うパイプを切り替えることができ、さらに転送効率を向上させることができる。
【0063】
選択中の転送タイプによってデータ転送を行うすべてのパイプについて、参照が終了した場合は(ステップS17においてYes)、転送タイプをインクリメントしつつ(ステップS18)、すべての転送タイプについて処理が終了するまでステップS12からの処理を繰り返す(ステップS19)。すなわち、ステップS18は、データを転送する権利を次の優先順位の転送タイプによってデータ転送を行うパイプに渡すことにより、パイプの選択を切り替える処理に相当する。
【0064】
パイプ選択回路34がこのような処理を行うことにより、転送タイプは、アイソクロナス転送、インタラプト転送、コントロール転送、バルク転送の順で選択され、各転送タイプごとにパイプ番号順にパイプが選択されてデータ転送が実行される。
【0065】
なお、優先順位が最も低いバルク転送(転送タイプ「3」)が選択されている状態で、すべてのパイプに対する参照が終了すると、転送タイプが「4」にインクリメントされる(ステップS18)。したがって、パイプ選択回路34は、パイプ情報が有効となっているすべてのパイプについてデータ転送の機会が与えられた後は(ステップS19においてYes)、選択中の転送タイプを転送タイプ「2」(コントロール転送)に戻して(ステップS20)、ステップS12からの処理を繰り返す。
【0066】
これにより、コントロール転送またはバルク転送によりデータ転送を行うパイプであって、応答結果(エラーまたはNAK)に応じて切り替えられたパイプについては、再度データ転送を行うパイプとして選択することができ、転送すべきトランザクションが残っているパイプ(パイプ制御PCにおけるパイプ情報が有効となっているパイプ)については、フレームの転送有効期間である限りデータの再転送をさせて、残りのトランザクションを転送する機会を与えることで、さらに転送効率を向上させることができる。
【0067】
以上の処理について、具体例を元に説明する。図4は、ホスト制御回路30によるフレーム内のデータ転送の模式図である。なお、図4では、パイプ0とパイプ1とにより、トランスファ0(トランザクションT00ないしT03により構成されるトランスファ)およびトランスファ1(トランザクションT10ないしT13により構成されるトランスファ)がそれぞれバルク転送される例を示している。また、図4に示す区間(時間)では、フレームは終了しないものとする。
【0068】
まず、パイプ選択回路34が、転送タイプ「3」(バルク転送)を選択中に、パイプ番号「0」を選択することにより、ステップS13においてパイプ0について参照され、トランザクション転送処理(ステップS14)が実行される。
【0069】
これにより、まず、トランザクションT00が転送される。転送に対する応答結果がACKである限り、さらにトランザクションT01,T02が順次転送され、ステップS35により正常に転送されたトランザクションに対して、トランザクションカウンタ350がカウントアップされる。すなわち、図4に示す、区間TM1の間、パイプ0によるバルク転送が行われる。
【0070】
図4に示す例では、トランザクションT02に対する応答結果が、NAK(ステップS34,S38がいずれもNoと判定される。)となっている。したがって、パイプ選択回路34は、ここまでに転送されたトランザクション数(T00,T01の2つ)から、転送したデータ数を算出して、転送情報バッファ33にアクセスすることにり転送情報TI0を更新し、パイプ0によるトランザクション転送処理を終了する。さらに、パイプ番号をインクリメントすることによって、選択していたパイプ0の切り替えを行い、パイプ1を選択する。
【0071】
これにより、ステップS13ではパイプ1が参照され、再びトランザクション転送処理(ステップS14)が実行される。
【0072】
区間TM2においても、区間TM1と同様に、まず、トランザクションT10が転送され、当該転送に対する応答結果がACKであることから、さらにトランザクションT11ないしT13が順次転送されつつ、トランザクションが正常に転送されるたびに、トランザクションカウンタ350がカウントアップされる。
【0073】
図4に示す例では、区間TM2における転送でも、トランザクションT13に対する応答結果がNAKとなっている。したがって、パイプ選択回路34は、ここまでに転送されたトランザクション数(T10ないしT12の3つ)から、転送したデータ数を算出して、転送情報TI1を更新し、パイプ1によるトランザクション転送処理を終了する。さらに、パイプ番号がインクリメントされ、パイプ選択の切り替えが行われる。
【0074】
この時点で、バルク転送におけるすべてのパイプの参照が終了していることから、パイプ選択回路34は、ステップS20を実行し、転送すべきトランザクションが残っているパイプについて、残りのトランザクションを転送する機会を与える。
【0075】
図4に示す例では、区間TM2の後にパイプが切り替えられると、コントロール転送、バルク転送の順に転送タイプが選択される。そして、バルク転送が選択されている間にパイプ0が参照されると、パイプ0は転送すべきトランザクションが残っているため、パイプ0によるトランザクション転送処理(ステップS14)が再開される。
【0076】
このとき、パイプ選択回路34は、転送情報TI0とパイプ情報PI0とを参照することにより、パイプ0において未転送のトランザクションT02から転送を開始する。
【0077】
これにより、区間TM3では、トランザクションT02,T03が順次転送され、トランザクションT02,T03の転送に対する応答結果がいずれもACKであることから、パイプ0によるトランザクションの転送が正常に終了する(トランスファが終了する)。したがって、パイプ選択回路34は、CPU10への通知を行うとともに(ステップS37)、転送情報TI0を更新し(ステップS39)、パイプ0によるトランザクション転送処理を終了する。
【0078】
さらに、パイプ番号をインクリメントすることによってパイプの切り替えを行い、パイプ1によるトランザクション転送処理を開始する。この場合も、転送情報TI1とパイプ情報PI1とを参照することにより、未転送のトランザクションT13から転送を再開する。
【0079】
トランザクションT13の転送に対する応答結果がACKであるため、パイプ1によるトランザクションの転送が正常に終了し、パイプ選択回路34は、CPU10への通知を行うとともに(ステップS37)、転送情報TI1を更新し(ステップS39)、パイプ1によるトランザクション転送処理を終了する。
【0080】
以後、有効なパイプ情報が存在しないことから、トランザクション転送処理が実行されることはなく、フレーム内の転送有効期間が終了(図示せず)することにより、ステップS21,S22が実行された後、処理が終了する。
【0081】
以上のように、ホスト制御回路30では、パイプ選択回路34がデータ転送が正常に終了した場合(ステップS36においてYes)のみならず、データ転送にエラーが生じた場合や、NAK応答(ビジー応答など)があった場合であっても、CPU10による指示を待つことなく、当該パイプによるデータ転送を終了して、他のパイプによるデータ転送を開始させることができ、CPU10の負担を抑制しつつ、転送効率の向上を図ることができる。
【0082】
また、コントロール転送およびバルク転送によるデータ転送を行うパイプについては、一旦、応答結果としてエラーやNAKを受け取ることにより、データ転送を終了した場合であっても、フレーム内の転送有効期間が残っている限り、再転送を行うことができるため、より転送効率を向上させることができる。
【0083】
【発明の効果】
以上説明したように、請求項1ないし7に記載の発明では、取得された応答結果に応じて、通信チャネルの選択を切り替えることにより、CPUの負担を抑制しつつ、転送効率を向上させることができる。
【0084】
請求項2に記載の発明では、通信チャネルにより転送されるトランザクションごとに応答結果を取得することにより、データ転送の最小単位ごとに応答結果を取得して、通信チャネルの選択の切り替えを行うことができるため、より転送効率を向上させることができる。
【0085】
請求項3に記載の発明では、応答結果が、エラーまたはNAKである場合に通信チャネルの選択を切り替えることにより、通信チャネルがデータ転送を行うことができない場合に他の通信チャネルに切り替えることができることから、転送効率を向上させることができる。
【0086】
請求項4に記載の発明では、記憶手段に記憶されている優先順位に従って、通信チャネルの選択を切り替えることにより、通信チャネルを効率よく切り替えることができる。
【0087】
請求項5に記載の発明では、応答結果に応じて切り替えられた通信チャネルについては、転送有効期間であると判定された時間内にデータの再転送をさせることにより、現時点がフレーム内の転送有効期間である場合には、一旦、中断した通信チャネルについてリトライすることで、さらに転送効率を向上させることができる。
【図面の簡単な説明】
【図1】この発明の実施の形態のホスト制御回路を他の構成とともに示す図である。
【図2】ホスト制御回路の動作を示す流れ図である。
【図3】ホスト制御回路におけるトランザクション転送処理の詳細を示す流れ図である。
【図4】ホスト制御回路によるフレーム内のデータ転送の模式図である。
【符号の説明】
1 USBホスト、10 CPU、20 メモリ、30 ホスト制御回路、31 パイプ制御バッファ、32 パイプ情報バッファ、33 転送情報バッファ、34 パイプ選択回路、35 データバッファ、350 トランザクションカウンタ、36 プロトコルエンジン、37 フレームタイマ、38 バス、40,41,42,43 USBデバイス。
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to data communication technology. More specifically, the present invention relates to a technology for controlling communication via USB.
[0002]
[Prior art]
In communication via USB, communication (data transfer) is performed between a single USB host and one or more USB devices. When performing data transfer between a plurality of USB devices, the USB host and the USB device perform data transfer by time-division processing using communication channels (logical channels) called pipes.
[0003]
The USB host performs transfer scheduling (routing of a communication channel) in advance in order to communicate with a plurality of USB devices. The transfer scheduling refers to determining which USB device performs communication with which pipe during a transfer effective period within a unit time called a frame, and determining the communication order (priority) of each pipe.
[0004]
Thereby, the data in the data transfer using the USB is divided into frames and transferred, and by allocating the data transfer time for each USB device in the frame, the USB host can impartially transmit the data to each USB device. It will operate to give a transfer opportunity.
[0005]
Conventionally, transfer scheduling by a USB host is performed in units of transfer for each frame, and when communication is performed using a plurality of pipes, data transfer of each pipe is averaged within a frame.
[0006]
[Problems to be solved by the invention]
However, in the conventional USB host as described above, even if a pipe assigned to transmit data in a certain frame is busy, transfer scheduling is performed for each frame. No update of transfer scheduling is performed. Therefore, if the busy state of the pipe continues in the frame, no data transfer is performed in the frame during that time, so that the transfer efficiency of the entire communication is reduced.
[0007]
In order to solve this problem, for example, when monitoring the state of each pipe and updating the transfer scheduling according to the communication status, the load on the CPU increases because transfer scheduling requires CPU processing. There was a problem of doing it.
[0008]
Particularly, when the number of transactions included in one transfer is small, the number of pipes defined in one frame increases, and the number of pipes to be scheduled increases. was there.
[0009]
The present invention has been made to solve the above problems, and has as its object to obtain a USB host control circuit that improves the transfer efficiency in USB while suppressing the load on the CPU.
[0010]
[Means for Solving the Problems]
In order to solve the above problem, the invention of claim 1 is a USB host control circuit that controls data transfer between a CPU and a plurality of USB devices, wherein each of the USB devices performs data transfer with the CPU. A plurality of communication channels for performing the communication, a channel selection unit for selecting a communication channel for performing the data transfer from the plurality of communication channels, and a data transfer performed by the communication channel selected by the channel selection unit. Acquiring means for acquiring a response result, wherein the channel selecting means switches the selection of the communication channel according to the response result acquired by the acquiring means.
[0011]
A second aspect of the present invention is the USB host control circuit according to the first aspect of the present invention, wherein the obtaining means obtains a response result for each transaction transferred by the communication channel.
[0012]
A third aspect of the present invention is the USB host control circuit according to the first or second aspect of the present invention, wherein the channel selection unit switches the communication channel selection when the response result is an error or NAK.
[0013]
A fourth aspect of the present invention is the USB host control circuit according to any one of the first to third aspects, further comprising storage means for storing the priority of each communication channel, and wherein the channel selection means comprises The selection of the communication channel is switched according to the priority stored in the means.
[0014]
A fifth aspect of the present invention is the USB host control circuit according to any one of the first to fourth aspects, wherein the channel selecting means determines whether or not the current time is a transfer valid period in the frame. The communication channel whose selection has been switched in accordance with the response result has data retransfer within the time determined by the propriety determination device to be a transfer valid period.
[0015]
A sixth aspect of the present invention is the USB host control circuit according to the fifth aspect of the present invention, wherein the channel selecting means further includes a transfer type determining means for determining a transfer type of data to be transferred for each communication channel. And retransmitting the data only to a communication channel determined to be of a predetermined transfer type by the transfer type determining means.
[0016]
The invention of claim 7 is the USB host control circuit according to the invention of claim 6, wherein the predetermined transfer type is control transfer or bulk transfer.
[0017]
BEST MODE FOR CARRYING OUT THE INVENTION
FIG. 1 is a block diagram showing a configuration of a USB host 1 according to an embodiment of the present invention, together with other configurations. The USB host 1 performs data transfer with each of the USB devices 41, 42, and 43 (hereinafter, collectively referred to as “USB device 40”) via the bus 38.
[0018]
The USB host 1 includes a CPU 10 for calculating various data and generating control signals, a memory 20 for storing various data, and a host control circuit 30 for controlling data transfer between the CPU 10 and the USB device 40 via USB. Prepare.
[0019]
The host control circuit 30 includes a pipe control buffer 31, a pipe information buffer 32, a transfer information buffer 33, a pipe selection circuit 34, a data buffer 35, a protocol engine 36, a frame timer 37, and a bus 38, and executes processing described later. It is configured as dedicated hardware.
[0020]
Further, in data transfer via USB, as described above, each of the USB devices 41, 42, and 43 defines a plurality of pipes for performing data transfer with the CPU 10, thereby performing time-division processing. .
[0021]
The pipe control buffer 31 is a storage buffer for holding information (pipe control PC) for controlling each pipe, and specifically, a transfer type in each pipe, valid / invalid of pipe information, and stored in the data buffer 35. The information includes validity / invalidity of data transmitted to the USB device 40, and presence / absence of an area in the data buffer 35 for storing data received from the USB device 40. These pieces of information exist for each pipe, and as shown in FIG. 1, each pipe number can be identified as a key, such as pipe control PC0, pipe control PC1,..., Pipe control PCn. (N is an arbitrary integer of 126 or less).
[0022]
The pipe information buffer 32 is a storage buffer for holding information about each pipe (pipe information PI), and specifically, addresses, end points, maximum addresses of the USB devices 41, 42, and 43 using each pipe. Includes packet size, transfer direction, and number of transactions. These pieces of information also exist for each pipe, similarly to the pipe control PC, and are held in an identifiable state like pipe information PI0, pipe information PI1,..., Pipe information PIn, respectively.
[0023]
Although details will be described later, in the host control circuit 30 according to the present embodiment, the priority in pipe selection is determined based on the transfer type and the pipe number. That is, the pipe control buffer 31 and the pipe information buffer 32 correspond to storage means for storing the priority of the communication channel.
[0024]
The transfer information buffer 33 is a storage buffer that holds information (transfer information TI) related to the communication result of each pipe, and includes a transfer completion, a transfer error, a transfer data number, and the like. These pieces of information also exist for each pipe, and are held in an identifiable state like transfer information TI0, transfer information TI1,..., Transfer information TIn.
[0025]
The pipe selection circuit 34 performs frame management based on the output of the frame timer 37 having a timing function, such as start / end of the frame and determination as to whether or not the time is a transfer valid period.
[0026]
The pipe selection circuit 34 is capable of accessing the pipe control buffer 31, the pipe information buffer 32, and the transfer information buffer 33, and based on the information held therein, during the frame transfer valid period. , Select a pipe for data transfer.
[0027]
Further, the pipe selection circuit 34 transmits the pipe information PI about the selected pipe to the data buffer 35 and the protocol engine 36, and information about the number of transferred transactions from the data buffer 35, and from the protocol engine 36, The information on the response result of each of the USB devices 41, 42, and 43 is received, the transfer information buffer 33 is accessed, and the transfer information TI is rewritten as necessary.
[0028]
The data buffer 35 is a storage buffer for holding data (data transmitted by the CPU 10 and data transmitted by the USB device 40) transferred by the pipe selected by the pipe selection circuit 34, and includes a protocol engine 36 and a memory 20. Arbitrates the exchange of data with the
[0029]
In addition, the data buffer 35 accesses the pipe control buffer 31 to change the state of the data buffer 35 such as validity / invalidity of data transmitted to the USB device 40 and presence / absence of an area for storing data received from the USB device 40. Write as pipe control PC.
[0030]
Further, a transaction counter 350 for counting the number of transferred transactions is provided based on the number of transferred data, and notifies the pipe selection circuit 34 of the number of transferred transactions.
[0031]
The data buffer 35 determines whether or not the data has actually been transferred based on information on a response result to the transferred data, which is notified from the protocol engine 36. Further, in the present embodiment, the data counter 35 includes the transaction counter 350, but the function of the transaction counter 350 may be included in the pipe selection circuit 34. In that case, the data buffer 35 simply transmits the number of transferred data to the pipe selection circuit 34, and counts the number of transactions transferred by the pipe selection circuit 34 based on the number of data.
[0032]
The protocol engine 36 performs a response operation in transaction units according to any one of the USB devices 41, 42, and 43 connected on the bus 38 and the pipe information PI supplied from the pipe selection circuit 34, and pipes the obtained response result to the pipe. The selection circuit 34 and the data buffer 35 are notified.
[0033]
When data is transmitted from the USB host 1, transmission data is obtained from the data buffer 35, and when data is received from the USB device 40, the received data is transmitted to the data buffer 35.
[0034]
The above is the description of the configuration of the host control circuit 30 in the embodiment.
[0035]
FIG. 2 is a flowchart showing the operation of the host control circuit 30. Hereinafter, the operation of the host control circuit 30 will be described with reference to FIG. First, prior to transfer by frame, the CPU 10 performs transfer scheduling, creates a pipe control PC and pipe information PI, and stores them in the pipe control buffer 31 and the pipe information buffer 32, respectively.
[0036]
Next, based on the input signal from the frame timer 37, the pipe selection circuit 34 determines whether or not the current time is within the data transfer valid period, and when the transfer valid period is reached, starts the processing of FIG. Initialization of the middle transfer type (step S11) and initialization of the pipe number (step S12) are performed.
[0037]
In USB data transfer,
(1) Isochronous (Isochronous) transfer: a transfer mode that does not perform error processing or retransmission processing and has the highest priority in transfer in a transfer mode that emphasizes real-time performance;
(2) Interrupt (Interrupt) transfer: A transfer mode used for transfer with a human interface device such as a keyboard, in which the amount of data is small but the data must be transferred preferentially at a constant period.
(3) Control transfer: a transfer mode used for transferring control commands and the like between the USB host 1 and the USB device 40;
(4) Bulk (Bulk) transfer: A transfer mode in which real-time performance is not so important but a transfer with a large amount of data is performed.
In the host control circuit 30, the isochronous transfer is a transfer type "0", the interrupt transfer is a transfer type "1", the control transfer is a transfer type "2", and the bulk transfer is a transfer type. Identify as "3". That is, in step S11, the currently selected transfer type is initialized to "0", so that the isochronous transfer with the highest priority is selected first.
[0038]
When the initialization is completed, the pipe selection circuit 34 accesses the pipe control buffer 31 to refer to the pipe control PC, and for the pipe indicated by the pipe number, the pipe information is valid (in the pipe in which data to be transferred exists). Is determined and the transfer type matches the selected transfer type (step S13), and the pipe information is valid and the transfer type matches the selected transfer type. Only in this case, the transaction transfer processing (step S14) is performed.
[0039]
FIG. 3 is a flowchart showing details of the transaction transfer process in step S14. In the transaction transfer process, first, the transaction counter 350 is cleared to "0" (step S31), and based on the input from the frame timer 37, whether or not the frame has ended, that is, the present time is the transfer valid period in the frame Is determined (step S32).
[0040]
If the frame has ended, the transfer information buffer 33 is accessed to update the portion of the transfer information TI relating to the pipe (step S40), and the process returns to step S21 in FIG. Is a bulk transfer (transfer type "3"), the pipe information stores a valid pipe number (steps S21 and S22), and the process ends.
[0041]
Specifically, the transfer information TI is updated by calculating the number of data transferred by the pipe selection circuit 34 based on the number of transferred transactions input from the transaction counter 350, This is performed by rewriting the number of data transfers.
[0042]
On the other hand, if the frame has not been completed, an instruction is given to the protocol engine 36 to transfer one transaction by the selected pipe, and a response result to the transfer of the transaction is obtained from the protocol engine 36 (step S33).
[0043]
The process of transferring a transaction in step S33 will be specifically described. First, the pipe selection circuit 34 sends information on a portion of the pipe information PI relating to the selected pipe number to the data buffer 35 and the protocol engine 36. introduce.
[0044]
The data buffer 35 determines whether the data transfer between the USB host 1 and the USB device 40 is transmission or reception based on the transfer direction indicated by the received pipe information PI.
[0045]
When the data transfer is transmission, necessary transmission data is read from the memory 20 and held, and the pipe control buffer 31 is accessed to transmit information indicating that transmission data to the USB device 40 is valid. Write to the pipe control PC. Further, in response to a request from the protocol engine 36, the transmission data held in the buffer is transmitted for each transaction.
[0046]
The protocol engine 36 transfers the transaction (transfer data) transmitted from the data buffer 35 to the USB device 40 according to the address and the transfer type of the USB device 40 indicated in the pipe information PI, and the response result of the data transfer. Is acquired and transmitted to the pipe selection circuit 34 and the data buffer 35.
[0047]
On the other hand, if the data transfer is reception, the data buffer 35 secures a necessary storage area on the buffer, accesses the pipe control buffer 31, and secures an area for storing the reception data from the USB device 40. Write information indicating that the operation has been performed.
[0048]
The protocol engine 36 makes a transmission request to the USB device 40 according to the address and the transfer type of the USB device 40 indicated in the pipe information PI, receives a transaction, and transmits the transaction to the data buffer 35. Further, a response result of the data transfer is obtained and transmitted to the pipe selection circuit 34 and the data buffer 35.
[0049]
When a transaction (transfer data) can be normally received, the data buffer 35 writes the data in a predetermined area of the memory 20 while temporarily holding the received transaction. The above is the specific description of step S33.
[0050]
Next, the data buffer 35 executes step S34. If the response result obtained from the protocol engine 36 in step S33 is ACK (Acknowledgement: acknowledgment), it indicates that the transferred transaction has been normally transferred. Therefore, the transaction counter 350 is counted up (step S35), and is notified to the pipe selection circuit 34.
[0051]
The pipe selection circuit 34 determines whether or not the transfer of the transaction to be transferred has been completed based on the input signal from the transaction counter 350 of the data buffer 35 and the pipe information PI (step S36), and the processing is still completed. If not, the process returns to step S32 to repeat the process to transfer the transaction by the pipe.
[0052]
As a result, when the transfer is performed normally (when the response result is ACK), the transfer of the transaction to be transferred ends (Yes in step S36), or the valid transfer period of the frame ends ( Until “Yes” in step S32), the processing in steps S32 to S36 is repeated, and the transfer of the transaction by the selected pipe (the pipe having the transfer right) (step S33) is repeatedly performed.
[0053]
When the transfer of the transaction is completed (Yes in step S36), the fact is notified to the CPU 10 (step S37), and the portion related to the pipe in the transfer information TI is updated (step S39), and the transaction by the selected pipe is performed. The transfer process ends, and the process returns to step S15 in FIG.
[0054]
Thereby, the CPU 10 can detect that the transfer of the transaction by the pipe has been normally completed, and can obtain necessary information by accessing the transfer information TI.
[0055]
If the response result acquired from the protocol engine 36 is not ACK (No in step S34) and is an error (Yes in step S38), some transfer error has occurred between the USB host 1 and the USB device 40. This is notified to the CPU 10 (step S37), the portion of the transfer information TI relating to the pipe is updated (step S39), the transaction transfer process by the selected pipe is completed, and the process returns to step S15 in FIG. . In this case, the pipe selection circuit 34 includes not only the number of transfer data that can be transferred until then, but also data indicating a transfer error in a portion of the transfer information TI related to the pipe.
[0056]
Thereby, the CPU 10 can detect that a transfer error has occurred in the data transfer by the pipe, and confirm the number of data transfers that can be transferred by accessing the transfer information TI. be able to.
[0057]
If the response result obtained from the protocol engine 36 is neither ACK nor error (No in step S38), it can be determined that the response result obtained from the protocol engine 36 is NAK (Not Acknowledgement: negative response). Therefore, in this case, the pipe selection circuit 34 does not notify the CPU 10 but updates only the transfer information TI (step S39), ends the transaction transfer processing by the selected pipe, and returns to step S15 in FIG. Return to
[0058]
When the transfer of the transaction to be transferred is completed or the response result to the transfer data is an error or NAK, and the transaction transfer processing (step S14) of the selected pipe is completed, the pipe selection circuit 34 It is determined whether or not the frame is completed based on the input (step S15). If the frame has ended, steps S21 and S22 are executed and the process ends.
[0059]
On the other hand, if the frame has not ended, the processing of steps S13 to S17 is repeated while incrementing the pipe number and switching the pipe (step S16) until the determination of step S13 is completed for all the pipes (step S17). . That is, step S16 corresponds to a process of transferring the right to transfer data to a pipe having a pipe number corresponding to the next priority and switching the pipe selection.
[0060]
As described above, the host control circuit 30 according to the present embodiment can switch the pipe for performing the data transfer in accordance with the response result obtained for each transaction. When the USB device 41 is busy, that is, when it is in a state where data transfer cannot be performed, the selection of the pipe used by the USB device 41 is switched to another USB device (42 or 43). ) Can start the data transfer by the pipe used, and it is possible to improve the transfer efficiency without waiting for another USB device until the busy state of the USB device 41 is eliminated.
[0061]
Further, the switching process of the pipe selection can be performed in the host control circuit 30 without the process by the CPU 10, so that the transfer efficiency can be improved while suppressing the load on the CPU 10.
[0062]
Furthermore, since the response result is obtained for each transaction, the pipe for performing data transfer can be switched for each transaction which is the minimum unit in data transfer, and the transfer efficiency can be further improved.
[0063]
If the reference has been completed for all the pipes that perform data transfer according to the selected transfer type (Yes in step S17), the transfer type is incremented (step S18) until the processing is completed for all the transfer types. The processing from S12 is repeated (step S19). That is, step S18 corresponds to a process of switching pipe selection by transferring the right to transfer data to a pipe that performs data transfer according to the next priority transfer type.
[0064]
By performing such processing by the pipe selection circuit 34, the transfer type is selected in the order of isochronous transfer, interrupt transfer, control transfer, and bulk transfer, and the pipe is selected in the order of the pipe number for each transfer type to transfer data. Is executed.
[0065]
Note that, when the bulk transfer (transfer type “3”) with the lowest priority is selected and reference to all the pipes is completed, the transfer type is incremented to “4” (step S18). Therefore, after the opportunity of data transfer is given to all the pipes for which the pipe information is valid (Yes in step S19), the pipe selection circuit 34 changes the selected transfer type to the transfer type “2” (control (Step S20), and the processing from Step S12 is repeated.
[0066]
Thus, a pipe that performs data transfer by control transfer or bulk transfer and that is switched according to a response result (error or NAK) can be selected as a pipe that performs data transfer again, and is transferred. For a pipe in which a transaction to be left (a pipe for which pipe information in the pipe control PC is valid), data is re-transferred as long as the frame is valid for transfer, and an opportunity to transfer the remaining transaction is provided. Thereby, the transfer efficiency can be further improved.
[0067]
The above processing will be described based on a specific example. FIG. 4 is a schematic diagram of data transfer in a frame by the host control circuit 30. FIG. 4 shows an example in which transfer 0 (transfer composed of transactions T00 to T03) and transfer 1 (transfer composed of transactions T10 to T13) are respectively bulk-transferred by pipes 0 and 1. ing. In the section (time) shown in FIG. 4, the frame is not ended.
[0068]
First, when the pipe selection circuit 34 selects the pipe number “0” while selecting the transfer type “3” (bulk transfer), the pipe 0 is referred to in step S13, and the transaction transfer processing (step S14) is performed. Be executed.
[0069]
As a result, first, the transaction T00 is transferred. As long as the response result to the transfer is ACK, the transactions T01 and T02 are further sequentially transferred, and the transaction counter 350 is counted up for the normally transferred transaction in step S35. That is, the bulk transfer by the pipe 0 is performed during the section TM1 shown in FIG.
[0070]
In the example illustrated in FIG. 4, the response result to the transaction T02 is NAK (Steps S34 and S38 are both determined to be No.). Accordingly, the pipe selection circuit 34 calculates the number of transferred data from the number of transactions (T00 and T01) transferred so far and accesses the transfer information buffer 33 to update the transfer information TI0. Then, the transaction transfer processing by the pipe 0 ends. Further, the selected pipe 0 is switched by incrementing the pipe number, and the pipe 1 is selected.
[0071]
Thereby, the pipe 1 is referred to in step S13, and the transaction transfer process (step S14) is executed again.
[0072]
In the section TM2, similarly to the section TM1, first, the transaction T10 is transferred, and since the response result to the transfer is ACK, the transactions T11 to T13 are sequentially transferred, and each time the transaction is transferred normally. Next, the transaction counter 350 is counted up.
[0073]
In the example shown in FIG. 4, the response result to the transaction T13 is NAK even in the transfer in the section TM2. Therefore, the pipe selection circuit 34 calculates the number of transferred data from the number of transactions transferred so far (T10 to T12), updates the transfer information TI1, and ends the transaction transfer processing by the pipe 1. I do. Further, the pipe number is incremented, and switching of pipe selection is performed.
[0074]
At this point, since all the pipes in the bulk transfer have been referred to, the pipe selection circuit 34 executes step S20 to provide an opportunity to transfer the remaining transactions to the remaining pipes to be transferred. give.
[0075]
In the example shown in FIG. 4, when the pipe is switched after the section TM2, the transfer type is selected in the order of control transfer and bulk transfer. When the pipe 0 is referred to while the bulk transfer is selected, the transaction to be transferred remains in the pipe 0, and the transaction transfer process (step S14) by the pipe 0 is restarted.
[0076]
At this time, the pipe selection circuit 34 starts the transfer from the untransferred transaction T02 in the pipe 0 by referring to the transfer information TI0 and the pipe information PI0.
[0077]
As a result, in the section TM3, the transactions T02 and T03 are sequentially transferred, and since the response results to the transfer of the transactions T02 and T03 are both ACK, the transfer of the transaction by the pipe 0 ends normally (the transfer ends). ). Therefore, the pipe selection circuit 34 notifies the CPU 10 (step S37), updates the transfer information TI0 (step S39), and ends the transaction transfer processing by the pipe 0.
[0078]
Further, the pipe is switched by incrementing the pipe number, and the transaction transfer processing by the pipe 1 is started. Also in this case, the transfer is restarted from the untransferred transaction T13 by referring to the transfer information TI1 and the pipe information PI1.
[0079]
Since the response result to the transfer of the transaction T13 is ACK, the transfer of the transaction by the pipe 1 ends normally, and the pipe selection circuit 34 notifies the CPU 10 (step S37) and updates the transfer information TI1 (step S37). Step S39), the transaction transfer processing by the pipe 1 ends.
[0080]
Thereafter, since there is no valid pipe information, the transaction transfer process is not executed, and after the transfer valid period in the frame ends (not shown), after steps S21 and S22 are executed, The process ends.
[0081]
As described above, in the host control circuit 30, not only when the pipe transfer circuit 34 has successfully completed the data transfer (Yes in step S36), but also when an error has occurred in the data transfer, a NAK response (busy response, etc.) ), The data transfer by the pipe can be terminated and the data transfer by another pipe can be started without waiting for an instruction from the CPU 10, and the transfer on the CPU 10 can be suppressed while suppressing the load on the CPU 10. Efficiency can be improved.
[0082]
In addition, for a pipe that performs data transfer by control transfer and bulk transfer, the transfer valid period in the frame remains even if the data transfer is terminated by receiving an error or NAK as a response result once. As long as the re-transfer can be performed, the transfer efficiency can be further improved.
[0083]
【The invention's effect】
As described above, according to the first to seventh aspects of the present invention, it is possible to improve the transfer efficiency while suppressing the load on the CPU by switching the selection of the communication channel according to the obtained response result. it can.
[0084]
According to the second aspect of the present invention, by acquiring the response result for each transaction transferred by the communication channel, it is possible to acquire the response result for each minimum unit of data transfer and switch the communication channel selection. Therefore, the transfer efficiency can be further improved.
[0085]
According to the third aspect of the present invention, by switching the communication channel selection when the response result is an error or NAK, it is possible to switch to another communication channel when the communication channel cannot perform data transfer. Therefore, the transfer efficiency can be improved.
[0086]
According to the fourth aspect of the present invention, the communication channel can be switched efficiently by switching the selection of the communication channel in accordance with the priority stored in the storage means.
[0087]
According to the invention described in claim 5, for the communication channel switched according to the response result, the data is re-transferred within the time determined to be the transfer valid period, so that the transfer validity within the frame is at present. In the case of the period, the transfer efficiency can be further improved by retrying the interrupted communication channel once.
[Brief description of the drawings]
FIG. 1 is a diagram showing a host control circuit according to an embodiment of the present invention together with another configuration.
FIG. 2 is a flowchart showing an operation of the host control circuit.
FIG. 3 is a flowchart showing details of a transaction transfer process in the host control circuit.
FIG. 4 is a schematic diagram of data transfer in a frame by a host control circuit.
[Explanation of symbols]
1 USB host, 10 CPU, 20 memory, 30 host control circuit, 31 pipe control buffer, 32 pipe information buffer, 33 transfer information buffer, 34 pipe selection circuit, 35 data buffer, 350 transaction counter, 36 protocol engine, 37 frame timer , 38 bus, 40, 41, 42, 43 USB devices.

Claims (7)

CPUと複数のUSB(Universal Serial Bus)デバイスとの間のデータ転送を制御するUSBホスト制御回路であって、
各USBデバイスのそれぞれが前記CPUとデータ転送を行うための複数の通信チャネルと、
前記複数の通信チャネルのうちから前記データ転送を行う通信チャネルを選択するチャネル選択手段と、
前記チャネル選択手段により選択された前記通信チャネルによって行われたデータ転送に対する応答結果を取得する取得手段と、
を備え、
前記チャネル選択手段が、
前記取得手段により取得された前記応答結果に応じて、前記通信チャネルの選択を切り替えることを特徴とするUSBホスト制御回路。
A USB host control circuit for controlling data transfer between a CPU and a plurality of USB (Universal Serial Bus) devices,
A plurality of communication channels for each of the USB devices to perform data transfer with the CPU;
Channel selection means for selecting a communication channel for performing the data transfer from the plurality of communication channels,
Acquisition means for acquiring a response result to data transfer performed by the communication channel selected by the channel selection means,
With
The channel selecting means,
A USB host control circuit, wherein selection of the communication channel is switched according to the response result obtained by the obtaining unit.
請求項1に記載のUSBホスト制御回路であって、
取得手段は、
通信チャネルにより転送されるトランザクションごとに応答結果を取得することを特徴とするUSBホスト制御回路。
The USB host control circuit according to claim 1, wherein
Acquisition means,
A USB host control circuit for acquiring a response result for each transaction transferred by a communication channel.
請求項1または2に記載のUSBホスト制御回路であって、
チャネル選択手段は、
応答結果が、エラーまたはNAKである場合に通信チャネルの選択を切り替えることを特徴とするUSBホスト制御回路。
The USB host control circuit according to claim 1 or 2,
The channel selection means is
A USB host control circuit for switching a communication channel selection when a response result is an error or NAK.
請求項1ないし3のいずれかに記載のUSBホスト制御回路であって、
各通信チャネルの優先順位を記憶する記憶手段を備え、
チャネル選択手段は、
前記記憶手段に記憶されている前記優先順位に従って、前記通信チャネルの選択を切り替えることを特徴とするUSBホスト制御回路。
The USB host control circuit according to claim 1, wherein:
Storage means for storing the priority of each communication channel,
The channel selection means is
A USB host control circuit, wherein the selection of the communication channel is switched according to the priority stored in the storage unit.
請求項1ないし4のいずれかに記載のUSBホスト制御回路であって、
チャネル選択手段は、
現時点が、フレーム内の転送有効期間であるか否かを判定する可否判定手段を有し、
応答結果に応じて選択が切り替えられた通信チャネルについては、前記可否判定手段により転送有効期間であると判定された時間内にデータの再転送をさせることを特徴とするUSBホスト制御回路。
The USB host control circuit according to claim 1, wherein:
The channel selection means is
The present time has a feasibility determination means for determining whether or not the transfer validity period in the frame,
A USB host control circuit characterized in that data is re-transferred for a communication channel whose selection has been switched according to a response result, within a time period determined by the availability determination unit to be a transfer valid period.
請求項5に記載のUSBホスト制御回路であって、
チャネル選択手段は、
転送されるデータの転送タイプを各通信チャネルごとに判定する転送タイプ判定手段をさらに有し、
前記転送タイプ判定手段により所定の転送タイプであると判定された通信チャネルに対してのみ前記データの再転送をさせることを特徴とするUSBホスト制御回路。
The USB host control circuit according to claim 5, wherein
The channel selection means is
Further comprising transfer type determining means for determining the transfer type of the transferred data for each communication channel,
A USB host control circuit, wherein the data is retransmitted only to a communication channel determined to be a predetermined transfer type by the transfer type determining means.
請求項6に記載のUSBホスト制御回路であって、
所定の転送タイプが、コントロール転送、またはバルク転送であることを特徴とするUSBホスト制御回路。
The USB host control circuit according to claim 6, wherein
A USB host control circuit, wherein the predetermined transfer type is control transfer or bulk transfer.
JP2002200792A 2002-07-10 2002-07-10 Usb host control circuit Pending JP2004046392A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002200792A JP2004046392A (en) 2002-07-10 2002-07-10 Usb host control circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002200792A JP2004046392A (en) 2002-07-10 2002-07-10 Usb host control circuit

Publications (1)

Publication Number Publication Date
JP2004046392A true JP2004046392A (en) 2004-02-12

Family

ID=31707511

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002200792A Pending JP2004046392A (en) 2002-07-10 2002-07-10 Usb host control circuit

Country Status (1)

Country Link
JP (1) JP2004046392A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7725623B2 (en) 2005-06-14 2010-05-25 Sony Computer Entertainment Inc. Command transfer controlling apparatus and command transfer controlling method
CN101814011A (en) * 2009-02-24 2010-08-25 恩益禧电子股份有限公司 Usb host controller and the control method that is used for usb host controller
CN102043741A (en) * 2009-10-22 2011-05-04 瑞萨电子株式会社 Circuit and method for pipe arbitration
JP2014081952A (en) * 2014-01-08 2014-05-08 Renesas Electronics Corp Host controller

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7725623B2 (en) 2005-06-14 2010-05-25 Sony Computer Entertainment Inc. Command transfer controlling apparatus and command transfer controlling method
CN101814011A (en) * 2009-02-24 2010-08-25 恩益禧电子股份有限公司 Usb host controller and the control method that is used for usb host controller
JP2010198171A (en) * 2009-02-24 2010-09-09 Renesas Electronics Corp Usb host controller and method for controlling the same
DE102010008907A1 (en) 2009-02-24 2010-10-07 Nec Electronics Corp., Kawasaki USB host controller and control method for USB host controller
US8386725B2 (en) 2009-02-24 2013-02-26 Renesas Electronics Corporation USB host controller and controlling method for USB host controller
CN101814011B (en) * 2009-02-24 2014-06-18 瑞萨电子株式会社 USB host controller and controlling method for USB host controller
CN102043741A (en) * 2009-10-22 2011-05-04 瑞萨电子株式会社 Circuit and method for pipe arbitration
CN102043741B (en) * 2009-10-22 2015-02-25 瑞萨电子株式会社 Circuit and method for pipe arbitration
CN104636280A (en) * 2009-10-22 2015-05-20 瑞萨电子株式会社 Circuit and method for pipe arbitration
JP2014081952A (en) * 2014-01-08 2014-05-08 Renesas Electronics Corp Host controller

Similar Documents

Publication Publication Date Title
US7581015B2 (en) Communication device having transmitting and receiving units supports RDMA communication
KR960012686B1 (en) Inter processor communication protocol
CN101115054B (en) For the buffer of the memory mapped of network interface controller
KR910001789B1 (en) Cache invalidation apparatus for multiprocessor system of digital computer system
EP1396792B1 (en) Memory copy command specifying source and destination of data executed in the memory controller
KR910001791B1 (en) Apparatus and method for controlling bus of computer system having synchronous bus
US7707346B2 (en) PCI express multi-root IOV endpoint retry buffer controller
US20040093454A1 (en) USB endpoint controller flexible memory management
JP3664664B2 (en) Bus system and bus arbitration method thereof
US5978879A (en) Bus bridge apparatus
JP2004046392A (en) Usb host control circuit
WO2007096712A1 (en) A method and device for exchanging data using a virtual fifo data structure
US7039730B2 (en) Storage device control apparatus and method
EP1936514B1 (en) Apparatus and method for controlling issue of requests to another operation processing device
JP2003108513A (en) Hardware chain pull
JP2004157795A (en) Dual system computer and its shared data matching method
JPH06132981A (en) Packet transmission system
EP1139228A2 (en) An intelligent bus interconnect unit
KR100205055B1 (en) Emergency message send control method in a send network interface
CN114153756A (en) Configurable micro-operation mechanism oriented to multi-core processor directory protocol
JPH04277850A (en) Descriptor control system
JP2008053783A (en) Data transfer buffer controller and data transfer control method
JP3457084B2 (en) Packet bus controller
JP2002164939A (en) Data processing unit
JPH1011387A (en) Information processor