JP4367003B2 - Interface device, interface control method, and interface control program - Google Patents
Interface device, interface control method, and interface control program Download PDFInfo
- Publication number
- JP4367003B2 JP4367003B2 JP2003146738A JP2003146738A JP4367003B2 JP 4367003 B2 JP4367003 B2 JP 4367003B2 JP 2003146738 A JP2003146738 A JP 2003146738A JP 2003146738 A JP2003146738 A JP 2003146738A JP 4367003 B2 JP4367003 B2 JP 4367003B2
- Authority
- JP
- Japan
- Prior art keywords
- function
- descriptor
- interface
- host
- usb
- 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.)
- Expired - Fee Related
Links
Images
Description
【0001】
【発明の属する技術分野】
本発明は、ホストからデバイスへの機能切替えリクエストによる設定機能の変更により、ホストとデバイスの区別なく、ホストになったり、デバイスになったりできるようにされたインタフェース装置及びインタフェース制御方法、並びにインタフェース制御プログラムに関する。
【0002】
【従来の技術】
コンピュータと各種周辺装置とを接続するためのバスとして、USB(Universal Serial Bus)が知られている。このUSBは、2本の信号線と2本の電源線とが内包されたケーブルバスとされ、最近提供されている、多くのパーソナルコンピュータやその周辺装置には、このUSBに対応したインタフェースが装備されている。USBインタフェースでは、1つのホストコンピュータ(以下、単にUSBホストと称す)に対し、1以上の周辺装置がバス接続されるシステムが想定されている。このUSBを介しUSBホストに接続される周辺装置は一般的にUSBデバイスと称されている。
【0003】
USBホストにUSBデバイスが接続されれば、USBホストからそのUSBデバイスに対しては、一意的なアドレスが割り当てられるようになっている。また、USBデバイスには、USBホストとの間の通信を終端するためのエンドポイント(Endpoint)が複数備えられている。このエンドポイントは具体的にデータ格納用のFIFO(First In First Out)バッファとして構成されており、USBホストとUSBデバイスとの間で通信が行われるに際しては、そのエンドポイントを介し通信が行われるようになっている。
【0004】
因みに、特許文献1には、USBデバイスとしてのハードディスクドライブ装置やFD(フレキシブル磁気ディスク)ドライブ装置、キーボード、ポインティングデバイス等を物理的に取外すことなく、外部のコンピュータ装置で兼用することができるコンピュータ装置が記載されている。
【0005】
【特許文献1】
特開2002―366268号公報
【0006】
【発明が解決しようとする課題】
ところで、USBの通信規格では、1つのUSBデバイスにはただ1つのディスクリプタ(descriptor)(USB通信規格において、どのような機能のデバイスが接続されているかを示す記述子)を持つようにされている。そのため、これまでのUSBデバイスでは、そのデバイスが複数の機能を持つ場合には、複数のディスクリプタを持つことが不可とされていたことから、1つのディスクリプタに対し複数のインタフェース(USB通信規格では、接続手段を示す)を実装せざるを得なかった。
【0007】
また、USBデバイスはUSBホストからのリクエストに応じてデータ転送を行うことから、USBデバイスから主体的にデータ転送を行うことは不可とされ、必然的にそのような形態でデータ転送が行われるように、USBデバイスが設計されていた。このような不具合を回避するには、USBホストコントローラとUSBデバイスコントローラを同一機器上に実装するか、USB―OTG規格に沿ったUSBコントローラを実装するしかなかった。
【0008】
本発明の目的は、ホストとデバイスの区別なく、機能切替えリクエストによる設定機能の変更によりホストになったり、デバイスになったりできるようにすることにある。
【0009】
【課題を解決するための手段】
本発明は、ホストからデバイスへの機能切替えリクエストによる設定機能の変更により、アプリケーションから見て、上記ホスト又は上記デバイスの区別なく、データ転送が可能とされているようにして、インタフェースディスクリプタ及びインタフェースディスクリプタの代替設定である他のディスクリプタを有し、インタフェースディスクリプタにホスト機能が設定される場合は他のディスクリプタにデバイス機能が設定され、インタフェースディスクリプタにデバイス機能が設定される場合は他のディスクリプタにホスト機能が設定され、初期状態ではインタフェースディスクリプタに設定された機能が有効となり、ホストからデバイスに定期的に問合せを行って、アプリケーションが発行する機能切替えリクエストをデバイスから受け取ることにより、インタフェースディスクリプタに設定された機能を無効とし、他のディスクリプタに設定された機能を有効とし、有効とされる機能に基づいて、機能切替えリクエスト又はデータの転送を行うものである。
【0010】
これまでにあっては、デバイスはホストからのリクエストに応じてデータ転送を行い、デバイスから主体的にデータ転送を行うことは不可とされていたが、ホストでの設定機能は自律的に変更可能とされ、また、その設定機能の変更に伴い、以上のように、デバイスでの設定機能がホストからの機能切替えリクエストにより変更可能とされる場合には、デバイスからも主体的にデータ転送を行うことが可能となる。
【0011】
【発明の実施の形態】
以下、本発明の一実施の形態をインタフェースはUSBであるとして、図1から図5により説明する。
先ず本発明に係るUSBシステムについて説明すれば、その一例でのシステム構成を図1に示す。図示のように、そのUSBシステムは、USBホスト11とUSBデバイス13とがUSBケーブル12により接続された状態として構成されている。このうち、先ずUSBホスト11について説明すれば、そのソフトウェアとハードウェアの構成は、USBホストコントローラ111とそれを制御するデバイスドライバ112、更には、そのデバイスドライバ112を利用するアプリケーション113により構成される。そのデバイスドライバ112はまた、使用される機能毎に分けられている。即ち、デバイスドライバ112は、ホスト機能デバイスドライバ1121とデバイス機能デバイスドライバ1122から構成されている。
【0012】
以上のような事情はUSBデバイス13側でも同様であり、そのソフトウェアとハードウェアの構成は、USBデバイスコントローラ131とそれを制御するデバイスドライバ132、更には、そのデバイスドライバ132を利用するアプリケーション133により構成される。そのデバイスドライバ132はまた、使用される機能毎に分けられている。即ち、デバイスドライバ132は、ホスト機能デバイスドライバ1321とデバイス機能デバイスドライバ1322から構成されている。このUSBデバイス13側では、USBの機能としては物理的に1つであるが、1つのインタフェース上に、少なくとも2つの機能(ホスト機能及びデバイス機能)が区別された状態として存在している。上述のように、デバイスドライバ112,132各々には、それら機能に対応したデバイスドライバが実装されている。
【0013】
ここで、USBデバイス13がホスト機能及びデバイス機能を有していることについて説明すれば、一般的に、USBの機能を表現するためにディスクリプタが使用される。複数の機能を表現するためには、インタフェースディスクリプタが複数記述されるが、本発明では、インタフェースを1つに見せるためにインタフェースディスクリプタは1つとし、その上に2つの機能が実装されていることを示す。図2にはディスクリプタの階層構成が示されているが、これからも判るように、インタフェースディスクリプタは1つであり、代替設定としてのディスクリプタが記述されることで、別の機能が存在していることを示している。そして、各々のインタフェース、代替設定に対してエンドポイントディスクリプタが関連付けられている。
【0014】
その図2について詳細に説明すれば、図2に示す例では、ディスクリプタ階層として、USBホスト11、USBデバイス13各々について以下の構成が成立するものとする。先ずデバイスディスクリプタ(Device)21が存在する。このデバイスディスクリプタ21にデバイス固有の情報とエンドポイント0(コントロールエンドポイント)情報が含まれている。このエンドポイント0情報には、デフォルトコントロールパイプ(default control pipe)における最大パケットサイズが記述される。また、そのデバイスディスクリプタ21に関連付けされて、コンフィギュレーションディスプリクタ(Configuration0)22が存在する。このコンフィギュレーションディスクリプタ22には、インタフェースの数や電源特性が記述される。図2においては、インタフェースの数は1である。
【0015】
更に、1つのインターフェィスディスクリプタ(Interface0)23が存在しているが、代替設定として、オルターネート0(Alternate0)24のディスクリプタが記述されることで、別の機能が存在していることを示している。そして、各々のインタフェース、代替設定に対してエンドポイントディスクリプタが関連付けられている。インタフェース0に関連付けられているエンドポイント情報は、図2に示す例においては、3つ存在している。エンドポイント1(Endpoint1)231、エンドポイント2(Endpoint2)232、エンドポイント3(Endpoint3)233各々のエンドポイント情報であり、デフォルトコントロールパイプ用として存在しているエンドポイント0(Endpoint0)221のエンドポイント情報とは別の、バルク(Bulk)転送、インタラプト(Interrupt)転送、アイソクロナス(Isochronous)転送のエンドポイント情報が記述される。図2に示す例においては、エンドポイント1、エンドポイント2、エンドポイント3各々には、Bulk IN転送、Bulk OUT転送、Interrupt IN転送の情報と、各エンドポイントにおける最大パケットサイズが記述される。
【0016】
また、オルターネート0に関連付けられているエンドポイント情報も、図2に示す例においては、3つ存在している。エンドポイント1(Endpoint1)241、エンドポイント2(Endpoint2)242、エンドポイント3(Endpoint3)243各々のエンドポイント情報であり、このオルターネート0のインタフェース固有のエンドポイント情報には、インタフェース0と同様の情報が記述されており、エンドポイントディスクリプタはインタフェースディスクリプタとその代替設定においては同一の構成にしておく。但し、インタフェース0とオルターネート0のインタフェース情報における違いは、USB Host機能を有しているか、USB Device機能を有しているかの違いになる。
【0017】
インタフェースディスクリプタ内にUSB Device機能を保有していることの情報を入れ、代替設定のディスクリプタ内にUSB Host機能を有していることの情報を入れることで、USBデバイス13として、USB Host機能及びUSB Device機能を有していることを表す。以降の説明において、ディスクリプタの構成は上記の通りであるとする。図2に示す例において、インタフェース0においては、USB Deviceとしてのストレージ機能が、また、オルターネート0においては、USB Hostとしてのデバッグ機能が有効になるように記載される。この情報は、インタフェースディスクリプタ内のClass/SubClassの組合せにて決定される。因みに、これらの機能を入れ替えて設定しておくことは基本的に不可能である。つまり、インタフェースディスクリプタ内にUSB Host機能を有していることの情報を入れ、代替設定のディスクリプタ内にUSB Device機能を有していることの情報をいれるという設定は不可とされる。
【0018】
以上の構成において、インタフェースディスクリプタに設定された機能が初期状態で有効な機能として設定されることになる。つまり、インタフェースディスクリプタ内にUSB Device機能の設定が、また、代替設定のディスクリプタ内にUSB Host機能の設定がされていれば、初期状態においては、USB Device機能が有効になるように、システム設定されることになる。
【0019】
したがって、USBホスト11では、それらディスクリプタ情報をUSBデバイス13から受け取ることで、USBデバイス13の機能を認識するようになる。1つのインタフェース上に、少なくとも2つの機能が区別された状態として存在していること知る手段として、ディスクリプタ構成に全てを記述する必要はなく、例えばベンダ定義のコマンドを用いるようにして、別の手段を用いることでも可能である。
【0020】
また、USBホスト11も同様のディスクリプタ情報を保持しており、インタフェースディスクリプタ内にUSB Host機能の設定が、また、代替設定のディスクリプタ内にUSB Device機能の設定がされていれば、初期状態においては、USB Host機能が有効になるように、システム設定される。そして、これらの機能を入れ替えて設定しておくことは基本的に不可とされる。このようにして、初期状態のUSBシステムにおいては、USBホスト11とUSBデバイス13は一意に区別されることになる。
【0021】
ここで、USBデバイス13がUSBホスト11に接続された際に、USBホスト11とUSBデバイス13との間で行われるセットアップの手順について説明すれば、USBデバイス13が接続されたことを検知すると、USBホスト11によりデフォルトコントロールパイプが形成される。デフォルトコントロールパイプが形成されれば、このデフォルトコントロールパイプを介し、USBホスト11によりUSBデバイス13のセットアップが開始される。先ずUSBホスト11は、USBデバイス13に対してコントロール転送を開始し、そのセットアップステージにおいて、Get Descriptor(DEVICE指定)リクエストを送信することで、デバイスディスクリプタをUSBホスト11に送信することが要求される。
【0022】
この要求に対する応答として、USBデバイス13からは、コントロール転送のデータステージにおいて、デバイスディスクリプタがUSBホスト11宛てに送信される。このデバイスディスクリプタが受信されれば、USBホスト11からは、ステータスステージにおいて、USBデバイス13のエンドポイント0宛てに長さ0のデータパケットが送信されることにより、正常にディスクリプタが受信されたことが通知される。このようにして、デバイスディスクリプタがUSBホスト11に送信されることで、USBホスト11はUSBデバイス13に関する一般情報を有するようになる。この一般情報には、USBデバイス13のプロトコルコードやエンドポイント0の最大パケットサイズ等が含まれている。
【0023】
USBホスト11ではまた、デバイスディスクリプタが受信されれば、USBデバイス13に対して一意のアドレス(以下、単にデバイスアドレスと称す)を割り当てるが、このデバイスアドレスの割当てが完了すれば、USBデバイス13に対し、Set Addressリクエストが送信されることによって、デバイスアドレスの割り当てが報告される。このようにして、USBデバイス13に対して、デバイスアドレスが設定される。
【0024】
以上のようにして、デバイスアドレスの設定が完了すれば、USBホスト11からは、再度、セットアップステージにおいて、Get Descriptor(CNFIGURATION指定)リクエストがUSBデバイス13に送信されることによって、コンフィギュレーションディスクリプタ等をUSBホスト11に送信することが、USBデバイス13に要求される。USBデバイス13からは、その要求に応答して、データステージにおいて、コンフィギュレーションディスクリプタ、インタフェースディスクリプタ、代替設定及びそれらに付随するエンドポイントディスクリプタがUSBホスト11に送信される。これに対する応答として、USBホスト11からはまた、ステータスステージにおいて、USBデバイス13のエンドポイント0宛てに長さ0のデータパケットが送信されることで、正常にそれらディスクリプタが受信されたことが通知される。
【0025】
以上のようにして、USBデバイス13からUSBホスト11へ送られるコンフィギュレーションディスクリプタ等には、USBデバイス13が有する情報が含まれている。この際に、USBホスト11が受け取るディスクリプタの構成は、インタフェースディスクリプタ内にはUSB Device機能の設定が、また、代替設定のディスクリプタ内にはUSB Host機能が設定されている。
【0026】
USBホスト11では、図2に示すディスクリプタ情報を全て受け取ると、各エンドポイントの番号とインタフェース番号との関係を把握するとともに、USBデバイス13の構成が以下のように設定される。
即ち、インタフェースディスクリプタ及びその代替設定にUSBデバイス13の機能が記述されているが、インタフェースディスクリプタに記述された機能であるところのストレージ機能が最初に有効になるように、USBデバイス13のエンドポイント及びインタフェース構成が設定される。これは、後述する機能変更のリクエストがくるまでは、デバッグ機能に対する要求を全てStall(停止)させるようにするためである。
【0027】
そして、エンドポイント情報のコンフィギュレーションを行い、図2に記載されたエンドポイント情報に基づき、Bulk転送やInterrupt転送等の転送モード、更には、IN/OUTの方向、最大パケットサイズが決定される。その際、代替設定に記述されたデバッグ機能もセットアップ後にも使用できるように、デバッグ機能を有することと、ディスクリプタ階層の情報を保持しておく。
【0028】
その後、USBホスト11からは、コントロール転送のセットアップステージにおいて、Set ConfigurationリクエストUSBデバイス13に送信されることによって、設定通りにインタフェース機能を設定することが要求される。USBデバイス13では、そのSet Configurationコマンドに従って、インタフェース設定が行われる。このようにして、USBデバイス13のセットアップは完了される。このセットアップ作業以降、USBデバイス13は、インタフェースディスクリプタに設定された機能であるところのUSB Deviceとして機能するようになる。この時点では、代替設定に記述されたUSB Host機能は有効にはならないが、USB Host機能を有することをUSBホスト11は理解していることになる。
【0029】
更に、その後、USBホスト11からUSBデバイス13に対しては、コンフィギュレーションが行われる。この際でのデータ転送には、先ほどコンフィギュレーションされたデバイスアドレスが使用される。USBホスト11は、先ほどと逆方向にディスクリプタ情報が転送されるように、Get Descriptor(DEVICE指定)とGet Descriptor(Configuration指定)を行うことで、USBホスト11からディスクリプタ情報がUSBデバイス13に転送される。その後、USBホスト11が逆方向のSet Configurationを行うことで、USBデバイス13はUSBホスト11のセットアップを完了する。
【0030】
以上の一連の作業が行われることで、USBシステムのセットアップが完了される。これにより、USBホスト11では、USBデバイス13がUSB Host/USB Deviceの両機能を有しており、USB Deviceが有効であることが判る。一方、USBデバイス13では、USBホスト11がUSB Host/USB Deviceの両機能を有しており、USB Hostが有効であることが判る。
【0031】
さて、図1に示すUSBシステムにおいて、USB HostとUSB Deviceの機能を切替る方法について具体的に説明すれば、機能の切替えは、インタラプト転送及びSET INTERFACEのコマンドを利用して行われる。これらのコマンドはUSBの規格上で定義されているコマンドであり、機能の切り替えは、USBホスト11上においてアプリケーションが切替わるとき、あるいはUSBデバイス13において、データ転送要求が発生した場合に起こる。因みに、USBホスト11上においてアプリケーションが切替わるときとは、1)USBホスト機能を利用していたアプリケーションがUSBデバイス機能を利用してデータ転送を発生させる場合や、2)USBデバイス機能を利用していたアプリケーションがUSBホスト機能を利用してデータ転送を発生させる場合を指す。
【0032】
図3に、その切替えの際に、現在の機能から別の機能の使用要求がなされた場合での動作シーケンスを示す。これによる場合、先ずUSBホスト11は、インタラプト転送を利用して、SOF(スタートオブフレーム)の発生するタイミングで、USBデバイス13に対しUSB Host機能が主体となってのデータ転送要求が発生しているか否かを定期的に確認する(処理301,302)。USBデバイス13でUSB Host機能を利用したデータ転送要求が発生している場合、あるいはUSBホスト11でUSB Device機能を利用したデータ転送要求が発生している場合には、データ転送要求がありとして、機能の切替えが行われることになる(処理303)。
【0033】
そのUSB Host/USB Device機能の機能切替えに先立っては、先ずUSBホスト11は、USBデバイス13のエンドポイント0宛てのコントロール転送を開始し、そのセットアップステージにおいて、そのエンドポイント0に対しては、GET INTERFACE(ベンダ定義のコマンド)が送信される(処理304)。このGET INTERFACEは、現在、USBデバイス13側では如何なる機能が設定された上、実行されているのか、その設定機能情報を要求する旨のコマンドである。その要求に応答して、USBデバイス13からは、データステージにおいて、現在設定されている機能に対応したデータがUSBホスト11側に送信される(処理305)。この場合、USBデバイス13には、USB Device機能が設定されているので、その旨の情報がUSBホスト11に送信される。その情報を受け取れば、USBホスト11からは、ステータスステージにおいて、正常に情報の受信が行われた旨がUSBデバイス13側に通知される(処理306)。
【0034】
以上のようにして、USBホスト11では、USBデバイス13に現に設定されている機能が確認されているが、果して、その機能がUSBホスト11が要求している機能と一致しているか否かが判定される(処理307)。もしも、一致していれば、その後に機能切替えのための設定機能変更要求は発生されることはないが、一致していなければ、その後に、設定機能変更要求が発生されるようになっている。この場合、USBホスト11からUSBデバイス13に対しては、デバッグ機能への切替えが要求されているが、USBデバイス13での設定機能はUSB Device機能であることから、設定機能変更要求が発生されることになる。
【0035】
その設定機能変更要求の発生に際しては、それに先立って、先ずUSBホスト11はUSB Host機能からUSB Device機能に仮切替えされる(処理308)。その後、USBホスト11は、USBデバイス13のエンドポイント0宛てのコントロール転送を開始し、そのセットアップステージにおいて、設定機能変更要求としてのSET INTERFACE(ベンダ定義のコマンド)が送信される(処理309)。このSET INTERFACEは、現在、USBデバイス13側に設定されている機能を指定機能に変更することを要求する旨のコマンドである。このコマンドにはUSB Host機能への切替えの情報が埋め込まれている。したがって、USBデバイス13では、そのコマンドを受信後、指定機能への切替えが行われる(処理310)。この場合、USBデバイス13には、それまでUSB Device機能が設定されていたが、設定機能はUSB Host機能に変更されることになる。この設定機能の変更後、コントロール転送のステータスステージで、機能切替えの成否がUSBデバイス13からUSBホスト11に送信される(処理311)。
【0036】
機能の切替えに成功した場合には、USBホスト11側での機能はUSB Host機能からUSB Device機能に最終的に切替えされ、後述のように、新機能であるUSB Host機能とUSB Deviceとの間でデータ通信が開始される。しかしながら、機能の切替えに失敗した場合、新機能であるUSB Host機能はUSBデバイス13側では有効とならず、また、USBホスト11はUSB Host機能に戻され、以前の機能でデータ通信が行われる。代替設定の機能からインタフェースディスクリプタの機能への機能切替えも同様な動作で行われる。
【0037】
引き続き、設定機能変更後でのデータ転送動作を図4に示すシーケンスに従って説明すれば、USBホスト11側のUSB Device機能からベンダ定義によるコマンド発行リクエストが出される(処理312)。そのリクエストにUSBデバイス13側のUSB Host機能が応答し、コマンドがUSBホスト11のUSB Device機能に発行される(処理313)。そのコマンドを受信したUSBホスト11のUSB Device機能はコマンド内容を解釈した上、ステータスをUSBデバイス13のUSB Host機能に返答する(処理314)。この後は、コマンドに従って、Bulk転送やInterrupt転送、Isochronous転送によるデータ転送が行われる(処理315)。
【0038】
更に、データ転送終了後での機能変更動作シーケンスを図5により説明すれば、USBホスト11は、インタラプト転送を利用して、SOF(スタートオブフレーム)の発生するタイミングで、USBデバイス13に対しUSB Host機能が主体となってのデータ転送要求が発生しているか否かを確認する(処理316,3317)。USBデバイス13でUSB Host機能を利用したデータ転送が発生しない場合、あるいはUSBホスト11でUSB Host機能を利用したデータ転送が発生する場合には、以降、図3での機能変更の場合と同様のシーケンスに従って、機能切替えが行われることになる。この機能変更が終了すれば、初期状態、即ち、USBホスト11側はUSB Host機能を、また、USBデバイス13側はUSB Device機能を有するようになる。
【0039】
以上、説明したように、USBホスト/USBデバイスにおいて、機能切替えベンダリクエストを発行する機能を備えたデバイスドライバを有することにより、これらの機能全てに必要なコンフィギュレーションやインタフェース、エンドポイントを持つことなく、必要最低限のコンフィギュレーションやインタフェース、エンドポイントで通信路を確保することができる。同時に、USBホストコントローラ、あるいはUSBデバイスコントローラの何れか1つしか有さないシステムにおいて、USBデバイスの機能、あるいはUSBホストの機能を実現することができる。
【0040】
上記効果に加え、複数の機能を同時に使用することにより、ホストアプリケーションからは複数のアプリケーションの同時利用が可能になり、ユーザの利便性が向上されることになる。それとともに、USBシステムのユーザーアプリケーションからは、USBホストコントローラ及びUSBデバイスコントローラの存在を意識することなく、データ転送を行うことが可能になる。
【0041】
因みに、本発明に係るUSBシステムでの特徴としては、以下のような内容(1)〜(8)が考えられる。
即ち、
(1):ホストコンピュータと周辺機器をUSBにより接続するUSB制御システムであって、USBホスト及びUSBデバイス上のアプリケーションからはそれらの機能の違いを意識することなく、データ転送が可能とされているUSB制御システム。
(2):(1)に記載のUSB制御システムにおいて、ホストコンピュータと周辺機器各々がホスト機能とデバイス機能を持つことを特徴とするUSB制御システム。
(3):(1)に記載のUSB制御システムにおいて、ホストが機能取得・切替えリクエストを発行する機能を備えたデバイスドライバを有し、前記USBホストは定期的にUSBデバイスにデータ転送の有無を問い合わせることを特徴とするUSB制御システム。
(4):(1)に記載のUSB制御システムにおいて、デバイスドライバはホスト機能、デバイス機能ごとに有するが、デバイスドライバはインタフェースが1つとして振舞うことを特徴とするUSB制御システム。
【0042】
(5):(1)に記載のUSB制御システムにおいて、前記機能切替えベンダリクエストを受信する機能を備えた制御部は、機能切替えベンダリクエストの受信時に、シームレスに指定された機能の内容に従った動作状態へ移行させることを特徴とするUSB制御システム。
(6):(1)に記載のUSB制御システムにおいて、前記機能切替えのために周辺機器の機能の情報をホストコンピュータに送る(ホストコンピュータは機能の情報を受信する)ことを特徴とするUSB制御システム。
(7):(1)に記載のUSB制御システムにおいて、前記機能切替えのためにUSBホストの機能の情報を周辺機器に送ることを特徴とするUSB制御システム。(8):(1)に記載のUSB制御システムにおいて、(2)に記載された問い合わせ機能はホストコントローラを保有するUSBホストから問い合わせが送られることを特徴とするUSB制御システム。
【0043】
以上、本発明者によってなされた発明を実施の形態に基づき、具体的に説明したが、本発明は上記実施の形態に限定されるものではなく、その要旨を逸脱しない範囲内で種々変更可能であることはいうまでもない。
【0044】
【発明の効果】
ホストとデバイスの区別なく、機能切替えリクエストによる設定機能の変更によりホストになったり、デバイスになったりできる。
【図面の簡単な説明】
【図1】本発明に係るUSBシステムの一例でのシステム構成を示す図である。
【図2】USBデバイスのディスクリプタの階層構成を示す図である。
【図3】現在の機能から別の機能の使用要求が行われた場合での動作シーケンスを示す図である。
【図4】設定機能変更後でのデータ転送動作シーケンスを示す図である。
【図5】データ転送終了後での機能変更動作シーケンスを示す図である。
【符号の説明】
11…USBホスト、12…USBケーブル、13…USBデバイス、111…USBホストコントローラ、112,132…デバイスドライバ、113,133…アプリケーション、1121,1321…ホスト機能デバイスドライバ、1122,1322…デバイス機能デバイスドライバ、131…USBデバイスコントローラ[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an interface device, an interface control method, and an interface control that can be configured as a host or a device without distinguishing between the host and the device by changing a setting function in response to a function switching request from the host to the device. Regarding the program.
[0002]
[Prior art]
A USB (Universal Serial Bus) is known as a bus for connecting a computer and various peripheral devices. This USB is a cable bus that contains two signal lines and two power lines, and many personal computers and peripheral devices that have been provided recently are equipped with interfaces that support this USB. Has been. The USB interface is assumed to be a system in which one or more peripheral devices are connected by bus to one host computer (hereinafter simply referred to as a USB host). A peripheral device connected to a USB host via the USB is generally called a USB device.
[0003]
When a USB device is connected to the USB host, a unique address is assigned from the USB host to the USB device. Also, the USB device is provided with a plurality of endpoints (Endpoints) for terminating communication with the USB host. This endpoint is specifically configured as a FIFO (First In First Out) buffer for storing data. When communication is performed between the USB host and the USB device, communication is performed via the endpoint. It is like that.
[0004]
Incidentally,
[0005]
[Patent Document 1]
JP 2002-366268 A
[0006]
[Problems to be solved by the invention]
By the way, in the USB communication standard, one USB device has only one descriptor (descriptor indicating what function device is connected in the USB communication standard). . Therefore, in the conventional USB device, when the device has a plurality of functions, it is impossible to have a plurality of descriptors. Therefore, a plurality of interfaces (in the USB communication standard, (Indicating connection means).
[0007]
Further, since the USB device performs data transfer in response to a request from the USB host, it is impossible to perform data transfer independently from the USB device, and data transfer is inevitably performed in such a form. In addition, a USB device was designed. In order to avoid such a problem, the USB host controller and the USB device controller must be mounted on the same device, or a USB controller conforming to the USB-OTG standard must be mounted.
[0008]
It is an object of the present invention to be able to become a host or a device by changing a setting function by a function switching request without distinguishing between a host and a device.
[0009]
[Means for Solving the Problems]
The present inventionBy changing the setting function due to a function switching request from the host to the deviceASeen from the applicationWhen the data transfer is enabled without distinguishing between the host or the device, the interface descriptor and other descriptors that are alternative settings for the interface descriptor are included, and the host function is set in the interface descriptor. When the device function is set in the descriptor and the device function is set in the interface descriptor, the host function is set in the other descriptor. In the initial state, the function set in the interface descriptor is valid and is periodically sent from the host to the device. The function set in the interface descriptor is invalidated by receiving the function switching request issued by the application from the device. It was valid, based on the features that are enabled, and performs transfer function switching request or data.
[0010]
In the past, devices transferred data in response to requests from the host, and it was not possible to transfer data independently from the device, but the setting function at the host can be changed autonomously. If the setting function on the device can be changed by a function switching request from the host as described above, along with the change of the setting function, the device also actively transfers data. It becomes possible.
[0011]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, an embodiment of the present invention will be described with reference to FIGS. 1 to 5 assuming that the interface is USB.
First, a USB system according to the present invention will be described. FIG. 1 shows a system configuration as an example. As shown in the figure, the USB system is configured in a state in which a
[0012]
The situation as described above is the same on the USB device 13 side, and the configuration of the software and hardware depends on the
[0013]
Here, to describe that the USB device 13 has a host function and a device function, generally, a descriptor is used to express a USB function. In order to express a plurality of functions, a plurality of interface descriptors are described. In the present invention, in order to make an interface appear as one, there is one interface descriptor, and two functions are mounted thereon. Indicates. Although FIG. 2 shows the hierarchical structure of descriptors, as will be understood, there is only one interface descriptor, and another function exists by describing a descriptor as an alternative setting. Is shown. An endpoint descriptor is associated with each interface and alternative setting.
[0014]
2 will be described in detail. In the example shown in FIG. 2, the following configurations are assumed for the
[0015]
Furthermore, although one interface descriptor (Interface0) 23 exists, as a substitute setting, the descriptor of alternate 0 (Alternate0) 24 is described, which indicates that another function exists. . An endpoint descriptor is associated with each interface and alternative setting. In the example shown in FIG. 2, there are three pieces of endpoint information associated with the
[0016]
There are also three pieces of endpoint information associated with the alternate 0 in the example shown in FIG. This is endpoint information for each of endpoint 1 (Endpoint 1) 241, endpoint 2 (Endpoint 2) 242, endpoint 3 (Endpoint 3) 243. Information is described, and the endpoint descriptor has the same configuration in the interface descriptor and its alternative setting. However, the difference in interface information between
[0017]
The information indicating that the USB Device function is held in the interface descriptor and the information indicating that the USB Host function is included in the alternative setting descriptor are entered as the USB device 13 and the USB Host function and USB. Indicates that the device has a function. In the following description, it is assumed that the configuration of the descriptor is as described above. In the example illustrated in FIG. 2, the
[0018]
In the above configuration, the function set in the interface descriptor is set as an effective function in the initial state. In other words, if the USB Device function is set in the interface descriptor and the USB Host function is set in the alternative setting descriptor, the system settings are set so that the USB Device function is enabled in the initial state. Will be.
[0019]
Therefore, the
[0020]
The
[0021]
Here, when the USB device 13 is connected to the
[0022]
As a response to this request, the device descriptor is transmitted from the USB device 13 to the
[0023]
In addition, when the device descriptor is received, the
[0024]
When the setting of the device address is completed as described above, the
[0025]
As described above, the configuration descriptor or the like sent from the USB device 13 to the
[0026]
When all the descriptor information shown in FIG. 2 is received, the
That is, although the function of the USB device 13 is described in the interface descriptor and its alternative setting, the endpoint of the USB device 13 and the storage function that is the function described in the interface descriptor are first enabled. The interface configuration is set. This is to stop all requests for the debug function until a function change request to be described later is received.
[0027]
Then, the end point information is configured, and based on the end point information described in FIG. 2, the transfer mode such as Bulk transfer and Interrupt transfer, the IN / OUT direction, and the maximum packet size are determined. At this time, the debug function and the descriptor hierarchy information are held so that the debug function described in the alternative setting can be used even after the setup.
[0028]
Thereafter, the
[0029]
Further, after that, configuration from the
[0030]
The USB system setup is completed by performing the above series of operations. Thereby, in the
[0031]
Now, in the USB system shown in FIG. 1, the method for switching the functions of the USB Host and USB Device will be described in detail. Switching between functions includes interrupt transfer and SET. This is done using the INTERFACE command. These commands are commands defined in the USB standard, and switching of functions occurs when an application is switched on the
[0032]
FIG. 3 shows an operation sequence when a request for using another function is made from the current function at the time of switching. In this case, first, the
[0033]
Prior to the function switching of the USB Host / USB Device function, the
[0034]
As described above, in the
[0035]
Prior to the generation of the setting function change request, the
[0036]
If the function switching is successful, the function on the
[0037]
If the data transfer operation after changing the setting function is described according to the sequence shown in FIG. 4, a vendor-defined command issue request is issued from the USB Device function on the
[0038]
Further, the function change operation sequence after the data transfer is completed will be described with reference to FIG. 5. The
[0039]
As described above, a USB host / USB device has a device driver having a function for issuing a function switching vendor request, so that it does not have a configuration, an interface, and an endpoint necessary for all these functions. The communication path can be secured with the minimum required configuration, interface, and endpoint. At the same time, the function of the USB device or the function of the USB host can be realized in a system having only one of the USB host controller and the USB device controller.
[0040]
In addition to the above effects, by using a plurality of functions simultaneously, a plurality of applications can be used simultaneously from the host application, and convenience for the user is improved. At the same time, it becomes possible to transfer data from the user application of the USB system without being aware of the existence of the USB host controller and the USB device controller.
[0041]
Incidentally, the following contents (1) to (8) can be considered as features in the USB system according to the present invention.
That is,
(1): A USB control system that connects a host computer and peripheral devices via USB, and data transfer is possible from applications on the USB host and USB device without being aware of the differences in their functions. USB control system.
(2): The USB control system according to (1), wherein each of the host computer and the peripheral device has a host function and a device function.
(3): In the USB control system according to (1), the host has a device driver having a function of issuing a function acquisition / switching request, and the USB host periodically checks whether or not data is transferred to the USB device. USB control system characterized by inquiring.
(4): The USB control system according to (1), wherein the device driver has a host function and a device function, but the device driver behaves as one interface.
[0042]
(5): In the USB control system according to (1), the control unit having the function of receiving the function switching vendor request follows the contents of the seamlessly designated function when receiving the function switching vendor request. A USB control system characterized by shifting to an operating state.
(6): The USB control system according to (1), wherein the function information of the peripheral device is sent to the host computer for the function switching (the host computer receives the function information). system.
(7): The USB control system according to (1), wherein the function information of the USB host is sent to a peripheral device for the function switching. (8): The USB control system according to (1), wherein the inquiry function described in (2) is sent from a USB host having a host controller.
[0043]
As mentioned above, the invention made by the present inventor has been specifically described based on the embodiment. However, the present invention is not limited to the embodiment described above, and various modifications can be made without departing from the scope of the invention. Needless to say.
[0044]
【The invention's effect】
Regardless of whether the device is a host or a device, it can become a host or a device by changing the setting function by a function switching request.
[Brief description of the drawings]
FIG. 1 is a diagram showing a system configuration of an example of a USB system according to the present invention.
FIG. 2 is a diagram illustrating a hierarchical configuration of descriptors of a USB device.
FIG. 3 is a diagram showing an operation sequence when a request for using another function is made from the current function.
FIG. 4 is a diagram showing a data transfer operation sequence after a setting function change.
FIG. 5 is a diagram showing a function change operation sequence after the end of data transfer;
[Explanation of symbols]
DESCRIPTION OF
Claims (7)
インタフェースディスクリプタ及び上記インタフェースディスクリプタの代替設定である他のディスクリプタを有し、上記インタフェースディスクリプタにホスト機能が設定される場合は上記他のディスクリプタにデバイス機能が設定され、上記インタフェースディスクリプタに上記デバイス機能が設定される場合は上記他のディスクリプタに上記ホスト機能が設定され、初期状態では上記インタフェースディスクリプタに設定された機能が有効となり、上記ホストから上記デバイスに定期的に問合せを行って、上記アプリケーションが発行する上記機能切替えリクエストを上記デバイスから受け取ることにより、上記インタフェースディスクリプタに設定された機能を無効とし、上記他のディスクリプタに設定された機能を有効とするデバイスドライバと、
上記デバイスドライバが有効とする機能に基づいて、上記機能切替えリクエスト又はデータの転送を行うコントローラ部と、を備える
インタフェース装置。By changing the settings function by function switching request to the device functions from the host function, as seen from the application, without distinguishing between the host or device, an interface device a data transfer is possible,
If there is an interface descriptor and another descriptor that is an alternative setting for the interface descriptor, and the host function is set in the interface descriptor, the device function is set in the other descriptor, and the device function is set in the interface descriptor If this is the case, the host function is set in the other descriptor. In the initial state, the function set in the interface descriptor is valid. The host periodically queries the device and issues the application. By receiving the function switching request from the device, the function set in the interface descriptor is invalidated and the function set in the other descriptor is validated. And vinegar driver,
An interface device comprising: a controller unit configured to transfer the function switching request or data based on a function enabled by the device driver .
上記ホストから、定期的に上記デバイスに対しデータ転送要求の有無の問合せを行い、該問合せの結果如何に応じて、上記デバイスから該デバイスでの設定機能を取得して、設定機能の変更が必要か否かを判断し、設定機能の変更が必要な場合に、上記デバイスに上記機能切替えリクエストを発行する
インタフェース装置。The interface device according to claim 1,
From the host periodically polls for the presence or absence of a data transfer request to the device, the result depending on how the said query, acquires the setting function at the device from the device, necessary to change the setting function whether the determined, if necessary to change the setting function, and issues a request switch the function to the device
Interface devices.
上記デバイスドライバは、1つの上記インタフェースディスクリプタを有することを特徴とするインタフェース装置。The interface device according to claim 1 or 2,
The interface device, wherein the device driver has one interface descriptor .
インタフェースディスクリプタ及び上記インタフェースディスクリプタの代替設定である他のディスクリプタを有し、上記インタフェースディスクリプタにホスト機能が設定される場合は上記他のディスクリプタにデバイス機能が設定され、上記インタフェースディスクリプタに上記デバイス機能が設定される場合は上記他のディスクリプタに上記ホスト機能が設定され、初期状態では上記インタフェースディスクリプタに設定された機能が有効となり、上記ホストから上記デバイスに定期的に問合せを行って、上記アプリケーションが発行する上記機能切替えリクエストを上記デバイスから受け取ることにより、上記インタフェースディスクリプタに設定された機能を無効とし、上記他のディスクリプタに設定された機能を有効とするステップと、
上記有効とされる機能に基づいて、上記機能切替えリクエスト又はデータの転送を行うステップと、を含む
インタフェース制御方法。By changing the settings function by function switching request to the device functions from the host function, as seen from the application, without distinguishing between the host or device, an interface control method a data transfer is possible,
If there is an interface descriptor and another descriptor that is an alternative setting for the interface descriptor, and the host function is set in the interface descriptor, the device function is set in the other descriptor, and the device function is set in the interface descriptor If this is the case, the host function is set in the other descriptor. In the initial state, the function set in the interface descriptor is valid. The host periodically queries the device and issues the application. By receiving the function switching request from the device, the function set in the interface descriptor is invalidated and the function set in the other descriptor is validated. And-flops,
And a step of transferring the function switching request or data based on the enabled function .
上記ホストから、定期的に上記デバイスに対しデータ転送要求の有無の問合せを行う問合せステップと、
該問合せステップで得られた問合せの結果に応じて、上記デバイスから該デバイスでの設定機能を取得する設定機能取得ステップと、
該設定機能取得ステップで取得された設定機能に基づき、設定機能の変更が必要か否かを判断の上、設定機能の変更が必要な場合に、上記デバイスに機能切替えリクエストを発行する機能切替えリクエスト発行ステップと
を含むインタフェース制御方法。The interface control method according to claim 4, wherein
From the host, the inquiry step of querying whether the data transfer request to periodically the device,
In accordance with the result of the inquiry obtained in the inquiry step, a setting function acquisition step for acquiring a setting function in the device from the device;
A function switching request for issuing a function switching request to the device when it is necessary to change the setting function based on the setting function acquired in the setting function acquisition step. An interface control method including an issuing step.
インタフェースディスクリプタ及び上記インタフェースディスクリプタの代替設定である他のディスクリプタを有し、上記インタフェースディスクリプタにホスト機能が設定される場合は上記他のディスクリプタにデバイス機能が設定され、上記インタフェースディスクリプタに上記デバイス機能が設定される場合は上記他のディスクリプタに上記ホスト機能が設定され、初期状態では上記インタフェースディスクリプタに設定された機能が有効となり、上記ホストから上記デバイスに定期的に問合せを行って、上記アプリケーションが発行する上記機能切替えリクエストを上記デバイスから受け取ることにより、上記インタフェースディスクリプタに設定された機能を無効とし、上記他のディスクリプタに設定された機能を有効とするステップと、
上記有効とされる機能に基づいて、上記機能切替えリクエスト又はデータの転送を行うステップと、を含む
インタフェース制御プログラム。 An interface control program that enables data transfer without changing the host or device as seen from the application by changing the setting function in response to a function switching request from the host function to the device function.
If there is an interface descriptor and another descriptor that is an alternative setting for the interface descriptor, and the host function is set in the interface descriptor, the device function is set in the other descriptor, and the device function is set in the interface descriptor If this is the case, the host function is set in the other descriptor. In the initial state, the function set in the interface descriptor is valid. The host periodically queries the device and issues the application. By receiving the function switching request from the device, the function set in the interface descriptor is invalidated and the function set in the other descriptor is validated. And-flops,
And a step of transferring the function switching request or data based on the valid function .
上記ホストから、定期的に上記デバイスに対しデータ転送要求の有無の問合せを行う問合せステップと、An inquiry step for making an inquiry about the presence or absence of a data transfer request to the device periodically from the host;
該問合せステップで得られた問合せの結果に応じて、上記デバイス該デバイスでの設定機能を取得する設定機能取得ステップと、In accordance with the result of the inquiry obtained in the inquiry step, a setting function acquisition step for acquiring a setting function in the device.
該設定機能取得ステップで取得された設定機能に基づき、設定機能の変更が必要か否かを判断の上、設定機能の変更が必要な場合に、上記デバイスに機能切替えリクエストを発行する機能切替えリクエスト発行ステップとA function switching request for issuing a function switching request to the device when it is necessary to change the setting function based on the setting function acquired in the setting function acquisition step. Issuing step and
を含むインタフェース制御プログラム。Interface control program including
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003146738A JP4367003B2 (en) | 2003-05-23 | 2003-05-23 | Interface device, interface control method, and interface control program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003146738A JP4367003B2 (en) | 2003-05-23 | 2003-05-23 | Interface device, interface control method, and interface control program |
Publications (3)
Publication Number | Publication Date |
---|---|
JP2004348589A JP2004348589A (en) | 2004-12-09 |
JP2004348589A5 JP2004348589A5 (en) | 2006-07-06 |
JP4367003B2 true JP4367003B2 (en) | 2009-11-18 |
Family
ID=33533503
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003146738A Expired - Fee Related JP4367003B2 (en) | 2003-05-23 | 2003-05-23 | Interface device, interface control method, and interface control program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4367003B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4792361B2 (en) * | 2006-09-27 | 2011-10-12 | 富士通株式会社 | Response device, response method, and response program |
-
2003
- 2003-05-23 JP JP2003146738A patent/JP4367003B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2004348589A (en) | 2004-12-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3045985B2 (en) | Connection establishment method, communication method, state change transmission method, state change execution method, wireless device, wireless device, and computer | |
CA2657827C (en) | Method and apparatus for distributing usb hub functions across a network | |
JP4261069B2 (en) | USB flash memory device | |
US6353866B1 (en) | Apparatus and method for initializing a universal serial bus device | |
AU2006222461B2 (en) | Method and apparatus for improving the performance of USB mass storage devices in the presence of long transmission delays | |
JP4377603B2 (en) | Bus communication system and communication control method thereof | |
US6185607B1 (en) | Method for managing network data transfers with minimal host processor involvement | |
US7162566B2 (en) | USB-based host-to-host networking method | |
JP4432385B2 (en) | Data relay system | |
CN110688333A (en) | PCIE (peripheral component interface express) -based DMA (direct memory Access) data transmission system and method | |
TWI233553B (en) | Bus system and bus interface for connection to a bus | |
JP4367003B2 (en) | Interface device, interface control method, and interface control program | |
JP3091184B2 (en) | Communication system and communication device | |
JP3653051B2 (en) | Data transfer method, system and program by protocol conversion | |
JP2003281072A (en) | Method and device for controlling device | |
JP3579884B2 (en) | Data communication method and apparatus, printer and control method therefor | |
AU2006200756B2 (en) | A USB flash memory device for connecting to a USB-defined BUS | |
JP2639248B2 (en) | Communication interface device | |
JP2015022678A (en) | Network information processing device having power saving function | |
KR101460360B1 (en) | A multi-function usb apparatus, a function of usb simultaneous recognition system and a method thereof | |
KR20050057635A (en) | A device including means for transferring information indicating wether or not the device supports dma | |
JP2007004815A (en) | Link bridge | |
JP2004326350A (en) | Data processor and data processing method | |
JP2003280829A (en) | Printer and printer system | |
JP2003523575A (en) | Coupling system and method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060523 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20060523 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090303 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20090422 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20090804 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20090817 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120904 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130904 Year of fee payment: 4 |
|
LAPS | Cancellation because of no payment of annual fees |