JP4252577B2 - Microcomputer and data receiving method - Google Patents
Microcomputer and data receiving method Download PDFInfo
- Publication number
- JP4252577B2 JP4252577B2 JP2005513090A JP2005513090A JP4252577B2 JP 4252577 B2 JP4252577 B2 JP 4252577B2 JP 2005513090 A JP2005513090 A JP 2005513090A JP 2005513090 A JP2005513090 A JP 2005513090A JP 4252577 B2 JP4252577 B2 JP 4252577B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- ram
- packet data
- program
- microcomputer
- 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 - Lifetime
Links
- 238000000034 method Methods 0.000 title claims description 37
- 238000012545 processing Methods 0.000 claims description 32
- 230000008569 process Effects 0.000 claims description 28
- 238000004891 communication Methods 0.000 claims description 18
- 230000005540 biological transmission Effects 0.000 claims description 15
- 230000004044 response Effects 0.000 claims description 8
- 239000004065 semiconductor Substances 0.000 claims description 6
- 238000004458 analytical method Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 229910021421 monocrystalline silicon Inorganic materials 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 239000008188 pellet Substances 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
- G06F13/385—Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
Description
本発明は、プログラム容量の小さなプロトコルスタックの実現に係り、具体的には、TCP/IPのプロトコルスタックを有するマイクロコンピュータやデータ受信方法に関し、例えばTCP/IPによるネットワーク接続可能な家電製品等に適用して有効な技術に関する。 The present invention relates to the realization of a protocol stack with a small program capacity. Specifically, the present invention relates to a microcomputer having a TCP / IP protocol stack and a data receiving method. And effective technology.
TCP/IP(トランスミッション・コントロール・プロトコル/インターネット・プロトコル)はネットワークのコア技術として発展し、現在通信のデファクトスタンダードとされる。そのプロトコルの詳細はインターネットの問題点を解決するための組織であるIETF(インターネット・エンジニアリング・タスク・フォース)が取りまとめている膨大な数のRFC(リクエスト・オブ・コメンツ)で各種定義されている。従来TCP/IPプロトコルによるデータ通信はCPU(セントラル・プロセッシング・ユニット)が処理するソフトウェアのプロトコルスタックとMAC(メディア・アクセス・コントロール)層のパケット通信処理を行なうハードウェアのネットワークインタフェースにより実現されている。
前記プロトコルスタックの実現に関し、特許文献1(特開2003−143221号公報)では、OSの制御とは独立した状態で実行できるハードウェアによるプロトコルスタックを提供する。OS制御下のソフトウェアで実行されるプロトコル処理が他の優先処理に阻まれないようにして、通信処理のリアルタイム性を保証しようとする。
特許文献2(特開2003−263323号公報)では、OSと共にプロトコルスタックを実装するとプログラム容量が増大するので、これを減少させるのに、簡易な通信プログラムと共に自己書き換えプログラムを含め、自己書き換えプログラムによってダウンロード機能のアップグレードや高機能への対処を可能にする。TCP / IP (Transmission Control Protocol / Internet Protocol) has been developed as a core technology of the network and is now the de facto standard for communication. The details of the protocol are variously defined by a large number of RFCs (Request of Comments) compiled by IETF (Internet Engineering Task Force), an organization for solving problems of the Internet. Conventionally, data communication using the TCP / IP protocol is realized by a software protocol stack processed by a CPU (Central Processing Unit) and a hardware network interface that performs packet communication processing of a MAC (Media Access Control) layer. .
Regarding the implementation of the protocol stack, Japanese Patent Laid-Open No. 2003-143221 provides a hardware protocol stack that can be executed independently of OS control. An attempt is made to guarantee real-time communication processing by preventing protocol processing executed by software under OS control from being blocked by other priority processing.
In Patent Document 2 (Japanese Patent Laid-Open No. 2003-263323), since the capacity of a program increases when a protocol stack is mounted together with an OS, a self-rewriting program including a simple communication program and a self-rewriting program can be used to reduce this. Enables upgrades to download functions and handling of advanced functions.
本発明者は、ネットワーク家電等でTCP/IPのプロトコルをサポートすることについて検討した。特に組込み制御用途の16ビットマイクロコンピュータ等の内蔵ROM/RAM上で動作可能なTCP/IPのプロトコルスタックについて検討した。これによれば、既に各種定義されているプロトコルではリソースを極端に節約すると言う思想はない。そのようなプロトコルの詳細にしたがってTCP/IPプロトコルを実装するにはプロトコルスタックを格納する大きな記憶容量のROM、そしてプロトコルスタックの実行に大きな記憶容量のワークRAMが必要になる。上記特許文献に記載の技術は本発明者による検討技術とは着眼点が異なる。
本発明の目的は、ネットワーク家電のような小規模システムに対してTCP/IPプロトコルによるネットワーク接続を実現可能にすることにある。
本発明の別の目的は、TCP/IPのプロトコルスタックのコンパクト化の実現に資することができるデータ処理方法を提供することにある。
本発明の上記並びにその他の目的と新規な特徴は本明細書の以下の記述と添付図面から明らかにされるであろう。
〔1〕本発明に係るマイクロコンピュータは、中央処理装置、RAM及びROMを含み1個の半導体チップに形成され、前記ROMはオペレーティングシステムと、アプリケーションプログラムと、前記アプリケーションプログラムから呼び出されて実行されるTCP/IP用処理プログラムとが格納され、前記TCP/IP用処理プログラムは、接続要求、イベント待ち、データ送信、及び接続切断の処理プログラムを有する。前記中央処理装置は、イベント待ちの処理プログラムの実行中にタスクスイッチ指令例えばデータ受信割込みに応答してパケットデータの一部をRAMに読み込み当該パケットデータを必要とするときはイベント待ち状態から起床し、アプリケーションプログラムを実行して対応するパケットデータをRAMに取り込む。
MAC層における受信パケットデータの一部をマイクロコンピュータのオンチップRAMに取り込んで解析すればよいからワークRAMにそのパケットデータの全てを取り込んで展開するような処理を要せず、必要とするワークRAMのサイズが小さくて済む。また、前記解析の結果に従ってパケットデータをオンチップRAMに取り込む処理はアプリケーションプログラムで直接行い、プロトコルスタックを用いない。よって、プロトコルスタックのコンパクト化に資することができる。
〔2〕本発明の別の観点によるマイクロコンピュータは、中央処理装置、RAM及びROMを含み1個の半導体チップに形成され、前記ROMはオペレーティングシステムと、アプリケーションプログラムと、前記アプリケーションプログラムから呼び出されて実行されるTCP/IP用処理プログラムとが格納され、前記RAMはCPUがプログラムを実行するときのワーク領域に用いられ、前記TCP/IP用処理プログラムは、サービス開始、接続要求、イベント待ち、データ送信、及び接続切断の処理プログラムを有する。
前記イベント待ちの処理プログラムにイベント待ち状態からの起床要因が与えられることによってアプリケーションプログラムに戻って必要なパケットデータの取り込み等を直接行うことが可能になる。
本発明の具体的な一形態として、前記イベント待ちで待つべきイベントは、接続確立、接続切断、データ受信、イベント待ちのタイムアウトとしてよい。前記イベント待ちの処理プログラムにて待つべきイベントの種類は前記アプリケーションプログラムによって指定するのがよい。このとき、前記イベント待ちの処理プログラムは、所定の割込みに応答して外部よりパケットデータの所定の一部データをRAMに取り込み、取り込んだデータを検査することで対応パケットが必要なパケットか否かを判定し、必要と判定されたときにイベント待ちの状態を終了する。そして、前記アプリケーションプログラムは、データ受信のイベント待ちの状態が終了されるのに応答して、対応受信パケットのデータをRAMに取り込めばよい。
上記構成のマイクロコンピュータにおいて前記オンチップRAMの記憶容量は2〜4キロバイト程度で済ませることが可能である。
〔3〕本発明に係るデータ受信方法は、TCP/IPのMAC層を構成する通信デバイスのバッファメモリに格納されたパケットデータの所定部分のデータを読み出してマイクロコンピュータのオンチップRAMに格納する第1処理と、前記オンチップRAMに格納された前記データを検査することで、対応パケットが必要か否かを判定する第2処理と、前記判定する処理で前記パケットデータが必要と判定された場合、前記バッファメモリから対応パケットデータの必要な部分を前記オンチップRAMに格納する第3処理と、を含む。前記判定する処理で前記パケットデータが不必要と判定された場合、対応パケットデータは廃棄される。廃棄とはオンチップRAMに格納しないということである。
第1処理にて受信パケットデータの一部をマイクロコンピュータのオンチップRAMに取り込んで第2処理にて解析すればよいからワークRAMにそのパケットデータの全てを取り込んで展開するような処理を要せず、必要とするワークRAMのサイズが小さくて済む。
第1処理及び第2処理をプロトコルスタックで規定し、第3処理をアプリケーションプログラムで規定することにより、前記第3処理による解析の結果に従ってパケットデータをオンチップRAMに取り込む処理はアプリケーションプログラムで直接行い、プロトコルスタックを用いないから、プロトコルスタックのコンパクト化に資することができる。
本発明の具体的な一形態では、前記所定部分のデータは、インターネット・プロトコル・バージョン4におけるパケットフォーマットの先頭より13バイト目から42バイトのデータである。最大ここまでの範囲で解析すれば、広義のTCP/IPプロトコルに含まれるARP(アドレス・リゾリューション・プロトコル)、ICMP(インターネット・コントロール・メッセージ・プロトコル)、TCP、UDP(ユーザ・データグラム・プロトコル)の全てに対処することが可能になる。The present inventor examined the support of the TCP / IP protocol in network home appliances and the like. In particular, a TCP / IP protocol stack operable on a built-in ROM / RAM such as a 16-bit microcomputer for embedded control was examined. According to this, there is no idea of extremely saving resources in the already defined protocols. Implementing the TCP / IP protocol according to such protocol details requires a large storage capacity ROM to store the protocol stack and a large storage capacity work RAM to execute the protocol stack. The technique described in the above patent document is different from the technique studied by the present inventors.
An object of the present invention is to enable network connection using a TCP / IP protocol for a small-scale system such as a network home appliance.
Another object of the present invention is to provide a data processing method that can contribute to the realization of a compact TCP / IP protocol stack.
The above and other objects and novel features of the present invention will become apparent from the following description of the present specification and the accompanying drawings.
[1] A microcomputer according to the present invention is formed in one semiconductor chip including a central processing unit, a RAM and a ROM, and the ROM is called and executed by an operating system, an application program, and the application program. A TCP / IP processing program is stored, and the TCP / IP processing program includes a connection request, event wait, data transmission, and connection disconnection processing program. The central processing unit reads a part of packet data into the RAM in response to a task switch command, for example, a data reception interrupt during execution of a processing program waiting for an event, and wakes up from an event waiting state when the packet data is required. Then, the application program is executed to fetch the corresponding packet data into the RAM.
Since a part of the received packet data in the MAC layer may be taken into the on-chip RAM of the microcomputer and analyzed, the work RAM which does not need processing for taking all the packet data into the work RAM and expanding it is required. The size of can be small. Further, the process of fetching the packet data into the on-chip RAM according to the result of the analysis is directly performed by the application program and does not use the protocol stack. As a result, the protocol stack can be made compact.
[2] A microcomputer according to another aspect of the present invention includes a central processing unit, a RAM and a ROM, and is formed on one semiconductor chip. The ROM is called from an operating system, an application program, and the application program. The processing program for TCP / IP to be executed is stored, and the RAM is used as a work area when the CPU executes the program. The processing program for TCP / IP includes service start, connection request, event wait, data It has a processing program for transmission and connection disconnection.
By giving a wake-up factor from the event waiting state to the event waiting processing program, it becomes possible to return to the application program and directly take in necessary packet data.
As a specific form of the present invention, the event to be waited for in the event may be connection establishment, connection disconnection, data reception, and event wait timeout. The type of event to be waited for in the event-waiting processing program is preferably specified by the application program. At this time, in response to a predetermined interrupt, the event-waiting processing program fetches a predetermined part of packet data from the outside into the RAM, and checks whether the corresponding packet is a necessary packet by checking the fetched data. And waits for an event when it is determined necessary. Then, in response to the end of the data reception event waiting state, the application program may capture the data of the corresponding reception packet into the RAM.
In the microcomputer having the above configuration, the storage capacity of the on-chip RAM can be reduced to about 2 to 4 kilobytes.
[3] In the data receiving method according to the present invention, a predetermined portion of the packet data stored in the buffer memory of the communication device constituting the TCP / IP MAC layer is read out and stored in the on-chip RAM of the microcomputer. When the packet data is determined to be necessary in one process, the second process for determining whether or not the corresponding packet is necessary by inspecting the data stored in the on-chip RAM, and the determination process. And a third process of storing a necessary part of the corresponding packet data from the buffer memory in the on-chip RAM. If it is determined in the determination process that the packet data is unnecessary, the corresponding packet data is discarded. Discarding means not storing in the on-chip RAM.
Since a part of the received packet data may be taken into the on-chip RAM of the microcomputer in the first process and analyzed in the second process, a process of taking all the packet data into the work RAM and expanding it is required. Therefore, the required work RAM size can be reduced.
By defining the first process and the second process with the protocol stack and the third process with the application program, the process of fetching the packet data into the on-chip RAM according to the analysis result of the third process is directly performed by the application program. Since the protocol stack is not used, the protocol stack can be made compact.
In a specific form of the present invention, the data of the predetermined portion is data of the 13th byte to the 42th byte from the beginning of the packet format in Internet
第1図は本発明に係るマイクロコンピュータのブロック図である。
第2図はCPUのアドレスマップである。
第3図はTCP/IPプロトコルスタックが保有する7種類のAPIプログラムの種類を示す説明図である。
第4図はイベント待ちAPIプログラムで認識するイベントの一覧を示す説明図である。
第5図はTCP/IPによるパケットデータ受信処理のフローチャートである。
第6図は広義のTCP/IPプロトコルのパケットフォーマットを示す説明である。
第7図はバッファメモリからパケットデータの42バイトを取り出す様子を模式的に示す説明図である。
第8図は第5図のプロトコル解析処理(S4)の詳細を示すフローチャートである。
第9図はTCP/IPによる受動接続処理のフローチャートである。
第10図はTCP/IPによる能動接続処理のフローチャートである。
第11図はTCP/IPによるデータ送信処理のフローチャートである。
第12図はTCP/IP接続に対する強制切断のフローチャートである。
第13図はTCP/IP接続に対する通常切断のフローチャートである。FIG. 1 is a block diagram of a microcomputer according to the present invention.
FIG. 2 is a CPU address map.
FIG. 3 is an explanatory diagram showing the types of seven types of API programs held by the TCP / IP protocol stack.
FIG. 4 is an explanatory diagram showing a list of events recognized by the event waiting API program.
FIG. 5 is a flowchart of packet data reception processing by TCP / IP.
FIG. 6 is an explanation showing a packet format of the TCP / IP protocol in a broad sense.
FIG. 7 is an explanatory view schematically showing how 42 bytes of packet data are extracted from the buffer memory.
FIG. 8 is a flowchart showing details of the protocol analysis process (S4) of FIG.
FIG. 9 is a flowchart of TCP / IP passive connection processing.
FIG. 10 is a flowchart of active connection processing by TCP / IP.
FIG. 11 is a flowchart of data transmission processing by TCP / IP.
FIG. 12 is a flowchart of forced disconnection for TCP / IP connection.
FIG. 13 is a flowchart of normal disconnection for TCP / IP connection.
第1図には本発明に係るマイクロコンピュータのブロック図が示される。同図に示されるマイクロコンピュータ1は、特に制限されないが、相補型MOS集積回路製造技術などにより、単結晶シリコンのような1個の半導体基板上に形成されて1個のチップ若しくはペレット状にされ、必要に応じてパッケージングされている。
マイクロコンピュータ1は、特に制限されないが、CPU(中央処理装置)2、クロック発振器3、割込みコントローラ4、DMAC(ダイレクト・メモリ・アクセス・コントローラ)5、フラッシュメモリのような書換え可能な不揮発性メモリ又はマスクROMなどによって構成されるROM(リード・オンリ・メモリ)6、SRAM(スタティック・ランダム・アクセス・メモリ)等によって構成されるRAM7、リフレッシュコントローラ8、クロックサイクル数によりシステムの動作異常を監視するWDT(ウォッチ・ドッグ・タイマ)9、TCU(タイマ・カウンタ・ユニット)10、SCI(シリアル・コミュニケーション・インタフェース)11、USB(ユニバーサル・シリアル・バス)12、AD(アナログ・ディジタル)変換器13、バスコントローラ14、及び入出力ポート15を有し、それらは参照符号16で代表される内部バスに接続される。
前記CPU2は、図示は省略するが、命令制御部と実行部を有する。命令制御部はROM6などに格納されているプログラムをアクセスして命令をフェッチし、フェッチした命令を解読して制御情報を生成する。実行部は前記制御情報に従って演算やオペランドアクセスなどを行なって命令を実行する。
特に制限されないが、入出力ポート15にはネットワークインタフェースカード(NIC)を構成するイーサネットデバイス20が接続される。イーサネットデバイス20はイーサネットケーブル21に接続され、MAC層のパケット通信処理を行なうハードウェアのネットワークインタフェースを実現する。特に制限されないが、イーサネットデバイス20はイーサネットコントローラ22、バッファメモリ23、及びイーサネットケーブル21に結合するトランシーバ・レシーバ24等を有する。
マイクロコンピュータ1は、TCP/IPプロトコルによるデータ通信を行なうのに、パケット通信処理を行なうハードウェアのイーサネットデバイス20とCPU2が処理するソフトウェアのプロトコルスタックとしてのTCP/IP用処理プログラム(単にTCP/IPプロトコルスタックとも称する)を用いる。TCP/IPプロトコルスタックはアプリケーションプログラムから呼び出されて実行される。アプリケーションプログラムとはブラウザソフトウェアやメールソフトウェアなどである。それらTCP/IPプロトコルスタック及びアプリケーションプログラムはオペレーティングシステム(OS)等と一緒に前記ROM6が保有する。
第2図にはCPU2のアドレスマップが例示される。ROM6のアドレス空間には、先頭から、ベクタ、OS、TCP/IPプロトコルスタック、及びアプリケーションプログラムが配置される。アプリケーションプログラムはデータ通信以外のプログラムも含まれ、マイクロコンピュータ1の利用者の必要に応じて組み込まれる所謂ユーザプログラムとして把握してよい。RAM7のアドレス空間には、OSのワーク領域(OSワーク)、スタック領域、TCP/IPプロトコルスタック用のワーク領域(TCP/IPワーク)、アプリケーションプログラム用のワーク領域(ユーザワーク)が割当てられる。
第3図にはTCP/IPプロトコルスタックが保有する7種類のAPIプログラムの種類が示される。サービス開始APIプログラムはTCP/IP通信のための初期設定を行なう処理プログラムである。初期設定項目として例えばイーサネットデバイス20の初期化、TCP/IPワークの初期化などがある。受動接続設定APIプログラムは、接続されるのを待つために自ポートのIPアドレスとポート番号を設定する処理プログラムである。能動接続要求APIプログラムは接続を要求する相手ポートを設定する処理プログラムとされる。イベント待ちAPIプログラムは設定や要求に対する応答を待つ処理プログラムである。データ送信APIプログラムはデータを送信する処理プログラムである。接続のクローズAPIプログラムは自らの接続を遮断し、相手側の接続遮断は相手に任せる処理プログラムとされる。接続の強制切断APIプログラムは自らの接続と相手側の接続を共に強制遮断する処理プログラムとされる。イベント待ちAPIプログラムは所定のイベント発生を待つための処理プログラムとされる。
第4図にはイベント待ちAPIプログラムが認識するイベントの一覧が示される。認識すべきイベントは、受動接続設定APIプログラム又は能動接続APIプログラムの実行後に確認すべき受動/能動接続の確立、接続のクローズAPIプログラムの実行後に確認すべきクローズ完了、接続の強制切断APIプログラムの実行後に確認すべき強制クローズ、データ受信があったというデータ受信、データ送信のAPIプログラムの実行後に確認すべきデータ送信完了、イベント待ちAPIプログラムによるイベント待ちのタイムアウト(ウェイトのタイムアウト)、とされる。どのイベントを待つのかはフラグなどによってアプリケーションプログラムから指示される。
第5図にはTCP/IPによるパケットデータ受信処理のフローチャートが例示される。パケットデータ受信処理は、サービス開始APIプログラムが実行されて通信設定の初期化が完了され、その上で、受動接続設定又は能動接続設定のAPIプログラムが実行されて接続が確立されていることが前提とされる。この前提の下で、アプリケーションプログラムからデータ受信イベントのフラグがセットされ、イベント待ちAPIプログラムが呼び出されて実行される。これによる実行内容が第5図の処理であり、先ず、イーサネットデバイス20からパケットデータの受信割り込みを待つ(S1)。
イーサネットデバイス20は受信したパケットデータを順次バッファメモリ23に受信し、データ受信に呼応してパケットデータの受信割り込みをマイクロコンピュータ1に出力する。TCP/IPによるパケットデータは、例えばインターネット・プロトコル・バージョン4では第6図に示されるフォーマットを有し、広義のTCP/IPプロトコルに含まれるARP(アドレス・リゾリューション・プロトコル)、ICMP(インターネット・コントロール・メッセージ・プロトコル)、TCP、UDP(ユーザ・データグラム・プロトコル)の全てのプロトコルのパケットフォーマットにおいて、先頭14バイトがMAC層の制御情報とされ、これに続いて、ヘッダ及び必要なデータが付随する。ICMPはIPのエラーメッセージや制御メッセージを転送するプロトコルでありTCP/IP接続されているコンピュータ間で互いの状態を確認するのに用いられる。TCPはネットワークのトランスポート層のプロトコルである。UDPは信頼性を保証しないトランスポート層の通信プロトコルである。第6図のパケットフォーマットにおいて14バイトのMAC層制御情報の最後の2バイトはパケットのタイプを示し、そこから少なくとも42バイトのデータを参照することによって当該パケットデータのプロトコルの種別、送信先IPアドレス及びポート番号等が解る。要するに、そのパケットデータが通信チャネルとしての機能上マイクロコンピュータが必要とするパケットデータであるかがわかる。第5図の処理フローではパケットデータの受信割り込みがあったとき、パケットデータの42バイトをバッファメモリ23からRAM7に読み込む(S2)。読み込んだデータから当該パケットが自らのIPアドレス宛てデータであるかを判定し(S3)、そうでなければ当該パケットデータを廃棄する。廃棄するとは、当該パケットデータをバッファメモリ23からRAM7に読み込まないという意味である。ステップS3にて自らのIPアドレス宛てデータであるかことを判別したときは、当該パケットデータをバッファメモリ23からRAM7に読み込んで、プロトコル解析を行なう(S4)。これによれば、MAC層における受信パケットデータの一部をマイクロコンピュータ1のオンチップRAM7に取り込んで解析すればよいからRAM7のワーク領域にそのパケットデータの全てを取り込んで展開するような処理を要せず、必要とするオンチップRAM7のサイズが小さくて済む。ちなみにRAM7の容量は2K〜4Kバイト程度とされる。
第7図にはバッファメモリ23からパケットデータの42バイトを取り出す様子が模式的に示される。バッファメモリ23はリングバッファとして動作される。リングバッファのパケットデータはページ単位で管理される。イーサネットコントローラ23はRAM7に対するMMU機能を有し、CPU2はこれを利用して、ページ内のパケットデータに対して13バイト目から42バイトのデータをRAM7のワーク領域(TCP/IPワーク)に読み込む。
第8図には第5図のプロトコル解析処理(S4)の詳細が例示される。CPU2はRAM7に読み込んだ42バイトのパケットデータに基づいて当該パケットデータのプロトコルがARP、ICMP、TCP、UDPなどのどれに該当するかを判定する。ARPの場合にはARP返答を送信し、ICMPの場合にはICMP返答を返す。TCPに対してはポート番号とIPアドレスを確認し、自らのアドレス宛てでなければ当該パケットデータは廃棄されている。自らのアドレス宛ての場合に、それが制御用パケットであればTCP返信を返し、データパケットであればイベント待ち状態から起床する。ここで、イベント待ち状態から起床するとは、イベント待ちAPIプログラムの実行を終了することであり、CPU2の制御はアプリケーションプログラムに移行し、アプリケーションプログラムにしたがって対応するパケットデータのデータ部(転送データ)がバッファメモリ23からRAM7に転送される。アプリケーションプログラムはRAM7に転送されたパケットデータに対して所要のデータ処理を行なう。これによれば、前記解析の結果に従ってパケットデータをオンチップRAM7に取り込む処理はアプリケーションプログラムで直接行い、プロトコルスタックを用いない。よって、プロトコルスタックのコンパクト化に資することができる。例えばROM6の容量は32Kバイトである。
TCPの場合42バイトのパケットデータに対するプロトコル解析によってイベントの発生が認識されるものがある。そのようなイベントの認識は、第8図では、接続確立(SLEV_CONNECT)、接続要求の成功、データ送信完了(SLEV_TEND)、接続切断(SLEV_RST)、及び切断要求の成功(SLEV_CLS)とされる。ちなみにデータ受信イベント(SLEV_RX)はRx割り込みで認識される。イベントが認識されると、対応するイベント待ち状態から起床され、そのイベントに応じてCPU2の処理がアプリケーションプログラムに移行され、或いは別のAPIプログラムに移行される。
第8図ではUDPが認識されたときの処理について特に図示していないが、TCPの場合とほぼ同様に考えることが可能である。但し、TCPよりは簡素化される。また、システムで対応していないその他のプロトコルに対してはそのパケットデータは廃棄される。
第9図にはTCP/IPによる受動接続処理のフローチャートが例示される。アプリケーションプログラムによって受動接続APIプログラムの実行が指定されると、受動接続設定のAPIプログラムがプロトコルスタックから呼び出され、自ポートのIPアドレスとポート番号が設定され、次に、イベント待ちAPIプログラムを実行して接続確立のイベント発生を待つ。そのイベント発生により、イベント待ち状態から起床し、接続が確立される。
第10図にはTCP/IPによる能動接続処理のフローチャートが例示される。アプリケーションプログラムによって能動接続APIプログラムの実行が指定されると、能動接続要求のAPIプログラムがプロトコルスタックから呼び出され、相手ポートのIPアドレスとポート番号が設定され、次に、イベント待ちAPIプログラムを実行して接続確立のイベント発生を待つ。そのイベント発生により、イベント待ち状態から起床し、接続が確立される。
第11図にはTCP/IPによるデータ送信処理のフローチャートが例示される。イベント待ちAPIプログラムを実行してデータ受信イベントの発生を待つ。データ受信イベントが発生すると、イベント待ち状態から起床し、アプリケーションプログラムに従って第5図で説明した処理が行なわれ、送信に必要なイーサネットデバイス上の受信ページ番号とデータ長をバッファメモリ23からRAM7に取得する。次にデータ送信APIプログラムの実行に移行し、RAM7上のデータをバッファメモリ23に転送し、イーサネットデバイスに送信させる。
第12図にはTCP/IP接続に対する強制切断のフローチャートが例示される。CPU2は接続の強制切断APIプログラムを実行すればよい。
第13図にはTCP/IP接続に対する通常切断のフローチャートが例示される。CPU2は接続のクローズAPIプログラムを実行してからイベント待ちAPIプログラムを実行して接続相手先からのクローズ完了のイベント発生を待つ。クローズ完了のイベント発生に起因して当該ポート番号による通信を終了する。
以上本発明者によってなされた発明を実施例に基づいて具体的に説明したが本発明はそれに限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能である。
例えば、RAM及びROMの記憶容量は上記説明に限定されず適宜変更可能である。また、マイクロコンピュータとはCPUを有するシステムオンチップの半導体集積回路を総称する概念のものでさる。CPUは16ビットCPUに限定されず、32ビットCPUなどであってもよい。用途から言えば特別に高機能なCPUは必要ない。また、プロトコルスタックの処理プログラムの種類や処理内容についても適宜変更可能である。更に、パケットデータの一部をバッファメモリからオンチップRAMに転送するときのタスク切替はデータ受信割り込みに限定されず、その他のタスクスイッチ指令に応答して行なってもよい。FIG. 1 shows a block diagram of a microcomputer according to the present invention. The
The
Although not shown, the
Although not particularly limited, the
The
FIG. 2 illustrates an address map of the
FIG. 3 shows seven types of API programs held by the TCP / IP protocol stack. The service start API program is a processing program for performing initial settings for TCP / IP communication. Examples of the initial setting items include initialization of the
FIG. 4 shows a list of events recognized by the event waiting API program. The events to be recognized include the establishment of a passive / active connection to be confirmed after execution of the passive connection setting API program or the active connection API program, the close completion to be confirmed after execution of the connection close API program, and the forced disconnection API program. Forced close to be confirmed after execution, data reception that data has been received, data transmission to be confirmed after execution of the API program for data transmission, event waiting timeout (wait timeout) by the event waiting API program . Which event is to be waited is instructed from the application program by a flag or the like.
FIG. 5 illustrates a flowchart of packet data reception processing by TCP / IP. The packet data reception process is based on the assumption that the service start API program is executed and the communication settings are initialized, and then the passive connection setting or active connection setting API program is executed and the connection is established. It is said. Under this assumption, the data reception event flag is set from the application program, and the event waiting API program is called and executed. The contents of the execution are the processing shown in FIG. 5. First, it waits for a packet data reception interrupt from the Ethernet device 20 (S1).
The
FIG. 7 schematically shows how 42 bytes of packet data are extracted from the
FIG. 8 illustrates details of the protocol analysis process (S4) of FIG. Based on the 42-byte packet data read into the
In the case of TCP, the occurrence of an event is recognized by protocol analysis for 42-byte packet data. In FIG. 8, the recognition of such an event is defined as connection establishment (SLEV_CONNECT), connection request success, data transmission completion (SLEV_TEND), connection disconnection (SLEV_RST), and disconnection request success (SLEV_CLS). Incidentally, the data reception event (SLEV_RX) is recognized by the Rx interrupt. When an event is recognized, it wakes up from the corresponding event waiting state, and the processing of the
Although FIG. 8 does not particularly show the processing when UDP is recognized, it can be considered almost the same as in the case of TCP. However, it is more simplified than TCP. For other protocols not supported by the system, the packet data is discarded.
FIG. 9 illustrates a flowchart of passive connection processing by TCP / IP. When execution of the passive connection API program is specified by the application program, the passive connection setting API program is called from the protocol stack, the IP address and port number of the own port are set, and then the event waiting API program is executed. And wait for the connection establishment event to occur. When the event occurs, the user wakes up from the event waiting state and establishes a connection.
FIG. 10 illustrates a flowchart of active connection processing by TCP / IP. When execution of the active connection API program is specified by the application program, the API program of the active connection request is called from the protocol stack, the IP address and port number of the partner port are set, and then the event waiting API program is executed. And wait for the connection establishment event to occur. When the event occurs, the user wakes up from the event waiting state and establishes a connection.
FIG. 11 illustrates a flowchart of data transmission processing by TCP / IP. The event waiting API program is executed to wait for the occurrence of a data reception event. When a data reception event occurs, it wakes up from the event waiting state, and the processing described in FIG. 5 is performed according to the application program, and the received page number and data length on the Ethernet device necessary for transmission are acquired from the
FIG. 12 illustrates a flowchart of forced disconnection for a TCP / IP connection. The
FIG. 13 illustrates a flowchart of normal disconnection for TCP / IP connection. The
Although the invention made by the present inventor has been specifically described based on the embodiments, the present invention is not limited thereto, and various modifications can be made without departing from the scope of the invention.
For example, the storage capacities of RAM and ROM are not limited to the above description and can be changed as appropriate. The microcomputer is a general term for a system-on-chip semiconductor integrated circuit having a CPU. The CPU is not limited to a 16-bit CPU, and may be a 32-bit CPU. In terms of usage, a CPU with a particularly high function is not necessary. Further, the type and processing contents of the protocol stack processing program can be changed as appropriate. Furthermore, task switching when part of the packet data is transferred from the buffer memory to the on-chip RAM is not limited to data reception interrupts, and may be performed in response to other task switch commands.
本発明は、ネットワーク家電や携帯端末等に代表される小規模でデータ処理性能が比較的低いシステムにおけるTCP/IPインタフェース等に広く適用することができる。 The present invention can be widely applied to a TCP / IP interface or the like in a small-scale system represented by a network home appliance or a portable terminal and having relatively low data processing performance.
Claims (12)
前記不揮発性メモリはオペレーティングシステムと、アプリケーションプログラムと、前記アプリケーションプログラムから呼び出されて実行されるTCP/IP用処理プログラムとが格納され、
前記TCP/IP用処理プログラムは、接続要求、イベント待ち、データ送信、及び接続切断の処理プログラムを有し、
前記中央処理装置は、前記イベント待ちの処理プログラムの実行中にタスクスイッチ指令に応答してパケットデータの送信先IPアドレスを含む一部のパケットデータを前記RAMに読み込み、当該パケットデータを必要とするときはイベント待ちの処理プログラムの実行を終了し、前記アプリケーションプログラムを実行して前記パケットデータに含まれるデータ部を前記RAMに取り込むことを特徴とするマイクロコンピュータ。A microcomputer including a central processing unit, a RAM and a non-volatile memory and formed on one semiconductor chip,
The nonvolatile memory stores an operating system, an application program, and a TCP / IP processing program that is called and executed from the application program,
The TCP / IP processing program includes a connection request, event waiting, data transmission, and connection disconnection processing program,
The central processing unit reads a part of the packet data including the destination IP address of the packet data in response to a task switch instruction during the execution of the event waiting processing program to the RAM, and requires the packet data microcomputer, wherein the capturing ends the execution of the event waiting processing program, the data unit contained in the said packet data execute the application program to the RAM when.
前記不揮発性メモリはオペレーティングシステムと、アプリケーションプログラムと、前記アプリケーションプログラムから呼び出されて実行されるTCP/IP用処理プログラムとが格納され、
前記RAMはCPUがプログラムを実行するときのワーク領域に用いられ、
前記TCP/IP用処理プログラムは、サービス開始、接続要求、イベント待ち、データ送信、及び接続切断の処理プログラムを有し、
前記イベント待ちの処理プログラムは、外部に接続される通信デバイスからのパケットデータの受信割込信号に応答し、前記通信デバイスからパケットデータに含まれる送信先IPアドレス情報を含む一部のデータを前記RAMに取り込み、前記取り込んだデータから、前記パケットデータが前記マイクロコンピュータが受信すべきデータであるかを判定し、
前記アプリケーションプログラムは、前記イベント待ち処理プログラムの実行によって、前記マイクロコンピュータが受信すべきデータであると判定した場合、前記パケットデータに含まれるデータ部を前記RAMに取り込み、所定のデータ処理を行うことを特徴とするマイクロコンピュータ。A microcomputer including a central processing unit, a RAM and a non-volatile memory and formed on one semiconductor chip,
The nonvolatile memory stores an operating system, an application program, and a TCP / IP processing program that is called and executed from the application program,
The RAM is used as a work area when the CPU executes a program,
The TCP / IP for processing program, service start, the connection request, an event waiting, have a data transmission, and disconnection processing program,
The event waiting processing program responds to a reception interrupt signal of packet data from a communication device connected to the outside, and receives a part of data including transmission destination IP address information included in the packet data from the communication device. Fetching into RAM, determining from the fetched data whether the packet data is to be received by the microcomputer;
When the application program determines that the data to be received by the microcomputer by executing the event waiting process program, the application program fetches the data portion included in the packet data into the RAM and performs predetermined data processing. A microcomputer characterized by.
前記オンチップRAMに格納された前記所定の部分のデータを検査することで、対応パケットが必要か否かを判定する第2処理と、
前記第2処理で前記パケットデータが必要と判定された場合、前記バッファメモリから前記パケットデータのデータ部を前記オンチップRAMに格納する第3処理と、を含むことを特徴とするデータ受信方法。A first process of reading data of a predetermined portion of packet data including the protocol type, transmission destination IP address or port number of the packet data stored in the buffer memory of the communication device and storing it in the on-chip RAM of the microcomputer;
A second process for determining whether or not a corresponding packet is necessary by inspecting data of the predetermined portion stored in the on-chip RAM;
If it said packet data in the second process is determined to be necessary, the data receiving method, which comprises a third process of storing in the on-chip RAM data portion of the packet data from the buffer memory.
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/JP2003/016855 WO2005066807A1 (en) | 2003-12-26 | 2003-12-26 | Microcomputer and data receiving method |
Publications (2)
Publication Number | Publication Date |
---|---|
JPWO2005066807A1 JPWO2005066807A1 (en) | 2007-07-26 |
JP4252577B2 true JP4252577B2 (en) | 2009-04-08 |
Family
ID=34746760
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2005513090A Expired - Lifetime JP4252577B2 (en) | 2003-12-26 | 2003-12-26 | Microcomputer and data receiving method |
Country Status (2)
Country | Link |
---|---|
JP (1) | JP4252577B2 (en) |
WO (1) | WO2005066807A1 (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003518788A (en) * | 1999-10-22 | 2003-06-10 | ローク マナー リサーチ リミテッド | Fully integrated web-operated control and monitoring device |
DE50013558D1 (en) * | 2000-02-23 | 2006-11-16 | Tektronix Berlin Gmbh & Co Kg | Device for constructing a protocol stack and associated method |
KR20030080443A (en) * | 2002-04-08 | 2003-10-17 | (주) 위즈네트 | Internet protocol system using hardware protocol processing logic and the parallel data processing method using the same |
JP3819804B2 (en) * | 2002-05-09 | 2006-09-13 | 日本電信電話株式会社 | Communication system using network interface having IP network connection function and apparatus thereof |
-
2003
- 2003-12-26 JP JP2005513090A patent/JP4252577B2/en not_active Expired - Lifetime
- 2003-12-26 WO PCT/JP2003/016855 patent/WO2005066807A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
JPWO2005066807A1 (en) | 2007-07-26 |
WO2005066807A1 (en) | 2005-07-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3955876B2 (en) | Microcomputer and system program development method | |
US6954806B2 (en) | Data transfer apparatus and method | |
WO2002069157A1 (en) | A subsystem boot and peripheral data transfer architecture for a subsystem of a system-on-chip | |
WO2014180110A9 (en) | Data processing apparatus and data processing method | |
US6810444B2 (en) | Memory system allowing fast operation of processor while using flash memory incapable of random access | |
JP2004503855A (en) | Integrated processor platform supporting wireless portable multimedia devices | |
US20080279098A1 (en) | Wireless Receiver Code Download and Boot Sequence | |
US6687763B2 (en) | ATAPI command receiving method | |
JP2007027951A (en) | Dma controller and communication processing apparatus | |
JP4252577B2 (en) | Microcomputer and data receiving method | |
US20060184708A1 (en) | Host controller device and method | |
US20050246500A1 (en) | Method, apparatus and system for an application-aware cache push agent | |
US20110222397A1 (en) | Packet buffering based at least in part upon packet receipt time interval weighted moving average | |
WO2023240941A1 (en) | Method and apparatus for downloading data, and secure element | |
Ribeiro et al. | Deploying a Real-Time Operating System on a Reconfigurable Internet of Things End-device | |
JP2002207715A (en) | Micro-computer, and method of controlling memory used therefor | |
Rajbharti | The Microchip TCP/IP Stack | |
US7793006B2 (en) | Method and apparatus for managing reconfiguration data memory with a preservation data storing buffer in the target system and server | |
Artail | A distributed system of network-enabled microcontrollers for controlling and monitoring home devices | |
JP2010262663A (en) | Memory interface device, memory interface method and modem device | |
JP3867911B2 (en) | State transition type communication processing apparatus and processing method | |
WO2009125664A1 (en) | Communication protocol processing circuit, communication protocol processing method, and communication terminal | |
WO2002075568A1 (en) | A method and a single chip system capable of loading and running specific operating system | |
JP2005242929A (en) | Accessing method for shared memory and data processor | |
JP2009217336A (en) | Computer system, network boot load system, and its boot load method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20081014 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20081215 |
|
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: 20090120 |
|
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: 20090121 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 4252577 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120130 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120130 Year of fee payment: 3 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313111 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120130 Year of fee payment: 3 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130130 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130130 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140130 Year of fee payment: 5 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313113 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313111 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313111 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
EXPY | Cancellation because of completion of term |