JP2012003673A - Inter-cpu communication system and inter-cpu communication method - Google Patents

Inter-cpu communication system and inter-cpu communication method Download PDF

Info

Publication number
JP2012003673A
JP2012003673A JP2010140383A JP2010140383A JP2012003673A JP 2012003673 A JP2012003673 A JP 2012003673A JP 2010140383 A JP2010140383 A JP 2010140383A JP 2010140383 A JP2010140383 A JP 2010140383A JP 2012003673 A JP2012003673 A JP 2012003673A
Authority
JP
Japan
Prior art keywords
cpu
data
memory
state
unit
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.)
Granted
Application number
JP2010140383A
Other languages
Japanese (ja)
Other versions
JP5511538B2 (en
Inventor
Shinichi Ochiai
真一 落合
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2010140383A priority Critical patent/JP5511538B2/en
Publication of JP2012003673A publication Critical patent/JP2012003673A/en
Application granted granted Critical
Publication of JP5511538B2 publication Critical patent/JP5511538B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To optimally control weight processing in inter-CPU communication depending on waiting time of synchronization.SOLUTION: In an inter-CPU communication system 800 in which a transmission side CPU and a reception side CPU perform data communication with each other through a memory 104, the transmission side CPU includes: a memory area determination part 351 for determining whether a free space exists in the memory 104; a data writing part 352 for writing data in the memory 104, when a free space exists; the reception side CPU determination part 353 for determining a state of the reception side CPU, when a free space does not exist; and a transmission side control part 354 for instructing the data writing part 352 to be in a waiting state until a free space in the memory 104 is available when a state of the reception side CPU is in an execution state of data reading processing, and transmitting a reading start request to the reception side CPU to instruct the reception side CPU to start execution of the data reading processing when a state of the reception side CPU is not in an execution state of the data reading processing.

Description

本発明は、複数のCPU(Central・Processing・Unit:中央処理装置)がメモリを介して通信するCPU間通信システム及びCPU間通信方法に関する。   The present invention relates to an inter-CPU communication system and an inter-CPU communication method in which a plurality of CPUs (Central Processing Units) communicate via a memory.

従来、複数のCPUがメモリを介してデータ通信を行うCPU間通信方式では、CPU間に専用のFIFOメモリを付加することにより、CPU間通信の制御を簡略化する方式が提案されている(例えば、特許文献1)。また、CPU間通信に使用する共有メモリの使用状態を示すフラグを付加することにより、送信開始および受信完了に必要となる2回のCPU間割込を、1回のCPU間割込のみにする方式も提案されている(例えば、特許文献2)。   Conventionally, in an inter-CPU communication method in which a plurality of CPUs perform data communication via a memory, a method has been proposed that simplifies control of inter-CPU communication by adding a dedicated FIFO memory between the CPUs (for example, Patent Document 1). Also, by adding a flag indicating the use state of the shared memory used for inter-CPU communication, the two inter-CPU interrupts required for the start of transmission and the completion of reception are limited to one inter-CPU interrupt. A method has also been proposed (for example, Patent Document 2).

特開昭58−169277号公報JP 58-169277 A 特開平05−081185号公報JP 05-081185 A

従来の方式では、FIFO(First−In・First−Out)メモリを使用した場合でも、共有メモリを使用した場合でも、CPU間で同期を取るためにCPU間割込を使用する。半導体技術の進歩によるCPU数の増加、CPUクロックの向上、メモリ速度の向上で、CPUの演算処理自体は極めて高速に実行されるようになった。しかし、CPUの演算処理と比較して割込処理は高速化できていない。そのため、CPU間通信の同期にCPU間割込を使うと大きな遅延が発生し、複数CPUの並行実行による高速性が活かせないという課題がある。また、CPU間の同期に割込でなくビジーループを使用すると、CPU間通信以外の他の処理を行うことができなくなるという課題がある。   In the conventional system, even when a FIFO (First-In First-Out) memory is used or a shared memory is used, an inter-CPU interrupt is used to synchronize between CPUs. With the increase in the number of CPUs, the improvement in CPU clock, and the improvement in memory speed due to advances in semiconductor technology, the CPU arithmetic processing itself has been executed at a very high speed. However, the interrupt processing cannot be accelerated compared with the CPU arithmetic processing. Therefore, when an inter-CPU interrupt is used for synchronization of inter-CPU communication, a large delay occurs, and there is a problem that high speed due to parallel execution of a plurality of CPUs cannot be utilized. Further, when a busy loop is used for synchronization between CPUs instead of interrupts, there is a problem that it is impossible to perform processing other than communication between CPUs.

本発明は、上記のような課題を解決するためになされたもので、CPU間通信による遅延時間を短縮すると共に、同期の待ち時間に応じて段階的にウェイト処理を最適に制御できるようにすることを目的とする。   The present invention has been made in order to solve the above-described problems, and reduces the delay time due to inter-CPU communication and enables optimal control of wait processing in stages according to the synchronization waiting time. For the purpose.

本発明に係るCPU間通信システムは、データを送信する送信側CPUとデータを受信する受信側CPUとにより共有されるメモリを介して、前記送信側CPUと前記受信側CPUとの間でデータの通信を行うCPU間通信システムにおいて、
前記送信側CPUは、
前記メモリに空き領域があるか否かを判定するメモリ領域判定部と、
前記メモリ領域判定部により前記メモリに空き領域があると判定された場合に、前記メモリにデータを書き込むデータ書き込み処理を実行するデータ書き込み部と、
前記メモリ領域判定部が前記メモリに空き領域がないと判定した場合に、前記受信側CPUの状態を判定する受信側CPU判定部と、
前記受信側CPU判定部により前記受信側CPUの状態が前記メモリからデータを読み出すデータ読み出し処理の実行状態であると判定された場合に、前記メモリに空き領域ができるまで前記データ書き込み部をデータ書き込み処理の待ち状態とし、前記受信側CPU判定部により前記受信側CPUの状態がデータ読み出し処理の実行状態でないと判定された場合に、前記受信側CPUにデータ読み出し処理の実行を開始させるための読み出し開始要求を前記受信側CPUへ送信する送信側制御部と
を備えることを特徴とする。
In the inter-CPU communication system according to the present invention, data is transmitted between the transmitting CPU and the receiving CPU via a memory shared by a transmitting CPU that transmits data and a receiving CPU that receives data. In an inter-CPU communication system that performs communication,
The sending CPU is
A memory area determination unit that determines whether or not there is a free area in the memory;
A data writing unit that executes a data writing process for writing data to the memory when the memory region determining unit determines that there is a free space in the memory;
A receiving-side CPU determining unit that determines a state of the receiving-side CPU when the memory region determining unit determines that there is no free space in the memory;
When the receiving CPU determination unit determines that the state of the receiving CPU is an execution state of a data read process for reading data from the memory, the data writing unit writes data until there is a free space in the memory. Reading to cause the receiving CPU to start executing the data reading process when the receiving CPU determining unit determines that the receiving CPU state is not the execution state of the data reading process. And a transmission-side control unit that transmits a start request to the reception-side CPU.

送信側CPUと受信側CPUとがメモリを介して通信を行うCPU間通信システムにおいて、送信側CPUは、メモリに空き領域があるかを判定するメモリ領域判定部と、空き領域がある場合に、メモリにデータを書き込むデータ書き込み部と、空き領域がない場合に、受信側CPUの状態を判定する受信側CPU判定部と、受信側CPUの状態がデータ読み出し処理の実行状態である場合に、メモリに空き領域ができるまでデータ書き込み部を待ち状態とし、受信側CPUの状態がデータ読み出し処理の実行状態でない場合に、受信側CPUにデータ読み出し処理の実行を開始させるための読み出し開始要求を受信側CPUへ送信する送信側制御部とを備えるので、受信側CPUの状態に応じてメモリの空き領域待ちの待ち状態を選択することができるので、CPU間通信時の待ち状態による遅延時間を短縮することができる。   In the inter-CPU communication system in which the transmission side CPU and the reception side CPU communicate with each other via the memory, the transmission side CPU has a memory area determination unit that determines whether there is an empty area in the memory, A data writing unit for writing data to the memory, a receiving side CPU determining unit for determining the state of the receiving side CPU when there is no free space, and a memory for when the state of the receiving side CPU is an execution state of the data reading process The data writing unit is put in a waiting state until a free space is created in the receiver, and when the receiving CPU is not in the data reading process execution state, a read start request is issued to cause the receiving CPU to start executing the data reading process. And a transmission side control unit for transmission to the CPU, so that a waiting state for waiting for a free area in the memory is selected according to the state of the reception side CPU. Since bets can, it is possible to reduce the delay time due to the wait state for communication between CPU.

実施の形態1に係るCPU間通信システム800のシステム構成図である。1 is a system configuration diagram of an inter-CPU communication system 800 according to Embodiment 1. FIG. 実施の形態1に係るCPU間通信システム800の機能ブロック図である。3 is a functional block diagram of an inter-CPU communication system 800 according to Embodiment 1. FIG. 実施の形態1に係るCPU間通信システム800のハードウェア構成の一例を示す図である。3 is a diagram illustrating an example of a hardware configuration of an inter-CPU communication system 800 according to Embodiment 1. FIG. 実施の形態1に係るCPU間通信システム800における送信側CPUの送信側CPU間通信制御処理(データ送信処理)を示すフローチャートである。7 is a flowchart showing a transmission-side inter-CPU communication control process (data transmission process) of the transmission-side CPU in the inter-CPU communication system 800 according to the first embodiment. 実施の形態1に係るCPU間通信システム800における送信側CPUの送信側CPU間通信制御処理(データ送信処理)の他の例を示すフローチャートである。12 is a flowchart illustrating another example of a transmission-side CPU communication control process (data transmission process) of a transmission-side CPU in the inter-CPU communication system 800 according to Embodiment 1. 実施の形態1に係る受信側CPUのCPU間通信制御部321による受信側CPU間通信制御処理を示すフローチャートである。4 is a flowchart showing a receiving-side CPU communication control process by the receiving-CPU communication control unit 321 of the receiving CPU according to Embodiment 1; 実施の形態2に係るCPU間通信制御部321の送信側CPU通信制御処理を示すフローチャートである。10 is a flowchart showing a transmission side CPU communication control process of an inter-CPU communication control unit 321 according to the second embodiment. 実施の形態2のCPU間通信制御部321の送信側CPU間通信制御処理がビジーループによるウェイト状態の場合のみに継続フラグ311がセットされる処理である場合を示すフローチャートである。10 is a flowchart illustrating a case where a continuation flag 311 is set only when the transmission-side CPU communication control process of the CPU-CPU communication control unit 321 according to the second embodiment is in a wait state due to a busy loop. 実施の形態3におけるCPU間通信システム800のブロック構成図である。FIG. 10 is a block configuration diagram of an inter-CPU communication system 800 in a third embodiment. 実施の形態3に係るCPU間通信システム800の送信側スケジューリング制御方法(送信側スケジューリング制御処理)のフローチャートである。12 is a flowchart of a transmission side scheduling control method (transmission side scheduling control process) of the inter-CPU communication system 800 according to Embodiment 3. 実施の形態3に係るCPU間通信システム800の受信側スケジューリング制御方法(受信側スケジューリング制御処理)のフローチャートである。10 is a flowchart of a receiving side scheduling control method (receiving side scheduling control process) of the inter-CPU communication system 800 according to the third embodiment. 実施の形態3に係るタイムアウト時間決定処理の動作を示すフロー図である。FIG. 10 is a flowchart showing an operation of timeout time determination processing according to the third embodiment. 実施の形態4におけるCPU間通信システム800の機能ブロック図である。FIG. 10 is a functional block diagram of an inter-CPU communication system 800 in a fourth embodiment. 実施の形態4におけるCPU間通信システム800の送信側CPU間通信方法の一例を示すフロー図である。FIG. 10 is a flowchart showing an example of a transmission-side inter-CPU communication method of an inter-CPU communication system 800 in a fourth embodiment. 実施の形態4におけるCPU間通信システム800の受信側CPU間通信方法の一例を示すフロー図である。FIG. 10 is a flowchart showing an example of a receiving-side inter-CPU communication method of an inter-CPU communication system 800 in a fourth embodiment. 実施の形態5に係る非対称型マルチCPU構成を備えるCPU間通信システムの構成図である。FIG. 9 is a configuration diagram of an inter-CPU communication system having an asymmetric multi-CPU configuration according to a fifth embodiment.

実施の形態1.
図1は、実施の形態1に係るCPU間通信システム800のシステム構成図である。図1を用いて、CPU間通信システム800のシステム構成について説明する。本実施の形態では、CPU間通信システム800は、複数のCPUがメモリを介してデータ通信を行う対称型マルチCPUシステムである。また、CPU間通信システム800を備える装置(計算機、コンピュータ装置)を想定している。
Embodiment 1 FIG.
FIG. 1 is a system configuration diagram of an inter-CPU communication system 800 according to the first embodiment. A system configuration of the inter-CPU communication system 800 will be described with reference to FIG. In the present embodiment, the inter-CPU communication system 800 is a symmetric multi-CPU system in which a plurality of CPUs perform data communication via a memory. Further, an apparatus (computer, computer apparatus) including the inter-CPU communication system 800 is assumed.

CPU間通信システム800は、複数のCPU(CPU101(CPU#0),CPU102(CPU#1),CPU103(CPU#n))、メモリ104、IOデバイス105、バス111を備えている。図1では、CPU間通信システム800は、3個のCPU101,102,103を備えているが、これに限られず、2個以上の複数個のCPUであればCPUをいくつ備えていてもよい。メモリ104は、CPU間通信システム800の備える全てのCPUからアクセスすることができる共有メモリである。また、IOデバイス105は、CPU間通信システム800の備える全てのCPUからアクセスすることができる共有のIOデバイスである。バス111は、CPU間通信システム800の備える全てのCPU101,102,103、メモリ104、IOデバイス105を接続するバスである。   The inter-CPU communication system 800 includes a plurality of CPUs (CPU 101 (CPU # 0), CPU 102 (CPU # 1), CPU 103 (CPU #n)), a memory 104, an IO device 105, and a bus 111. In FIG. 1, the inter-CPU communication system 800 includes three CPUs 101, 102, and 103. However, the present invention is not limited to this, and any number of CPUs may be provided as long as the number of CPUs is two or more. The memory 104 is a shared memory that can be accessed from all the CPUs included in the inter-CPU communication system 800. The IO device 105 is a shared IO device that can be accessed from all the CPUs included in the inter-CPU communication system 800. The bus 111 is a bus that connects all the CPUs 101, 102, 103, the memory 104, and the IO device 105 included in the inter-CPU communication system 800.

CPU間通信システム800の備える複数のCPU101,102,103は、メモリ104を介して互いにデータのやりとりを行う。CPU間通信システム800は、データを送信する送信側CPUとデータを受信する受信側CPUとにより共有されるメモリ104を介して、送信側CPUと受信側CPUとの間でデータの通信を行うCPU間通信システムの一例である。CPU間通信システム800(CPU間通信システム)は、後述するCPU間通信方式が動作するシステムである。   The plurality of CPUs 101, 102, and 103 included in the inter-CPU communication system 800 exchange data with each other via the memory 104. The inter-CPU communication system 800 is a CPU that performs data communication between a transmission-side CPU and a reception-side CPU via a memory 104 that is shared by a transmission-side CPU that transmits data and a reception-side CPU that receives data. It is an example of an inter-communication system. The inter-CPU communication system 800 (inter-CPU communication system) is a system in which an inter-CPU communication method described later operates.

図2は、実施の形態1に係るCPU間通信システム800の機能ブロック図である。図2を用いて、CPU101及びメモリ104の機能ブロックについて説明する。CPU間通信システム800の備えるCPU101,102,103は、全て同様の構成(CPU101と同様の構成)を備えるものとする。CPU101は、データを送信する場合は送信側CPUとして動作し、データを受信する場合は受信側CPUとして動作する。   FIG. 2 is a functional block diagram of the inter-CPU communication system 800 according to the first embodiment. The function blocks of the CPU 101 and the memory 104 will be described with reference to FIG. It is assumed that the CPUs 101, 102, and 103 included in the inter-CPU communication system 800 have the same configuration (the same configuration as the CPU 101). The CPU 101 operates as a transmitting CPU when transmitting data, and operates as a receiving CPU when receiving data.

CPU101は、CPU101で動作するオペレーションシステム(OS301)、OS301により動作するタスク302,303,304、CPU間割込レジスタ308、タイマレジスタ309、CPU間通信制御部321を備える。   The CPU 101 includes an operation system (OS 301) that operates on the CPU 101, tasks 302, 303, and 304 that operate on the OS 301, an inter-CPU interrupt register 308, a timer register 309, and an inter-CPU communication control unit 321.

CPU間割込レジスタ308は、後述するCPU間割込を発生させる処理に使用される。タイマレジスタ309は、後述する時間計測および指定時間経過割込を発生させる処理に使用される。   The inter-CPU interrupt register 308 is used for processing for generating an inter-CPU interrupt described later. The timer register 309 is used for processing for generating time measurement and a specified time lapse interrupt, which will be described later.

CPU間通信制御部321は、メモリ104を介して行われるCPU間のデータ通信を制御する。CPU間通信制御部321は、ハングオン制御部322を備える。   The inter-CPU communication control unit 321 controls data communication between CPUs performed via the memory 104. The inter-CPU communication control unit 321 includes a hang-on control unit 322.

ハングオン制御部322は、CPU101がデータを送信する側のCPU(以下、送信側CPUという)となる場合、すなわちCPU101が送信側CPUとなる場合に次のような機能を実行する。すなわち、ハングオン制御部322は、以下の機能ブロックを備える。   The hang-on control unit 322 performs the following functions when the CPU 101 becomes a CPU that transmits data (hereinafter referred to as a transmission-side CPU), that is, when the CPU 101 becomes a transmission-side CPU. That is, the hang-on control unit 322 includes the following functional blocks.

送信側CPUは、
(1)メモリ104に空き領域があるか否かを判定するメモリ領域判定部351;
(2)メモリ領域判定部351によりメモリ104に空き領域があると判定された場合に、メモリ104にデータを書き込むデータ書き込み処理を実行するデータ書き込み部352;
(3)メモリ領域判定部351がメモリ104に空き領域がないと判定した場合に、受信側のCPU(受信側CPU)の状態を判定する受信側CPU判定部353;
(4)受信側CPU判定部353により受信側CPUの状態がメモリ104からデータを読み出すデータ読み出し処理の実行状態であると判定された場合に、メモリ104に空き領域ができるまでデータ書き込み部352をデータ書き込み処理の待ち状態とし、受信側CPU判定部353により受信側CPUの状態がデータ読み出し処理の実行状態でないと判定された場合に、受信側CPUにデータ読み出し処理の実行を開始させるための読み出し開始要求を受信側のCPUへ送信する送信側制御部354;
を備える。
The sending CPU
(1) A memory area determination unit 351 that determines whether or not there is an empty area in the memory 104;
(2) A data writing unit 352 that executes a data writing process for writing data to the memory 104 when the memory region determining unit 351 determines that there is an empty area in the memory 104;
(3) A reception-side CPU determination unit 353 that determines the state of the reception-side CPU (reception-side CPU) when the memory region determination unit 351 determines that there is no free space in the memory 104;
(4) When the receiving CPU determination unit 353 determines that the state of the receiving CPU is an execution state of the data reading process for reading data from the memory 104, the data writing unit 352 is used until the memory 104 has a free space. Reading to make the receiving CPU start executing the data reading process when the receiving CPU determining unit 353 determines that the receiving CPU is not in the data reading process execution state. A transmission side control unit 354 that transmits a start request to the CPU on the reception side;
Is provided.

送信側制御部354は、受信側CPU判定部353により受信側CPUの状態がデータ読み出し処理の実行状態であると判定された場合に、メモリ104に空き領域ができるまでデータ書き込み部352をビジーウェイトさせる(ビジーループさせる)ことによりデータ書き込み処理の待ち状態とする。また、送信側制御部354は、受信側CPU判定部353により受信側CPUの状態がデータ読み出し処理の実行状態でないと判定された場合に、受信側CPUにデータ読み出し処理の実行を開始させるための読み出し開始要求を受信側CPUへCPU間割込により送信する。送信側制御部354は、読み出し開始要求を受信側CPUへCPU間割込で送信した後、データ書き込み処理をCPU間割込でウェイトする状態(すなわち、後述する送信待ちセマフォ306によるウェイト状態)とする。   When the receiving CPU determining unit 353 determines that the receiving CPU state is the execution state of the data reading process, the transmitting control unit 354 causes the data writing unit 352 to wait busy until the memory 104 has a free space. By making it (busy loop), the data write processing is waited. The transmission-side control unit 354 causes the reception-side CPU to start executing the data reading process when the reception-side CPU determination unit 353 determines that the state of the reception-side CPU is not the execution state of the data reading process. A read start request is transmitted to the receiving CPU by inter-CPU interruption. The transmission-side control unit 354 transmits a read start request to the reception-side CPU by an inter-CPU interrupt, and then waits for a data write process by an inter-CPU interrupt (that is, a wait state by a transmission waiting semaphore 306 described later) To do.

また、ハングオン制御部322は、CPU101がデータを受信する側のCPU(以下、受信側CPUという)となる場合、すなわちCPU101が受信側CPUとなる場合に次のような機能を実行する。すなわち、ハングオン制御部322は、以下の機能ブロックを備える。   The hang-on control unit 322 performs the following functions when the CPU 101 is a CPU that receives data (hereinafter referred to as a receiving CPU), that is, when the CPU 101 is a receiving CPU. That is, the hang-on control unit 322 includes the following functional blocks.

受信側CPUは、
(1)メモリ104にデータが格納されているか否かを判定するメモリ状態判定部361;
(2)メモリ状態判定部361によりメモリ104にデータが格納されていると判定された場合に、メモリ104からデータを読み出すデータ読み出し処理を実行するデータ読み出し部362;
(3)メモリ状態判定部361によりメモリ104にデータが格納されていないと判定された場合に、送信側CPUの状態を判定する送信側CPU判定部363;
(4)送信側CPU判定部363により送信側CPUの状態がデータ書き込み処理の実行状態であると判定された場合に、メモリ104にデータが格納されるまでデータ読み出し部362をデータ読み出し処理の待ち状態とし、送信側CPU判定部363により送信側CPUの状態がデータ書き込み処理の実行状態でないと判定された場合に、データ書き込み部352にデータ書き込み処理の実行を開始させるための書き込み開始要求を送信側CPUへ送信する受信側制御部364;
を備える。
The receiving CPU
(1) a memory state determination unit 361 that determines whether data is stored in the memory 104;
(2) a data read unit 362 that executes a data read process for reading data from the memory 104 when the memory state determination unit 361 determines that data is stored in the memory 104;
(3) A transmission side CPU determination unit 363 that determines the state of the transmission side CPU when the memory state determination unit 361 determines that no data is stored in the memory 104;
(4) When the transmission side CPU determination unit 363 determines that the state of the transmission side CPU is the execution state of the data writing process, the data reading unit 362 waits for the data reading process until the data is stored in the memory 104. When the transmission side CPU determination unit 363 determines that the state of the transmission side CPU is not the execution state of the data write process, a write start request for starting the execution of the data write process is transmitted to the data write unit 352 Receiving side control unit 364 for transmitting to the side CPU;
Is provided.

受信側制御部364は、送信側CPU判定部363により送信側CPUの状態がデータ書き込み処理の実行状態であると判定された場合に、メモリ104にデータが格納されるまでデータ読み出し部362をビジーウェイトさせる(ビジーループさせる)ことによりデータ読み出し処理の待ち状態とする。また、受信側制御部364は、送信側CPU判定部363により送信側CPUの状態がデータ書き込み処理の実行状態でないと判定された場合に、データ書き込み部352にデータ書き込み処理の実行を開始させるための書き込み開始要求を送信側CPUへCPU間割込により送信する。受信側制御部364は、書き込み開始要求を送信側CPUへCPU間割込で送信した後、データ読み出し処理をCPU間割込でウェイトする状態(すなわち、後述する受信待ちセマフォ307によるウェイト状態)とする。   When the transmission side CPU determination unit 363 determines that the state of the transmission side CPU is the execution state of the data writing process, the reception side control unit 364 keeps the data reading unit 362 busy until data is stored in the memory 104. By waiting (busy loop), the data read processing is waited. In addition, when the transmission side CPU determination unit 363 determines that the state of the transmission side CPU is not the execution state of the data writing process, the reception side control unit 364 causes the data writing unit 352 to start executing the data writing process. Is sent to the sending CPU by an inter-CPU interrupt. The reception-side control unit 364 transmits a write start request to the transmission-side CPU by an inter-CPU interrupt, and waits for a data read process by an inter-CPU interrupt (that is, a wait state by a reception waiting semaphore 307 described later). To do.

送信側制御部354及び受信側制御部364は、通信相手が通信処理実行中の場合は早期に待ち状態が解除になると見込んでビジーループで待ち、通信相手がスリープ状態かセマフォによるウェイト状態(すなわち、スリープ状態)の場合は、CPU間割込により通知してから自己をセマフォによるウェイト状態とする。これにより、データフル解除までの時間やデータエンプティ解除までの時間が短時間と予想されるときはビジーループで待ち、データフル解除までの時間やデータエンプティ解除までの時間に遅延が生じると見込まれるときは、CPU間割込でウェイトする状態(セマフォによるウェイト状態)となるように制御することができる。ここで、データフル解除とは、メモリに空き領域ができることであり、データエンプティ解除とはメモリにデータが格納されることである。   The transmission side control unit 354 and the reception side control unit 364 expect that the waiting state will be released early when the communication partner is executing communication processing, and wait in a busy loop, and the communication partner is in a sleep state or a semaphore wait state (that is, In the case of (sleep state), after notifying by an interrupt between CPUs, it sets itself to a wait state by a semaphore. As a result, when it is expected that the time until the data full release or the time until the data empty release is short, wait in the busy loop, and the time until the data full release or the time until the data empty release is expected to be delayed. Can be controlled to be in a state of waiting by an inter-CPU interrupt (wait state by a semaphore). Here, the data full release means that a free area is created in the memory, and the data empty release means that data is stored in the memory.

メモリ104は、通信用メモリ305、送信待ちセマフォ306、受信待ちセマフォ307、継続フラグ311、レディフラグ312を備える。   The memory 104 includes a communication memory 305, a transmission waiting semaphore 306, a reception waiting semaphore 307, a continuation flag 311, and a ready flag 312.

通信用メモリ305は、メモリ104上のメモリであって、CPU間のデータ通信のためのメモリである。送信側CPUは送信するデータをメモリ104に書き込むことにより送信し、受信側CPUはメモリ104に書き込まれたデータを読み出すことにより受信する。つまり、送信側CPUと受信側CPUとはメモリ104を介してデータの送受信(通信)を行う。   The communication memory 305 is a memory on the memory 104, and is a memory for data communication between CPUs. The transmission side CPU transmits the data to be transmitted by writing it in the memory 104, and the reception side CPU receives the data by reading the data written in the memory 104. That is, the transmitting CPU and the receiving CPU perform data transmission / reception (communication) via the memory 104.

送信待ちセマフォ306は、通信用メモリに空き領域がなくなった(データフル状態)場合に、送信側CPUがCPU間割込(受信側CPUから送信側CPUに送信されるデータ書き込み処理をさせるための割込)を受信するまでデータ書き込み処理をウェイトするために使用するセマフォ変数である。   The transmission waiting semaphore 306 is used for causing the sending CPU to perform an inter-CPU interrupt (data writing process transmitted from the receiving CPU to the sending CPU) when there is no free space in the communication memory (data full state). This is a semaphore variable used to wait for data write processing until an interrupt is received.

受信待ちセマフォ307は、通信用メモリにデータが格納されていない(データエンプティ状態)場合に、受信側CPUがCPU間割込(送信側CPUから受信側CPUに送信されるデータ読み出し処理をさせるための割込)を受信するまでデータ読み出し処理をウェイトするために使用するセマフォ変数である。   The reception waiting semaphore 307 causes the receiving CPU to perform an inter-CPU interruption (data reading process transmitted from the transmitting CPU to the receiving CPU) when data is not stored in the communication memory (in a data empty state). This is a semaphore variable used to wait for the data reading process until it receives an interrupt.

送信待ちセマフォ306あるいは受信待ちセマフォ307を用いたセマフォによるウェイトの場合、ウェイトするタスクは一旦CPUを放棄し、他の実行可能なタスクに実行をスイッチする。このとき、セマフォ(送信待ちセマフォ306あるいは受信待ちセマフォ307)はデータ書き込み処理、あるいは、データ読み出し処理を実行できないことを示す値(例えば、値ゼロ)に設定されている。この状態でCPU間割込を受信すると、対応するセマフォ(送信待ちセマフォ306あるいは受信待ちセマフォ307)がカウントアップされ、対応するセマフォでウェイトしているタスク(データ書き込み処理のタスク、あるいは、データ読み出し処理のタスク)が実行可能状態になり、OS301により再スケジューリングされ再開される。タスクが処理待ち状態であるか否かはOS301が管理している。   In the case of a semaphore wait using the transmission waiting semaphore 306 or the reception waiting semaphore 307, the task to be waited once abandons the CPU and switches execution to another executable task. At this time, the semaphore (the transmission waiting semaphore 306 or the reception waiting semaphore 307) is set to a value (for example, value zero) indicating that the data writing process or the data reading process cannot be executed. When an inter-CPU interrupt is received in this state, the corresponding semaphore (transmission wait semaphore 306 or reception wait semaphore 307) is counted up, and the task waiting for the corresponding semaphore (data write processing task or data read) The processing task is ready to be executed, and is rescheduled and restarted by the OS 301. The OS 301 manages whether or not the task is waiting for processing.

継続フラグ311は、データ送信を継続的に行うことを示すフラグである。継続フラグ311は、送信側CPUの状態を示す送信側状態フラグの一例である。送信側CPU判定部363は、継続フラグ311に基づいて、送信側CPUの状態を判定する。送信側CPU判定部363は、例えば、継続フラグ311がオンの場合(継続フラグ311がセットされている場合)に送信側CPUがデータ書き込み処理の実行中(すなわち、データ送信を継続的に実行中)であると判定する。送信側CPUがデータ書き込み処理の実行中(すなわち、データ送信を継続的に実行中)であるとは、送信側CPUがビジーループでデータ書き込み処理の待ち状態である場合を含むものとする。   The continuation flag 311 is a flag indicating that data transmission is continuously performed. The continuation flag 311 is an example of a transmission side state flag indicating the state of the transmission side CPU. The transmission side CPU determination unit 363 determines the state of the transmission side CPU based on the continuation flag 311. For example, when the continuation flag 311 is on (when the continuation flag 311 is set), the transmission side CPU determination unit 363 is executing the data writing process (that is, continuously executing data transmission). ). The case where the transmission side CPU is executing the data writing process (that is, continuously executing the data transmission) includes the case where the transmission side CPU is in a busy loop and waiting for the data writing process.

また、送信側CPU判定部363は、例えば、継続フラグ311がオフの場合(継続フラグ311がクリアされている場合)に、送信側CPUがデータ書き込み処理の実行中でないと判定する。送信側CPUがデータ書き込み処理の実行中でないとは、データ書き込み部(データ書き込み処理)がスリープ中であるか、あるいは、データ書き込み部(データ書き込み処理)が送信待ちセマフォ306によるウェイト状態で他のタスクが実行中である場合を示している。ここでいう他のタスクとは、CPU間通信制御部321以外のタスク(例えば、タスク302,303,304等)を意味する。   For example, when the continuation flag 311 is off (when the continuation flag 311 is cleared), the transmission-side CPU determination unit 363 determines that the transmission-side CPU is not executing the data writing process. If the sending CPU is not executing the data writing process, the data writing unit (data writing process) is in the sleep state, or the data writing unit (data writing process) is in a wait state by the transmission waiting semaphore 306 and is in another state. Shows when the task is running. The other task here means a task other than the inter-CPU communication control unit 321 (for example, tasks 302, 303, 304, etc.).

レディフラグ312は、データ受信をビジーループでウェイトすることを示すフラグである。レディフラグ312は、受信側CPUの状態を示す受信側状態フラグの一例である。受信側CPU判定部353は、レディフラグ312に基づいて、受信側CPUの状態を判定する。受信側CPU判定部353は、例えば、レディフラグ312がオンの場合に受信側CPUがデータ読み出し処理の実行中(すなわち、データ受信を実行中)であると判定する。受信側CPUがデータ読み出し処理の実行中(すなわち、データ受信を実行中)であるとは、受信側CPUがビジーループでデータ読み出し処理の待ち状態である場合を含むものとする。   The ready flag 312 is a flag indicating that data reception is waited in a busy loop. The ready flag 312 is an example of a reception side state flag indicating the state of the reception side CPU. The reception side CPU determination unit 353 determines the state of the reception side CPU based on the ready flag 312. For example, when the ready flag 312 is on, the reception-side CPU determination unit 353 determines that the reception-side CPU is executing a data reading process (that is, executing data reception). The fact that the receiving CPU is executing the data reading process (that is, executing the data receiving) includes the case where the receiving CPU is in a busy loop and waiting for the data reading process.

また、受信側CPU判定部353は、例えば、レディフラグ312がオフの場合に、受信側CPUがデータ読み出し処理の実行中でないと判定する。受信側CPUがデータ読み出し処理の実行中でないとは、データ読み出し部(データ読み出し処理)がスリープ中であるか、あるいは、データ読み出し部(データ読み出し処理)が受信待ちセマフォ307によるウェイト状態で他のタスクが実行中である場合を示している。   Further, for example, when the ready flag 312 is off, the reception-side CPU determination unit 353 determines that the reception-side CPU is not executing the data reading process. When the receiving CPU is not executing the data reading process, the data reading unit (data reading process) is in the sleep state, or the data reading unit (data reading process) is in a wait state by the reception waiting semaphore 307 and is in another state. Shows when the task is running.

ビジーループとは、連続ループによる所定の値(例えば、メモリ104の状態を示すフラグ等の値)のチェックにより、上記所定の値の変更をウェイトする処理である。   The busy loop is a process of waiting for a change in the predetermined value by checking a predetermined value (for example, a value such as a flag indicating the state of the memory 104) by a continuous loop.

図3は、本実施の形態1に係るCPU間通信システム800のハードウェア構成の一例を示す図である。   FIG. 3 is a diagram illustrating an example of a hardware configuration of the inter-CPU communication system 800 according to the first embodiment.

図3は、以下の実施の形態に係るCPU間通信システム800を備える装置890のハードウェア資源の一例を示す図である。図3において、CPU間通信システム800を備える装置890は、プログラムを実行するCPU911(Central・Processing・Unit、中央処理装置、処理装置、演算装置、マイクロプロセッサ、マイクロコンピュータ、プロセッサともいう)を複数(CPU911(101),CPU911(102),CPU911(103))備えている。CPU911は、バス111を介してROM913、RAM914、通信ボード915、表示装置901、キーボード902、マウス903、FDD904、CDD905、プリンタ装置906、スキャナ装置907、磁気ディスク装置920と接続され、これらのハードウェアデバイスを制御する。これらのハードウェアデバイス(ROM913、RAM914、通信ボード915、表示装置901、キーボード902、マウス903、FDD904、CDD905、プリンタ装置906、スキャナ装置907、磁気ディスク装置920等)は、IOデバイス105の一例である。磁気ディスク装置920の代わりに、光ディスク装置、メモリカード読み書き装置などの記憶装置でもよい。   FIG. 3 is a diagram illustrating an example of hardware resources of the device 890 including the inter-CPU communication system 800 according to the following embodiment. In FIG. 3, an apparatus 890 including the inter-CPU communication system 800 includes a plurality of CPUs 911 (also referred to as a central processing unit, a central processing unit, a processing unit, an arithmetic unit, a microprocessor, a microcomputer, and a processor) that execute a program. CPU 911 (101), CPU 911 (102), CPU 911 (103)). The CPU 911 is connected to the ROM 913, the RAM 914, the communication board 915, the display device 901, the keyboard 902, the mouse 903, the FDD 904, the CDD 905, the printer device 906, the scanner device 907, and the magnetic disk device 920 via the bus 111. Control the device. These hardware devices (ROM 913, RAM 914, communication board 915, display device 901, keyboard 902, mouse 903, FDD 904, CDD 905, printer device 906, scanner device 907, magnetic disk device 920, etc.) are examples of the IO device 105. is there. Instead of the magnetic disk device 920, a storage device such as an optical disk device or a memory card read / write device may be used.

RAM914は、揮発性メモリの一例である。ROM913、FDD904、CDD905、磁気ディスク装置920の記憶媒体は、不揮発性メモリの一例である。これらは、記憶装置あるいは記憶部の一例である。   The RAM 914 is an example of a volatile memory. The storage media of the ROM 913, the FDD 904, the CDD 905, and the magnetic disk device 920 are an example of a nonvolatile memory. These are examples of a storage device or a storage unit.

通信ボード915、キーボード902、スキャナ装置907、FDD904、表示装置901などは、入力部、入力装置の一例である。また、入力装置としてタッチパネル等を備えていてもよい。また、通信ボード915、表示装置901、プリンタ装置906などは、出力部、出力装置の一例である。   The communication board 915, the keyboard 902, the scanner device 907, the FDD 904, the display device 901, and the like are examples of an input unit and an input device. Further, a touch panel or the like may be provided as an input device. Further, the communication board 915, the display device 901, the printer device 906, and the like are examples of an output unit and an output device.

通信ボード915は、ファクシミリ機、電話器、LAN等に接続されている。通信ボード915は、LANに限らず、インターネット、ISDN等のWAN(ワイドエリアネットワーク)などに接続されていても構わない。   The communication board 915 is connected to a facsimile machine, a telephone set, a LAN, and the like. The communication board 915 may be connected not only to the LAN but also to a WAN (wide area network) such as the Internet or ISDN.

磁気ディスク装置920には、オペレーティングシステム921(OS301)、ウィンドウシステム922、プログラム群923、ファイル群924が記憶されている。プログラム群923のプログラムは、CPU911、オペレーティングシステム921、ウィンドウシステム922により実行される。   The magnetic disk device 920 stores an operating system 921 (OS 301), a window system 922, a program group 923, and a file group 924. The programs in the program group 923 are executed by the CPU 911, the operating system 921, and the window system 922.

上記プログラム群923には、以下に述べる実施の形態の説明において「〜部」、「〜手段」として説明する機能を実行するプログラムが記憶されている。プログラムは、CPU911により読み出され実行される。ファイル群924には、以下に述べる実施の形態の説明において、「〜の判定結果」、「〜の計算結果」、「〜の処理結果」として説明する情報やデータや信号値や変数値やパラメータが、「〜ファイル」、「〜データベース」、「〜データ」の各項目として記憶されている。「〜ファイル」、「〜データベース」、「〜データ」は、ディスクやメモリなどの記録媒体に記憶される。ディスクやメモリになどの記憶媒体に記憶された情報やデータや信号値や変数値やパラメータは、読み書き回路を介してCPU911によりメインメモリやキャッシュメモリに読み出され、抽出・検索・参照・比較・演算・計算・処理・出力・印刷・表示などのCPUの動作に用いられる。抽出・検索・参照・比較・演算・計算・処理・出力・印刷・表示のCPUの動作の間、情報やデータや信号値や変数値やパラメータは、メインメモリやキャッシュメモリやバッファメモリに一時的に記憶される。   The program group 923 stores programs for executing functions described as “˜unit” and “˜means” in the description of the embodiments described below. The program is read and executed by the CPU 911. The file group 924 includes information, data, signal values, variable values, and parameters that are described as “determination results of”, “calculation results of”, and “processing results of” in the description of the embodiments described below. Are stored as items “˜file”, “˜database”, and “˜data”. “˜file”, “˜database”, and “˜data” are stored in a recording medium such as a disk or a memory. Information, data, signal values, variable values, and parameters stored in a storage medium such as a disk or memory are read out to the main memory or cache memory by the CPU 911 via a read / write circuit, and extracted, searched, referenced, compared, Used for CPU operations such as calculation, calculation, processing, output, printing, and display. Information, data, signal values, variable values, and parameters are temporarily stored in the main memory, cache memory, and buffer memory during the CPU operations of extraction, search, reference, comparison, operation, calculation, processing, output, printing, and display. Is remembered.

また、以下に述べる実施の形態の説明において説明するフローチャートの矢印の部分は主としてデータや信号の入出力を示し、データや信号値は、RAM914のメモリ、FDD904のフレキシブルディスク、CDD905のコンパクトディスク、磁気ディスク装置920の磁気ディスク、その他光ディスク、ミニディスク、DVD(Digital・Versatile・Disk)等の記録媒体に記録される。また、データや信号は、バス111や信号線やケーブルその他の伝送媒体によりオンライン伝送される。   In addition, the arrows in the flowcharts described in the following description of the embodiments mainly indicate input / output of data and signals. The data and signal values are the RAM 914 memory, the FDD 904 flexible disk, the CDD 905 compact disk, and the magnetic field. The data is recorded on a recording medium such as a magnetic disk of the disk device 920, another optical disk, a mini disk, and a DVD (Digital Versatile Disk). Data and signals are transmitted online via the bus 111, signal lines, cables and other transmission media.

また、以下に述べる実施の形態の説明において「〜部」として説明するものは、「〜回路」、「〜装置」、「〜機器」、「手段」であってもよく、また、「〜ステップ」、「〜手順」、「〜処理」であってもよい。すなわち、「〜部」として説明するものは、ROM913に記憶されたファームウェアで実現されていても構わない。或いは、ソフトウェアのみ、或いは、素子・デバイス・基板・配線などのハードウェアのみ、或いは、ソフトウェアとハードウェアとの組み合わせ、さらには、ファームウェアとの組み合わせで実施されても構わない。ファームウェアとソフトウェアは、プログラムとして、磁気ディスク、フレキシブルディスク、光ディスク、コンパクトディスク、ミニディスク、DVD等の記録媒体に記憶される。プログラムはCPU911により読み出され、CPU911により実行される。すなわち、プログラムは、以下に述べる「〜部」としてコンピュータを機能させるものである。あるいは、以下に述べる「〜部」の手順や方法をコンピュータに実行させるものである。   In addition, what is described as “to part” in the description of the embodiment described below may be “to circuit”, “to device”, “to device”, “means”, and “to step”. ”,“ ˜procedure ”, or“ ˜processing ”. That is, what is described as “˜unit” may be realized by firmware stored in the ROM 913. Alternatively, it may be implemented only by software, or only by hardware such as elements, devices, substrates, and wirings, by a combination of software and hardware, or by a combination of firmware. Firmware and software are stored as programs in a recording medium such as a magnetic disk, a flexible disk, an optical disk, a compact disk, a mini disk, and a DVD. The program is read by the CPU 911 and executed by the CPU 911. That is, the program causes the computer to function as “to part” described below. Alternatively, the procedure or method of “to part” described below is executed by a computer.

次に、本実施の形態に係るCPU間通信システム800のCPU間通信制御方法の動作について説明する。   Next, the operation of the inter-CPU communication control method of the inter-CPU communication system 800 according to the present embodiment will be described.

図4は、実施の形態1に係る送信側CPUのCPU間通信制御部321による送信側CPU間通信制御処理(データ送信処理ともいう)を示すフローチャートである。図4において、送信側CPU間通信制御処理は、CPU101において実行される処理であるものとする。以下で説明する機能ブロック(ハングオン制御部322(メモリ領域判定部351,データ書き込み部352,受信側CPU判定部353,送信側制御部354等))は、記憶装置に記憶されており、CPU101により読み出されてCPU101により実行される。   FIG. 4 is a flowchart showing a transmission-side CPU communication control process (also referred to as a data transmission process) by the CPU-side communication control unit 321 of the transmission-side CPU according to the first embodiment. In FIG. 4, it is assumed that the transmission-side CPU communication control process is a process executed by the CPU 101. The functional blocks described below (hang-on control unit 322 (memory area determination unit 351, data writing unit 352, reception-side CPU determination unit 353, transmission-side control unit 354, etc.)) are stored in the storage device. It is read out and executed by the CPU 101.

CPU101でCPU間通信のデータ送信処理が開始すると、ハングオン制御部322は、S401aにおいて継続フラグ311をセットする。S401において、ハングオン制御部322(データ書き込み部352)は、送信するデータをメモリ104の通信用メモリ305に書き込む。この場合、CPU101は送信側CPUの一例である。   When the CPU 101 starts data transmission processing for inter-CPU communication, the hang-on control unit 322 sets the continuation flag 311 in S401a. In step S <b> 401, the hang-on control unit 322 (data writing unit 352) writes data to be transmitted to the communication memory 305 of the memory 104. In this case, the CPU 101 is an example of a transmission side CPU.

S402において、ハングオン制御部322(受信側CPU判定部353)は、レディフラグ312を判定する。ハングオン制御部322(受信側CPU判定部353)によりレディフラグ312がセットされていないと判定されると(S402でNo)、処理はS403へ進む。   In S402, the hang-on control unit 322 (reception-side CPU determination unit 353) determines the ready flag 312. If the hang-on control unit 322 (reception-side CPU determination unit 353) determines that the ready flag 312 is not set (No in S402), the process proceeds to S403.

ハングオン制御部322(受信側CPU判定部353)によりレディフラグ312がセットされていると判定されると(S402でYes)、処理はS404へ進む。   If the hang-on control unit 322 (reception-side CPU determination unit 353) determines that the ready flag 312 is set (Yes in S402), the process proceeds to S404.

S402においてレディフラグ312がセットされていないということは、通信データを受信するタスク(受信側CPUのデータ読み出し部362)が起動していないスリープ状態であるか、あるいは、受信待ちセマフォ307によるウェイト状態(スリープ状態)であることを意味する。したがって、S403において、ハングオン制御部322は、CPU間通信の通信データを受信するタスク(受信側CPUのデータ読み出し部362)を起床するためのデータ読み出し開始要求を受信側CPUにCPU間割込(データ読み出し開始要求X1)として送信する。受信側CPUでは、CPU間割込(データ読み出し開始要求X1)により、受信タスク(受信側CPUのデータ読み出し部362)が起床されるか、あるいは、受信待ちセマフォ307がカウントアップされ受信タスク(受信側CPUのデータ読み出し部362)のウェイト状態が解除される(後述するS461)。ここで、タスクあるいは「〜部」を起床するとは、タスクあるいは「〜部」を起動する(ウェイクアップさせる)ことを意味する(以下同じ)。   If the ready flag 312 is not set in S402, this means that the task that receives the communication data (the data reading unit 362 of the receiving CPU) is not in the sleep state or is in the wait state by the reception waiting semaphore 307. (Sleep state). Accordingly, in S403, the hang-on control unit 322 interrupts the CPU on the receiving side with a data read start request to wake up the task (data reading unit 362 of the receiving CPU) that receives the communication data of inter-CPU communication ( This is transmitted as a data read start request X1). In the receiving CPU, a receiving task (data reading unit 362 of the receiving CPU) is woken up by an inter-CPU interrupt (data reading start request X1), or the receiving waiting semaphore 307 is counted up and the receiving task (receiving) The wait state of the data reading unit 362) of the side CPU is released (S461 described later). Here, to wake up a task or “˜part” means to start (wake up) the task or “˜part” (the same applies hereinafter).

S402においてレディフラグ312がセットされているということは、通信データを受信するタスク(受信側CPUのデータ読み出し部362)が実行中(ビジーループでウェイト状態である場合も含む)であることを意味する。したがって、ハングオン制御部322による受信側CPUへの通知(CPU間割込(データ読み出し開始要求X1))は不要となる。   When the ready flag 312 is set in S402, it means that the task for receiving communication data (the data reading unit 362 of the receiving CPU) is being executed (including a case where the busy loop is in the wait state). . Therefore, the notification (inter-CPU interrupt (data read start request X1)) to the receiving CPU by the hang-on control unit 322 becomes unnecessary.

S404において、ハングオン制御部322は、全データの送信が完了したか否かをチェックする。全データの送信が完了した場合(S404でYes)は、処理はS411に進む。全データの送信が完了していない場合(S404でNo)は、処理はS405に進む。   In S404, the hang-on control unit 322 checks whether transmission of all data is completed. If transmission of all data has been completed (Yes in S404), the process proceeds to S411. If transmission of all data has not been completed (No in S404), the process proceeds to S405.

全データの送信が完了した場合(S404でYes)は、ハングオン制御部322は、S411において継続フラグ311をクリアし、送信側CPU間通信制御処理を完了する。   When the transmission of all data is completed (Yes in S404), the hang-on control unit 322 clears the continuation flag 311 in S411 and completes the transmission-side inter-CPU communication control process.

全データの送信が完了していない場合(S404でNo)は、S405において、ハングオン制御部322(メモリ領域判定部351)は、メモリ104の通信用メモリ305にデータフルが発生していないかチェックする。すなわち、メモリ領域判定部351は、メモリ104の通信用メモリ305に空き領域があるか否かを判定する。   If transmission of all data has not been completed (No in S404), in S405, the hang-on control unit 322 (memory area determination unit 351) checks whether data full has occurred in the communication memory 305 of the memory 104. To do. That is, the memory area determination unit 351 determines whether there is a free area in the communication memory 305 of the memory 104.

メモリ104の通信用メモリ305にデータフルが発生していない場合(S405でNo)、処理はS401に戻りデータ送信処理を繰り返す。メモリ104の通信用メモリ305にデータフルが発生している場合は、ハングオン制御部322(データ書き込み部352)は続けてデータ送信(書き込み)ができない。メモリ104の通信用メモリ305にデータフルが発生している場合(S405でYes)、処理はS406へ進む。   If data full has not occurred in the communication memory 305 of the memory 104 (No in S405), the process returns to S401 and repeats the data transmission process. When data full occurs in the communication memory 305 of the memory 104, the hang-on control unit 322 (data writing unit 352) cannot continue to transmit (write) data. If data full has occurred in the communication memory 305 of the memory 104 (Yes in S405), the process proceeds to S406.

S406において、ハングオン制御部322(受信側CPU判定部353)は、レディフラグ312を判定する。すなわち、ハングオン制御部322(受信側CPU判定部353)は、受信側CPUの状態を判定する。   In step S <b> 406, the hang-on control unit 322 (reception-side CPU determination unit 353) determines the ready flag 312. That is, the hang-on control unit 322 (reception side CPU determination unit 353) determines the state of the reception side CPU.

ハングオン制御部322(受信側CPU判定部353)によりレディフラグ312がセットされていないと判定されると(S406でNo)、処理はS406aへ進む。ハングオン制御部322(受信側CPU判定部353)によりレディフラグ312がセットされていると判定されると(S406でYes)、処理はS410へ進む。   If the hang-on control unit 322 (reception-side CPU determination unit 353) determines that the ready flag 312 is not set (No in S406), the process proceeds to S406a. If the hang-on control unit 322 (reception-side CPU determination unit 353) determines that the ready flag 312 is set (Yes in S406), the process proceeds to S410.

レディフラグ312がセットされているということは、受信側CPUは連続してデータを受信しようとしている(すなわち、受信側CPUのデータ読み出し処理の実行中、あるいは、受信側CPUのデータ読み出し処理のビジーウェイト中)であることを意味する。このように受信側CPUのデータ読み出し処理が実行中であるので、短時間でメモリ104の通信用メモリ305に空き領域ができるはずと推定される。   When the ready flag 312 is set, the receiving CPU is continuously trying to receive data (that is, the receiving CPU is busy executing the data reading process or the receiving CPU is busy with the data reading process). Means waiting. As described above, since the data reading process of the receiving CPU is being executed, it is estimated that an empty area should be formed in the communication memory 305 of the memory 104 in a short time.

S410において、ハングオン制御部322(送信側制御部354)は、メモリに空き領域ができるまでデータ書き込み部352をデータ書き込み処理の待ち状態とする。すなわち、ハングオン制御部322(送信側制御部354)は、ビジーループで通信用メモリ305に空きができることをウェイトする。ハングオン制御部322(送信側制御部354)は、通信用メモリ305のデータフルが解消されるまでループを回る。   In S410, the hang-on control unit 322 (transmission-side control unit 354) places the data writing unit 352 in a waiting state for data writing processing until a free area is created in the memory. In other words, the hang-on control unit 322 (transmission-side control unit 354) waits for the communication memory 305 to be free in a busy loop. The hang-on control unit 322 (transmission side control unit 354) loops until the data full in the communication memory 305 is resolved.

ハングオン制御部322(受信側制御部354)は、S410にて通信用メモリ305に空き領域ができたと判定すると、ビジーウェイト状態を解除し、処理はS401に戻りデータ送信処理を実行する。   If the hang-on control unit 322 (reception side control unit 354) determines in S410 that the communication memory 305 has a free area, the hang-on control unit 322 releases the busy wait state, and the process returns to S401 to execute the data transmission process.

S406においてレディフラグ312がセットされていないということは、通信データを受信するタスク(受信側CPUのデータ読み出し部362)が受信待ちセマフォ307によるウェイト状態(スリープ状態)であることを意味する。通信データを受信するタスク(受信側CPUの受信データ読み出し部362)が受信待ちセマフォ307によるウェイト状態(スリープ状態)である場合は、受信側CPUではハングオン制御部322(受信データ読み出し部362)以外の他タスクが実行中であるので、データ受信処理(データ読み出し処理)開始までの時間が長くなると推定される。つまり、レディフラグ312がセットされている場合(受信データ読み出し部362が実行中、あるいはビジーウェイト中)の方が、レディフラグ312がセットされていない場合(受信データ読み出し部362がスリープ中、あるいは受信待ちセマフォによりウェイト中のためスリープ中))であるよりデータ読み出し部362によるデータ読み出し処理開始までの時間が短い。   The fact that the ready flag 312 is not set in S406 means that the task (data reading unit 362 of the receiving CPU) that receives communication data is in a wait state (sleep state) by the reception waiting semaphore 307. When the task that receives the communication data (the reception data reading unit 362 of the reception side CPU) is in the wait state (sleep state) by the reception waiting semaphore 307, the reception side CPU other than the hang-on control unit 322 (reception data reading unit 362) Since another task is being executed, it is estimated that the time until the data reception process (data read process) starts increases. That is, when the ready flag 312 is set (when the received data reading unit 362 is executing or busy waiting), when the ready flag 312 is not set (when the received data reading unit 362 is sleeping, or The time until the data reading unit 362 starts the data reading process is shorter than that during the waiting due to the reception waiting semaphore.

したがって、レディフラグ312がセットされていない場合は、ハングオン制御部322(送信側制御部354)は、データ書き込み処理をビジーウェイトせずに、受信側CPUの受信データ読み出し処理を開始するためのCPU間割込を実行するとともに、自らのデータ書き込み処理(データ送信処理)は送信待ちセマフォ306によるウェイト状態とし、送信側CPUの処理を他のタスクにスイッチする処理を実行する。   Therefore, when the ready flag 312 is not set, the hang-on control unit 322 (transmission-side control unit 354) does not busy wait for the data writing process, and the CPU for starting the reception data reading process of the receiving CPU. In addition to executing the interim interrupt, its own data write processing (data transmission processing) is put into a wait state by the transmission waiting semaphore 306, and processing for switching the processing of the transmitting CPU to another task is executed.

S406aにおいて、ハングオン制御部322(送信側制御部354)は、継続フラグ311をクリアする。   In S406a, the hang-on control unit 322 (transmission side control unit 354) clears the continuation flag 311.

S406bにおいて、ハングオン制御部322(送信側制御部354)は、CPU間通信の通信データを受信するタスク(受信側CPUのデータ読み出し部362)を起床するためのデータ読み出し開始要求を受信側CPUにCPU間割込(データ読み出し開始要求X1)として送信する。   In S406b, the hang-on control unit 322 (transmission side control unit 354) sends a data read start request to the reception side CPU to wake up the task (communication data read unit 362 of the reception side CPU) that receives communication data for inter-CPU communication. It is transmitted as an inter-CPU interrupt (data read start request X1).

S407において、ハングオン制御部322(送信側制御部354)は、データ書き込み処理を送信待ちセマフォ306によるウェイト状態とする。ハングオン制御部322(送信側制御部354)は、受信側CPUからのCPU間割込(データ書き込み要求X2)を受信すると(S409)、データ書き込み処理の送信待ちセマフォ306によるウェイト状態を解除してS401に戻りデータ送信処理を実行する。   In step S <b> 407, the hang-on control unit 322 (transmission side control unit 354) sets the data writing process to a wait state by the transmission waiting semaphore 306. When the hang-on control unit 322 (transmission side control unit 354) receives an inter-CPU interrupt (data write request X2) from the reception side CPU (S409), the hang-on control unit 322 releases the wait state by the transmission waiting semaphore 306 in the data write processing. Returning to S401, data transmission processing is executed.

S409aにおいて、ハングオン制御部322(送信側制御部354)は、継続フラグ311をセットし、処理をS401に戻し、データ送信処理を続ける。   In S409a, the hang-on control unit 322 (transmission side control unit 354) sets the continuation flag 311, returns the process to S401, and continues the data transmission process.

図4に示す送信側CPU間通信制御方法では、CPU間通信制御部321が実行中(CPU間通信制御部321がビジーループによるウェイト状態の場合も含む)の場合に継続フラグ311がセットされ、CPU間通信制御部321が送信待ちセマフォ306によりウェイト状態の場合には、継続フラグ311がクリアされるとした。   In the transmission side inter-CPU communication control method shown in FIG. 4, the continuation flag 311 is set when the inter-CPU communication control unit 321 is being executed (including the case where the inter-CPU communication control unit 321 is in a wait state due to a busy loop), and the CPU When the inter-communication control unit 321 is in a wait state by the transmission waiting semaphore 306, the continuation flag 311 is cleared.

しかし、例えば、送信側CPU間通信制御処理では、CPU間通信制御部321がビジーループによるウェイト状態の場合のみに継続フラグ311がセットされる処理としてもよい。上記処理の場合には、S401a(継続フラグのセット処理)、S406a(継続フラグのクリア処理)、S409a(継続フラグのセット処理)は不要となる。そして、ハングオン制御部322(送信側制御部354)は、S406でYesの場合(レディフラグ312がセットされている場合)に継続フラグ311をセットした後、S410のビジーループの処理を開始することになる(図5参照)。   However, for example, in the transmission-side CPU communication control process, the continuation flag 311 may be set only when the CPU communication control unit 321 is in a wait state due to a busy loop. In the case of the above processing, S401a (continuation flag setting processing), S406a (continuation flag clearing processing), and S409a (continuation flag setting processing) are not required. Then, the hang-on control unit 322 (transmission-side control unit 354) sets the continuation flag 311 in the case of Yes in S406 (when the ready flag 312 is set), and then starts the busy loop processing of S410. (See FIG. 5).

以上で、送信側CPU間通信制御処理の説明を終わる。次に、受信側CPUの受信側CPU間通信制御処理について説明する。   This is the end of the description of the transmission-side CPU communication control process. Next, the communication control process between the receiving CPUs of the receiving CPU will be described.

図6は、本実施の形態に係る受信側CPUのCPU間通信制御部321による受信側CPU間通信制御処理を示すフローチャートである。図6において、受信側CPU間通信制御処理は、CPU101において実行される処理であるものとする。以下で説明する機能ブロック(ハングオン制御部322(メモリ状態判定部361,データ読み出し部362,送信側CPU判定部363,受信側制御部364等))は、記憶装置に記憶されており、CPU101により読み出されてCPU101により実行される。   FIG. 6 is a flowchart showing the inter-reception CPU communication control processing by the inter-CPU communication control unit 321 of the reception CPU according to the present embodiment. In FIG. 6, it is assumed that the receiving-side CPU communication control process is a process executed by the CPU 101. The functional blocks described below (hang-on control unit 322 (memory state determination unit 361, data reading unit 362, transmission side CPU determination unit 363, reception side control unit 364, etc.)) are stored in the storage device, and the CPU 101 It is read out and executed by the CPU 101.

CPU101でCPU間通信のデータ受信処理(受信側CPU間通信制御処理)が開始すると、S451において、ハングオン制御部322は、レディフラグ312をセットする(オンにする)。この場合、CPU101は受信側CPUの一例である。   When the CPU 101 starts data reception processing for communication between CPUs (reception-side CPU communication control processing), the hang-on control unit 322 sets (turns on) the ready flag 312 in S451. In this case, the CPU 101 is an example of a receiving CPU.

S452において、ハングオン制御部322(メモリ状態判定部361)は、メモリ104の通信用メモリ305にデータフルが発生しているかチェックする。つまり、ハングオン制御部322(メモリ状態判定部361)は、メモリ104の通信用メモリ305に空き領域があるか否かをチェックする。ハングオン制御部322(メモリ状態判定部361)によりメモリ104(通信用メモリ305)がデータフルであると判定された場合は(S452でYes)、処理はS453へ進む。ハングオン制御部322(メモリ状態判定部361)によりメモリ104(通信用メモリ305)がデータフルでないと判定された場合は(S452でNo)、処理はS456へ進む。   In S452, the hang-on control unit 322 (memory state determination unit 361) checks whether data full has occurred in the communication memory 305 of the memory 104. That is, the hang-on control unit 322 (memory state determination unit 361) checks whether there is a free area in the communication memory 305 of the memory 104. If the hang-on control unit 322 (memory state determination unit 361) determines that the memory 104 (communication memory 305) is full of data (Yes in S452), the process proceeds to S453. If the hang-on control unit 322 (memory state determination unit 361) determines that the memory 104 (communication memory 305) is not full of data (No in S452), the process proceeds to S456.

S453において、ハングオン制御部322(データ読み出し部362)は、通信用メモリ305からデータの受信(読み出し)をするデータ受信処理を実行する。次に、S454において、ハングオン制御部322(送信側CPU判定部363)は、継続フラグ311がセットされているか否かをチェックする。   In step S453, the hang-on control unit 322 (data reading unit 362) executes data reception processing for receiving (reading) data from the communication memory 305. Next, in S454, the hang-on control unit 322 (transmission-side CPU determination unit 363) checks whether or not the continuation flag 311 is set.

ハングオン制御部322(送信側CPU判定部363)により継続フラグ311がセットされていると判定された場合は(S454でYes)、処理はS463へ進む。ハングオン制御部322(送信側CPU判定部363)により継続フラグ311がセットされていないと判定された場合は(S454でNo)、処理はS455へ進む。   If the hang-on control unit 322 (transmission-side CPU determination unit 363) determines that the continuation flag 311 is set (Yes in S454), the process proceeds to S463. If the hang-on control unit 322 (transmission-side CPU determination unit 363) determines that the continuation flag 311 is not set (No in S454), the process proceeds to S455.

S454において、継続フラグ311がセットされていないということは、通信データを送信するタスク(送信側CPUのハングオン制御部322(データ書き込み部352))が起動されていないスリープ状態であるか、あるいは、送信待ちセマフォ306によるウェイト状態(スリープ状態)であることを意味する。   In S454, the fact that the continuation flag 311 is not set means that the task for transmitting communication data (the hang-on control unit 322 (data writing unit 352) of the transmission side CPU) is not activated, or This means that it is in a wait state (sleep state) by the transmission waiting semaphore 306.

したがって、S455において、ハングオン制御部322は、CPU間通信の通信データを送信するタスク(送信側CPUのデータ書き込み部352)を起床するためのデータ書き込み開始要求をCPU間割込(データ書き込み開始要求X2)として送信側CPUに送信する。送信側CPUでは、CPU間割込(データ書き込み開始要求X2)により、送信タスク(送信側CPUのデータ書き込み部352)が起床されるか、あるいは、送信待ちセマフォ306がカウントアップされ送信タスク(送信側CPUのデータ書き込み部352)のウェイト状態が解除される(S409参照)。   Therefore, in S455, the hang-on control unit 322 issues an inter-CPU interrupt (data write start request) to wake up a task for transmitting communication data for inter-CPU communication (data writing unit 352 of the sending CPU). X2) is transmitted to the transmitting CPU. In the transmission side CPU, a transmission task (data writing unit 352 of the transmission side CPU) is woken up by an inter-CPU interrupt (data write start request X2), or the transmission waiting semaphore 306 is counted up and the transmission task (transmission) The wait state of the data writing unit 352) of the side CPU is released (see S409).

S455において、ハングオン制御部322が送信側CPUに対してCPU間割込(データ書き込み開始要求X2)を実行した後、処理はS463へ進む。   In S455, after the hang-on control unit 322 executes an inter-CPU interrupt (data write start request X2) for the transmitting CPU, the process proceeds to S463.

S454において継続フラグ311がセットされているということは、送信側CPUにおいて通信データを送信するタスク(送信側CPUのデータ書き込み部352)がウェイクアップ状態ではあるものの、メモリ104がデータフルのためビジーループによりデータ書き込み処理のウェイト状態中であることを意味する。したがって、ハングオン制御部322による送信側CPUへの通知(CPU間割込(データ書き込み開始要求X2))は不要となる。すなわち、S454において継続フラグ311がセットされているということは、送信側CPUは通信用メモリ305に空きができるのをビジーループで待っている状態である。このとき、処理はS463に進む。   In S454, the continuation flag 311 is set, which means that the task that transmits communication data in the transmission side CPU (data writing unit 352 of the transmission side CPU) is in a wake-up state, but the memory 104 is full of data and is busy loop. This means that the data writing process is in a wait state. Therefore, the notification (inter-CPU interrupt (data write start request X2)) to the transmitting CPU by the hang-on control unit 322 is not necessary. In other words, the fact that the continuation flag 311 is set in S454 means that the sending CPU is waiting in a busy loop until the communication memory 305 is available. At this time, the process proceeds to S463.

S463において、ハングオン制御部322(データ読み出し部362)は、全データの受信が完了したかチェックする。ハングオン制御部322(データ読み出し部362)により全データの受信が完了したと判断された場合は(S463でYes)、処理はS464へ進む。ハングオン制御部322(データ読み出し部362)により全データの受信が完了していないと判断された場合は(S463でNo)、処理はS452へ戻る。   In step S463, the hang-on control unit 322 (data reading unit 362) checks whether reception of all data is completed. If the hang-on control unit 322 (data reading unit 362) determines that the reception of all data has been completed (Yes in S463), the process proceeds to S464. If the hang-on control unit 322 (data reading unit 362) determines that the reception of all data has not been completed (No in S463), the process returns to S452.

S464において、全データの受信が完了したので、ハングオン制御部322は、レディフラグ312をクリアして、受信側CPU間通信制御処理を終了する。   In S464, since the reception of all data has been completed, the hang-on control unit 322 clears the ready flag 312 and ends the receiving-side inter-CPU communication control process.

上述したように、ハングオン制御部322によりメモリ104(通信用メモリ305)がデータフルでないと判定された場合は(S452でNo)、処理はS456へ進む。S456において、ハングオン制御部322(メモリ状態判定部361)は、メモリ104の通信用メモリ305に、データが格納されているか否かを判定する。すなわち、ハングオン制御部322(メモリ状態判定部361)は、メモリ104(通信用メモリ305)がデータエンプティであるか否かを判定する。   As described above, when the hang-on control unit 322 determines that the memory 104 (communication memory 305) is not full of data (No in S452), the process proceeds to S456. In S <b> 456, the hang-on control unit 322 (memory state determination unit 361) determines whether data is stored in the communication memory 305 of the memory 104. That is, the hang-on control unit 322 (memory state determination unit 361) determines whether or not the memory 104 (communication memory 305) is data empty.

S456において、ハングオン制御部322(メモリ状態判定部361)によりデータエンプティであると判定された場合は(S456でYes)、処理はS457へ進む。ハングオン制御部322(メモリ状態判定部361)によりデータエンプティでないと判定された場合は(S456でNo)、処理はS462へ進み、ハングオン制御部322(データ読み出し部362)によりデータ受信処理が実行される。   If the hang-on control unit 322 (memory state determination unit 361) determines that the data is empty in S456 (Yes in S456), the process proceeds to S457. If the hang-on control unit 322 (memory state determination unit 361) determines that the data is not empty (No in S456), the process proceeds to S462, and the hang-on control unit 322 (data reading unit 362) performs data reception processing. The

S457において、ハングオン制御部322(送信側CPU判定部363)は、送信側CPUの状態を判定する。すなわち、ハングオン制御部322(送信側CPU判定部363)は、継続フラグ311がセットされているか否かをチェックする。S457において、ハングオン制御部322(送信側CPU判定部363)により継続フラグ311がセットされていると判定された場合は(S457でYes)、処理はS456へ戻る。ハングオン制御部322(送信側CPU判定部363)により継続フラグ311がセットされていないと判定された場合は(S457でNo)、処理はS458へ進む。   In S457, the hang-on control unit 322 (transmission side CPU determination unit 363) determines the state of the transmission side CPU. That is, the hang-on control unit 322 (transmission-side CPU determination unit 363) checks whether or not the continuation flag 311 is set. In S457, when the hang-on control unit 322 (transmission-side CPU determination unit 363) determines that the continuation flag 311 is set (Yes in S457), the process returns to S456. If the hang-on control unit 322 (transmission-side CPU determination unit 363) determines that the continuation flag 311 is not set (No in S457), the process proceeds to S458.

S456において継続フラグ311がセットされているということは、メモリ104はデータエンプティであっても送信側CPUのデータ書き込み部352(データ送信処理)は、継続的に実行中であることを示している。したがって、短時間のうちにメモリ104のデータエンプティが解消すると推定されるので、ハングオン制御部322(受信側制御部364)は、メモリ104(通信メモリ305)のデータエンプティが解消されるまでビジーループによりデータ受信処理(データ読み出し処理)をウェイト状態とする。   The fact that the continuation flag 311 is set in S456 indicates that the data writing unit 352 (data transmission processing) of the transmission side CPU is continuously executing even if the memory 104 is data empty. . Therefore, since it is estimated that the data empty of the memory 104 is canceled within a short time, the hang-on control unit 322 (reception side control unit 364) performs the busy loop until the data empty of the memory 104 (communication memory 305) is canceled. The data reception process (data read process) is set to the wait state.

すなわち、ハングオン制御部322(受信側制御部364)は、継続フラグ311がセットされていると判定すると、メモリ104(通信メモリ305)のデータエンプティが解消されるまでビジーループによりデータ受信処理(データ読み出し処理)をウェイト状態とする。   That is, when the hang-on control unit 322 (reception side control unit 364) determines that the continuation flag 311 is set, the data reception process (data read-out) is performed in a busy loop until the data empty of the memory 104 (communication memory 305) is eliminated. Process) is set to the wait state.

S457において継続フラグ311がセットされていないということは、メモリ104はデータエンプティであって、通信データを送信するタスク(送信側CPUのデータ書き込み部352)が起動されていないスリープ状態であるか、あるいは、送信待ちセマフォ306によるウェイト状態(スリープ状態)であることを意味する。通信データを送信するタスク(送信側CPUのデータ書き込み部352)が起動されていないスリープ状態か、あるいは、送信待ちセマフォ306によるウェイト状態(スリープ状態)である場合は、送信側CPUにおいてデータ送信処理(データ書き込み処理)開始までの時間が長くなると推定される。そこで、受信側CPUでは、次のような手順(S458〜S461)により、所定の時間の経過を待って受信待ちセマフォ307によるウェイト状態へ移り、CPU101の処理をデータ受信処理から他のタスクの処理にスイッチして、データ受信処理はウェイト状態とする。   The fact that the continuation flag 311 is not set in S457 means that the memory 104 is data empty and is in a sleep state in which the task for transmitting communication data (data writing unit 352 of the sending CPU) is not activated, Alternatively, this means that the transmission wait semaphore 306 is in a wait state (sleep state). If the task for transmitting communication data (data writing unit 352 of the sending CPU) is not activated or is in a wait state (sleeping state) by the transmission waiting semaphore 306, the sending CPU performs data transmission processing. (Data writing process) It is estimated that the time until the start becomes longer. Therefore, the receiving CPU waits for the elapse of a predetermined time according to the following procedure (S458 to S461) and shifts to the wait state by the reception waiting semaphore 307, and the processing of the CPU 101 is changed from the data receiving processing to the processing of other tasks. The data reception process is switched to the wait state.

受信側CPU(受信側制御部364(第2のタイムアウト時間記憶部))は、予め第2のタイムアウト時間を記憶装置に記憶している。第2のタイムアウト時間は、S456からS458までのビジーループの連続実行時間の上限を定めるものである。   The reception side CPU (reception side control unit 364 (second timeout time storage unit)) stores the second timeout time in the storage device in advance. The second timeout time defines the upper limit of the continuous execution time of the busy loop from S456 to S458.

上述したように、S457において、送信側CPU判定部363により送信側CPUの状態がデータ書き込み処理の実行状態でない(継続フラグ311がセットされていない)と判定された場合に、S458において、ハングオン制御部322(受信側制御部364)は、最初にS456においてメモリがデータエンプティであると判定された時点から第2のタイムアウト時間が経過したか否かを判定する。つまり、S458において、ハングオン制御部322(受信側制御部364)は、記憶装置に記憶された指定時間(第2のタイムアウト時間)を用いて、タイムアウトが発生しているか否かチェックする。   As described above, when the transmission CPU determination unit 363 determines in S457 that the state of the transmission CPU is not the execution state of the data writing process (the continuation flag 311 is not set), the hang-on control is performed in S458. The unit 322 (reception side control unit 364) first determines whether or not the second time-out period has elapsed since it was determined in S456 that the memory is data empty. That is, in S458, the hang-on control unit 322 (reception side control unit 364) checks whether a timeout has occurred using the specified time (second timeout time) stored in the storage device.

S458において第2のタイムアウト時間が経過していない場合(タイムアウトが発生していない場合)(S458でNo)は、ハングオン制御部322(受信側制御部364)は、処理をS456に戻し、メモリ104(通信用メモリ305)にデータが格納されるまでビジーループによりデータ読み出し部362をデータ読み出し処理の待ち状態(ビジーウェイト状態)とする。   If the second timeout time has not elapsed in S458 (no timeout has occurred) (No in S458), the hang-on control unit 322 (reception side control unit 364) returns the process to S456, and the memory 104 Until the data is stored in (communication memory 305), the data reading unit 362 is set in a waiting state (busy wait state) for data reading processing by a busy loop.

S458において第2のタイムアウト時間が経過した場合(タイムアウトが発生した場合)(S458でYes)は、ハングオン制御部322(受信側制御部364)は、処理をS459に進める。   When the second timeout time has elapsed in S458 (when a timeout has occurred) (Yes in S458), the hang-on control unit 322 (reception side control unit 364) advances the process to S459.

S459において、ハングオン制御部322(受信側制御部364)は、レディフラグ312をクリアする。S459aにおいて、ハングオン制御部322(受信側制御部364)は、CPU間通信の通信データを送信するタスク(送信側CPUのデータ書き込み部352)を起床するためのデータ書き込み開始要求を送信側CPUにCPU間割込(データ書き込み開始要求X2)として送信する。   In S459, the hang-on control unit 322 (reception side control unit 364) clears the ready flag 312. In S459a, the hang-on control unit 322 (reception side control unit 364) sends a data write start request to the transmission side CPU to wake up a task (data transmission unit 352 of the transmission side CPU) that transmits communication data for inter-CPU communication. It is transmitted as an inter-CPU interrupt (data write start request X2).

S460において、ハングオン制御部322(受信側制御部364)は、データ読み出し処理を受信待ちセマフォ307によるウェイト状態とする。ハングオン制御部322(受信側制御部364)は、データ読み出し処理の受信待ちセマフォ307によるウェイト状態で、送信側CPUからCPU間割込(データ読み出し開始要求X1)を受信すると(S461)、データ読み出し処理の受信待ちセマフォ307によるウェイト状態を解除し、処理をS461aに進める。S461aにおいて、ハングオン制御部322(受信側制御部364)は、レディフラグ312をセットし、S462に進む。受信側制御部364は、受信側スケジューリング部の一例である。   In S460, the hang-on control unit 322 (reception side control unit 364) sets the data reading process to the wait state by the reception waiting semaphore 307. When the hang-on control unit 322 (reception side control unit 364) receives an inter-CPU interrupt (data read start request X1) from the transmission side CPU in a wait state by the reception waiting semaphore 307 of the data read process (S461), the data read is performed. The wait state by the process reception waiting semaphore 307 is released, and the process proceeds to S461a. In S461a, the hang-on control unit 322 (reception side control unit 364) sets the ready flag 312 and proceeds to S462. The reception side control unit 364 is an example of a reception side scheduling unit.

S462において、ハングオン制御部322(データ読み出し部362)は、メモリ104(通信用メモリ305)からデータを読み出すデータ読み出し処理(データ受信処理)を実行する。   In S462, the hang-on control unit 322 (data reading unit 362) executes a data reading process (data receiving process) for reading data from the memory 104 (communication memory 305).

S457〜S458において、継続フラグ311がセットされておらず、かつ、タイムアウトが発生したということは、メモリ104がデータエンプティであるのに送信側CPUのデータ書き込み処理はスリープ中であり、かつ、所定時間(第2のタイムアウト時間)の経過を待ったがメモリ104にデータが格納されなかったことを意味する。このように、通信データを送信するタスク(送信側CPUのデータ書き込み部352)が起動されていないスリープ状態か、あるいは、送信待ちセマフォ306によるウェイト状態(スリープ状態)である場合は、通信データの送信(書き込み)処理開始までの時間が長くなる可能性が高いと推定される。   In S457 to S458, if the continuation flag 311 is not set and a timeout has occurred, the memory 104 is in a data empty state, but the data writing process of the sending CPU is sleeping, and This means that data has not been stored in the memory 104 after the elapse of time (second timeout time). As described above, when the task for transmitting the communication data (data writing unit 352 of the transmission side CPU) is not activated or is in the wait state (sleep state) by the transmission waiting semaphore 306, the communication data It is estimated that there is a high possibility that the time until the transmission (writing) process starts will be long.

したがって、S459a〜S460において、ハングオン制御部322(受信側制御部364)は、送信側CPUのデータ書き込み処理を開始するためのCPU間割込を実行するとともに、自らのデータ受信処理は受信待ちセマフォ307によるウェイト状態とし、受信側CPUのデータ読み出し処理を他のタスクの処理にスイッチする。   Therefore, in S459a to S460, the hang-on control unit 322 (reception side control unit 364) executes an inter-CPU interrupt for starting the data writing process of the transmission side CPU, and its own data reception process is a reception waiting semaphore. The waiting state is set to 307, and the data reading process of the receiving CPU is switched to the process of another task.

上述したように、ハングオン制御部322は、S463で全データの受信が完了した場合は、S464でレディフラグ312をクリアし、CPU間通信のデータ受信処理を完了する。   As described above, when the reception of all data is completed in S463, the hang-on control unit 322 clears the ready flag 312 in S464, and completes the data reception process of the inter-CPU communication.

ハングオン制御部322は、次のCPU間通信のデータ受信処理をすぐに始めることができる場合は、S464におけるレディフラグ312のクリアの処理を行わないことにより、受信側CPUからのCPU間割込(データ読み出し開始要求X1)を送らせないようにすることもできる。   If the data reception processing for the next inter-CPU communication can be started immediately, the hang-on control unit 322 does not perform the clear processing of the ready flag 312 in S464, thereby interrupting the CPU from the receiving CPU ( It is also possible not to send the data read start request X1).

本実施の形態では、以下のようなCPU間通信方式(CPU間通信システム800)について説明した。   In the present embodiment, the following inter-CPU communication method (inter-CPU communication system 800) has been described.

本実施の形態に係るCPU間通信方式は、2個以上の複数のCPU(101,102,103,・・・)が、メモリ104を介してデータ通信を行うCPU間通信方式において、以下の手段を備えること特徴とする。
(a)CPU間通信による送信側のデータフル解消待ち、受信側のデータエンプティ待ちを、CPU間割込によりウェイトするか、ビジーループによりウェイトするかを制御するハングオン制御手段(ハングオン制御部322)を持つCPU間通信制御手段(CPU間通信制御部321)。
(b)データ送信を継続的に行うことを示す継続フラグ311。
(c)データ受信をビジーループで待つことを示すレディフラグ312。
The inter-CPU communication method according to the present embodiment is the following means in the inter-CPU communication method in which two or more CPUs (101, 102, 103,...) Perform data communication via the memory 104. It is characterized by providing.
(A) Hang-on control means (hang-on control unit 322) for controlling whether to wait for data full elimination waiting on the transmission side by communication between CPUs and waiting for data empty on the receiving side by interrupt between CPUs or by busy loop Inter-CPU communication control means (inter-CPU communication control unit 321).
(B) A continuation flag 311 indicating that data transmission is continuously performed.
(C) A ready flag 312 indicating waiting for data reception in a busy loop.

本実施の形態に係るCPU間通信方式は、ハングオン制御手段(ハングオン制御部322)が、第2のタイムアウト時間を用いたタイムアウト時間の設定により、タイムアウトの発生までビジーループでウェイトし、タイムアウトの発生以降はCPU間割込によりウェイトするように自動的に切り換えることを特徴とする。   In the inter-CPU communication system according to the present embodiment, the hang-on control means (hang-on control unit 322) waits in a busy loop until the timeout occurs by setting the timeout time using the second timeout time, and after the timeout occurs Is characterized in that it is automatically switched to wait by an inter-CPU interrupt.

以上のように、本実施の形態のCPU間通信システム800によれば、CPU間通信制御手段(CPU間通信制御部321)内のハングオン制御手段(ハングオン制御部322)が、継続フラグ311とレディフラグ312との値に基づいて、ビジーループによるウェイトとCPU間割込によるウェイトとを切り替えて制御する。したがって、CPU(送信側CPU,受信側CPU)が連続的にデータ送受信を行う場合は、CPU間割込による遅延を受けずに、高速なCPU間通信を行うことができる。   As described above, according to the inter-CPU communication system 800 of the present embodiment, the hang-on control unit (hang-on control unit 322) in the inter-CPU communication control unit (inter-CPU communication control unit 321) is connected to the continuation flag 311 and the ready flag 311. Based on the value of the flag 312, control is performed by switching between a wait by a busy loop and a wait by an interrupt between CPUs. Therefore, when the CPU (transmission side CPU, reception side CPU) continuously transmits and receives data, high-speed communication between CPUs can be performed without receiving a delay due to an inter-CPU interrupt.

また、データ連続処理が連続する場合には、S464においてレディフラグ(312)をクリアしないことにより、次に行われるCPU間通信もCPU間割込を使わずに続けることがでる。したがって、短時間で次のCPU間通信のデータ受信を開始することを見込んだ制御を行うことができるので、CPU間割込による遅延をなくすことができる。   If the continuous data processing continues, the next inter-CPU communication can be continued without using the inter-CPU interrupt by not clearing the ready flag (312) in S464. Therefore, since it is possible to perform control in anticipation of starting data reception of the next inter-CPU communication in a short time, it is possible to eliminate a delay due to an inter-CPU interrupt.

本実施の形態では、ハングオン制御部322の備えるメモリ領域判定部351、データ書き込み部352、受信側CPU判定部353、送信側制御部354、メモリ状態判定部361、データ読み出し部362、送信側CPU判定部363、受信側制御部364は、それぞれ独立した機能ブロックとして構成されているものとして説明した。しかし、上記機能ブロックは、ひとつの機能ブロックとして構成されていてもよい。また、メモリ領域判定部351とデータ書き込み部352と受信側CPU判定部353と送信側制御部354とをひとつの機能ブロックとし、メモリ状態判定部361とデータ読み出し部362と送信側CPU判定部363と受信側制御部364とをひとつの機能ブロックとして構成してもよい。あるいは、全ての機能ブロックを独立した機能ブロックとしても良い。あるいは、これらの機能ブロックを、他のどのような組み合わせで構成しても構わない。   In the present embodiment, a memory area determination unit 351, a data writing unit 352, a reception-side CPU determination unit 353, a transmission-side control unit 354, a memory state determination unit 361, a data reading unit 362, and a transmission-side CPU included in the hang-on control unit 322. The determination unit 363 and the reception-side control unit 364 have been described as being configured as independent functional blocks. However, the functional block may be configured as one functional block. The memory area determination unit 351, the data writing unit 352, the reception-side CPU determination unit 353, and the transmission-side control unit 354 are configured as one functional block, and the memory state determination unit 361, the data reading unit 362, and the transmission-side CPU determination unit 363 are used. And the receiving side control unit 364 may be configured as one functional block. Alternatively, all functional blocks may be independent functional blocks. Alternatively, these functional blocks may be configured in any other combination.

実施の形態2.
実施の形態1では、受信側CPU間通信制御手段(CPU間通信制御部321)のハングオン制御手段(ハングオン制御部322の受信側CPU間通信制御処理)にタイムアウト処理(図6のS458)を入れて、レディフラグ312のセット、クリアを制御するようにしたものである。すなわち、受信側CPU間通信制御処理では、タイムアウト処理によりビジーループの実行継続時間の上限を制御し、受信側CPUが主体となってビジーループの実行を制御する処理とした。
Embodiment 2. FIG.
In the first embodiment, a timeout process (S458 in FIG. 6) is added to the hang-on control means (reception-side CPU communication control process of the hang-on control part 322) of the reception-side CPU communication control means (inter-CPU communication control part 321). Thus, the setting and clearing of the ready flag 312 are controlled. That is, in the communication control process between the receiving CPUs, the upper limit of the busy loop execution time is controlled by the timeout process, and the execution of the busy loop is controlled mainly by the receiving CPU.

本実施の形態では、送信側のCPU間通信制御手段(CPU間通信制御部321)のハングオン制御手段(ハングオン制御部322の送信側CPU間通信制御処理)でタイムアウト処理を実行する場合について説明する。   In the present embodiment, a case will be described in which timeout processing is executed by the hang-on control means (transmission-side inter-CPU communication control process of the hang-on control section 322) of the transmission-side CPU communication control means (inter-CPU communication control section 321). .

本実施の形態に係るCPU間通信システム800(CPU間通信システム、CPU間通信方式)の構成は図2と同様であるため、説明を省略する。   The configuration of the inter-CPU communication system 800 (inter-CPU communication system, inter-CPU communication method) according to the present embodiment is the same as that in FIG.

本実施の形態では、CPU間通信制御部321の送信側CPU通信制御処理は、実施の形態1の図4の送信側CPU間通信制御処理の一部の動作を変更したものである。図7は、本実施の形態に係るCPU間通信制御部321の送信側CPU通信制御処理を示すフローチャートである。図7において、図4と同様の動作には同一の符号を付し、その説明を省略する。   In the present embodiment, the transmission-side CPU communication control process of the inter-CPU communication control unit 321 is obtained by changing a part of the operation of the transmission-side inter-CPU communication control process of FIG. FIG. 7 is a flowchart showing a transmission-side CPU communication control process of the inter-CPU communication control unit 321 according to the present embodiment. 7, the same operations as those in FIG. 4 are denoted by the same reference numerals, and the description thereof is omitted.

図7において、S401〜S405間での処理は図4と同様である。また、本実施の形態に係るCPU間通信制御部321のハングオン制御部322(送信側制御部354(第1のタイムアウト時間記憶部))は、予め第1のタイムアウト時間を記憶装置に記憶する。S405において、ハングオン制御部322は、メモリ104(通信用メモリ305)がデータフルであると判定すると、S501へ進む。   In FIG. 7, the processing between S401 to S405 is the same as that in FIG. In addition, the hang-on control unit 322 (transmission side control unit 354 (first timeout time storage unit)) of the inter-CPU communication control unit 321 according to the present embodiment stores the first timeout time in the storage device in advance. In S405, if the hang-on control unit 322 determines that the memory 104 (communication memory 305) is full of data, the process proceeds to S501.

S501において、ハングオン制御部322(受信側CPU判定部353)は、レディフラグ312を判定する。すなわち、ハングオン制御部322(受信側CPU判定部353)は、受信側CPUの状態を判定する。   In step S <b> 501, the hang-on control unit 322 (reception-side CPU determination unit 353) determines the ready flag 312. That is, the hang-on control unit 322 (reception side CPU determination unit 353) determines the state of the reception side CPU.

ハングオン制御部322(受信側CPU判定部353)によりレディフラグ312がセットされていないと判定されると(S501でNo)、処理はS406aへ進む。S406aからS409aまでの処理は図4と同様である。   If the hang-on control unit 322 (reception-side CPU determination unit 353) determines that the ready flag 312 is not set (No in S501), the process proceeds to S406a. The processing from S406a to S409a is the same as that in FIG.

ハングオン制御部322(受信側CPU判定部353)によりレディフラグ312がセットされていると判定されると(S501でYes)、処理はS503へ進む。   If the hang-on control unit 322 (reception-side CPU determination unit 353) determines that the ready flag 312 is set (Yes in S501), the process proceeds to S503.

S503において、ハングオン制御部322(送信側制御部354)は、データフル解消待ちのビジーループを継続するタイムアウト時間として、記憶装置に記憶されている第1のタイムアウト時間を設定する。   In S503, the hang-on control unit 322 (transmission-side control unit 354) sets the first timeout time stored in the storage device as the timeout time for continuing the busy loop waiting for data full resolution.

S504において、ハングオン制御部322(送信側制御部354)は、メモリ104(通信用メモリ305)のデータフルが解消したか否かを判定する。データフルが解消したと判定された場合は(S504でYes)、S401へ戻りデータ送信処理(データ書き込み処理)を実行する。データフルが解消していないと判定された場合は(S504でNo)、S505へ進む。   In step S504, the hang-on control unit 322 (transmission-side control unit 354) determines whether the data full in the memory 104 (communication memory 305) has been eliminated. If it is determined that the data full has been resolved (Yes in S504), the process returns to S401 to execute the data transmission process (data writing process). If it is determined that the data full has not been resolved (No in S504), the process proceeds to S505.

S505において、ハングオン制御部322(送信側制御部354)は、第1のタイムアウト時間によるデータフル解消待ちタイムアウトが発生したか否かを判定する。すなわち、ハングオン制御部322(送信側制御部354)は、受信側CPUの状態がデータ読み出し処理の実行状態である(レディフラグ312がセットされている)と判定された場合に、データ書き込み処理の待ち状態とし、データ書き込み処理の待ち状態の開始時点から第1のタイムアウト時間が経過したか否かを判定する。   In step S505, the hang-on control unit 322 (transmission side control unit 354) determines whether or not a data full resolution waiting timeout has occurred due to the first timeout time. In other words, the hang-on control unit 322 (transmission side control unit 354) determines that the data write process is performed when it is determined that the state of the reception side CPU is the execution state of the data read process (the ready flag 312 is set). A wait state is set, and it is determined whether or not the first time-out period has elapsed since the start of the wait state of the data writing process.

データフル解消待ちタイムアウトが発生していないと判定された場合は(S505でNo)、S504へ戻り、メモリ104(通信用メモリ305)のデータフルが解消するまでS504からS505の処理を繰り返す。すなわち、ハングオン制御部322(送信側制御部354)は、受信側CPUのデータ書き込み処理の実行中(データ書き込み処理のビジーウェイト中も含む)であるため、短時間でデータフルが解消すると見込んで、データ書き込み処理(データ送信処理)を第1のタイムアウト時間が経過するまでビジーループする。   If it is determined that the data full resolution waiting timeout has not occurred (No in S505), the process returns to S504, and the processes from S504 to S505 are repeated until the data full in the memory 104 (communication memory 305) is resolved. That is, since the hang-on control unit 322 (transmission side control unit 354) is executing the data write process of the reception side CPU (including the busy wait of the data write process), it is expected that the data full will be eliminated in a short time. The data write processing (data transmission processing) loops busy until the first timeout time elapses.

データフル解消待ちタイムアウトが発生したと判定された場合は(S505でYes)、S406aに進み、ハングオン制御部322(送信側制御部354)は送信側CPU間通信制御処理(データ書き込み処理(データ送信処理))を送信待ちセマフォ306によるウェイト状態とする。   If it is determined that a data full resolution waiting timeout has occurred (Yes in S505), the process proceeds to S406a, and the hang-on control unit 322 (transmission side control unit 354) performs communication control processing between the transmission side CPUs (data write processing (data transmission processing (data transmission processing)). Processing)) is set to a wait state by the transmission waiting semaphore 306.

本実施の形態のCPU間通信制御部321は、次のような特徴を備える。送信側制御部354は、予め第1のタイムアウト時間を記憶装置に記憶する。受信側CPU判定部353により受信側CPUの状態がデータ読み出し処理の実行状態でないと判定された場合(S501でNo)に、データ読み出し開始要求X1を受信側CPUへ送信し(S406b)、送信待ちセマフォ306によりデータ書き込み処理を待ち状態とする。受信側CPU判定部353により受信側CPUの状態がデータ読み出し処理の実行状態であると判定された場合(S501でYes)、送信側制御部354は、第1のタイムアウト時間が経過したか否かを判定し、第1のタイムアウト時間が経過していない場合は、メモリ104に空き領域ができるまでデータ書き込み処理の待ち状態(ビジーループ)とし、第1のタイムアウト時間が経過した場合は、データ読み出し開始要求X1を受信側CPUへ送信し(S406b)、送信待ちセマフォ306によるデータ書き込み処理の待ち状態とする。送信側制御部354は、送信側スケジューリング部の一例である。   The inter-CPU communication control unit 321 according to the present embodiment has the following characteristics. The transmission side control unit 354 stores the first timeout time in the storage device in advance. When the receiving CPU determination unit 353 determines that the receiving CPU is not in the data reading process execution state (No in S501), the data reading start request X1 is transmitted to the receiving CPU (S406b), and waiting for transmission. The semaphore 306 puts the data writing process in a wait state. When the reception-side CPU determination unit 353 determines that the state of the reception-side CPU is the execution state of the data read process (Yes in S501), the transmission-side control unit 354 determines whether or not the first timeout time has elapsed. If the first time-out period has not elapsed, the data write process waits (busy loop) until there is an empty area in the memory 104. If the first time-out period elapses, data read starts. The request X1 is transmitted to the receiving CPU (S406b), and the data write processing by the transmission waiting semaphore 306 is waited. The transmission side control unit 354 is an example of a transmission side scheduling unit.

図7に示す送信側CPU間通信方法では、CPU間通信制御部321が実行中(CPU間通信制御部321がビジーループによるウェイト状態の場合も含む)の場合に継続フラグ311がセットされ、CPU間通信制御部321が送信待ちセマフォ306によりウェイト状態の場合には、継続フラグ311がクリアされるとした。   In the transmission side inter-CPU communication method shown in FIG. 7, the continuation flag 311 is set when the inter-CPU communication control unit 321 is executing (including the case where the inter-CPU communication control unit 321 is in a wait state due to a busy loop), and the inter-CPU communication It is assumed that the continuation flag 311 is cleared when the communication control unit 321 is in the wait state by the transmission waiting semaphore 306.

しかし、例えば、送信側CPU間通信制御処理では、CPU間通信制御部321がビジーループによるウェイト状態の場合のみに継続フラグ311がセットされる処理(すなわち、図5の処理)としてもよい。図8は、本実施の形態のCPU間通信制御部321の送信側CPU間通信制御処理がビジーループによるウェイト状態の場合のみに継続フラグ311がセットされる処理である場合を示すフローチャートである。すなわち、図8は図5の一部が変更となった処理を示すフロー図である。   However, for example, in the transmission-side CPU communication control process, the continuation flag 311 may be set only when the inter-CPU communication control unit 321 is in a wait state due to a busy loop (that is, the process of FIG. 5). FIG. 8 is a flowchart illustrating a case where the continuation flag 311 is set only when the transmission-side CPU communication control processing of the CPU-to-CPU communication control unit 321 according to the present embodiment is in a wait state due to a busy loop. That is, FIG. 8 is a flowchart showing processing in which part of FIG. 5 is changed.

上記処理の場合には、図7におけるS406a(継続フラグのクリア処理)、S409a(継続フラグのセット処理)は不要となる。そして、ハングオン制御部322(送信側制御部354)は、S501でYesの場合(レディフラグ312がセットされている場合)に継続フラグ311をセットし(S502)、その後S504〜S505のビジーループの処理を実行する。ハングオン制御部322(送信側制御部354)は、S504〜S505においてビジーループの処理を第1のタイムアウト時間経過(タイムアウト発生)により抜けると、S506において継続フラグ311をクリアする。   In the case of the above process, S406a (continuation flag clearing process) and S409a (continuation flag setting process) in FIG. 7 are not required. Then, the hang-on control unit 322 (transmission-side control unit 354) sets the continuation flag 311 when S501 is Yes (when the ready flag 312 is set) (S502), and thereafter the busy loop processing of S504 to S505 Execute. The hang-on control unit 322 (transmission side control unit 354) clears the continuation flag 311 in S506 when the busy loop process is exited in S504 to S505 due to the elapse of the first timeout period (timeout occurrence).

以上のように、本実施の形態では、送信側CPU間通信制御手段にタイムアウト処理を入れたので、送信側CPUにおいて、ビジーループの実行・終了を制御することができる。   As described above, in the present embodiment, the timeout processing is inserted into the transmission-side CPU communication control means, so that the execution and termination of the busy loop can be controlled in the transmission-side CPU.

実施の形態3.
上述した実施の形態1及び実施の形態2では、継続フラグ311とレディフラグ312とに基づいて、ビジーループによるウェイトとセマフォ待ちによるウェイトとを切り替えるものであった。本実施の形態では、ビジーループ実行時のOS301のスケジューリングを制御する方式について説明する。
Embodiment 3 FIG.
In the first embodiment and the second embodiment described above, based on the continuation flag 311 and the ready flag 312, the wait loop wait and the semaphore wait wait are switched. In the present embodiment, a method for controlling scheduling of the OS 301 at the time of busy loop execution will be described.

図9は、本実施の形態におけるCPU間通信システム800のブロック構成図である。図9において、実施の形態1で説明した図2と同様の機能ブロックについては同一の符号を付し、その説明を省略する。   FIG. 9 is a block configuration diagram of an inter-CPU communication system 800 in the present embodiment. 9, the same functional blocks as those in FIG. 2 described in the first embodiment are denoted by the same reference numerals, and the description thereof is omitted.

図9では、図2の構成に加えて、CPU間通信制御部321が、スケジューリング制御部601、割込・コンテキストスイッチ遅延計測部602、ビジーループ時間設定部603を備える。また、ビジーループのスケジューリング制御時間のタイムアウト時間として、データフル解消待ち第3タイムアウト時間611(第3のタイムアウト時間)、データフル解消待ち第4タイムアウト時間612(第4のタイムアウト時間)、データエンプティ待ち第5タイムアウト時間613(第5のタイムアウト時間)、データエンプティ待ち第6タイムアウト時間614(第6のタイムアウト時間)を予め備える。すなわち、CPU間通信システム800のCPU間通信制御部321は、予め、データフル解消待ち第3タイムアウト時間611、データフル解消待ち第4タイムアウト時間612、データエンプティ待ち第5タイムアウト時間613、データエンプティ待ち第6タイムアウト時間614を決定し、記憶装置(CPU101のローカルメモリでもよい)に記憶する。CPU間通信制御部321は、第3のタイムアウト時間記憶部、第4のタイムアウト時間記憶部、第5のタイムアウト時間記憶部、第6のタイムアウト時間記憶部の一例である。   In FIG. 9, in addition to the configuration of FIG. 2, the inter-CPU communication control unit 321 includes a scheduling control unit 601, an interrupt / context switch delay measurement unit 602, and a busy loop time setting unit 603. Further, as a timeout time of the scheduling control time of the busy loop, a third timeout time 611 (third timeout time) waiting for data full resolution, a fourth timeout time 612 (fourth timeout time) waiting for data full resolution, a data empty waiting time A 5 timeout period 613 (fifth timeout period) and a data empty waiting sixth timeout period 614 (sixth timeout period) are provided in advance. That is, the inter-CPU communication control unit 321 of the inter-CPU communication system 800 previously stores the data full resolution waiting third timeout time 611, the data full resolution waiting fourth timeout time 612, the data empty waiting fifth timeout time 613, and the data empty waiting. A sixth timeout time 614 is determined and stored in a storage device (which may be a local memory of the CPU 101). The inter-CPU communication control unit 321 is an example of a third timeout time storage unit, a fourth timeout time storage unit, a fifth timeout time storage unit, and a sixth timeout time storage unit.

図10は、本実施の形態に係るCPU間通信システムの送信側スケジューリング制御方法(送信側スケジューリング制御処理)である。図10を用いて、CPU間通信システムのスケジューリング制御部601による送信側スケジューリング制御方法の動作について説明する。   FIG. 10 shows a transmission side scheduling control method (transmission side scheduling control process) of the inter-CPU communication system according to the present embodiment. The operation of the transmission side scheduling control method by the scheduling control unit 601 of the inter-CPU communication system will be described with reference to FIG.

本実施の形態で説明するCPU間通信方法は、継続フラグ311は受信側CPUのデータ書き込み処理のビジーループ時にセットされる方式(すなわち、図5あるいは図8の方式)であるものとする。したがって実施の形態2で説明した図8を一部変更した場合について説明し、図8において説明した処理と同様の処理には同一の符号を付し、その説明を省略する。   In the inter-CPU communication method described in the present embodiment, it is assumed that the continuation flag 311 is a method (that is, the method shown in FIG. 5 or FIG. 8) that is set during a busy loop of data write processing of the receiving CPU. Therefore, a case where FIG. 8 described in the second embodiment is partly changed will be described. The same processes as those described in FIG. 8 are denoted by the same reference numerals, and the description thereof is omitted.

図10においてS401からS502までは図8の処理と同様である。S502において、ハングオン制御部322は、継続フラグ311をセットするとS701に進む。   In FIG. 10, S401 to S502 are the same as the processing of FIG. In S502, when the hang-on control unit 322 sets the continuation flag 311, the process proceeds to S701.

S701において、スケジューリング制御部601は、データフル解消待ち第3タイムアウト時間611を設定する。また、スケジューリング制御部601は、S702で、データフル解消待ち第4タイムアウト時間612を設定する。CPU間通信制御システム801におけるCPU間通信制御方法において、データフル解消待ち第3タイムアウト時間611、データフル解消待ち第4タイムアウト時間612に設定する時間を決定する方法は、後述する。スケジューリング制御部601は、送信側制御部354の一例であってもよい。   In step S <b> 701, the scheduling control unit 601 sets a third timeout period 611 waiting for data full resolution. In step S <b> 702, the scheduling control unit 601 sets a fourth timeout period 612 waiting for data full resolution. In the inter-CPU communication control method in the inter-CPU communication control system 801, a method for determining the time to be set as the data full resolution wait third timeout time 611 and the data full resolution wait fourth timeout time 612 will be described later. The scheduling control unit 601 may be an example of the transmission side control unit 354.

S703において、スケジューリング制御部601は、OS301にスケジューリングロックの指示を出し、他のタスクへのスイッチを禁止する。次に、S704において、スケジューリング制御部601は、メモリ104(通信用メモリ305)のデータフルが解消したかチェックする。このとき、スケジューリング制御部601は、メモリ領域判定部351でもよい。データフルが解消していない場合は(S704でNo)、スケジューリング制御部601は、S705に進む。   In step S <b> 703, the scheduling control unit 601 issues a scheduling lock instruction to the OS 301 and prohibits switching to other tasks. In step S <b> 704, the scheduling control unit 601 checks whether the data full in the memory 104 (communication memory 305) has been eliminated. At this time, the scheduling control unit 601 may be the memory area determination unit 351. If the data full has not been resolved (No in S704), the scheduling control unit 601 proceeds to S705.

S705において、スケジューリング制御部601は、データフル解消待ち第3タイムアウトが発生したかチェックし、タイムアウトが発生していない場合はS704に戻り、データフルが解消するまでビジーループでウェイトする第1の待ち状態とする。つまり、S703で実行したスケジューリングロック状態のまま、ビジーループによりデータフル解消をウェイトする。なお、スケジューリングロック状態でも割込は受信できるものとする。   In S705, the scheduling control unit 601 checks whether a third timeout for waiting for data full has occurred. If no timeout has occurred, the scheduling control unit 601 returns to S704 and waits in a busy loop until the data full is cleared. And That is, the data full cancellation is waited by the busy loop while the scheduling lock state executed in S703 is maintained. Note that interrupts can be received even in the scheduling lock state.

スケジューリング制御部601は、S705において、第1の待ち状態が発生してからデータフル解消待ち第3タイムアウト時間が経過したか否かを判定する。S705でデータフル解消待ち第3タイムアウト時間611によるデータフル解消待ち第3タイムアウトが発生した場合は、スケジューリング制御部601は、S706で、OS301にスケジューリングロック解除指示を出し、OS301によるタスクスイッチを可能にする。続いて、スケジューリング制御部601は、ビジーループのスケジューリングを、OS301内の同一優先度のタスク間で再スケジューリングを繰り返すYieldスケジューリングに切り替える。スケジューリング制御部601は、S707に進む。   In step S <b> 705, the scheduling control unit 601 determines whether a third timeout period for waiting for data full resolution has elapsed since the occurrence of the first wait state. When the third timeout waiting for data full resolution due to the third timeout period 611 waiting for data full resolution occurs in S705, the scheduling control unit 601 issues a scheduling lock release instruction to the OS 301 in S706 to enable task switching by the OS 301. To do. Subsequently, the scheduling control unit 601 switches the busy loop scheduling to Yield scheduling that repeats rescheduling between tasks of the same priority in the OS 301. The scheduling control unit 601 proceeds to S707.

S707において、スケジューリング制御部601は、データフルが解消したかチェックする。データフルが解消していない場合は、スケジューリング制御部601は、S708で、データフル解消待ち第4タイムアウト時間612によるデータフル解消待ち第4タイムアウトが発生したかチェックし、タイムアウトが発生していない場合はS707に戻り、Yieldスケジューリングによるビジーループでデータフル解消をウェイトする第2の待ち状態とする。つまり、S706で実行したスケジューリングロック解除状態のまま、ビジーループによりデータフル解消をウェイトする(第2の待ち状態)。   In step S707, the scheduling control unit 601 checks whether the data full has been resolved. If the data full has not been eliminated, the scheduling control unit 601 checks in step S708 whether a fourth timeout has occurred waiting for data full elimination due to the fourth timeout time 612 waiting for data full elimination, and if no timeout has occurred. Returns to S707, and enters a second waiting state in which data full cancellation is waited in a busy loop based on Yield scheduling. That is, the data full cancellation is waited by the busy loop in the scheduling lock release state executed in S706 (second waiting state).

S704またはS707で、スケジューリング制御部601は、データフルが解消した場合は、S401に戻り、データ送信を行う。S401以降の処理は図5あるいは図8にて説明した処理と同様である。   In S704 or S707, when the data full is resolved, the scheduling control unit 601 returns to S401 and performs data transmission. The processing after S401 is the same as the processing described in FIG. 5 or FIG.

スケジューリング制御部601は、S708において、第2の待ち状態が発生してからデータフル解消待ち第4タイムアウト時間が経過したか否かを判定する。S708でデータフル解消待ち第4タイムアウト時間612によるデータフル解消待ち第4タイムアウトが発生した場合は、スケジューリング制御部601は、図8のS506に戻り、継続フラグ311をクリアして、ビジーループによるウェイト(第2の待ち状態)を終了する。   In step S <b> 708, the scheduling control unit 601 determines whether a fourth timeout period has elapsed since the second wait state has occurred and the data full resolution wait time has elapsed. If the fourth timeout waiting for data full resolution due to the fourth timeout period 612 waiting for data full resolution occurs in S708, the scheduling control unit 601 returns to S506 in FIG. 8, clears the continuation flag 311 and waits for busy loop ( The second waiting state is terminated.

以上で、本実施の形態に係る送信側CPU間通信方法の送信側スケジューリング制御方法の説明を終了する。スケジューリング制御部601は、第1のスケジューリング部、第2のスケジューリング部の一例である。   This is the end of the description of the transmission side scheduling control method of the transmission side inter-CPU communication method according to the present embodiment. The scheduling control unit 601 is an example of a first scheduling unit and a second scheduling unit.

図11は、本実施の形態に係るCPU間通信システム800の受信側スケジューリング制御方法(受信側スケジューリング制御処理)のフロー図である。図11を用いて、本実施の形態に係るCPU間通信システム800のスケジューリング制御部601における受信側スケジューリング制御方法の動作について説明する。   FIG. 11 is a flowchart of the receiving side scheduling control method (receiving side scheduling control process) of the inter-CPU communication system 800 according to the present embodiment. The operation of the receiving side scheduling control method in the scheduling control unit 601 of the inter-CPU communication system 800 according to the present embodiment will be described using FIG.

図11では、実施の形態1で説明した図6の処理を一部変更した処理であり、図6と異なる処理について説明し、図6において説明した処理と同様の処理には同一の符号を付し、その説明を省略する。   11 is a process obtained by partially changing the process of FIG. 6 described in the first embodiment. The process different from that of FIG. 6 is described. The same processes as those described in FIG. The description is omitted.

図11においてS451からS452までは図5の処理と同様である。S452において、ハングオン制御部322がメモリ104(通信用メモリ305)にデータフルが発生していないと判断すると(S452でNo)、S752に進む。   In FIG. 11, S451 to S452 are the same as the processing of FIG. If the hang-on control unit 322 determines in S452 that data is not full in the memory 104 (communication memory 305) (No in S452), the process proceeds to S752.

S752において、受信側のスケジューリング制御部601は、データエンプティ待ち第5タイムアウト時間613を設定する。S753において、受信側のスケジューリング制御部601は、データエンプティ待ち第6タイムアウト時間614を設定する。CPU間通信システム800におけるCPU間通信方法において、データエンプティ待ち第5タイムアウト時間613、データエンプティ待ち第6タイムアウト時間614に設定する時間を決定する方法は、後述する。スケジューリング制御部601は、受信側制御部364であってもよい。   In step S <b> 752, the scheduling control unit 601 on the reception side sets a data empty waiting fifth timeout period 613. In step S753, the scheduling control unit 601 on the reception side sets the sixth timeout period 614 waiting for data empty. In the inter-CPU communication method in the inter-CPU communication system 800, a method of determining the times to be set as the data empty waiting fifth timeout time 613 and the data empty waiting sixth timeout time 614 will be described later. The scheduling control unit 601 may be the reception side control unit 364.

次に、S754で、受信側のスケジューリング制御部601は、OS301対してスケジューリングロックの指示を出し、OS301による他のタスクへのスイッチを禁止する。次に、S755で、受信側のスケジューリング制御部601は、データエンプティであるかチェックする。スケジューリング制御部601は、メモリ状態判定部361であってもよい。   Next, in S754, the scheduling control unit 601 on the receiving side issues a scheduling lock instruction to the OS 301 and prohibits the OS 301 from switching to another task. Next, in S755, the scheduling control unit 601 on the receiving side checks whether the data is empty. The scheduling control unit 601 may be the memory state determination unit 361.

データエンプティでない場合は(S755でNo)、受信側のスケジューリング制御部601は、S462へ進む。S462以降の処理は図6の処理と同様である。   If it is not data empty (No in S755), the scheduling control unit 601 on the receiving side proceeds to S462. The processing after S462 is the same as the processing in FIG.

データエンプティの場合は(S755でYes)、受信側のスケジューリング制御部601は、S756で、データエンプティ待ち第5タイムアウト時間613によるデータエンプティ待ち第5タイムアウトが発生したかチェックする。データエンプティ待ち第5タイムアウトが発生していない場合は(S756でNo)、受信側のスケジューリング制御部601は、S755に戻る。すなわち、受信側のスケジューリング制御部601は、S754で指示したOS301のスケジューリングロック状態のまま、ビジーループによりデータエンプティでなくなるのをウェイトする第3の待ち状態とする。送信側CPUの場合と同様に、スケジューリングロック状態でも割込は受信できるものとする。   In the case of data empty (Yes in S755), the scheduling control unit 601 on the receiving side checks in S756 whether the fifth timeout waiting for data empty due to the fifth timeout time 613 waiting for data empty has occurred. If the fifth timeout waiting for data empty has not occurred (No in S756), the receiving side scheduling control unit 601 returns to S755. In other words, the scheduling control unit 601 on the reception side remains in the scheduling lock state of the OS 301 instructed in S754, and enters a third waiting state that waits for data empty due to a busy loop. As in the case of the transmission side CPU, it is assumed that the interrupt can be received even in the scheduling lock state.

受信側のスケジューリング制御部601は、S756において、第3の待ち状態が発生してからデータフル解消待ち第5タイムアウト時間が経過したか否かを判定する。S756でデータフル解消待ち第5タイムアウト時間613によるデータフル解消待ち第5タイムアウトが発生した場合は、受信側のスケジューリング制御部601は、S757で、OS301にスケジューリングロック解除指示を出し、OS301によるタスクスイッチを可能にする。   In S756, the scheduling control unit 601 on the receiving side determines whether or not the fifth timeout period for waiting for data full resolution has elapsed since the occurrence of the third wait state. When the fifth timeout waiting for data full resolution due to the fifth timeout time 613 waiting for data full resolution occurs in S756, the scheduling control unit 601 on the receiving side issues a scheduling lock release instruction to the OS 301 in S757, and the task switching by the OS 301 is performed. Enable.

データエンプティ待ち第5タイムアウトが発生した場合は(S756でYes)、S757に進む。S757において、受信側のスケジューリング制御部601は、OS301にスケジューリングロックを解除させるためのスケジューリングロック解除指示を出し、タスクスイッチを可能にする。そして、受信側のスケジューリング制御部601は、ビジーループのスケジューリングを、OS301内の同一優先度のタスク間で再スケジューリングを繰り返すYieldスケジューリングに切り替える。   If the fifth timeout waiting for data empty has occurred (Yes in S756), the process proceeds to S757. In step S757, the scheduling control unit 601 on the reception side issues a scheduling lock release instruction for causing the OS 301 to release the scheduling lock, and enables task switching. Then, the scheduling control unit 601 on the reception side switches busy loop scheduling to Yield scheduling that repeats rescheduling between tasks of the same priority in the OS 301.

S758において、受信側のスケジューリング制御部601は、メモリ104(通信用メモリ305)がデータエンプティであるかチェックする。データエンプティでない場合は(S758でNo)、受信側のスケジューリング制御部601は、S462へ進む。S462以降の処理は図6の処理と同様である。   In S758, the scheduling control unit 601 on the reception side checks whether the memory 104 (communication memory 305) is data empty. If it is not data empty (No in S758), the scheduling control unit 601 on the receiving side proceeds to S462. The processing after S462 is the same as the processing in FIG.

データエンプティの場合は(S758でYes)、受信側のスケジューリング制御部601は、S759で、データエンプティ待ち第6タイムアウト時間614によるデータエンプティ待ち第6タイムアウトが発生したかチェックする。データエンプティ待ち第6タイムアウトが発生していない場合は(S759でNo)、受信側のスケジューリング制御部601は、S758に戻る。すなわち、受信側のスケジューリング制御部601は、Yieldスケジューリングによるビジーループでデータエンプティでなくなるのをウェイトする第4の待ち状態とする。   In the case of data empty (Yes in S758), the scheduling control unit 601 on the receiving side checks in S759 whether or not a data empty waiting sixth timeout due to the data empty waiting sixth timeout time 614 has occurred. If the sixth timeout waiting for data empty has not occurred (No in S759), the scheduling control unit 601 on the receiving side returns to S758. In other words, the scheduling control unit 601 on the receiving side sets the fourth waiting state to wait for the data empty state in the busy loop based on the Yield scheduling.

データエンプティ待ち第6タイムアウトが発生した場合は(S759でYes)、受信側のスケジューリング制御部601は、図6のS459ヘ進み、レディフラグ312をクリアして、ビジーループによるウェイトを終了する。S459以降の処理は、図6の処理と同様である。スケジューリング制御部601は、第3のスケジューリング部、第4のスケジューリング部の一例である。   If the sixth timeout waiting for data empty has occurred (Yes in S759), the scheduling control unit 601 on the receiving side proceeds to S459 in FIG. 6, clears the ready flag 312 and ends the busy loop wait. The processing after S459 is the same as the processing in FIG. The scheduling control unit 601 is an example of a third scheduling unit and a fourth scheduling unit.

次に、タイムアウト時間を決定する処理について説明する。図12は、本実施の形態3に係るタイムアウト時間決定処理の動作を示すフロー図である。   Next, processing for determining the timeout time will be described. FIG. 12 is a flowchart showing the operation of the timeout time determination process according to the third embodiment.

図12を用いて、データフル解消待ち第3タイムアウト時間611、データフル解消待ち第4タイムアウト時間612、データエンプティ待ち第5タイムアウト時間613、データエンプティ待ち第6タイムアウト時間614に設定するタイムアウト時間の決定方法(算出方法)を説明する。図12は、タイムアウト時間を決定する割込・コンテキストスイッチ遅延計測部602、及び、ビジーループ時間設定部603の動作を示すものである。   Referring to FIG. 12, the determination of the timeout time to be set as the third timeout time 611 waiting for data full resolution, the fourth timeout time 612 waiting for data full resolution, the fifth timeout time 613 waiting for data empty, and the sixth timeout time 614 waiting for data empty A method (calculation method) will be described. FIG. 12 shows operations of the interrupt / context switch delay measuring unit 602 and the busy loop time setting unit 603 for determining the timeout time.

割込・コンテキストスイッチ遅延計測部602及びビジーループ時間設定部603は、システム起動時に1回だけ動作し、タイムアウト時間を決定し記憶装置に記憶する。あるいは、割込・コンテキストスイッチ遅延計測部602及びビジーループ時間設定部603は、定期的に動作して、記憶装置に記憶されたタイムアウト時間を定期的に更新するとしてもよい。   The interrupt / context switch delay measurement unit 602 and the busy loop time setting unit 603 operate only once at the time of system startup, determine a timeout time, and store it in the storage device. Alternatively, the interrupt / context switch delay measurement unit 602 and the busy loop time setting unit 603 may periodically operate to periodically update the timeout time stored in the storage device.

S801において、割込・コンテキストスイッチ遅延計測部602は、割込による遅延時間の測定用のタイマ割込を発生させるための設定を行う。割込・コンテキストスイッチ遅延計測部602による割込・コンテキストスイッチ遅延時間計測方法では、タイマ割込を発生させた時刻である「タイマ割込発生時刻751」と、実際に割込ハンドラが呼び出された「割込ハンドラ呼出時刻752」との差を割込遅延時間701とする。   In step S <b> 801, the interrupt / context switch delay measurement unit 602 performs settings for generating a timer interrupt for measuring a delay time due to an interrupt. In the interrupt / context switch delay time measuring method by the interrupt / context switch delay measuring unit 602, the timer interrupt generation time 751 that is the time when the timer interrupt is generated and the interrupt handler is actually called. The difference from the “interrupt handler call time 752” is defined as an interrupt delay time 701.

割込・コンテキストスイッチ遅延計測部602は、S802において、タイマ割込を発生させタイマ割込発生時刻751を記憶装置に記憶する。S803において、OS301によりタイマ割込の発生に起因する割込ハンドラが呼び出されると、割込・コンテキストスイッチ遅延計測部602は、割込ハンドラが呼び出された時刻を、割込ハンドラ呼出時刻752として記憶装置に記憶する。   In step S802, the interrupt / context switch delay measuring unit 602 generates a timer interrupt and stores the timer interrupt generation time 751 in the storage device. In step S <b> 803, when an interrupt handler due to the occurrence of a timer interrupt is called by the OS 301, the interrupt / context switch delay measurement unit 602 stores the time when the interrupt handler is called as an interrupt handler call time 752. Store in the device.

S804において、割込・コンテキストスイッチ遅延計測部602は、記憶装置に記憶されたタイマ割込発生時刻751と割込ハンドラ呼出時刻752との差を算出し、算出した差を「割込遅延時間701」として記憶装置に記憶する。   In step S804, the interrupt / context switch delay measurement unit 602 calculates a difference between the timer interrupt occurrence time 751 and the interrupt handler call time 752 stored in the storage device, and calculates the calculated difference as “interrupt delay time 701. Is stored in the storage device.

S805において、OS301により割込ハンドラからタスクへコンテキストスイッチする。S806において、割込・コンテキストスイッチ遅延計測部602は、割込ハンドラからタスクへコンテキストスイッチする時間を計測して「コンテキストスイッチ時間702」として記憶装置に記憶するとともに、コンテキストスイッチした時刻をコンテキストスイッチ時刻753として記憶装置に記憶する。   In step S805, the OS 301 performs context switching from the interrupt handler to the task. In step S806, the interrupt / context switch delay measurement unit 602 measures the time for context switching from the interrupt handler to the task, stores the time as “context switch time 702” in the storage device, and sets the context switch time as the context switch time. 753 is stored in the storage device.

ビジーループ時間設定部603は、以下の処理により各タイムアウト時間(データフル解消待ち第3タイムアウト時間611、データフル解消待ち第4タイムアウト時間612、データエンプティ待ち第5タイムアウト時間613、データエンプティ待ち第6タイムアウト時間614)を決定し、記憶装置に記憶する。   The busy loop time setting unit 603 performs the following processing for each timeout time (data full resolution waiting third timeout time 611, data full resolution waiting fourth timeout time 612, data empty waiting fifth timeout time 613, and data empty waiting sixth timeout). Time 614) is determined and stored in the storage device.

S807において、ビジーループ時間設定部603は、S804で算出された「割込遅延時間701」と、S806で算出された「コンテキストスイッチ時間702」との差分の2倍の値を算出し、データフル解消待ち第3タイムアウト時間611として設定する。これは、コンテキストスイッチを2回行って元のタスクにスイッチする時間よりも短い時間でCPU間通信が行われるならば、スケジューリングロックで状態変更をウェイトした方が効率的なため、「割込遅延時間701」と「コンテキストスイッチ時間702」との差分の2倍の値をスケジューリングロック状態でのタイムアウト時間(データフル解消待ち第3タイムアウト時間611)とした例である。   In S807, the busy loop time setting unit 603 calculates a value that is twice the difference between the “interrupt delay time 701” calculated in S804 and the “context switch time 702” calculated in S806, and eliminates data full. This is set as the waiting third timeout period 611. This is because it is more efficient to wait for the state change with the scheduling lock if the inter-CPU communication is performed in a time shorter than the time for performing the context switch twice and switching to the original task. In this example, a value twice the difference between the “time 701” and the “context switch time 702” is set as a timeout time in the scheduling lock state (the third timeout time 611 waiting for data full resolution).

また、ビジーループ時間設定部603は、データエンプティ待ち第5タイムアウト時間613も、データフル解消待ち第3タイムアウト時間611と同じ決定方法により時間を決定する。すなわち、ビジーループ時間設定部603は、割込遅延時間701とコンテキストスイッチ時間702との差分の2倍の値を、スケジューリングロック状態でのタイムアウト時間(データフル解消待ち第5タイムアウト時間613)として設定する。   The busy loop time setting unit 603 also determines the time for the data empty waiting fifth timeout time 613 by the same determination method as the data full resolution waiting third timeout time 611. That is, the busy loop time setting unit 603 sets a value twice the difference between the interrupt delay time 701 and the context switch time 702 as the timeout time in the scheduling lock state (the fifth timeout time 613 waiting for data full resolution). .

次に、S808において、ビジーループ時間設定部603は、S806のコンテキストスイッチ時刻753と、S802のタイマ割込発生時刻751との差分の2倍の値を、データフル解消待ち第4タイムアウト時間612として設定する。これは、タイマ割込を受けてからコンテキストスイッチする時間に相当する時間でCPU間通信が行われるならば、ビジーループで状態変更をウェイトした方が効率的なため、コンテキストスイッチ時刻753とタイマ割込発生時刻751の差分の2倍の値をビジーループのタイムアウト時間(データフル解消待ち第4タイムアウト時間612)とした例である。また、ビジーループ時間設定部603は、データエンプティ待ち第6タイムアウト時間614も、データフル解消待ち第4タイムアウト時間612と同じ時間に設定する。   Next, in S808, the busy loop time setting unit 603 sets a value that is twice the difference between the context switch time 753 in S806 and the timer interrupt generation time 751 in S802 as the data full resolution wait fourth timeout time 612. To do. This is because it is more efficient to wait for a state change in the busy loop if communication between CPUs is performed in a time corresponding to the time of context switch after receiving the timer interrupt. In this example, a value twice as large as the difference between the generation times 751 is used as a busy loop timeout time (fourth timeout time 612 waiting for data full resolution). The busy loop time setting unit 603 also sets the data empty waiting sixth timeout time 614 to the same time as the data full resolution waiting fourth timeout time 612.

以上のように、CPU間通信制御部321は、スケジューリング制御部601を備えているので、CPU間通信のウェイト方法を段階的に変更することができる。また、遅延時間に合わせて適切なウェイト方法をとることができるようになる。また、割込・コンテキストスイッチ遅延計測手段(割込・コンテキストスイッチ遅延計測部602)とビジーループ時間設定手段(ビジーループ時間設定部603)とにより、それぞれのウェイト時間(タイムアウト時間)をシステムのハードウェア性能、OS301の性能に合わせて適切な時間を自動的に設定することができるようになる。   As described above, since the inter-CPU communication control unit 321 includes the scheduling control unit 601, the wait method for inter-CPU communication can be changed in stages. In addition, an appropriate wait method can be taken according to the delay time. The interrupt / context switch delay measuring means (interrupt / context switch delay measuring section 602) and the busy loop time setting means (busy loop time setting section 603) are used to set each wait time (timeout time) to the hardware performance of the system. Thus, it is possible to automatically set an appropriate time according to the performance of the OS 301.

本実施の形態では、以下のような特徴を有するCPU間通信システム800について説明した。   In the present embodiment, the inter-CPU communication system 800 having the following characteristics has been described.

CPU間通信制御手段(CPU間通信制御部321)内に、ハングオン制御部322に加えて、以下の手段を備えることを特徴とするCPU間通信方式(CPU間通信システム800)。
(a)CPU間通信による送信側のデータフル解消待ちをビジーループでウェイトする場合に、一定時間OS301のスケジューリングをロックすることにより他のタスクにスイッチしないようにしてウェイトする送信側スケジューリング制御手段(スケジューリング制御部601)。
(b)前記(a)のOS301のスケジューリングロックの間に送信側のデータフルが解消しなかった場合、OS301内の同一優先度のタスク間で再スケジューリングを繰り返すYieldスケジューリングによりウェイトすることにより、段階的にビジーループの優先性を制御する送信側スケジューリング制御手段(スケジューリング制御部601)。
(c)CPU間通信による受信側のデータエンプティ待ちをビジーループでウェイトする場合に、送信の場合と同様に、一定時間OS301のスケジューリングをロックすることにより他のタスクにスイッチしないようにしてウェイトする受信側スケジューリング制御手段(スケジューリング制御部601)。
(d)前記(c)のOS301のスケジューリングロックの間に受信側のデータエンプティが解消しなかった場合、OS301内の同一優先度のタスク間で再スケジューリングを繰り返すYieldスケジューリングによりウェイトすることにより、段階的にビジーループの優先性を制御する受信側スケジューリング制御手段(スケジューリング制御部601)。
An inter-CPU communication method (inter-CPU communication system 800) comprising the following means in addition to the hang-on control unit 322 in the inter-CPU communication control means (inter-CPU communication control unit 321).
(A) A transmission side scheduling control means (scheduling) that waits so as not to switch to another task by locking the scheduling of the OS 301 for a certain period of time when waiting for data full resolution waiting on the transmission side by communication between CPUs in a busy loop. Control unit 601).
(B) If the data full on the transmission side is not resolved during the scheduling lock of the OS 301 in (a) above, a stage is obtained by waiting by Yield scheduling that repeats rescheduling between tasks of the same priority in the OS 301. The transmission side scheduling control means (scheduling control unit 601) for controlling the priority of the busy loop.
(C) When waiting for a data empty on the receiving side by communication between CPUs in a busy loop, as in the case of transmission, the reception waits without switching to another task by locking the scheduling of the OS 301 for a certain period of time. Side scheduling control means (scheduling control unit 601).
(D) If the data empty on the receiving side is not resolved during the scheduling lock of the OS 301 in (c) above, a stage is obtained by waiting by Yield scheduling that repeats rescheduling between tasks of the same priority in the OS 301. Receiving-side scheduling control means (scheduling control unit 601) for controlling the priority of busy loops.

前記のCPU間通信制御手段内(CPU間通信制御部321)に、ハングオン制御手段(ハングオン制御部322)、スケジューリング制御手段(スケジューリング制御部601)に加えて、以下の手段を備えることを特徴とするCPU間通信方式(CPU間通信システム800)。
(a)タイマ割込発生からOS301の割込ハンドラ呼出しまでの割込応答遅延時間(割込遅延時間701)を測定する割込遅延計測手段(割込み・コンテキストスイッチ遅延計測部602)。
(b)OS301のタスク間のコンテキストスイッチ遅延時間(コンテキストスイッチ時間702)を計測するコンテキストスイッチ計測手段(割込み・コンテキストスイッチ遅延計測部602)。
(c)前記(a)、(b)で計測した割込応答遅延時間(割込遅延時間701)とコンテキストスイッチ遅延時間(コンテキストスイッチ時間702)とに基づいて、ビジーループのタイムアウト時間を決定するビジーループ時間設定手段(ビジーループ時間設定部603)。
In addition to the hang-on control means (hang-on control part 322) and the scheduling control means (scheduling control part 601), the following means are provided in the inter-CPU communication control means (inter-CPU communication control part 321). The inter-CPU communication method (inter-CPU communication system 800).
(A) Interrupt delay measurement means (interrupt / context switch delay measurement unit 602) that measures an interrupt response delay time (interrupt delay time 701) from the occurrence of a timer interrupt to the call of an interrupt handler of the OS 301.
(B) Context switch measuring means (interrupt / context switch delay measuring unit 602) that measures a context switch delay time (context switch time 702) between tasks of the OS 301.
(C) A busy loop that determines a timeout time of a busy loop based on the interrupt response delay time (interrupt delay time 701) and the context switch delay time (context switch time 702) measured in (a) and (b). Time setting means (busy loop time setting unit 603).

実施の形態4.
実施の形態1で説明したCPU間通信システム800のCPU間割込処理を変更することにより、CPU間通信の遅延時間を短縮する方法について説明する。
Embodiment 4 FIG.
A method for shortening the delay time of inter-CPU communication by changing the inter-CPU interrupt process of the inter-CPU communication system 800 described in the first embodiment will be described.

図13は、本実施の形態4におけるCPU間通信システムの機能ブロック図である。図13において、上述した図9と同様の機能ブロックについては同一の符号を付し、その説明を省略する。図13では、図9の構成に加えて、CPU間通信制御部321がプレCPU間割込部650を備えている。   FIG. 13 is a functional block diagram of the inter-CPU communication system according to the fourth embodiment. 13, the same functional blocks as those in FIG. 9 described above are denoted by the same reference numerals, and the description thereof is omitted. In FIG. 13, in addition to the configuration of FIG. 9, the inter-CPU communication control unit 321 includes a pre-CPU interrupt unit 650.

図14は、本実施の形態4におけるCPU間通信システムのCPU間通信方法の一部を示すフロー図である。図14に示すフローは、上述した図4に示すフローを一部変更したものである。図14を用いて、本実施の形態に係るCPU間通信システム800の送信側のプレCPU間割込手段(プレCPU間割込部650)の動作を示す。   FIG. 14 is a flowchart showing a part of the inter-CPU communication method of the inter-CPU communication system according to the fourth embodiment. The flow shown in FIG. 14 is a partial modification of the flow shown in FIG. 4 described above. The operation of the pre-CPU interrupt means (pre-CPU interrupt unit 650) on the transmission side of the inter-CPU communication system 800 according to the present embodiment will be described using FIG.

図4のS401〜S403で説明したように、CPU間割込(データ読み出し開始要求X1)は、送信側CPUから受信側CPUへデータ送信が行われたことを通知するためのCPU間割込であった。   As described in S401 to S403 of FIG. 4, the inter-CPU interrupt (data read start request X1) is an inter-CPU interrupt for notifying that data transmission has been performed from the transmitting CPU to the receiving CPU. there were.

本実施の形態では、S401aにて、ハングオン制御部322により継続フラグ311がセットされると、S1002において、プレCPU間割込部650は、レディフラグ312がセットされているかをチェックする。レディフラグ3121がセットされている場合は(S1002でYes)、S1004に進み、ハングオン制御部322は、データ送信処理を実行する。レディフラグ3121がセットされていない場合は(S1002でNo)、S1003に進む。   In this embodiment, when the continuation flag 311 is set by the hang-on control unit 322 in S401a, the pre-CPU interrupt unit 650 checks whether the ready flag 312 is set in S1002. If the ready flag 3121 is set (Yes in S1002), the process proceeds to S1004, and the hang-on control unit 322 executes data transmission processing. If the ready flag 3121 is not set (No in S1002), the process proceeds to S1003.

S1003において、プレCPU間割込部650は、受信側CPUへCPU間割込(データ読み出し開始要求X1)を送信する。その後、S1004に進み、ハングオン制御部322は、データ送信処理を実行する。ハングオン制御部322は、S1004でデータ送信を行った後、S404に進む。S404以降の処理は、図4において説明した処理と同様に、全データ送信完了チェック以降の手順を行う。   In S1003, the pre-CPU interrupt unit 650 transmits an inter-CPU interrupt (data read start request X1) to the receiving CPU. Thereafter, the process proceeds to S1004, and the hang-on control unit 322 executes a data transmission process. The hang-on control unit 322 transmits data in S1004, and then proceeds to S404. In the processing after S404, similar to the processing described in FIG. 4, the procedure after the all data transmission completion check is performed.

上記の処理により、CPU間割込(データ読み出し開始要求X1)がデータ送信前に受信側CPUに処理されても、受信側タスクはビジーループでデータエンプティ待ちするため、CPU間通信を行うことができる。   With the above processing, even if an inter-CPU interrupt (data read start request X1) is processed by the receiving CPU before data transmission, the receiving task waits for data empty in a busy loop, so that inter-CPU communication can be performed. .

図15は、本実施の形態4におけるCPU間通信システムのCPU間通信方法の一部を示すフロー図である。図15に示すフローは、上述した図6に示すフローを一部変更したものである。図15を用いて、本実施の形態に係るCPU間通信システム800の受信側のプレCPU間割込手段(プレCPU間割込部650)の動作を示す。   FIG. 15 is a flowchart showing a part of the inter-CPU communication method of the inter-CPU communication system according to the fourth embodiment. The flow shown in FIG. 15 is a partial modification of the flow shown in FIG. The operation of the pre-CPU interrupt means (pre-CPU interrupt unit 650) on the receiving side of the inter-CPU communication system 800 according to the present embodiment will be described using FIG.

図6のS453〜S455で説明したように、CPU間割込(データ書き込み開始要求X2)は、受信側CPUから送信側CPUへデータ受信が行われたことを通知するためのCPU間割込であった。   As described in S453 to S455 of FIG. 6, the inter-CPU interrupt (data write start request X2) is an inter-CPU interrupt for notifying that data reception has been performed from the receiving CPU to the transmitting CPU. there were.

本実施の形態では、S452にてデータフルが発生したと判断されると(S452でYes)、プレCPU間割込部650は、継続フラグ311がセットされているかチェックする(S1051)。継続フラグ311がセットされている場合は(S1051でYes)、S1053に進み、ハングオン制御部322は、データ受信処理を実行する。継続フラグ311がセットされていない場合は(S1051でNo)、S1052に進む。   In this embodiment, when it is determined that data full has occurred in S452 (Yes in S452), the pre-CPU interrupt unit 650 checks whether the continuation flag 311 is set (S1051). If the continuation flag 311 is set (Yes in S1051), the process proceeds to S1053, and the hang-on control unit 322 executes data reception processing. If the continuation flag 311 is not set (No in S1051), the process proceeds to S1052.

S1052において、プレCPU間割込部650は、送信側CPUへCPU間割込(データ書き込み開始要求X2)を送信する。その後、S1053に進み、ハングオン制御部322は、データ受信処理を実行する。ハングオン制御部322は、S1053でデータ受信(データ読み出し処理)を行った後、S463に進む。S463以降の処理は、図6において説明した処理と同様に、全データ受信完了チェック以降の手順を行う。   In S1052, the pre-CPU interrupt unit 650 transmits an inter-CPU interrupt (data write start request X2) to the transmitting CPU. Thereafter, the process proceeds to S1053, and the hang-on control unit 322 executes data reception processing. The hang-on control unit 322 performs data reception (data read processing) in S1053, and then proceeds to S463. In the processing after S463, similar to the processing described with reference to FIG.

上記処理により、CPU間割込(データ書き込み開始要求X2)がデータ受信前に送信側CPUに処理されても、送信側タスクはビジーループでデータフル解消待ちするため、CPU間通信を行うことができる。   With the above processing, even if an inter-CPU interrupt (data write start request X2) is processed by the transmitting CPU before data reception, the transmitting task waits for data full cancellation in a busy loop, and therefore, inter-CPU communication can be performed. .

本実施の形態では、以下の特徴と備えるCPU間通信システム800について説明した。   In the present embodiment, the inter-CPU communication system 800 including the following features has been described.

CPU間通信制御手段(CPU間通信制御部321)内に、ハングオン制御手段(ハングオン制御部322)に加えて、以下の手段を備えることを特徴とするCPU間通信方式(CPU間通信システム800)。
(a)CPU間通信において、受信側タスクを起床するCPU間割込を、データ送信処理後ではなく、データ送信処理前に送る送信側プレCPU間割込手段(プレCPU間割込部650)。
(b)CPU間通信において、送信側タスクを起床するCPU間割込を、データ受信処理後ではなく、データ受信処理前に送る受信側プレCPU間割込手段(プレCPU間割込部650)。
In addition to the hang-on control means (hang-on control section 322), the following communication means is provided in the inter-CPU communication control means (inter-CPU communication control section 321) (inter-CPU communication system 800). .
(A) In inter-CPU communication, an inter-CPU interrupt means for sending an inter-CPU interrupt that wakes up a reception-side task before the data transmission processing, not after the data transmission processing (pre-inter-CPU interrupt unit 650) .
(B) In inter-CPU communication, an inter-CPU interrupt means for sending an inter-CPU interrupt that wakes up a transmission-side task before the data reception process, not after the data reception process (pre-CPU interrupt unit 650) .

以上のように、本実施の形態に係るCPU間通信システム800は、CPU間通信制御手段(CPU間通信制御部321)内にプレCPU間割込手段(プレCPU間割込部650)を持つことにより、遅延時間の大きいCPU間割込を事前に相手側CPUに送ることができ、CPU間割込を受けてビジーループでCPU間通信の送受信をウェイトするので、高速なCPU間通信を行うことができる。   As described above, the inter-CPU communication system 800 according to the present embodiment has pre-CPU interrupt means (pre-CPU interrupt section 650) in the inter-CPU communication control means (inter-CPU communication control section 321). Therefore, it is possible to send an inter-CPU interrupt with a long delay time to the other CPU in advance and wait for the transmission / reception of inter-CPU communication in a busy loop in response to the inter-CPU interrupt, so that high-speed inter-CPU communication is performed. Can do.

実施の形態5.
実施の形態1〜4では、図1のような対称型マルチCPU構成のCPU間通信システム800におけるCPU間通信方式(CPU間通信制御方法)を示した。本実施の形態では、2ポートメモリやFIFOメモリによりCPU間を接続する非対称型マルチCPU構成のCPU間通信システム801でも、実施の形態1〜4で説明したCPU間通信方式(CPU間通信制御方法)を適用することができることについて説明する。
Embodiment 5 FIG.
In the first to fourth embodiments, the inter-CPU communication method (inter-CPU communication control method) in the inter-CPU communication system 800 having a symmetric multi-CPU configuration as shown in FIG. In this embodiment, an inter-CPU communication system 801 having an asymmetric multi-CPU configuration in which CPUs are connected by a two-port memory or a FIFO memory (inter-CPU communication control method) described in the first to fourth embodiments. ) Will be explained.

図16は、本実施の形態に係る非対称型マルチCPU構成を備えるCPU間通信システム801の構成図である。各CPU(101、102、103)は、自CPU用のローカルメモリ(221、222、223)と、自CPU用のバス(211、212、213)を備える。   FIG. 16 is a configuration diagram of an inter-CPU communication system 801 having an asymmetric multi-CPU configuration according to the present embodiment. Each CPU (101, 102, 103) includes a local memory (221, 222, 223) for its own CPU and a bus (211, 212, 213) for its own CPU.

各CPU(101、102、103)間は、各CPUの持つバス(自CPU用のバス(211、212、213))を介して、2ポートメモリもしくはFIFOメモリ(204、205)により接続される。CPU間通信システム801では、2ポートメモリもしくはFIFOメモリ(204、205)上に、図2の通信用メモリ305、送信待ちセマフォ306、受信待ちセマフォ307、継続フラグ311、レディフラグ312を備える。   Each CPU (101, 102, 103) is connected by a 2-port memory or a FIFO memory (204, 205) via a bus (bus for own CPU (211, 212, 213)) possessed by each CPU. . The inter-CPU communication system 801 includes the communication memory 305, the transmission waiting semaphore 306, the reception waiting semaphore 307, the continuation flag 311, and the ready flag 312 in FIG. 2 on the 2-port memory or the FIFO memory (204, 205).

以上の構成とすることにより、上述した実施の形態1〜4のCPU間通信制御手段(CPU間通信制御部321)に、上述した実施の形態1〜4と同じ動作をさせることができる。すなわち、非対称型マルチCPU構成のシステム(装置)においても、上述した実施の形態1〜4のCPU間通信方式(CPU間通信制御方法)を適用することにより、高速なCPU間通信を行うことができる。   With the above configuration, the above-described inter-CPU communication control unit (inter-CPU communication control unit 321) according to the first to fourth embodiments can perform the same operation as the above-described first to fourth embodiments. That is, even in a system (apparatus) having an asymmetric multi-CPU configuration, high-speed CPU communication can be performed by applying the above-described CPU communication method (CPU communication control method) according to the first to fourth embodiments. it can.

本実施の形態のCPU間通信システム801は、上述した実施の形態1〜4のCPU間通信方式(CPU間通信制御方法)を、同一CPUバス内にあるメモリを使ったデータ通信ではなく、異なるバス間を接続する2ポートメモリもしくはFIFOメモリを使ったデータ通信に適用することを特徴とする。   The inter-CPU communication system 801 of the present embodiment differs from the above-described inter-CPU communication method (inter-CPU communication control method) of the first to fourth embodiments, not data communication using a memory in the same CPU bus. The present invention is characterized by being applied to data communication using a two-port memory or a FIFO memory for connecting buses.

以上、実施の形態1〜5について説明したが、これらのうち、2つ以上の実施の形態を組み合わせて実施しても構わない。あるいは、これらのうち、1つの実施の形態を部分的に実施しても構わない。あるいは、これらのうち、2つ以上の実施の形態を部分的に組み合わせて実施しても構わない。   As mentioned above, although Embodiment 1-5 was demonstrated, you may implement combining 2 or more embodiment among these. Alternatively, one of these embodiments may be partially implemented. Or you may implement combining two or more embodiment among these partially.

また、実施の形態1〜5の説明において、CPU間通信制御部321内のハングオン制御部322の備えるメモリ領域判定部351、データ書き込み部352、受信側CPU判定部353、送信側制御部354、メモリ状態判定部361、データ読み出し部362、送信側CPU判定部363、受信側制御部364は、それぞれ独立した機能ブロックとして構成されているものとして説明した。また、さらに、CPU間通信制御部321内のスケジューリング制御部601、割込・コンテキストスイッチ遅延計測部602、ビジーループ時間設定部603、プレCPU間割込部650が独立した機能ブロックであるとして説明した。しかし、上記機能ブロックは、例えば、ひとつの機能ブロックとして構成されていてもよいし、上述した機能ブロックを組み合わせることにより3つの機能ブロックとしてもよい。上述した機能をどのように組み合わせて機能ブロックを構成しても構わない。   In the description of the first to fifth embodiments, the memory area determination unit 351, the data writing unit 352, the reception-side CPU determination unit 353, the transmission-side control unit 354, and the like included in the hang-on control unit 322 in the inter-CPU communication control unit 321. The memory state determination unit 361, the data reading unit 362, the transmission side CPU determination unit 363, and the reception side control unit 364 have been described as being configured as independent functional blocks. Further, the scheduling control unit 601, the interrupt / context switch delay measurement unit 602, the busy loop time setting unit 603, and the pre-CPU interrupt unit 650 in the inter-CPU communication control unit 321 have been described as independent function blocks. . However, the functional block may be configured as one functional block, for example, or may be configured as three functional blocks by combining the functional blocks described above. The functional blocks may be configured by combining the functions described above.

101,102,103 CPU、104 メモリ、105 IOデバイス、111 バス、204,205 2ポートメモリもしくはFIFOメモリ、221,222,223 自CPU用のローカルメモリ、211,212,213 自CPU用のバス、301 OS、302,303,304 タスク、305 通信用メモリ、306 送信待ちセマフォ、307 受信待ちセマフォ、308 CPU間割込レジスタ、309 タイマレジスタ、311 継続フラグ、312 レディフラグ、321 CPU間通信制御部、322 ハングオン制御部、351 メモリ領域判定部、352 データ書き込み部、353 受信側CPU判定部、354 送信側制御部、361 メモリ状態判定部、362 データ読み出し部、363 送信側CPU判定部、364 受信側制御部、601 スケジューリング制御部、602 割込・コンテキストスイッチ遅延計測部、603 ビジーループ時間設定部、611 データフル解消待ち第3タイムアウト時間、612 データフル解消待ち第4タイムアウト時間、613 データエンプティ待ち第5タイムアウト時間、614 データエンプティ待ち第6タイムアウト時間、650 プレCPU間割込部、701 割込遅延時間、702 コンテキストスイッチ時間、751 タイマ割込発生時刻、752 割込ハンドラ呼出時刻、753 コンテキストスイッチ時刻、800 CPU間通信システム、890 装置、901 表示装置、902 キーボード、903 マウス、904 FDD、905 CDD、906 プリンタ装置、907 スキャナ装置、911 CPU、913 ROM、914 RAM、915 通信ボード、920 磁気ディスク装置、921 オペレーティングシステム、922 ウィンドウシステム、923 プログラム群、924 ファイル群、X1 データ読み出し開始要求、X2 データ書き込み開始要求。   101, 102, 103 CPU, 104 memory, 105 IO device, 111 bus, 204, 205 2-port memory or FIFO memory, 221, 222, 223 Local memory for own CPU, 211, 212, 213 Bus for own CPU, 301 OS, 302, 303, 304 Task, 305 Communication memory, 306 Transmission waiting semaphore, 307 Reception waiting semaphore, 308 Inter-CPU interrupt register, 309 Timer register, 311 Continuation flag, 312 Ready flag, 321 Inter-CPU communication control unit 322 Hang-on control unit, 351 Memory area determination unit, 352 Data writing unit, 353 Reception side CPU determination unit, 354 Transmission side control unit, 361 Memory state determination unit, 362 Data reading unit, 363 Transmission side CPU determination unit 364 receiving side control unit, 601 scheduling control unit, 602 interrupt / context switch delay measurement unit, 603 busy loop time setting unit, 611 third full timeout time waiting for data full resolution, 612 fourth timeout time waiting for data full resolution, 613 data empty Wait 5th timeout time, 614 Data empty wait 6th timeout time, 650 Pre-CPU interrupt unit, 701 Interrupt delay time, 702 Context switch time, 751 Timer interrupt generation time, 752 Interrupt handler call time, 753 Context Switch time, 800 CPU communication system, 890 device, 901 display device, 902 keyboard, 903 mouse, 904 FDD, 905 CDD, 906 printer device, 907 scanner device, 9 1 CPU, 913 ROM, 914 RAM, 915 communication board, 920 a magnetic disk device, 921 operating system, 922 Window system, 923 Program group, 924 File group, X1 data read start request, X2 data write start request.

Claims (10)

データを送信する送信側CPU(Central・Processing・Unit:中央処理装置)とデータを受信する受信側CPUとにより共有されるメモリを介して、前記送信側CPUと前記受信側CPUとの間でデータの通信を行うCPU間通信システムにおいて、
前記送信側CPUは、
前記メモリに空き領域があるか否かを判定するメモリ領域判定部と、
前記メモリ領域判定部により前記メモリに空き領域があると判定された場合に、前記メモリにデータを書き込むデータ書き込み処理を実行するデータ書き込み部と、
前記メモリ領域判定部が前記メモリに空き領域がないと判定した場合に、前記受信側CPUの状態を判定する受信側CPU判定部と、
前記受信側CPU判定部により前記受信側CPUの状態が前記メモリからデータを読み出すデータ読み出し処理の実行状態であると判定された場合に、前記メモリに空き領域ができるまで前記データ書き込み部をデータ書き込み処理の待ち状態とし、前記受信側CPU判定部により前記受信側CPUの状態がデータ読み出し処理の実行状態でないと判定された場合に、前記受信側CPUにデータ読み出し処理の実行を開始させるための読み出し開始要求を前記受信側CPUへ送信する送信側制御部と
を備えることを特徴とするCPU間通信システム。
Data is transmitted between the transmitting CPU and the receiving CPU via a memory shared by the transmitting CPU (Central Processing Unit) that transmits data and the receiving CPU that receives the data. In the inter-CPU communication system that performs communication of
The sending CPU is
A memory area determination unit that determines whether or not there is a free area in the memory;
A data writing unit that executes a data writing process for writing data to the memory when the memory region determining unit determines that there is a free space in the memory;
A receiving-side CPU determining unit that determines a state of the receiving-side CPU when the memory region determining unit determines that there is no free space in the memory;
When the receiving CPU determination unit determines that the state of the receiving CPU is an execution state of a data read process for reading data from the memory, the data writing unit writes data until there is a free space in the memory. Reading to cause the receiving CPU to start executing the data reading process when the receiving CPU determining unit determines that the receiving CPU state is not the execution state of the data reading process. An inter-CPU communication system comprising: a transmission-side control unit that transmits a start request to the reception-side CPU.
前記CPU間通信システムは、
前記受信側CPUの状態を示す受信側状態フラグを備え、
前記受信側CPU判定部は、
前記受信側状態フラグの値に基づいて、前記受信側CPUの状態を判定することを特徴とする請求項1に記載のCPU間通信システム。
The inter-CPU communication system is:
A receiving side state flag indicating the state of the receiving side CPU;
The receiving CPU determination unit
2. The inter-CPU communication system according to claim 1, wherein the state of the receiving CPU is determined based on the value of the receiving state flag.
前記送信側制御部は、
予め第1のタイムアウト時間を記憶装置に記憶する第1のタイムアウト時間記憶部と、
前記受信側CPU判定部により前記受信側CPUの状態がデータ読み出し処理の実行状態であると判定された場合に、前記データ書き込み部をデータ書き込み処理の待ち状態とし、前記データ書き込み処理の待ち状態の開始時点から前記第1のタイムアウト時間記憶部により記憶された第1のタイムアウト時間が経過したか否かを判定し、前記第1のタイムアウト時間が経過していない場合は、前記メモリに空き領域ができるまで前記データ書き込み処理の待ち状態を継続し、前記第1のタイムアウト時間が経過した場合は、前記読み出し開始要求を前記受信側CPUへ送信する送信側スケジューリング部と
を備えることを特徴とする請求項1また2に記載のCPU間通信システム。
The transmission side control unit
A first timeout time storage unit that stores the first timeout time in the storage device in advance;
When the receiving CPU determining unit determines that the state of the receiving CPU is the execution state of the data reading process, the data writing unit is set to a waiting state for the data writing process, and the waiting state for the data writing process is set. It is determined whether or not the first timeout time stored in the first timeout time storage unit has elapsed from the start time. If the first timeout time has not elapsed, there is an empty area in the memory. The data write processing wait state is continued until possible, and when the first time-out period has elapsed, a transmission side scheduling unit is provided that transmits the read start request to the reception side CPU. Item 3. The communication system between CPUs according to Item 1 or 2.
前記送信側制御部は、
予め第3のタイムアウト時間を記憶装置に記憶する第3のタイムアウト時間記憶部と、
予め第4のタイムアウト時間を記憶装置に記憶する第4のタイムアウト時間記憶部と、
前記受信側CPU判定部により前記受信側CPUの状態がデータ読み出し処理の実行状態であると判定された場合に、前記送信側CPUをスケジューリングロックしてから前記データ書き込み部をデータ書き込み処理の第1の待ち状態とし、前記データ書き込み処理の第1の待ち状態の開始時点から第3のタイムアウト時間記憶部により記憶された第3のタイムアウト時間が経過したか否かを判定し、前記第3のタイムアウト時間が経過していない場合は、前記メモリに空き領域ができるまで前記データ書き込み処理の第1の待ち状態を継続する第1のスケジューリング部と、
前記第3のタイムアウト時間が経過した場合に、前記データ書き込み処理の第1の待ち状態を終了し、前記スケジューリングロックを解除してから前記データ書き込み部をデータ書き込み処理の第2の待ち状態とし、前記データ書き込み処理の第2の待ち状態の開始時点から第4のタイムアウト時間記憶部により記憶された前記第4のタイムアウト時間が経過したか否かを判定し、前記第4のタイムアウト時間が経過していない場合は、前記メモリに空き領域ができるまで前記データ書き込み処理の第2の待ち状態を継続し、前記第4のタイムアウト時間が経過した場合に、前記読み出し開始要求を前記受信側CPUへ送信する第2のスケジューリング部と
を備えることを特徴とする請求項1また2に記載のCPU間通信システム。
The transmission side control unit
A third timeout time storage unit that stores the third timeout time in the storage device in advance;
A fourth timeout time storage unit that stores the fourth timeout time in the storage device in advance;
When the receiving CPU determining unit determines that the state of the receiving CPU is an execution state of the data reading process, the data writing unit is set to the first of the data writing process after scheduling locking of the transmitting CPU. The third time-out time stored in the third time-out time storage unit has elapsed since the start of the first wait state of the data writing process, and the third time-out If the time has not elapsed, a first scheduling unit that continues the first waiting state of the data writing process until an empty area is created in the memory; and
When the third timeout period has elapsed, the first waiting state of the data writing process is terminated, the scheduling lock is released, and then the data writing unit is set to a second waiting state of the data writing process, It is determined whether or not the fourth time-out time stored in the fourth time-out time storage unit has elapsed since the start of the second wait state of the data writing process, and the fourth time-out time has elapsed. If not, the second waiting state of the data writing process is continued until free space is created in the memory, and the read start request is transmitted to the receiving CPU when the fourth time-out period has elapsed. The inter-CPU communication system according to claim 1, further comprising: a second scheduling unit that performs the second scheduling unit.
前記受信側CPUは、
前記メモリにデータが格納されているか否かを判定するメモリ状態判定部と、
前記メモリ状態判定部により前記メモリにデータが格納されていると判定された場合に、前記メモリからデータを読み出すデータ読み出し処理を実行するデータ読み出し部と、
前記メモリ状態判定部により前記メモリにデータが格納されていないと判定された場合に、前記送信側CPUの状態を判定する送信側CPU判定部と、
前記送信側CPU判定部により前記送信側CPUの状態がデータ書き込み処理の実行状態であると判定された場合に、前記メモリにデータが格納されるまで前記データ読み出し部をデータ読み出し処理の待ち状態とし、前記送信側CPU判定部により送信側CPUの状態がデータ書き込み処理の実行状態でないと判定された場合に、前記データ書き込み部にデータ書き込み処理の実行を開始させるための書き込み開始要求を前記送信側CPUへ送信する受信側制御部と
を備えることを特徴とする請求項1〜4のいずれかに記載のCPU間通信システム。
The receiving CPU is
A memory state determination unit for determining whether data is stored in the memory;
A data reading unit that executes a data reading process of reading data from the memory when the memory state determination unit determines that data is stored in the memory;
A transmission side CPU determination unit for determining a state of the transmission side CPU when the memory state determination unit determines that data is not stored in the memory;
When the transmission side CPU determination unit determines that the state of the transmission side CPU is the execution state of the data write process, the data read unit is set in a wait state for the data read process until data is stored in the memory. When the transmission side CPU determination unit determines that the state of the transmission side CPU is not the execution state of the data writing process, a transmission start request for causing the data writing unit to start executing the data writing process is sent to the transmission side The inter-CPU communication system according to any one of claims 1 to 4, further comprising a reception-side control unit that transmits to the CPU.
前記CPU間通信システムは、さらに、
前記送信側CPUの状態を示す送信側状態フラグを備え、
前記送信側CPU判定部は、
前記送信側状態フラグに基づいて、前記送信側CPUの状態を判定することを特徴とする請求項5に記載のCPU間通信システム。
The inter-CPU communication system further includes:
A transmission side state flag indicating the state of the transmission side CPU;
The transmitting CPU determination unit
6. The inter-CPU communication system according to claim 5, wherein the state of the transmission side CPU is determined based on the transmission side state flag.
前記受信側制御部は、
予め第2のタイムアウト時間を記憶装置に記憶する第2のタイムアウト時間記憶部と、
前記送信側CPU判定部により前記送信側CPUの状態がデータ書き込み処理の実行状態でないと判定された場合に、前記メモリ状態判定部により前記メモリにデータが格納されていないと判定された時点から前記第2のタイムアウト時間が経過したか否かを判定し、前記第2のタイムアウト時間が経過していない場合は、前記メモリにデータが格納されるまで前記データ読み出し部をデータ読み出し処理の待ち状態とし、前記第2のタイムアウト時間が経過した場合は、前記書き込み開始要求を前記送信側CPUへ送信する受信側スケジューリング部と
を備えることを特徴とする請求項5または6に記載のCPU間通信システム。
The receiving side control unit
A second timeout time storage unit for storing the second timeout time in the storage device in advance;
When the transmission side CPU determination unit determines that the state of the transmission side CPU is not the execution state of the data writing process, from the time when the memory state determination unit determines that no data is stored in the memory It is determined whether or not a second timeout period has elapsed. If the second timeout period has not elapsed, the data reading unit is placed in a wait state for data reading processing until data is stored in the memory. 7. The inter-CPU communication system according to claim 5, further comprising: a receiving side scheduling unit that transmits the write start request to the transmitting side CPU when the second time-out period elapses.
前記受信側制御部は、
予め第5のタイムアウト時間を記憶装置に記憶する第5のタイムアウト時間記憶部と、
予め第6のタイムアウト時間を記憶装置に記憶する第6のタイムアウト時間記憶部と、
前記送信側CPU判定部により前記送信側CPUの状態がデータ読み出し処理の実行状態であると判定された場合に、前記受信側CPUをスケジューリングロックしてから前記データ読み出し部をデータ読み出し処理の第3の待ち状態とし、前記データ書き込み処理の第3の待ち状態の開始時点から第5のタイムアウト時間記憶部により記憶された第5のタイムアウト時間が経過したか否かを判定し、前記第5のタイムアウト時間が経過していない場合は、前記メモリにデータが格納されるまで前記データ読み出し処理の第3の待ち状態を継続する第3のスケジューリング部と、
前記第5のタイムアウト時間が経過した場合に、前記データ読み出し処理の第3の待ち状態を終了し、前記スケジューリングロックを解除してから前記データ読み出し部をデータ読み出し処理の第4の待ち状態とし、前記データ読み出し処理の第4の待ち状態の開始時点から第6のタイムアウト時間記憶部により記憶された前記第6のタイムアウト時間が経過したか否かを判定し、前記第6のタイムアウト時間が経過していない場合は、前記メモリにデータが格納されるまで前記データ読み出し処理の第4の待ち状態を継続し、前記第6のタイムアウト時間が経過した場合に、前記書き込み開始要求を前記送信側CPUへ送信する第4のスケジューリング部と
を備えることを特徴とする請求項5また6に記載のCPU間通信システム。
The receiving side control unit
A fifth time-out time storage unit that stores the fifth time-out time in the storage device in advance;
A sixth time-out time storage unit for storing the sixth time-out time in the storage device in advance;
When the transmitting CPU determining unit determines that the state of the transmitting CPU is an execution state of the data reading process, the receiving CPU is scheduled and locked, and then the data reading unit is set to the third data reading process. And determines whether or not the fifth timeout time stored in the fifth timeout time storage unit has elapsed since the start of the third waiting state of the data writing process, and the fifth timeout If the time has not elapsed, a third scheduling unit that continues the third waiting state of the data read processing until the data is stored in the memory;
When the fifth time-out period has elapsed, the third waiting state of the data reading process is terminated, the scheduling lock is released, and then the data reading unit is set to a fourth waiting state of the data reading process, It is determined whether or not the sixth timeout time stored in the sixth timeout time storage unit has elapsed since the start of the fourth wait state of the data reading process, and the sixth timeout time has elapsed. If not, the fourth wait state of the data reading process is continued until data is stored in the memory, and when the sixth timeout period has elapsed, the write start request is sent to the transmitting CPU. The inter-CPU communication system according to claim 5 or 6, further comprising a fourth scheduling unit for transmission.
データを送信する送信側CPU(Central・Processing・Unit:中央処理装置)とデータを受信する受信側CPUとにより共有されるメモリを介して、前記送信側CPUと前記受信側CPUとの間でデータの通信を行うCPU間通信システムのCPU間通信方法において、
送信側CPUのメモリ領域判定部が、前記メモリに空き領域があるか否かを判定するメモリ領域判定工程と、
送信側CPUのデータ書き込み部が、前記メモリ領域判定工程により前記メモリに空き領域があると判定された場合に、前記メモリにデータを書き込むデータ書き込み処理を実行するデータ書き込み工程と、
送信側CPUの受信側CPU判定部が、前記メモリ領域判定工程により前記メモリに空き領域がないと判定された場合に、前記受信側CPUの状態を判定する受信側CPU判定工程と、
送信側CPUの送信側制御部が、前記受信側CPU判定工程により前記受信側CPUの状態が前記メモリからデータを読み出すデータ読み出し処理の実行状態であると判定された場合に、前記メモリに空き領域ができるまで前記データ書き込み工程をデータ書き込み処理の待ち状態とし、前記受信側CPU判定工程により前記受信側CPUの状態がデータ読み出し処理の実行状態でないと判定された場合に、前記受信側CPUにデータ読み出し処理の実行を開始させるための読み出し開始要求を前記受信側CPUへ送信する送信側制御工程と
を備えることを特徴とするCPU間通信システムのCPU間通信方法。
Data is transmitted between the transmitting CPU and the receiving CPU via a memory shared by the transmitting CPU (Central Processing Unit) that transmits data and the receiving CPU that receives the data. In the inter-CPU communication method of the inter-CPU communication system that performs communication of
A memory area determination step in which a memory area determination unit of the transmission side CPU determines whether or not there is a free area in the memory;
A data writing step of executing a data writing process of writing data to the memory when the data writing unit of the transmitting CPU determines that the memory area has a free space in the memory area determining step;
A reception-side CPU determination unit that determines a state of the reception-side CPU when the reception-side CPU determination unit of the transmission-side CPU determines that the memory has no free space in the memory region determination step;
When the transmission-side control unit of the transmission-side CPU determines that the state of the reception-side CPU is an execution state of a data read process for reading data from the memory by the reception-side CPU determination step, an empty area in the memory The data writing process is put into a waiting state for data writing processing until the data is received, and when the receiving CPU determining step determines that the receiving CPU is not in the data reading processing execution state, data is sent to the receiving CPU. An inter-CPU communication method of an inter-CPU communication system, comprising: a transmission-side control step of transmitting a read start request for starting execution of read processing to the reception-side CPU.
前記CPU間通信システムのCPU間通信方法は、
受信側CPUのメモリ状態判定部が、前記メモリにデータが格納されているか否かを判定するメモリ状態判定工程と、
受信側CPUのデータ読み出し部が、前記メモリ状態判定工程により前記メモリにデータが格納されていると判定された場合に、前記メモリからデータを読み出すデータ読み出し処理を実行するデータ読み出し工程と、
受信側CPUの送信側CPU判定部が、前記メモリ状態判定工程により前記メモリにデータが格納されていないと判定された場合に、前記送信側CPUの状態を判定する送信側CPU判定工程と、
受信側CPUの受信側制御部が、前記送信側CPU判定工程により前記送信側CPUの状態がデータ書き込み処理の実行状態であると判定された場合に、前記メモリにデータが格納されるまで前記データ読み出し工程をデータ読み出し処理の待ち状態とし、前記送信側CPU判定工程により送信側CPUの状態がデータ書き込み処理の実行状態でないと判定された場合に、前記データ書き込み工程にデータ書き込み処理の実行を開始させるための書き込み開始要求を前記送信側CPUへ送信する受信側制御工程と
を備えることを特徴とする請求項9に記載のCPU間通信システムのCPU間通信方法。
The inter-CPU communication method of the inter-CPU communication system is:
A memory state determination step of determining whether or not the memory state determination unit of the receiving CPU stores data in the memory;
A data reading step of executing a data reading process of reading data from the memory when the data reading unit of the receiving CPU determines that the data is stored in the memory by the memory state determining step;
A transmission-side CPU determination unit that determines a state of the transmission-side CPU when the transmission-side CPU determination unit of the reception-side CPU determines that data is not stored in the memory by the memory state determination step;
When the receiving-side control unit of the receiving-side CPU determines that the state of the transmitting-side CPU is the execution state of the data writing process in the transmitting-side CPU determination step, the data is stored until the data is stored in the memory. The reading process is set to a waiting state for the data reading process, and when the transmitting CPU determining process determines that the transmitting CPU is not in the data writing process, the data writing process is started in the data writing process. 10. The inter-CPU communication method of the inter-CPU communication system according to claim 9, further comprising: a reception-side control step of transmitting a write start request for making the request to the transmission-side CPU.
JP2010140383A 2010-06-21 2010-06-21 Inter-CPU communication system and inter-CPU communication method Active JP5511538B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010140383A JP5511538B2 (en) 2010-06-21 2010-06-21 Inter-CPU communication system and inter-CPU communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010140383A JP5511538B2 (en) 2010-06-21 2010-06-21 Inter-CPU communication system and inter-CPU communication method

Publications (2)

Publication Number Publication Date
JP2012003673A true JP2012003673A (en) 2012-01-05
JP5511538B2 JP5511538B2 (en) 2014-06-04

Family

ID=45535539

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010140383A Active JP5511538B2 (en) 2010-06-21 2010-06-21 Inter-CPU communication system and inter-CPU communication method

Country Status (1)

Country Link
JP (1) JP5511538B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014010585A (en) * 2012-06-29 2014-01-20 Fujitsu Ltd Data transmission method and data transmission apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0281254A (en) * 1988-09-19 1990-03-22 Hitachi Ltd Multi-processor controller
JPH0774786A (en) * 1993-08-31 1995-03-17 Oki Electric Ind Co Ltd Inter-multi-point data transmission method
JP2005242929A (en) * 2004-02-27 2005-09-08 Fujitsu Ltd Accessing method for shared memory and data processor
JP2005316659A (en) * 2004-04-28 2005-11-10 Matsushita Electric Ind Co Ltd Inter-task communication device
JP2008097084A (en) * 2006-10-06 2008-04-24 Hitachi Ltd Processor and data transfer unit

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0281254A (en) * 1988-09-19 1990-03-22 Hitachi Ltd Multi-processor controller
JPH0774786A (en) * 1993-08-31 1995-03-17 Oki Electric Ind Co Ltd Inter-multi-point data transmission method
JP2005242929A (en) * 2004-02-27 2005-09-08 Fujitsu Ltd Accessing method for shared memory and data processor
JP2005316659A (en) * 2004-04-28 2005-11-10 Matsushita Electric Ind Co Ltd Inter-task communication device
JP2008097084A (en) * 2006-10-06 2008-04-24 Hitachi Ltd Processor and data transfer unit

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014010585A (en) * 2012-06-29 2014-01-20 Fujitsu Ltd Data transmission method and data transmission apparatus

Also Published As

Publication number Publication date
JP5511538B2 (en) 2014-06-04

Similar Documents

Publication Publication Date Title
JP4119945B2 (en) Task processing device
JP2010015318A (en) Usb host controller, information processor, and program
JP2532191B2 (en) A method of managing data transmission for use in a computing system having a dual bus architecture.
JP5681576B2 (en) Host controller device, information processing device, and event information output method
JP5511538B2 (en) Inter-CPU communication system and inter-CPU communication method
CN114902181A (en) GPU (graphics processing Unit) packet aggregation system
JP6319473B1 (en) Information processing device
JP5783348B2 (en) Control device, control program, and image forming apparatus
KR101087177B1 (en) System for conrtolling request order, method for controlling request order, and a computer-readable recording medium having program for controlling request order
JP2011065359A (en) Memory system
CN114328350A (en) Communication method, device and medium based on AXI bus
JP2010211506A (en) Computer equipped with non-uniform memory access mechanism, controller, and data movement method
JP5334173B2 (en) Data transfer system and retry control method
JP5204740B2 (en) Task processing device
TW200905483A (en) Bridges and the related electronic systems and methods for flushing data
JP2003233434A (en) Electric power consumption management device
JP2005216317A (en) Queue device
JP2003114863A (en) Nonsynchronous bus interface device
JP2015148978A (en) Information processor and control method for information processor
JP2006285724A (en) Information processor and information processing method
JP2020135524A (en) Arithmetic device
US10768688B2 (en) Arithmetic processing device, information processing apparatus, and method for controlling arithmetic processing device
JP7302303B2 (en) Image processing device, image processing method, and program
JP2615677B2 (en) Shared extended storage control method
JP6631370B2 (en) Microcomputer and electronic control unit

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20121119

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20131218

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140114

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140214

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: 20140225

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140325

R150 Certificate of patent or registration of utility model

Ref document number: 5511538

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250