JPH0376500B2 - - Google Patents
Info
- Publication number
- JPH0376500B2 JPH0376500B2 JP58228121A JP22812183A JPH0376500B2 JP H0376500 B2 JPH0376500 B2 JP H0376500B2 JP 58228121 A JP58228121 A JP 58228121A JP 22812183 A JP22812183 A JP 22812183A JP H0376500 B2 JPH0376500 B2 JP H0376500B2
- Authority
- JP
- Japan
- Prior art keywords
- task
- command
- executed
- register
- memory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Lifetime
Links
Description
【発明の詳細な説明】
<技術分野>
本発明は、マイクロコンピユータのシステム管
理プログラムに有効なマルチ・タスク制御用機能
を内蔵したコンピユータ周辺デバイスに関するも
のである。DETAILED DESCRIPTION OF THE INVENTION <Technical Field> The present invention relates to a computer peripheral device having a built-in multi-task control function effective for a system management program of a microcomputer.
<従来技術>
マイクロコンピユータ・システムにおいて、1
つのCPUによつて複数のタスクを同時に処理さ
せるためには、コンピユータ・システムのOS(オ
ペレーテイング・システム)によるマルチ・タス
ク制御が必要である。<Prior art> In a microcomputer system, 1
In order to have a single CPU process multiple tasks simultaneously, multitasking control by the computer system's OS (operating system) is required.
従来、マルチ・タスク制御システムにおいて、
各タスクの使用するワーク・メモリの重複使用の
禁止や少ないメモリ領域を有効利用するためのメ
モリ管理は、上記OSのソフトウエアによつて行
なわれていた。そのため、ユーザー・プログラム
の負担が大きく、また、小さなメモリ空間しかも
たないマイクロコンピユータのようなシステムで
は、OSのプログラムがプログラム・メモリ空間
の一部を占めるため、ユーザー・プログラムの大
きさやユーザー・プログラムを配置するアドレス
に制約を受けた。 Conventionally, in multi-task control systems,
Prohibition of overlapping use of work memory used by each task and memory management to effectively utilize a small memory area are performed by the software of the above-mentioned OS. Therefore, in systems such as microcomputers where the load on the user program is large and the memory space is small, the OS program occupies part of the program memory space, so the size of the user program and the user program I was constrained by the address where I would place it.
<発明の目的>
本発明は、上述したようなタスクのメモリ管理
は本デバイス内で行なわれる。そのため、ユーザ
ー・プログラム中で、メモリ領域を確保したい場
合、本デバイスに対してコマンドを実行すれば、
あらかじめタスクの使用するメモリ領域として登
録しておいたメモリ領域の中から、本デバイス内
で空き領域が自動的に探し出され、空き領域のア
ドレスを得ることができる。また、タスクが使用
していたメモリが不要になつたときは、別のコマ
ンドにより適宜メモリ領域を解放することも可能
である。<Objective of the Invention> According to the present invention, memory management of the above-mentioned tasks is performed within the present device. Therefore, if you want to reserve a memory area in your user program, you can execute a command for this device.
An empty area is automatically searched within the device from among the memory areas registered in advance as memory areas used by tasks, and the address of the empty area can be obtained. Furthermore, when the memory used by a task is no longer needed, it is possible to release the memory area as appropriate using another command.
<実施例>
以下図面に従つて本発明の一実施例を説明す
る。<Example> An example of the present invention will be described below with reference to the drawings.
第1図はマイクロコンピユータ・システムとし
ての構成例を示す図である。素子(又は装置)1
は、本発明に係るマルチ・タスク制御を実現する
ための独立したマルチ・タスク・サポート・プロ
セツサとして構成されたものであり、他の周辺デ
バイスと同様、入出力素子の形態で供給される。
以下、本デバイスをマルチ・タスク制御用素子と
呼ぶ。マスタCPU2,プログラム・メモリ
(ROM)3,データ・メモリ(RAM)4及び他
のI/O等の周辺入出力素子5は、周知のマイク
ロコンピユータ・システムとしても具備されるも
のであり、マルチ・タスク制御用素子1とともに
バス6を介して相互に接続される。プログラム・
メモリ3は、マルチ・タスク制御用素子1の初期
化プログラムと複数のタスクをそれぞれ独立して
プログラムしている。 FIG. 1 is a diagram showing an example of the configuration of a microcomputer system. Element (or device) 1
is configured as an independent multi-task support processor for realizing multi-task control according to the present invention, and is supplied in the form of input/output elements like other peripheral devices.
Hereinafter, this device will be referred to as a multi-task control element. The master CPU 2, program memory (ROM) 3, data memory (RAM) 4, and other peripheral input/output elements 5 such as I/O are also included in a well-known microcomputer system, and are a multi-channel system. It is interconnected with the task control element 1 via a bus 6. program·
The memory 3 independently programs an initialization program for the multi-task control element 1 and a plurality of tasks.
マルチ・タスク制御用素子1は、マスタCPU
2により実行されるこれら複数のタスクの管理を
マスタCPU2以外で行なう独立機能素子であり、
タスクのスケジユーリング機能(優先度順又は時
分割による実行タスクの切換え)、タスク間の同
期・通信機能(各タスク間でデータの送受信を行
ない、タスクの実行中断,実行再開を決定)、メ
モリ管理機能(各タスクの使用メモリ領域の重複
使用の禁止)、時計機能(内蔵タイマによる時刻
のセツト)等を有している。つまり、このマル
チ・タスク制御用素子1は、マルチ・タスクの制
御機能をコンピユータ・システムのOS自身のも
つ機能とせず、その機能を有する周辺デバイスと
した点に特色がある。 Multi-task control element 1 is the master CPU
It is an independent functional element that manages these multiple tasks executed by the master CPU 2 other than the master CPU 2,
Task scheduling function (switching execution tasks in priority order or time-sharing), inter-task synchronization and communication function (sending and receiving data between each task, deciding whether to suspend or resume task execution), memory It has a management function (prohibition of overlapping use of the memory area used by each task), a clock function (setting the time using a built-in timer), etc. In other words, this multi-task control element 1 is characterized in that the multi-task control function is not a function of the OS itself of the computer system, but a peripheral device that has this function.
第2図はマルチ・タスク制御用素子1の内部構
成例を示すブロツク図である。 FIG. 2 is a block diagram showing an example of the internal configuration of the multi-task control element 1.
マルチ・タスク制御用素子1はマスタCPU2
からアクセス可能なレジスタ群を備えている。 Multi-task control element 1 is master CPU 2
It has a group of registers that can be accessed from.
コマンド・パラメータ・レジスタCPIOは、マ
スタCPU2からコマンド実行時に入力するパラ
メータや、実行後に出力するパラメータを保持す
る。コマンド/ステータス・レジスタCNSTは書
込み時にはコマンド書込み用として、読出し時に
は実行したコマンドの実行情報を格納するための
レジスタとして機能する。新スタツク・ポイン
タ・レジスタSPNは、タスク切換え情報として
これから新らたに実行状態となるタスクのスタツ
ク・ポインタの値を出力するためのレジスタであ
る。また、旧スタツク・ポインタ・レジスタ
SPBは、タスク切換え情報として今まで実行状
態にあつたタスクのスタツク・ポインタの値を入
力するためのレジスタである。 The command parameter register CPIO holds parameters input from the master CPU 2 when executing a command and parameters output after execution. The command/status register CNST functions as a register for writing commands during writing, and as a register for storing execution information of executed commands during reading. The new stack pointer register SPN is a register for outputting the value of the stack pointer of a task that will be newly executed from now on as task switching information. Also, the old stack pointer register
SPB is a register for inputting the value of the stack pointer of the task that has been in the execution state as task switching information.
マスタ割込み制御レジスタMICは本素子1に
おける、マスタCPU2に対する割込み発生を制
御するためのレジスタで、割込みベクタ・レジス
タMIVは割込みベクタ値を書込む。データ・レ
ジスタP1D,P2D,P3Dはポート1,ポー
ト2およびポート3のデータ入出力のためのレジ
スタである。ポート1とポート2はデータ入出力
方向をプログラムによつてビツト単位で設定でき
る8ビツト入出力ポートであり、ポート3は1ビ
ツトの入力ポートである。ポート3はプログラム
によつてイベント入力(ポート3への入力信号の
遷移により停止状態のタスクをレデイー状態に移
す)にセツトすることが可能である。 The master interrupt control register MIC is a register for controlling the generation of interrupts to the master CPU 2 in the device 1, and the interrupt vector register MIV writes an interrupt vector value. Data registers P1D, P2D, and P3D are registers for data input/output of port 1, port 2, and port 3. Ports 1 and 2 are 8-bit input/output ports whose data input/output direction can be set bit by bit by a program, and port 3 is a 1-bit input port. Port 3 can be set to an event input (transition of a task in a stopped state to a ready state by transition of an input signal to port 3) by a program.
以上のレジスタ群はマスタCPU2からアクセ
スされて、本素子1とマスタCPU2との間で情
報を相互に交換するために用いられる。データ・
バス・インターフエイスDBI,バス・タイミング
発生・制御回路BTGC,割込み制御回路INTC
は、マスタCPU2とのインターフエイス回路と
して備えられたものである。 The above register group is accessed by the master CPU 2 and used for mutually exchanging information between the device 1 and the master CPU 2. data·
Bus interface DBI, bus timing generation/control circuit BTGC, interrupt control circuit INTC
is provided as an interface circuit with the master CPU 2.
タスク制御ブロツクTCB1〜8はタスクの状
態を保存するためのメモリ領域である。ここでは
8つまでのタスクを取扱うことが可能である。各
ブロツクは第3図に示されるように、タスク・ス
テータス,タスク優先度,先にレデイーQに
接続されているタスクの番号,後にレデイーQ
に接続されているタスクの番号,タスクが占有
しているワーク・メモリの先頭アドレス,その
サイズ,使用しているメイル・ボツクス番号
,そしてタスク実行中断時のスタツク・ポイン
タ値を格納する領域を有している。 Task control blocks TCB1-TCB8 are memory areas for saving the states of tasks. It is possible to handle up to eight tasks here. As shown in Figure 3, each block has the task status, task priority, the number of the task connected to Lady Q first, and the number of the task connected to Lady Q afterward.
It has an area to store the number of the task connected to the task, the start address of the work memory occupied by the task, its size, the mail box number used, and the stack pointer value when task execution is interrupted. are doing.
メイル・ボツクスMBXはタスク間でデータの
授受を行なえるよう設けられたバツフア・メモリ
領域である。 The mail box MBX is a buffer memory area provided so that data can be exchanged between tasks.
メモリ・マツプMEMMAPはワーク・メモリ
を管理するためのメモリ領域であり、例えば第4
図のように32バイトから構成される。メモリ・マ
ツプMEMMAPにより256バイト単位のワーク・
メモリを管理することが可能である。ワーク・メ
モリを使用していないときその領域に対応するビ
ツトは“0”で、占有中であるときはそのビツト
が“1”にセツトされる。 The memory map MEMMAP is a memory area for managing work memory.
It consists of 32 bytes as shown in the figure. Memory map MEMMAP allows work in units of 256 bytes.
It is possible to manage memory. When the work memory is not in use, the bit corresponding to that area is "0", and when it is occupied, the bit is set to "1".
タイマTMは時分割処理(同一優先度のタスク
を一定時間毎に実行させる処理)等のために、素
子1内に割込み信号を発生させるもので、システ
ムクロツク領域SCAは同時にタイマTMの出力に
より計数される時,分,秒等の時刻データを格納
するメモリ領域である。 The timer TM generates an interrupt signal in element 1 for time-sharing processing (processing to execute tasks with the same priority at fixed intervals), and the system clock area SCA simultaneously uses the output of the timer TM. This is a memory area that stores time data such as hours, minutes, and seconds to be counted.
内部演算制御回路CONTは論理演算ユニツト
(ALU),本素子1のプログラムを格納する
ROM,一時記憶用のRAMおよび各種制御のた
めのフラグ用レジスタ等を有してなる。 The internal arithmetic control circuit CONT stores the logic arithmetic unit (ALU) and the program for this element 1.
It has ROM, RAM for temporary storage, flag registers for various controls, etc.
マスタCPU2からマルチ・タスク制御用素子
1へのアクセスは、実行中のタスクから発行され
るコマンドによつて行なわれ、マルチ・タスク制
御用素子1からマスタCPU2へのアクセスは、
マルチ・タスク制御用素子1の割込み信号発生に
基づいて行なわれる。第5図はコマンドの種類と
入力パラメータおよび出力パラメータを示す図で
ある。 Access from the master CPU 2 to the multi-task control element 1 is performed by a command issued from the task being executed, and access from the multi-task control element 1 to the master CPU 2 is as follows:
This is performed based on the generation of an interrupt signal by the multi-task control element 1. FIG. 5 is a diagram showing command types, input parameters, and output parameters.
基本的動作としては次のとおりである。なお、
タスク制御ブロツクTCBには各タスクの状態が
既に保存されているものとする。 The basic operation is as follows. In addition,
It is assumed that the state of each task is already stored in the task control block TCB.
マルチ・タスク制御用素子1は、実行可能状態
のタスクから優先度の一番高いタスクを選び出
し、登録されたそのタスクのスタツク・ポインタ
の値を新スタツク・ポインタ・レジスタSPNに
準備する。スタツク・ポインタの値を準備した
後、マルチ・タスク制御用素子1はマスタCPU
2に対し割込みを発生する。マスタCPU2は割
込み処理ルーチンを実行し、マルチ・タスク制御
用素子1にセツトされているスタツク・ポインタ
の値を自分のスタツク・ポインタにロードし、予
じめ書込まれていたレジスタの初期値をスタツク
からポツプしてレジスタを書換える。そしてマス
タCPU2の管理下において指定されたタスクを
実行する。 The multi-task control element 1 selects the task with the highest priority from the tasks in the executable state, and prepares the registered stack pointer value of that task in the new stack pointer register SPN. After preparing the stack pointer value, multi-task control element 1 returns to the master CPU.
Generates an interrupt for 2. The master CPU 2 executes the interrupt processing routine, loads the value of the stack pointer set in the multi-task control element 1 into its own stack pointer, and loads the initial value of the register written in advance. Pop it from the stack and rewrite the register. Then, the designated task is executed under the control of the master CPU 2.
実行中のタスクからコマンド入力があるか、ま
たはタイマTMあるいはポート3への入力による
割込みがあるまで、マルチ・タスク制御用素子1
は待ち状態となる。ここで例えばコマンド入力が
あれば、マルチ・タスク制御用素子1はそのコマ
ンドを解析しコマンド処理を行なう。そして、こ
のコマンドがタスク切換え機能を含むものであれ
ば、次に切換えるべきタスクのスタツク・ポイン
タの値を新スタツク・ポインタ・レジスタSPN
にセツトし、マスタCPU2に対し割込みを発生
する。この割込みによつてマスタCPU2は現在
実行中のタスクの実行を停止し、次に実行すべき
タスクのスタツク・ポインタの値をマルチ・タス
ク制御用素子1から読出す。 Multi-task control element 1 remains active until there is a command input from the task being executed or an interrupt due to input to timer TM or port 3.
is in a waiting state. For example, if a command is input here, the multi-task control element 1 analyzes the command and processes the command. If this command includes a task switching function, the value of the stack pointer of the next task to be switched is stored in the new stack pointer register SPN.
, and generates an interrupt to master CPU2. This interrupt causes the master CPU 2 to stop executing the task currently being executed, and reads from the multi-task control element 1 the value of the stack pointer of the task to be executed next.
以下フローチヤートを参照してさらに詳しく説
明する。 A more detailed explanation will be given below with reference to a flowchart.
第6図はマルチ・タスク制御用素子1のメイン
ルーチンの動作を説明するフローチヤート、第7
図〜第21図は各コマンド0〜14による処理ルー
チンの動作を説明するフローチヤート,第22図
はタスク切換えルーチンの動作を説明するフロー
チヤート,第23図はポート3へのイベント入力
による割込み処理ルーチンの動作を説明するフロ
ーチヤート,第24図はタイマTMによる割込み
処理ルーチンの動作を説明するフローチヤートで
ある。 FIG. 6 is a flowchart explaining the operation of the main routine of the multi-task control element 1;
Figures 21 to 21 are flowcharts explaining the operation of the processing routine for each command 0 to 14, Figure 22 is a flowchart explaining the operation of the task switching routine, and Figure 23 is interrupt processing due to event input to port 3. Flowchart for explaining the operation of the routine. FIG. 24 is a flowchart for explaining the operation of the interrupt handling routine by the timer TM.
第6図において、システムに電源が投入される
と、本マルチ・タスク制御用素子1はリセツト動
作を行ない内部の各機能素子を初期化する(ステ
ツプ)。そして、マスタCPU2からコマンドが
コマンド/ステータス・レジスタCNSTに書込ま
れるのを待つ(ステツプ)。コマンドが書込ま
れると、各コマンド・コードに対応したコマンド
処理を行なう(ステツプ)。 In FIG. 6, when the system is powered on, the multi-task control element 1 performs a reset operation to initialize each internal functional element (step). Then, it waits for a command to be written from the master CPU 2 to the command/status register CNST (step). When a command is written, command processing corresponding to each command code is performed (step).
コマンド0(コマンド名:INIT,第7図フロー
チヤート)は、マルチ・タスク制御用素子1の初
期化を行なうためのコマンドであり、マルチ・タ
スク制御用素子1がマスタCPU2に対して割込
みを発生するときにマスタCPU2へ出力するベ
クタ値、マルチ・タスク制御用素子1が管理する
ワーク・メモリ領域の先頭アドレスとその大き
さ、及びタスクの優先度を各タスクに対して登録
するためのコマンドである。 Command 0 (command name: INIT, flowchart in Figure 7) is a command to initialize multi-task control element 1, and multi-task control element 1 generates an interrupt to master CPU 2. This command is used to register for each task the vector value to be output to the master CPU 2 when executing the command, the start address and size of the work memory area managed by the multi-task control element 1, and the priority of the task. be.
このコマンドが実行されると、入力データのエ
ラーを調査し(ステツプ)、もし入力データに
誤りがあれば、エラーコードをコマンド/ステー
タス・レジスタCNSTにセツトする(ステツプ
)。 When this command is executed, the input data is checked for errors (step), and if there is an error in the input data, an error code is set in the command/status register CNST (step).
入力データに誤りがなければ、コマンド・パラ
メータ・レジスタCPIOに送られたデータから、
割込みベクタ値を割込みベクタレジスタMIVに
書込み(ステツプ)、またワーク・メモリ領域
の先頭アドレスとその大きさのデータをもとにし
てメモリ・マツプMEMMAPを初期化する(ス
テツプ)。そして、書込まれたタスクの優先度
をもとにして各タスク制御ブロツクTCBを作成
する(ステツプ)。そして、優先度の高い順に
並べてレデイーQを構成する(ステツプ)。こ
のとき、タスク制御ブロツクTCB内の,に
よつて順序づけを行なう。生成後は正常終了コー
ドをコマンド/ステータス・レジスタCNSTにセ
ツトし(ステツプ)、内部演算制御回路CONT
のTSKCHGフラグをリセツトして(ステツプ
)、第6図のメインルーチンに戻る。 If there is no error in the input data, from the data sent to the command parameter register CPIO,
The interrupt vector value is written to the interrupt vector register MIV (step), and the memory map MEMMAP is initialized based on the start address of the work memory area and its size data (step). Then, each task control block TCB is created based on the written priority of the task (step). Then, they are arranged in descending order of priority to form a ready Q (step). At this time, the ordering is performed by the in the task control block TCB. After generation, the normal completion code is set in the command/status register CNST (step), and the internal arithmetic control circuit CONT
The TSKCHG flag is reset (step) and the process returns to the main routine shown in FIG.
エラーコードをコマンド/ステータス・レジス
タCNSTにセツトした場合も同様にTSKCHGフ
ラグをリセツトしてメインルーチンに戻る。 If an error code is set in the command/status register CNST, the TSKCHG flag is similarly reset and the process returns to the main routine.
コマンド1(コマンド名:TSTR,第8図フロ
ーチヤート)は、初期化したマルチ・タスク制御
用素子1を実行状態に移すためのコマンドであ
る。 Command 1 (command name: TSTR, flowchart in FIG. 8) is a command for moving the initialized multi-task control element 1 to an execution state.
このコマンド1では、コマンド0の処理が実行
済かどうかのチエツクを行ない(ステツプ)、
実行済の場合のみ、レデイーQの先頭に接続され
ているタスク(一番優先度の高いタスク)を実行
状態に移すためTSKCHGフラグ(内部演算制御
回路CONTの制御フラグ)をセツトして(ステ
ツプ)、第6図のメインルーチンに戻る。実行
済でない場合は、コマンド/ステータス・レジス
タCNSTにエラーコードをセツトし(ステツプ
)、メインルーチンに戻る。 This command 1 checks whether the process of command 0 has been executed (step).
Only when the task has been executed, the TSKCHG flag (control flag of the internal arithmetic control circuit CONT) is set to move the task connected to the head of Ready Q (the task with the highest priority) to the execution state (step). , returns to the main routine of FIG. If it has not been executed, an error code is set in the command/status register CNST (step) and the process returns to the main routine.
以上のコマンド0,1およびマルチ・タスク制
御用素子1への書込み情報は、例えば第1図のプ
ログラム・メモリ3の初期化プログラムに予じめ
格納され、タスク内容に応じてプログラム変更が
可能であり、マルチ・タスク制御用素子1はこれ
により種々に初期化設定することができる。 The above commands 0 and 1 and the information written to the multi-task control element 1 are stored in advance in the initialization program of the program memory 3 shown in FIG. 1, for example, and the program can be changed according to the task content. Thereby, the multi-task control element 1 can be initialized in various ways.
コマンド2(コマンド名:TCRT,第9図タイ
ムチヤート)は初期設定の後、任意にタスクを生
成するためのコマンドであり、入力データとして
生成するタスクの番号およびその優先度が本素子
1のコマンド・パラメータ・レジスタCPIOに書
込まれる。 Command 2 (command name: TCRT, Figure 9 Time Chart) is a command to arbitrarily generate a task after initial settings, and the number of the task to be generated and its priority as input data is the command of this element 1. -Written to parameter register CPIO.
このコマンド2が実行されると、入力データに
エラーがないかの検査を行ない(ステツプ)、
エラーがあればコマンド/ステータス・レジスタ
CNSTにエラーコードを書込む(ステツプ)。
エラーがなければ、入力データで指定されたタス
クのタスク制御ブロツクTCBを生成する(ステ
ツプ)。 When this command 2 is executed, the input data is checked for errors (step),
Command/Status register if there is an error
Write error code to CNST (step).
If there is no error, a task control block TCB for the task specified by the input data is generated (step).
タスク制御ブロツクTCB中のタスク・ステー
タス(第3図参照)には次の4つのフラグが含
まれる。 The task status in the task control block TCB (see FIG. 3) includes the following four flags.
RUNフラグはタスクが実行状態にあることを
示す。 The RUN flag indicates that the task is in a running state.
READYフラグはタスクがレデイー状態にあつ
てレデイQに接続されていることを示す。 The READY flag indicates that the task is in a ready state and is connected to ready Q.
PENDWフラグはメツセージ受信待ち状態にあ
ることを示す。 The PENDW flag indicates that the device is waiting to receive a message.
SUSPENDフラグはタスクが停止状態にある
ことを示す。 The SUSPEND flag indicates that the task is in a suspended state.
上記タスク制御ブロツクTCBの生成時(ステ
ツプ)、同時にその中のREADYフラグをセツ
トする。 When the task control block TCB is generated (step), the READY flag in it is set at the same time.
そして、タスクの優先度が高い順にレデイーQ
に再接続する(ステツプ)。次にコマンド/ス
テータス・レジスタCNSTに正常終了コードをセ
ツトし(ステツプ)、実行状態のタスクとレデ
イーQの先頭に接続されているタスクの優先度を
比較させるためのTSKCHGフラグをセツトして
(ステツプ)、第6図のメインルーチンに戻る。 Then, in order of task priority, Ready Q
(step). Next, a normal completion code is set in the command/status register CNST (step), and the TSKCHG flag is set to compare the priorities of the running task and the task connected to the beginning of ready Q (step). ), the process returns to the main routine of FIG.
コマンド3(コマンド名:TDEL,第10図タ
イムチヤート)は不要のタスクを消去するための
コマンドで、消去するタスクの番号を入力データ
として実行する。 Command 3 (command name: TDEL, time chart in Figure 10) is a command for erasing unnecessary tasks, and is executed using the number of the task to be erased as input data.
入力データにエラーがないかの検査(ステツプ
〓〓)において、エラーがあればコマンド/ステー
タス・レジスタCNSTにエラーコードがセツトさ
れ(ステツプ〓〓)、第6図のメインルーチンに戻
る。 In checking whether there are any errors in the input data (step 〓〓), if there is an error, an error code is set in the command/status register CNST (step 〓〓), and the process returns to the main routine of FIG.
エラーがなければ、消去するタスクが占有して
いたワーク・メモリを解放するため、このタスク
のタスク制御ブロツクTCB中にある占有メモリ
先頭アドレスおよび占有メモリ・サイズを読
出し、このデータに基づいてメモリ・マツプ
MEMMAP上で対応した領域を“0”クリアす
る(ステツプ〓〓)。ついでこのタスクがレデイー
状態にあれば、消去するタスクのタスク制御ブロ
ツクTCBをレデイーQから切離し(ステツプ
〓〓)、このタスク制御ブロツクTCBのすべてをク
リアする(ステツプ〓〓)。終われば、コマンド/
ステータス・レジスタCNSTに正常終了コードを
セツトして(ステツプ〓〓)、メインルーチンに戻
る。 If there is no error, in order to release the work memory occupied by the task to be erased, read the occupied memory start address and occupied memory size in the task control block TCB of this task, and erase the memory based on this data. mappu
Clear the corresponding area on MEMMAP to “0” (step 〓〓). Next, if this task is in the ready state, the task control block TCB of the task to be erased is separated from the ready Q (step 〓〓), and all of this task control block TCB is cleared (step 〓〓). When finished, command /
Set the normal completion code in the status register CNST (step 〓〓) and return to the main routine.
コマンド4(コマンド名:TRSM,第11図フ
ローチヤート)は、入力データで指定されたタス
ク番号を持つ待機または停止中のタスクをレデイ
ー状態(再起動可能状態)にするためのコマンド
である。タスク番号を入力データとして実行す
る。 Command 4 (command name: TRSM, flowchart in FIG. 11) is a command for making a waiting or stopped task with a task number specified by input data into a ready state (restartable state). Execute the task number as input data.
コマンド4が実行されると、まず入力データに
エラーがないかの検査が行なわれ(ステツプ〓〓)、
エラーがあればコマンド/ステータス・レジスタ
CNSTにエラーコードを設定して(ステツプ〓〓)、
メインルーチンに戻る。 When command 4 is executed, the input data is first checked for errors (step 〓〓),
Command/Status register if there is an error
Set the error code in CNST (Step 〓〓),
Return to main routine.
エラーがなければ、指定されたタスクの
PENDWフラグまたはSUSPENDフラグをリセ
ツトするとともにREADYフラグをセツトし、か
つこのタスク制御ブロツクTCBをタスクの優先
度の高い順序でレデイーQに接続する(ステツプ
〓〓)。そして,正常終了コードをコマンド/ステ
ータス・レジスタCNSTにセツトし(ステツプ
〓〓)、実行状態のタスクとレデイーQの先頭に接
続されているタスクの優先度を比較するため
TSKCHGフラグをセツトし(ステツプ〓〓)、メ
インルーチンに戻る。 If there are no errors, the specified task
The PENDW flag or SUSPEND flag is reset, the READY flag is set, and the task control block TCB is connected to the ready Q in order of priority of the tasks (step 〓〓). Then, the normal completion code is set in the command/status register CNST (step 〓〓), and the priorities of the task in the running state and the task connected to the beginning of Lady Q are compared.
Set the TSKCHG flag (step 〓〓) and return to the main routine.
コマンド5(コマンド名:TSPD,第12図フ
ローチヤート)は、入力データで指定されたタス
ク番号を持つ実行状態あるいはレデイー状態にあ
るタスクを停止状態にするためのコマンドであ
る。 Command 5 (command name: TSPD, flowchart in FIG. 12) is a command for bringing a task in a running or ready state with a task number specified by input data into a stopped state.
このコマンド5が実行されると、入力データの
エラーを検査し、エラーがあればコマンド/ステ
ータス・レジスタCNSTにエラーコードを設定し
てメインルーチンに戻る(ステツプ〓〓,〓〓)。 When this command 5 is executed, the input data is checked for errors, and if there is an error, an error code is set in the command/status register CNST and the process returns to the main routine (steps 〓〓〓〓〓〓).
エラーがなければ、まず、入力データによつ
て、停止状態になるタスクをポート3からの入力
信号(外部イベント)によりレデイー状態にする
(再起動)という指定がされているかどうかのチ
エツクを行なう(ステツプ〓〓)。外部イベントの
指定がなければステツプ〓〓の処理へスキツプす
る。指定がある場合は、他のタスクが既に外部イ
ベントを使用しているかどうかの検査を行ない
(ステツプ〓〓)、使用されていれば、コマンド/ス
テータス・レジスタCNSTにエラーコードをセツ
トして(ステツプ〓〓)メインルーチンに戻る。使
用されていなければ、ポート3の入力信号の遷移
による内部割込みをイネーブルにする(ステツプ
〓〓)。すなわち、本コマンド5の入力データ設定
により外部イベント起動の指定が可能である。 If there is no error, first check whether the input data specifies that the task that is in the stopped state is to be made ready (restarted) by the input signal (external event) from port 3 ( Step〓〓). If no external event is specified, the process skips to step 〓〓. If specified, it is checked whether another task is already using the external event (Step 〓〓), and if it is, an error code is set in the command/status register CNST (Step 〓〓). 〓〓) Return to the main routine. If not used, enable internal interrupts due to the transition of the input signal of port 3 (step 〓〓). That is, by setting the input data of this command 5, it is possible to specify the activation of an external event.
そして、スキツプした場合を含めて次に、その
タスク制御ブロツクTCB中のRUNフラグ(指定
したタスクが実行状態にある場合)または
READYフラグ(レデイー状態にある場合)をリ
セツトし、SUSPENDフラグをセツトする(ス
テツプ〓〓)。終われば、コマンド/ステータス・
レジスタCNSTに正常終了コードをセツトする
(ステツプ〓〓)。そして指定されたタスクがレデイ
ー状態にある場合を考慮して、このタスクをレデ
イーQから切離し、レデイーQに接続されている
タスク制御ブロツクTCBを再度優先度順になら
び換え(ステツプ〓〓)、実行状態のタスクとレデ
イーQの先頭に接続されているタスクの優先度を
比較するためのTSKCHGフラグをセツトして
(ステツプ〓〓)、メインルーチンに戻る。 Then, including the case of skipping, the RUN flag in the task control block TCB (if the specified task is in the running state) or
Reset the READY flag (if it is in the ready state) and set the SUSPEND flag (step 〓〓). When finished, command/status/
Set the normal completion code in register CNST (step 〓〓). Then, considering the case where the specified task is in the ready state, this task is separated from the ready Q, the task control block TCBs connected to the ready Q are rearranged in priority order (step 〓〓), and the task is returned to the execution state. The TSKCHG flag is set to compare the priority of the task connected to the beginning of Lady Q with the priority of the task connected to the beginning of Lady Q (Step 〓〓), and the process returns to the main routine.
コマンド6(コマンド名:TPRI,第13図フ
ローチヤート)は、入力データで指定された番号
のタスクの優先度を変更するコマンドである。 Command 6 (command name: TPRI, flowchart in FIG. 13) is a command for changing the priority of the task with the number specified by the input data.
入力データにエラーがあるかの検査(ステツプ
〓〓)において、エラーがある場合はコマンド/ス
テータス・レジスタCNSTにエラーコードをセツ
トして(ステツプ〓〓)メインルーチンに戻る。 In checking whether there is an error in the input data (Step 〓〓), if there is an error, an error code is set in the command/status register CNST (Step 〓〓) and the process returns to the main routine.
エラーがない場合、指定されたタスクのタスク
管理ブロツクTCB内の優先度(第3図参照)
を入力データの変更優先度の値に書換える(ステ
ツプ〓〓)。次に、レデイーQに接続されているタ
スク管理ブロツクTCBを優先度順にならび換え
(ステツプ〓〓)、コマンド/ステータ・レジスタ
CNSTに正常終了コードをセツトする(ステツプ
〓〓)。そして、実行状態のタスクとレデイーQの
先頭に接続されているタスクの優先度を比較する
ためにTSKCHGフラグをセツトして(ステツプ
〓〓)、メインルーチンに戻る。 If there is no error, the priority of the specified task in the task management block TCB (see Figure 3)
is rewritten to the change priority value of the input data (step 〓〓). Next, the task management block TCBs connected to Lady Q are rearranged in priority order (step 〓〓), and the command/status registers are
Set the normal completion code to CNST (Step 〓〓). Then, the TSKCHG flag is set to compare the priorities of the running task and the task connected to the head of the ready Q (step 〓〓), and the process returns to the main routine.
コマンド7(コマンド名:TSLI,第14図フロ
ーチヤート)は、入力データで指定された優先度
を持つタスク群のマスタCPU占有時間を制限す
るためのコマンドである。すなわち、このコマン
ドは同一優先度のタスクの時分割処理を指定す
る。時分割処理は、指定した優先度より高い優先
度を持つレデイー状態のタスクが存在しない場合
に限り有効である。より高い優先度を持つレデイ
ー状態のタスクが存在すれば、そのタスクが実行
され時分割処理は無効となるが、高い優先度のタ
スクがなくなれば有効となる。 Command 7 (command name: TSLI, flowchart in FIG. 14) is a command for limiting the master CPU occupation time of a task group having a priority specified by input data. That is, this command specifies time-sharing processing of tasks with the same priority. Time-sharing processing is effective only when there is no ready task with a higher priority than the specified priority. If there is a ready task with a higher priority, that task will be executed and time-sharing processing will be disabled, but if there are no tasks with a higher priority, it will become effective.
このコマンド7が実行されると、まず、入力デ
ータのエラーが検査される(ステツプ〓〓)。エラ
ーが検出された場合は、コマンド/ステータス・
レジスタCNSTにエラーコードがセツトされ(ス
テツプ〓〓)、メインルーチンに戻る。 When this command 7 is executed, first, the input data is checked for errors (step 〓〓). If an error is detected, the command/status
An error code is set in register CNST (step 〓〓), and the process returns to the main routine.
エラーが検出されなければ、入力データが時分
割処理をキヤンセルする指定であるのかどうかを
判定する(ステツプ〓〓)。キヤンセルの場合は、
内部演算制御回路CONT内にある時分割制御用
レジスタSLICNTおよびSLIPRIを“0”クリア
する(ステツプ〓〓,〓〓)。入力データが新たに時
分割処理の設定を指定する場合は、その入力デー
タからタスクのCPU占有時間を制御用レジスタ
SLICNTに設定し(ステツプ〓〓)、時分割処理を
行なうタスクの優先度をもう一つの制御用レジス
タSLIPRIに設定する(ステツプ〓〓)。そして最後
にコマンド/ステータス・レジスタCNSTに正常
終了コードをセツトして(ステツプ〓〓)メインル
ーチンに戻る。 If no error is detected, it is determined whether the input data is a designation for canceling time-sharing processing (step 〓〓). In case of cancellation,
Clear the time division control registers SLICNT and SLIPRI in the internal arithmetic control circuit CONT to "0" (steps 〓〓〓〓〓〓). If the input data specifies new time-sharing processing settings, use the input data to specify the CPU occupation time control register for the task.
SLICNT is set (Step 〓〓), and the priority of the task that performs time-sharing processing is set in another control register SLIPRI (Step 〓〓). Finally, a normal completion code is set in the command/status register CNST (step 〓〓) and the process returns to the main routine.
コマンド8(コマンド名:CSET,第15図フ
ローチヤート)は、マルチ・タスク制御用素子1
内に設けられた時計に時刻を設定するためのコマ
ンドである。マスタCPU2から本素子1内のコ
マンド・パラメータ・レジスタCPIOに、入力デ
ータとして時,分,秒データを書込みコマンドを
実行する。 Command 8 (command name: CSET, flowchart in Figure 15) is the multi-task control element 1.
This command is used to set the time on the internal clock. The master CPU 2 writes hour, minute, and second data as input data to the command parameter register CPIO in the device 1 and executes the command.
入力データのエラーが検査されて(ステツプ
〓〓)、エラーが検出された場合はコマンド/ステ
ータス・レジスタCNSTにエラーコードがセツト
されて(ステツプ〓〓)、メインルーチンに戻る。 The input data is checked for errors (Step 〓〓), and if an error is detected, an error code is set in the command/status register CNST (Step 〓〓), and the process returns to the main routine.
エラーがなければ、システム・クロツク領域
SCAに時,分,秒のデータが移される(ステツ
プ〓〓)。そしてコマンド/ステータス・レジスタ
CNSTに正常終了コードをセツトして(ステツプ
〓〓)メインルーチンに戻る。この時計は後述する
タイマ割込みルーチンにより刻々計時される。 If there are no errors, the system clock area
Hour, minute, and second data is transferred to SCA (step 〓〓). and command/status registers
Set the normal completion code in CNST (step 〓〓) and return to the main routine. This clock is kept ticking by a timer interrupt routine to be described later.
コマンド9(コマンド名:CGET,第16図フ
ローチヤート)は、上記の時計から現在の時刻を
読出すためのコマンドである。 Command 9 (command name: CGET, flowchart in FIG. 16) is a command for reading the current time from the above clock.
このコマンド9が実行されると、システム・ク
ロツク領域SCAから時,分,秒のデータが、マ
スタCPU2からアクセス可能なコマンド・パラ
メータ・レジスタCPIOに移される。移した後は
コマンド/ステータス・レジスタCNSTに正常終
了コードをセツトして(ステツプ〓〓)メインルー
チンに戻る。 When this command 9 is executed, the hour, minute, and second data from the system clock area SCA are transferred to the command parameter register CPIO accessible from the master CPU 2. After the transfer, a normal completion code is set in the command/status register CNST (step 〓〓) and the process returns to the main routine.
コマンド10(コマンド名:MALC,第17図フ
ローチヤート)は、マルチ・タスク制御用素子1
が管理しているワーク・メモリ領域の中から、コ
マンドを実行したタスクに対して要求されたサイ
ズのワーク・メモリの使用を許可するコマンドで
ある。コマンド・パラメータ・レジスタCPIOに
要求するワーク・メモリ数(100H単位)を書込
みコマンドを実行する。 Command 10 (command name: MALC, flowchart in Figure 17) is the multi-task control element 1.
This command allows the task that executed the command to use the requested size of work memory from the work memory area managed by . Write the requested work memory number (in units of 100H) to the command parameter register CPIO and execute the command.
コマンド10が実行されると、入力データのエラ
ー検出が行なわれる(ステツプ〓〓)。エラーが検
出されれば、コマンド/ステータス・レジスタ
CNSTにエラーコードをセツトして(ステツプ
〓〓)メインルーチンに戻る。 When command 10 is executed, error detection of input data is performed (step 〓〓). If an error is detected, the command/status register
Set the error code in CNST (step 〓〓) and return to the main routine.
エラーが検出されなければ、メモリ・マツプ
MEMMAPを調査し、要求されたワーク・メモ
リが空いているかどうかのチエツクを行なう(ス
テツプ〓〓)。空き領域がなければコマンド/ステ
ータス・レジスタCNSTにメモリ占有不可コード
をセツトして(ステツプ〓〓)、メインルーチンに
戻る。空き領域が見つかれば、コマンドを実行し
たタスクが要求したサイズだけメモリ・マツプ
MEMMAP上の対応したビツトに“1”をセツ
トする(ステツプ〓〓)。そして、コマンドを実行
したタスクのタスク制御ブロツクTCB内の占有
メモリ・先頭アドレスおよび占有メモリ・サイ
ズの領域(第3図参照)にそれぞれの値を設定
し(ステツプ〓〓)、次にコマンド・パラメータ・
レジスタCPIOに占有メモリ先頭アドレスを書込
む。書込まれば、コマンド/ステータス・レジス
タCNSTに正常終了コードをセツトし(ステツプ
〓〓)メインルーチンに戻る。 If no errors are detected, the memory map
Examine MEMMAP and check whether the requested work memory is free (step 〓〓). If there is no free space, a memory occupancy disable code is set in the command/status register CNST (step 〓〓) and the process returns to the main routine. If free space is found, the memory map is expanded to the size requested by the task that executed the command.
Set the corresponding bit on MEMMAP to "1" (Step 〓〓). Then, set the respective values in the occupied memory start address and occupied memory size areas (see Figure 3) in the task control block TCB of the task that executed the command (Step 〓〓), and then set the command parameters.・
Write the occupied memory start address to register CPIO. Once written, a normal completion code is set in the command/status register CNST (step 〓〓) and the process returns to the main routine.
コマンド11(コマンド名:MREL,第18図フ
ローチヤート)は、占有していたワーク・メモリ
領域を開放するためのコマンドである。 Command 11 (command name: MREL, flowchart in FIG. 18) is a command for freeing the occupied work memory area.
コマンド11を実行したタスクがワーク・メモリ
を占有していなければ(ステツプ〓〓)、コマン
ド/ステータス・レジスタCNSTにエラーコード
をセツトして(ステツプ〓〓)メインルーチンに戻
る。 If the task that executed command 11 does not occupy the work memory (step <<>), an error code is set in the command/status register CNST (step <<>) and the process returns to the main routine.
既にワーク・メモリが占有されていれば、コマ
ンドを実行したタスクのタスク制御ブロツク
TCB内に登録されている占有メモリ先頭アドレ
スおよび占有メモリ・サイズの領域の値を参
照し、メモリ・マツプMEMMAP上の対応した
ビツトを“0”にリセツトする(ステツプ〓〓)。
そして、タスク制御ブロツクTCB内の占有メモ
リ先頭アドレスおよび占有メモリ・サイズの
領域をクリアする(ステツプ〓〓)。最後にコマン
ド/ステータス・レジスタCNSTに正常終了コー
ドをセツトして(ステツプ〓〓)、メインルーチン
に戻る。 If work memory is already occupied, the task control block of the task that executed the command
Refers to the values of the occupied memory start address and occupied memory size area registered in the TCB, and resets the corresponding bit on the memory map MEMMAP to "0" (step 〓〓).
Then, the area of the occupied memory start address and occupied memory size in the task control block TCB is cleared (step 〓〓). Finally, a normal completion code is set in the command/status register CNST (step 〓〓), and the process returns to the main routine.
上述のようにタスクからメモリを要求する場合
には、マルチ・タスク制御用素子1に対してコマ
ンド10(メモリ占有コマンド,MALC)を実行す
る。また、タスクが使用していたメモリが不要に
なり解放したい場合には、コマンド11(メモリ解
放コマンド,MREL)を実行する。 When a task requests memory as described above, command 10 (memory occupancy command, MALC) is executed to the multi-task control element 1. Also, if the memory used by a task is no longer needed and you want to release it, execute command 11 (memory release command, MREL).
このようにマルチ・タスク制御用素子1は、こ
れらコマンド10,11によつて、予じめ登録された
64Kバイトまでのワーク用メモリ領域を100Hバ
イト単位で使用中か否かを判断し、タスクから要
求されたサイズの空き領域を探し出して、タスク
に割付ける機能を有する。 In this way, the multi-task control element 1 is registered in advance by these commands 10 and 11.
It has a function that determines whether a work memory area of up to 64K bytes is in use in units of 100H bytes, searches for free space of the size requested by a task, and allocates it to the task.
この機能は、限られたメモリ空間を複数のタス
クで有効に利用するのに効果を発揮し、またお互
いのタスク間で同一メモリ領域を重複して使用す
ることを防止するのに役立つ。なお、マルチ・タ
スク制御用素子1へのワーク・メモリ領域の設定
は、マルチ・タスク制御用素子1の初期設定時
(コマンド0の実行時)に行なわれる。 This function is effective in effectively utilizing limited memory space among multiple tasks, and is also useful in preventing multiple tasks from using the same memory area overlappingly. Note that the setting of the work memory area in the multi-task control element 1 is performed at the time of initial setting of the multi-task control element 1 (at the time of execution of command 0).
コマンド12(コマンド名:POST,第19図フ
ローチヤート)は、本マルチ・タスク制御用素子
1内に設けられたメイルボツクスMBXと呼ばれ
るメモリ領域に、データを送るためのコマンドで
ある。メイルボツクスMBXはこのコマンド12を
実行したタスクと別タスク(次に説明するコマン
ド13実行)とのメツセージ中継点となる。5個の
メイルボツクスMBX1〜MBX5中の1個を指
定できる。コマンド・パラメータ・レジスタ
CPIOに使用するメイル・ボツクスMBXの番号,
および指定したメイル・ボツクスMBXへ送るデ
ータを書込み、コマンドを実行する。 Command 12 (command name: POST, flowchart in FIG. 19) is a command for sending data to a memory area called mailbox MBX provided in the multi-task control element 1. The mailbox MBX serves as a message relay point between the task that executed this command 12 and another task (execution of command 13, which will be explained next). One of the five mailboxes MBX1 to MBX5 can be specified. Command parameter register
Mail box MBX number used for CPIO,
and writes the data to be sent to the specified mail box MBX and executes the command.
コマンド12が実行されると、入力データのエラ
ーを検査し(ステツプ〓〓)、エラーが検出されれ
ばコマンド/ステータス・レジスタCNSTにエラ
ーコードをセツトして(ステツプ〓〓)メインルー
チンに戻る。 When command 12 is executed, the input data is checked for errors (step 〓〓), and if an error is detected, an error code is set in the command/status register CNST (step 〓〓) and the process returns to the main routine.
エラーが検出されなければ、送信データを指定
された番号のメイル・ボツクスMBXに書込む
(ステツプ〓〓)。そして次に、既にコマンド13が実
行され、コマンド12の実行によつてデータが指定
のメイル・ボツクスMBXに送られてくるのを待
つているタスクがあるかどうかを調査する(ステ
ツプ〓〓)。これはすべてのタスクのタスク制御ブ
ロツクTCB内のタスク・ステータ中の
PENDWフラグおよびメイルボツクス番号とを
参照して行なわれる。もし送信待ちのタスクがな
い場合はステツプ〓〓へスキツプする。送信待ちの
タスクがある場合(本実施例では1個のみを許し
ている)は、送信待ちのタスクのタスク制御ブロ
ツクTCB内のPENDWフラグをリセツト,また
READYフラグをセツトし、レデイーQを優先度
順に接続しなおす(ステツプ〓〓)。 If no error is detected, the transmitted data is written to the mail box MBX of the designated number (step 〓〓). Next, it is checked whether there is a task that has already executed command 13 and is waiting for data to be sent to the specified mail box MBX by executing command 12 (step 〓〓). This is in the task status in the task control block TCB of all tasks.
This is done with reference to the PENDW flag and mailbox number. If there is no task waiting to be sent, skip to step 〓〓. If there is a task waiting for transmission (only one is allowed in this embodiment), reset the PENDW flag in the task control block TCB of the task waiting for transmission, or
Set the READY flag and reconnect Ready Q in order of priority (Step 〓〓).
そして送信待ちのタスクがある場合、ない場合
共に、コマンド/ステータス・レジスタCNSTに
正常終了コードをセツト(ステツプ〓〓)、さらに
TSKCHGフラグをセツトして(ステツプ〓〓)メ
インルーチンに戻る。 Then, whether there is a task waiting for transmission or not, a normal completion code is set in the command/status register CNST (step 〓〓), and
Set the TSKCHG flag (step 〓〓) and return to the main routine.
コマンド13(コマンド名:PEND,第20図フ
ローチヤート)は別タスクより、指定したメイ
ル・ボツクスMBXを介してデータを受け取るコ
マンドである。コマンド・パラメータ・レジスタ
CPIOにデータを受け取るメイル・ボツクス
MBXの番号を書込みコマンドを実行する。コマ
ンド13が実行されると、まず入力データのエラー
検査が行なわれ(ステツプ〓〓)、エラーがあれば
コマンド/ステータス・レジスタCNSTにエラー
コードをセツトして(ステツプ〓〓)、メインルー
チンに戻る。 Command 13 (command name: PEND, flowchart in Figure 20) is a command to receive data from another task via the specified mail box MBX. Command parameter register
Mailbox receiving data to CPIO
Write the MBX number and execute the command. When command 13 is executed, the input data is first checked for errors (Step 〓〓), and if there is an error, an error code is set in the command/status register CNST (Step 〓〓), and the process returns to the main routine. .
エラーが検出されなければ、指定したメイル・
ボツクスMBXにデータが既に書込まれているか
どうかチエツクする(ステツプ〓〓)。もし書込ま
れていなければ、RUNフラグをリセツト,
PENDWフラグをセツトし(ステツプ〓〓)、また
TSKCHGフラグをセツトする(ステツプ〓〓)。
そして次に、コマンド/ステータス・レジスタ
CNSTにデータ未着コードをセツトし(ステツプ
〓〓)、メインルーチンに戻る。既にデータが書込
まれていれば、コマンド・パラメータ・レジスタ
CPIOに指定したメイル・ボツクスMBXに書込
まれているデータを転送し(ステツプ〓〓)、コマ
ンド/ステータス・レジスタCNSTに正常終了コ
ードをセツトして(ステツプ〓〓)、メインルーチ
ンに戻る。 If no errors are detected, the specified mail
Check whether data has already been written to the box MBX (step 〓〓). If not written, reset the RUN flag,
Set the PENDW flag (step 〓〓) and
Set the TSKCHG flag (step 〓〓).
And then the command/status register
Set the data unarrival code in CNST (step 〓〓) and return to the main routine. If data has already been written, the command parameter register
Transfers the data written to the mail box MBX specified by CPIO (Step 〓〓), sets a normal completion code in the command/status register CNST (Step 〓〓), and returns to the main routine.
コマンド14(コマンド名:PMOD,第21図フ
ローチヤート)は、ポート1とポート2のデータ
入出力方向を設定するコマンドである。コマン
ド・パラメータ・レジスタCPIOにポート1とポ
ート2との入出力方向を指定するためのコードを
設定してコマンドを実行する。 Command 14 (command name: PMOD, flowchart in FIG. 21) is a command for setting the data input/output direction of port 1 and port 2. Set the code for specifying the input/output direction of port 1 and port 2 in the command parameter register CPIO and execute the command.
コマンド・パラメータ・レジスタCPIOに設定
されたコードに基づきポート1とポート2の入出
力方向を指定し(ステツプ〓〓)、コマンド/ステ
ータス・レジスタCNSTに正常終了コードをセツ
トして(ステツプ〓〓)、メインルーチンに戻る。 Specify the input/output direction of ports 1 and 2 based on the code set in the command parameter register CPIO (Step 〓〓), and set the normal completion code in the command/status register CNST (Step 〓〓). , return to the main routine.
タスクから発行された上記任意のコマンド0〜
14の処理ルーチンを実行し、第6図のメインルー
チンに戻ると、まずコマンド/ステータス・レジ
スタCNSTにエラーコードがセツトされているか
どうかの判定を行なう(ステツプ〓〓)。エラーコ
ードがセツトされていればステツプ〓〓へスキツプ
し、もしエラーコードがセツトされていなけれ
ば、次にTSKCHGフラグがセツトされているか
どうか判定する(ステツプ〓〓)。TSKCHGフラ
グが“0”であればステツプ〓〓へスキツプし、
“1”であればタスク切換えルーチンを実行する
(ステツプ〓〓)、タスク切換えルーチンは第22図
のフローチヤートに詳しく述べられる)。ステツ
プ〓〓またはステツプ〓〓からスキツプして、あるい
はタスク切換えルーチン(ステツプ〓〓)が実行さ
れてメインルーチンに戻ると、次のコマンド受け
入れ準備を行ない(ステツプ〓〓)、TSKCHGフ
ラグをリセツトする(ステツプ〓〓)。そして、ス
テツプに戻り、次のコマンド受け入れ待ち状態
となる。 Any command 0~ issued by the task above
After executing the processing routine No. 14 and returning to the main routine shown in FIG. 6, it is first determined whether an error code is set in the command/status register CNST (step 〓〓). If the error code is set, the program skips to step 〓〓, and if the error code is not set, then it is determined whether the TSKCHG flag is set (step 〓〓). If the TSKCHG flag is “0”, skip to step 〓〓,
If it is "1", a task switching routine is executed (step 〓〓) (the task switching routine is described in detail in the flowchart of FIG. 22). When the program returns to the main routine by skipping from Step〓〓 or Step〓〓 or after executing the task switching routine (Step〓〓), it prepares to accept the next command (Step〓〓) and resets the TSKCHG flag ( Step〓〓). Then, the process returns to the step and waits for the next command to be accepted.
上記したようにコマンド処理ルーチンで、
TSKCHGフラグがセツト(“1”)されれば、タ
スク切換ルーチンを実行する。第22図のフロー
チヤートにおいて、タスク切換えルーチンに入る
と、まずコマンド1(初期設定終了および実行開
始)の実行時かどうかのチエツクを行なう(ステ
ツプ〓〓)。 As mentioned above, in the command processing routine,
When the TSKCHG flag is set (to "1"), a task switching routine is executed. In the flowchart of FIG. 22, when the task switching routine is entered, it is first checked whether command 1 (end of initial setting and start of execution) is to be executed (step 〓〓).
コマンド1の実行時であればステツプ 100 へ
スキツプし、以降の処理により、先にコマンド0
(初期設定)で登録したタスクの中から、レデイ
ー状態にありかつ優先度の最も高いタスクを実行
させるべくマスタCPU2に割込み信号を発生す
る。まず、レデイーQの先頭に接続されているタ
スクのタスク制御ブロツクTCBをレデイーQか
ら切離し(ステツプ 100 )、このタスク制御ブロ
ツクTCB内のタスク・スタツク・ポインタ
(第3図参照)の値を新スタツク・ポインタ・レ
ジスタSPNに書込む(ステツプ 101 )。そして、
タスク制御ブロツクTCB内のタスク・ステータ
スにRUNフラグをセツトして(ステツプ 102
)、マスタCPU2に対して割込み信号を発
生する(ステツプ 103 )。 If command 1 is being executed, skip to step 100, and in the subsequent processing, command 0 will be executed first.
An interrupt signal is generated to the master CPU 2 to cause the task that is in the ready state and has the highest priority to be executed from among the tasks registered in (initial setting). First, the task control block TCB of the task connected to the beginning of Lady Q is disconnected from Lady Q (step 100), and the value of the task stack pointer (see Figure 3) in this task control block TCB is set to the new stack. - Write to pointer register SPN (step 101). and,
Set the RUN flag in the task status in the task control block TCB (step 102).
), generates an interrupt signal to the master CPU 2 (step 103).
マスタCPU2は、この割込み信号に基づ
くマスタCPU2側のタスク切換え割込みルーチ
ンにより新しいタスクのスタツク・ポインタの値
を読込み、割込みルーチンのリターンと同時に、
マスタCPU2の管理下においてそのタスクを実
行する。 The master CPU 2 reads the value of the stack pointer of the new task by the task switching interrupt routine on the master CPU 2 side based on this interrupt signal, and at the same time as the interrupt routine returns,
The task is executed under the control of the master CPU 2.
コマンド1の実行時以外では、タスクが実行状
態かどうか検査される(ステツプ〓〓)。実行状態
でない場合、ステツプ〓〓へスキツプし、旧スタツ
ク・ポインタ・レジスタSPBのデータを、前ま
で実行状態にあつたタスクのタスク制御ブロツク
TCB内のタスク・スタツク・ポインタ領域に
書込み、保存する。この後、ステツプ 100 〜
103 の処理を通して別のタスクを実行するため、
マルチ・タスク制御用素子1からマスタCPU2
に割込み信号を発生する。 At times other than when command 1 is executed, it is checked whether the task is in the execution state (step 〓〓). If it is not in the execution state, it skips to step
Write and save in the task stack pointer area in the TCB. After this, step 100 ~
103 to perform another task through processing.
From multi-task control element 1 to master CPU 2
generates an interrupt signal.
タスクが実行状態(RUN状態)であれば、時
分割処理のタイム・アツプ時間かどうか検査され
る(ステツプ〓〓)。時分割処理指定のタスクがタ
イムアツプした時にはステツプ〓〓へスキツプす
る。このスキツプルーチンは後に説明する第24
図フローチヤートのタイマ割込み処理中でしか通
らない。 If the task is in the RUN state, it is checked whether it is the time-up time for time-sharing processing (step 〓〓). When a task specified for time-sharing processing times up, it skips to step 〓〓. This skip routine is the 24th skip routine that will be explained later.
It only passes during timer interrupt processing in the flowchart.
タイム・アツプ時でなければ、レデイーQに接
続されているタスクがあるかどうかの検査を行な
う(ステツプ〓〓)。なければ、すなわち、現在実
行状態のタスク以外に実行待ち(レデイー)状態
のタスクがなければ、第6図のメインルーチンに
戻る。レデイーQに接続されているタスクがあれ
ば、次に、実行状態のタスクの優先度とレデイー
Qの先頭に接続されているタスクの優先度とを比
較する(ステツプ〓〓)。実行状態のタスクの優先
度の方が高ければ、同じく第6図のメインルーチ
ンに戻る。ステツプ〓〓,〓〓でメインルーチンに戻
れば、割込み信号が発生されず、現在実行
中のタスクがそのまま実行を続行することとな
る。 If it is not time up, a check is made to see if there is a task connected to Lady Q (step 〓〓). If not, that is, if there is no task in the ready state other than the task currently in the execution state, the process returns to the main routine of FIG. If there is a task connected to Lady Q, then the priority of the task in the running state is compared with the priority of the task connected to the head of Lady Q (step 〓〓). If the priority of the task in the execution state is higher, the process returns to the main routine shown in FIG. 6 as well. If the main routine is returned by steps 〓〓〓〓〓〓, no interrupt signal will be generated and the task currently being executed will continue its execution.
レデイーQの先頭に接続されているタスクの優
先度の方が高ければ、実行中のタスクのタスク制
御ブロツクTCBをレデイーQに接続するととも
に、RUNフラグをリセツトする(ステツプ〓〓)。
そして、旧スタツク・ポインタ・レジスタSPB
のデータをタスク・制御ブロツクTCBのタス
ク・スタツク・ポインタ領域に保存し(ステツ
プ〓〓)、以降のステツプ 100 〜 103 の処理を通
して割込みを発生させる。なお、ステツプ 100
〜 103 において、新しく実行状態となる別のタ
スクは、前述したようにレデイーQの先頭に接続
されているタスクで、コマンド実行等により最も
優先度が高くなつたタスクである。割込み信号
INTを発生した後は第6図のメインルーチンに
戻り、次のコマンド受け入れ準備を行なう(第6
図ステツプ〓〓)。 If the priority of the task connected to the head of Lady Q is higher, the task control block TCB of the task being executed is connected to Lady Q, and the RUN flag is reset (step 〓〓).
and the old stack pointer register SPB
The data is stored in the task stack pointer area of the task control block TCB (step 〓〓), and an interrupt is generated through the processing of subsequent steps 100 to 103. In addition, step 100
In steps 103 to 103, another task that newly enters the execution state is the task connected to the head of Lady Q, as described above, and is the task that has become the highest priority due to command execution or the like. interrupt signal
After generating INT, return to the main routine shown in Figure 6 and prepare to accept the next command (see Figure 6).
Figure step〓〓).
第23図,第24図は第6図のメインルーチン
に対する割込み処理ルーチンのフローチヤートで
ある。 23 and 24 are flowcharts of the interrupt handling routine for the main routine of FIG. 6.
第23図はポート3への入力による割込み処理
で、コマンド5(タスクの停止,第12図フロー
チヤート)によつて停止状態にあるタスクを外部
イベント起動するものである。 FIG. 23 shows interrupt processing by input to port 3, in which a task in a stopped state is activated by an external event by command 5 (stop task, flowchart in FIG. 12).
ポート3に入力されている信号の遷移によつて
このルーチンが起動される。このルーチンでは、
コマンド5で外部イベント起動を設定しているタ
スクのタスク制御ブロツクTCBを優先度順でレ
デイーQに接続し(ステツプ 104 )、そのタスク
制御ブロツクTCB内のSUSPENDフラグをリセ
ツト,READYフラグをセツトする(ステツプ
105 )。すなわち、これによつて停止状態のタス
クが再起動可能状態となるわけで、これが終れば
割込み処理ルーチンからリターンする。 This routine is activated by the transition of the signal input to port 3. In this routine,
Connect the task control block TCB of the task for which external event activation is set with command 5 to the ready Q in priority order (step 104), reset the SUSPEND flag in the task control block TCB, and set the READY flag ( step
105). That is, this enables the stopped task to be restarted, and once this is completed, the interrupt processing routine returns.
第24図はタイマによる割込み処理で、第2図
のタイマTMからの信号を内部割込み信号とし
て、これが一定時間単位で発生するとタイマ割込
み処理ルーチンに入る。 FIG. 24 shows interrupt processing by a timer. The signal from the timer TM in FIG. 2 is used as an internal interrupt signal, and when this occurs in fixed time units, the timer interrupt processing routine is entered.
タイマTMから内部割込み信号が発生すると、
まず、システム・クロツク領域SCAに登録され
ている時計の値(時,分,秒のデータ)を進める
(ステツプ 106 )。次にコマンド7(タスクの時分
割処理の設定,第7図フローチヤート)で設定さ
れたレジスタSLIPRIに登録されている優先度と、
現在実行状態のタスクの優先度とを比較する(ス
テツプ 107 )。時分割処理は指定した優先度より
高いレデイー状態のタスクが存在しない場合に限
り有効である。より高い優先度を持つレデイー状
態のタスクが存在すれば、そのタスクが実行され
時分割処理は無効となるが、高い優先度のタスク
がなくなれば有効となる。上記ステツプ 107 の
比較は、レジスタSLIPLIに登録されている優先
度のタスクが実行中であるかどうか検査すること
と同等であり、時分割処理指定タスクが実行状態
にない場合は直ちに割込み処理ルーチンからリタ
ーンする。 When an internal interrupt signal is generated from timer TM,
First, the clock values (hour, minute, and second data) registered in the system clock area SCA are advanced (step 106). Next, the priority registered in the register SLIPRI set by command 7 (setting of task time-sharing processing, flowchart in Figure 7),
The priority of the task currently being executed is compared (step 107). Time-sharing processing is effective only when there is no task in a ready state with a higher priority than the specified priority. If there is a ready task with a higher priority, that task will be executed and time-sharing processing will be disabled, but if there are no tasks with a higher priority, it will become effective. The comparison in step 107 above is equivalent to checking whether the task with the priority registered in the register SLIPLI is being executed, and if the task specified for time-sharing processing is not in the execution state, the interrupt processing routine is immediately executed. Return.
レジスタSLIPRIに登録されている優先度と現
在実行状態のタスクの優先度と一致、つまり、現
在実行状態のタスクが時分割処理指定のタスクで
あれば、レジスタSLICNTで登録されている時
間が経過したかどうかの判定を行なう(ステツプ
108 )。経過していなければ、この割込み処理
ルーチンからリターンする。すなわち、マルチ・
タスク制御用素子1はメインルーチンに戻り次の
コマンド受け入れ待ち状態となり、マスタCPU
2は時分割処理指定の現在実行状態にあるタスク
を続けて実行する。 If the priority registered in the register SLIPRI matches the priority of the currently running task, that is, if the currently running task is a task with time-sharing processing specified, then the time registered in the register SLICNT has elapsed. (step)
108). If the elapsed time has not elapsed, return from this interrupt processing routine. That is, multi-
Task control element 1 returns to the main routine and waits for the next command, and the master CPU
2, the task currently in the execution state specified by time-sharing processing is executed continuously.
登録された時間が経過したときは、実行状態の
タスクのタスク制御ブロツクTCBをレデイーQ
の末尾に接続するとともに、RUNフラグをリセ
ツト,READYフラグをセツトし(ステツプ 109
)、第22図のタスク切換えルーチンをコール
する(ステツプ 110 )。 When the registered time has elapsed, the task control block TCB of the task in execution state is readied.
At the same time, reset the RUN flag and set the READY flag (step 109).
), calls the task switching routine shown in FIG. 22 (step 110).
第22図フローチヤートにおいて、時分割処理
指定のタスクがタイム・アツプした場合は、ステ
ツプ〓〓からステツプ〓〓へスキツプする。そしてス
テツプ〓〓〜 103 の処理を行なう。これらによつ
て、前まで実行状態にあつたタスクのタスク・ス
タツク・ポインタ領域に旧スタツク・ポイン
タ・レジスタSPBのデータを保存する(ステツ
プ〓〓)とともに、時分割処理に指定された同じ優
先度を持つタスクのタスク制御ブロツクTCBを
レデイーQから切離し(ステツプ 100 )、このタ
スク制御ブロツクTCB内のタスク・スタツク・
ポインタ領域のデータを新スタツク・ポイン
タ・レジスタSPNに書込む(ステツプ 101 )。
そして最後にタスク・ステータスにRUNフラ
グをセツトする(ステツプ 102 )。こうしたタス
ク切換えルーチンを行なつたのち割込みからリタ
ーンする。マスタCPU2では上述したマルチ・
タスク制御用素子1の動作により、時分割処理に
指定した別のタスクを実行することとなる。 In the flowchart of FIG. 22, if the time has expired for a task designated for time-sharing processing, the process skips from step 〓〓 to step 〓〓. Then, the processing from steps 〓〓〓 to 103 is performed. By doing this, the data of the old stack pointer register SPB is saved in the task stack pointer area of the task that was previously in the execution state (step 〓〓), and the same priority specified for time-sharing processing is saved. The task control block TCB of the task with
Write the data in the pointer area to the new stack pointer register SPN (step 101).
Finally, the RUN flag is set in the task status (step 102). After performing such a task switching routine, the program returns from the interrupt. The master CPU 2 uses the multi
The operation of the task control element 1 causes another task designated for time-sharing processing to be executed.
上述のように本実施例のマルチ・タスク制御用
素子1は同時に最大8個までのタスクをサポート
することができる。8個を越えるタスクをサポー
トさせるには、必要に応じてコマンド2(タスク
の生成),コマンド3(タスクの消去)によりタス
クを生成,消去し、タスクの入れ換えを行なえば
よい。そして、マルチ・タスク制御用素子1によ
り各タスクは優先度順にマスタCPU2の占有権
を割当てられる。また、コマンド7(タスクの時
分割処理の設定)により、同一優先度の複数のタ
スクを時分割方式でスケージユーリングすること
も可能である。なお、各タスクの優先度はタスク
生成時に設定されるが、コマンド6(タスクの優
先度変更)によりマスタCPU2のプログラム実
行中にも変更可能である。 As described above, the multi-task control element 1 of this embodiment can support up to eight tasks at the same time. In order to support more than eight tasks, tasks can be created and deleted using command 2 (task creation) and command 3 (task deletion), and tasks can be replaced as necessary. Then, the multi-task control element 1 allocates exclusive rights to the master CPU 2 to each task in order of priority. Further, by using command 7 (setting of time-sharing processing for tasks), it is also possible to schedule multiple tasks with the same priority in a time-sharing manner. Although the priority of each task is set when the task is generated, it can also be changed during program execution by the master CPU 2 using command 6 (change task priority).
時分割処理の開始時、タスクの実行順序はコマ
ンド0(初期設定)またはコマンド2(タスクの生
成)により生成したタスクの順序に従う。タスク
実行中でコマンド7(タスクの時分割処理の設定)
を実行すれば、実行したタスクの優先度と時分割
指定優先度とが等しい場合には、実行した時点か
ら時分割処理が有効となる。 At the start of time-sharing processing, the execution order of tasks follows the order of tasks generated by command 0 (initial setting) or command 2 (task generation). Command 7 (setting time-sharing processing for tasks) while a task is running
If the priority of the executed task is equal to the time-sharing specified priority, time-sharing processing becomes effective from the time of execution.
コマンド12(メツセージの送信),コマンド13
(メツセージの受信)により、マルチ・タスク制
御用素子1のメイル・ボツクスMBXを利用して
タスク間のデータ(メツセージ)の受授が行なえ
る。 Command 12 (sending message), Command 13
(Message reception) allows data (messages) to be exchanged between tasks using the mail box MBX of the multi-task control element 1.
コマンド12を実行した際、実行したタスクより
も高い優先度を持つタスクが既にコマンド13を実
行して待機状態にあれば、タスク切換えにより待
機していたタスクが実行を開始する。低い優先度
をもつタスクがコマンド13により待機中であれ
ば、そのタスクはレデイー状態になるだけで、本
コマンド12を実行したタスクがそのまま実行を継
続する。コマンド12を実行した際、コマンド13が
実行されていなければ、データ(メツセージ)は
メイル・ボツクスMBXに保存され、同様にその
ままタスクの実行が継続される。 When command 12 is executed, if a task with a higher priority than the executed task has already executed command 13 and is in a standby state, the task that was waiting starts execution due to task switching. If a task with a low priority is on standby due to command 13, that task simply becomes ready, and the task that executed command 12 continues execution. When command 12 is executed, if command 13 has not been executed, the data (message) will be saved in the mail box MBX and the task execution will continue in the same way.
コマンド13を実行した際、既に指定したメイ
ル・ボツクスMBXにデータ(メツセージ)が届
いている場合には、そのタスクがコマンド・パラ
メータ・レジスタCPIOより、直ちに届いている
データ(メツセージ)を読出すことができる。 When executing command 13, if data (message) has already arrived at the specified mail box MBX, the task must immediately read the received data (message) from command parameter register CPIO. I can do it.
また、コマンド13の待機機能を利用すれば、タ
スク間のデータ通信だけでなく、タスク間の同期
および相互排除を行なうことが可能である。な
お、タスク間の同期および相互排除において、メ
イル・ボツクスMBXに書込まれるデータはダミ
ーデータで、実際のタスク処理には使用しなくて
もよい。 Furthermore, by using the standby function of command 13, it is possible to perform not only data communication between tasks, but also synchronization and mutual exclusion between tasks. Note that during synchronization and mutual exclusion between tasks, the data written to the mail box MBX is dummy data and does not need to be used for actual task processing.
2個のタスクが処理の都合上、実行順序を制御
しなければならない場合がある。例えば、一方の
タスクの処理が終了するまで他方のタスクの処理
を行なわず待たせる場合、コマンド12,コマンド
13を次のように利用してお互いの同期をとること
ができる。 There are cases where it is necessary to control the execution order of two tasks for processing reasons. For example, if you want to wait until one task finishes processing the other task, use command 12, command
13 can be used as follows to synchronize each other.
タスク2、コマンド13を実行。タスク2はメ
ツセージ未着のため待機状態となる。 Task 2, execute command 13. Task 2 enters a standby state because no message has arrived.
タスク1の処理をタスク2の処理よりも
先に実行する。 Execute task 1 processing before task 2 processing.
タスク1、コマンド12を実行。タスク2の処
理の実行を許可する。 Execute task 1, command 12. Allow execution of task 2 processing.
タスク2の処理を実行。 Execute task 2 processing.
次に、相互排除であるが、複数のタスクが1つ
の共通の資源、例えばI/O,メモリ等を利用す
る上で同時利用を禁止する必要がある場合があ
る。例として、プリンタの同時使用を禁止する場
合、次のようにして互いに排除することができ
る。 Next, regarding mutual exclusion, when multiple tasks use one common resource, such as I/O, memory, etc., there are cases where it is necessary to prohibit simultaneous use. For example, if simultaneous use of printers is prohibited, they can be excluded from each other as follows.
タスク1、コマンド12を実行。 Execute task 1, command 12.
タスク1、コマンド13を実行。既にコマンド
12が実行されているため待機状態にはならず、
排他部分をロツク。 Execute task 1, command 13. already command
12 is running, so it does not enter the standby state,
Lock the exclusive part.
タスク2、コマンド13を実行。このコマンド
13によりタスクは待機状態となる。 Task 2, execute command 13. This command
13 puts the task in a standby state.
タスク1、プリンタ使用。 Task 1: Use a printer.
タスク1、コマンド12を実行。排他部分のロ
ツク解除、同時にタスク2の排他部分をロツ
ク。 Execute task 1, command 12. Unlock the exclusive part and lock the exclusive part of task 2 at the same time.
タスク2、プリンタ使用。 Task 2: Use a printer.
タスク2、コマンド12を実行、排他部分のロ
ツク解除。 Task 2, execute command 12, unlock the exclusive part.
上述のようにしてタスク間の同期および相互排
除を行なうこともできる。 Synchronization and mutual exclusion between tasks can also be achieved as described above.
なお、本実施例におけるマルチ・タスク制御用
素子1はハードウエアを1個のLSI上に集積化し
たものであるが、適宜回路要素を組合せ、装置と
するようにして何ら差支えない。 Although the multi-task control element 1 in this embodiment has hardware integrated on one LSI, there is no problem in creating a device by combining circuit elements as appropriate.
<発明の効果>
以上のように本発明のデバイスによれば、簡単
に各タスクの管理メモリを行なうことができ、ま
たマスタCPU側のメモリ管理のためのソフトウ
エアの負担を大幅に軽減できる。<Effects of the Invention> As described above, according to the device of the present invention, it is possible to easily manage memory for each task, and the burden on software for memory management on the master CPU side can be significantly reduced.
第1図は本発明のデバイスを使用したシステム
構成例を示す図、第2図は本発明の一実施例にお
けるデバイスの内部構成例を示すブロツク図、第
3図は第2図のタスク制御ブロツクTCB領域を
説明する図、第4図は第2図のメモリ・マツプ
MEMMAP領域を説明する図、第5図は本デバ
イスで使用されるコマンドと入力パラメータおよ
び出力パラメータを説明する図、第6図は本デバ
イスのメインルーチンの動作を説明するフローチ
ヤート、第7図〜第21図は各コマンドによる処
理ルーチンの動作を説明するフローチヤート、第
22図はタスク切換ルーチンの動作を説明するフ
ローチヤート、第23図はイベント入力による割
込み処理ルーチンの動作を説明するフローチヤー
ト、第24図はタイマ割込み処理ルーチンの動作
を説明するフローチヤートである。
1……マルチ・タスク制御用素子、2……マス
タCPU、3……プログラム・メモリ、4……デ
ータ・メモリ、INTC……割込み制御回路、
……割込み信号、MEMMAP……メモリ領域、
TCB……タスク制御ブロツク、CONT……内部
演算制御回路、MIV……マスタ割込み制御レジ
スタ、CPIO……コマンド・パラメータ・レジス
タ、CNST……コマンド/ステータス・レジス
タ、SPN……新スタツク・ポインタ・レジスタ、
SPB……旧スタツク・ポインタ・レジスタ。
FIG. 1 is a diagram showing an example of a system configuration using the device of the present invention, FIG. 2 is a block diagram showing an example of the internal configuration of the device in an embodiment of the present invention, and FIG. 3 is a diagram showing the task control block of FIG. 2. A diagram explaining the TCB area, Figure 4 is a memory map of Figure 2.
Figure 5 is a diagram explaining the MEMMAP area, Figure 5 is a diagram explaining commands used in this device, input parameters, and output parameters, Figure 6 is a flowchart explaining the operation of the main routine of this device, Figures 7- FIG. 21 is a flowchart explaining the operation of the processing routine by each command, FIG. 22 is a flowchart explaining the operation of the task switching routine, and FIG. 23 is a flowchart explaining the operation of the interrupt processing routine by event input. FIG. 24 is a flowchart illustrating the operation of the timer interrupt processing routine. 1... Multi-task control element, 2... Master CPU, 3... Program memory, 4... Data memory, INTC... Interrupt control circuit,
...Interrupt signal, MEMMAP...memory area,
TCB...Task control block, CONT...Internal arithmetic control circuit, MIV...Master interrupt control register, CPIO...Command parameter register, CNST...Command/status register, SPN...New stack pointer register ,
SPB...Old stack pointer register.
Claims (1)
複数のタスクの管理を上記マスタCPU以外で行
なうデバイスであり、上記各タスクの使用するワ
ーク・メモリを管理するためのメモリ領域を有
し、上記マスタCPUにより実行中のタスクから
発行されるコマンドに従い、上記メモリ領域の状
況に応じ使用中か否かを判断し、タスクから要求
されたサイズの空き領域を探し出してタスクに割
付け制御する手段を備えてなり、上記マスタ
CPUとは独立して処理を実行することを特徴と
するマルチ・タスク制御用デバイス。1 A device that manages multiple tasks executed by a single master CPU in a time-sharing manner using a device other than the master CPU, and has a memory area for managing the work memory used by each of the above tasks. A means is provided for determining whether or not the above memory area is in use according to the command issued by the task being executed by the CPU, searching for a free area of the size requested by the task, and allocating it to the task. The above master
A multi-task control device that executes processing independently of the CPU.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP22812183A JPS60118937A (en) | 1983-11-30 | 1983-11-30 | Multi-task controlling device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP22812183A JPS60118937A (en) | 1983-11-30 | 1983-11-30 | Multi-task controlling device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS60118937A JPS60118937A (en) | 1985-06-26 |
| JPH0376500B2 true JPH0376500B2 (en) | 1991-12-05 |
Family
ID=16871537
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP22812183A Granted JPS60118937A (en) | 1983-11-30 | 1983-11-30 | Multi-task controlling device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPS60118937A (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH0727340B2 (en) * | 1985-09-25 | 1995-03-29 | ソニー株式会社 | Video tex terminal |
| JPS63226762A (en) * | 1987-03-16 | 1988-09-21 | Hitachi Ltd | Data processing method |
| US6931497B2 (en) * | 2003-01-09 | 2005-08-16 | Emulex Design & Manufacturing Corporation | Shared memory management utilizing a free list of buffer indices |
| US10528476B2 (en) | 2016-05-24 | 2020-01-07 | International Business Machines Corporation | Embedded page size hint for page fault resolution |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS5652447A (en) * | 1979-10-02 | 1981-05-11 | Nec Corp | Working set control system |
| JPS5833975B2 (en) * | 1980-07-30 | 1983-07-23 | 富士通株式会社 | data processing system |
-
1983
- 1983-11-30 JP JP22812183A patent/JPS60118937A/en active Granted
Also Published As
| Publication number | Publication date |
|---|---|
| JPS60118937A (en) | 1985-06-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5168566A (en) | Multi-task control device for central processor task execution control provided as a peripheral device and capable of prioritizing and timesharing the tasks | |
| US4914570A (en) | Process distribution and sharing system for multiple processor computer system | |
| US5884077A (en) | Information processing system and method in which computer with high load borrows processor of computer with low load to execute process | |
| TWI493466B (en) | Hardware control method and apparatus | |
| JPH0997189A (en) | Exclusive control method for shared resources | |
| US8145820B2 (en) | Multiprocessor system and computer program product | |
| JPS6031648A (en) | Controlling method of multitask | |
| EP0533805A4 (en) | Method for efficient non-virtual main memory management | |
| JP3113841B2 (en) | Parallel transaction processing system | |
| JP2005056067A (en) | DMA transfer control device | |
| CA1304513C (en) | Multiple i/o bus virtual broadcast of programmed i/o instructions | |
| CN100429625C (en) | Real-time Internal Simple Monitoring Method | |
| US5530871A (en) | Asynchronous input and output control system | |
| JPH0376500B2 (en) | ||
| JP3644042B2 (en) | Multitask processing device | |
| JPH0376499B2 (en) | ||
| JPH0348538B2 (en) | ||
| JPH0376497B2 (en) | ||
| IE61307B1 (en) | Method to execute two instruction sequences in an order determined in advance | |
| JPH0376498B2 (en) | ||
| JPH02130666A (en) | System reconfiguration method for multiprocessor systems | |
| JPH08129492A (en) | Resource exclusion check system and resource exclusion check method | |
| JPS60114942A (en) | Device for multi-task control | |
| JPH0519179B2 (en) | ||
| JPH0115899B2 (en) |