Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JPH0348538B2 - - Google Patents
[go: Go Back, main page]

JPH0348538B2 - - Google Patents

Info

Publication number
JPH0348538B2
JPH0348538B2 JP58228123A JP22812383A JPH0348538B2 JP H0348538 B2 JPH0348538 B2 JP H0348538B2 JP 58228123 A JP58228123 A JP 58228123A JP 22812383 A JP22812383 A JP 22812383A JP H0348538 B2 JPH0348538 B2 JP H0348538B2
Authority
JP
Japan
Prior art keywords
task
command
register
executed
data
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
Application number
JP58228123A
Other languages
Japanese (ja)
Other versions
JPS60118939A (en
Inventor
Toshimitsu Nakade
Masaru Kuki
Hirotake Hayashi
Takaaki Uno
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.)
Sharp Corp
Original Assignee
Sharp 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 Sharp Corp filed Critical Sharp Corp
Priority to JP58228123A priority Critical patent/JPS60118939A/en
Publication of JPS60118939A publication Critical patent/JPS60118939A/en
Publication of JPH0348538B2 publication Critical patent/JPH0348538B2/ja
Granted legal-status Critical Current

Links

Landscapes

  • Multi Processors (AREA)

Description

【発明の詳細な説明】[Detailed description of the invention]

<技術分野> 本発明は、マイクロコンピユータのシステム管
理プログラムに有効なマルチ・タスク制御用機能
を備えたコンピユータ周辺デバイスに関するもの
である。 <従来技術> マイクロコンピユータ・システムにおいて、1
つのCPUによつて複数のタスクを同時に処理さ
せるためには、OS(オペレーテイング・システ
ム)によるマルチ・タスク制御が必要である。 従来、マルチ・タスク制御システムにおいて、
タスク中からデータ入出力を行なうためには、
I/O素子を別途外付けする必要があり、またタ
スクの制御はシステムOSのソフトウエアによつ
てサポートしなければならなかつた。そして、外
部事象によるタスクの制御を行なうためには、外
部割込みルーチンを設け、割込みルーチン中で外
部事象を持つことができないため、タスクをデー
タ受信持ちで待機状態にし、外部事象が発生した
とき、割込みルーチン中からデータ受信待ちのタ
スクにデータを送ることにより、各タスクを起動
する方式を採つている。従つて外部割込みに対す
るオーバーヘツドは非常に大きいものとなつてい
る。 <発明の目的> 本発明は、データ入出力とマルチ・タスク制御
機能を1つのデバイスに組込んだものであり、マ
ルチ・タスク制御システムに従来のI/O素子の
代わりに本デバイスを用いれば、従来のI/O素
子と同様、パラレル・データの入出力が可能であ
り、しかもマルチ・タスク制御のためのソフトウ
エアも不要にできる。また、タスク中で外部事象
待ちのコマンドを実行することにより、外部事象
発生までタスクを停止状態にし、発生と同時に、
マスタCPUによる実行中のタスクとは独立して
起動可能状態とすることができるため、外部割込
みに対するオーバーヘツドを単縮できる。 <実施例> 以下図面に従つて本発明の一実施例を説明す
る。 第1図はマイクロコンピユータ・システムとし
ての構成例を示す図である。素子(又は装置)1
は、本発明に係るマルチ・タスク制御を実現する
ための独立したマルチ・タスク・サポート・プロ
セツサとして構成されたものであり、他の周辺デ
バイスと同様、入出力素子の形態で供給される。
以下、本デバイスをマルチ・タスク制御用素子と
呼ぶ。マスタCPU2,プログラム・メモリROM
3,データ・メモリRAM4及び他のI/O等の
周辺入出力素子5は、周知のマイクロコンピユー
タ・システムとしても具備されるものであり、マ
ルチ・タスク制御用素子1とともにバス6を介し
て相互に接続される。プログラム・メモリ3は、
マルチ・タスク制御用素子1の初期化プログラム
と複数のタスクをそれぞれ独立してプログラムし
ている。 マルチ・タスク制御用素子1は、マスタCPU
2により実行されるこれら複数のタスクの管理を
マスタCPU2以外で行なう独立機能素子であり、
タスクのスケジユーリング機能(優先度順又は時
分割による実行タスクの切換え)、タスク間の同
期・通信機能(各タスク間でデータの送受信を行
ない、タスクの実行中断,実行再開を決定)、メ
モリ管理機能(各タスクの使用メモリ領域の重複
使用の禁止)、時計機能(内蔵タイマによる時刻
のセツト)等を有している。つまり、このマル
チ・タスク制御用素子1は、マルチ・タスクの制
御機能をコンピユータ・システムのOS自身のも
つ機能とせず、その機能を有する周辺デバイスと
した点に特色がある。 第2図はマルチ・タスク制御用素子1の内部構
成例を示すブロツク図である。 マルチ・タスク制御用素子1はマスタCPU2
からアクセス可能なレジスタ群を備えている。 コマンド・パラメータ・レジスタCPIOは、マ
スタCPU2からコマンド実行時に入力するパラ
メータや、実行後に出力するパラメータを保持す
る。コマンド/ステータス・レジスタCNSTは書
込み時にはコマンド書込み用として、読出し時に
は実行したコマンドの実行情報を格納するめのレ
ジスタとして機能する。新スタツク・ポインタ・
レジスタSPNは、タスク切換え情報としてこれ
から新らたに実行状態となるタスクのスタツク・
ポインタの値を出力するためのレジスタである。
また、旧スタツク・ポインタ・レジスタSPBは、
タスク切換え情報として今まで実行状態にあつた
タスクのスタツク・ポインタの値を入力するため
のレジスタである。 マスタ割込み制御レジスタMICは本素子1に
おける、マスタCPU2に対する割込み発生を制
御するためのレジスタで、割込みベクタ・レジス
タMIVは割込みベクタ値を書込む。データ・レ
ジスタP1D,P2D,P3Dはポート1,ポー
ト2およびポート3のデータ入出力のためのレジ
スタである。ポート1とポート2はデータ入出力
方向をプログラムによつてビツト単位で設定でき
る8ビツト入出力ポートであり、ポート3は1ビ
ツトの入力ポートである。ポート3はプログラム
によつてイベント入力(ポート3への入力信号の
遷移により停止状態のタスクをレデイー状態に移
す)にセツトすることが可能である。 以上のレジスタ群はマスタCPU2からアクセ
スされて、本素子1とマスタCPU2との間で情
報を相互に交換するために用いられる。データ・
バス・インターフエイスDBI,バス・タイミング
発生・制御回路BTGC,割込み制御回路INTC
は、マスタCPU2とのインターフエイス回路と
して備えられたものである。 タスク制御ブロツクTCB(1〜8)はタスクの
状態を保存するためのメモリ領域である。ここで
は8つまでのタスクを取扱うことが可能である。
各ブロツクは第3図に示されるように、タスク・
ステータス,タスク優先度,先にレデイーQ
に接続されているタスクの番号,後にレデイー
Qに接続されているタスクの番号,タスクが占
有しているワーク・メモリの先頭アドレス,そ
のサイズ,使用しているメイル・ボツクス番号
,そしてタスク実行中断時のスタツク・ポイン
タ値を格納する領域を有している。 メイル・ボツクスMBXはタスク間でデータの
授受を行なえるよう設けられたバツフア・メモリ
領域である。 メモリ・マツプMEMMAPはワーク・メモリ
を管理するためのメモリ領域であり、例えば第4
図のように32バイトから構成される。メモリ・マ
ツプMEMMAPにより256バイト単位のワーク・
メモリを管理することが可能である。ワーク・メ
モリを使用していないときその領域に対応するビ
ツトは“0”で、占有中であるときはそのビツト
が“1”にセツトされる。 タイマTMは時分割処理(同一優先度のタスク
を一定時間毎に実行させる処理)等のために、素
子1内に割込み信号を発生させるもので、システ
ムクロツク領域SCAは同時にタイマTMの出力に
より計数される時,分,秒等の時刻データを格納
するメモリ領域である。 内部演算制御回路CONTは論理演算ユニツト
(ALU),本素子1のプログラムを格納する
ROM,一時記憶用のRAMおよび各種制御のた
めのフラグ用レジスタ等を有してなる。 マスタCPU2からマルチ・タスク制御用素子
1へのアクセスは、実行中のタスクから発行され
るコマンドによつて行なわれ、マルチ・タスク制
御用素子1からマスタCPU2へのアクセスは、
マルチ・タスク制御用素子1の割込み信号発生に
基づいて行なわれる。第5図はコマンドの種類と
入力パラメータおよび出力パラメータを示す図で
ある。 基本的動作としては次のとおりである。なお、
タスク制御ブロツクTCBには各タスクの状態が
既に保存されているものとする。 マルチ・タスク制御用素子1は、実行可能状態
のタスクから優先度の一番高いタスクを選び出
し、登録されたそのタスクのスタツク・ポインタ
の値を新スタツク・ポインタ・レジスタSPNに
準備する。スタツク・ポインタの値を準備した
後、マルチ・タスク制御用素子1はマスタCPU
2に対し割込みを発生する。マスタCPU2は割
込み処理ルーチンを実行し、マルチ・タスク制御
用素子1にセツトされているスタツク・ポインタ
の値を自分のスタツク・ポインタにロードし、予
じめ書込まれていたレジスタの初期値をスタツク
からポツプしてレジスタを書換える。そしてマス
タCPU2の管理下において指定されたタスクを
実行する。 実行中のタスクからコマンド入力があるか、ま
たはタイマTMあるいはポート3への入力による
割込みがあるまで、マルチ・タスク制御用素子1
は待ち状態となる。ここで例えばコマンド入力が
あれば、マルチ・タスク制御用素子1はそのコマ
ンドを解析しコマンド処理を行なう。そして、こ
のコマンドがタスク切換え機能を含むものであれ
ば、次に切換えるべきタスクのスタツク・ポイン
タの値を新スタツク・ポインタ・レジスタSPN
にセツトし、マスタCPU2に対し割込みを発生
する。この割込みによつてマスタCPU2は現在
実行中のタスクの実行を停止し、次に実行すべき
タスクのスタツク・ポインタの値をマルチ・タス
ク制御用素子1から読出す。 以下フローチヤートを参照してさらに詳しく説
明する。 第6図はマルチ・タスク制御用素子1のメイン
ルーチンの動作を説明するフローチヤート、第7
図〜第21図は各コマンド0〜14による処理ルー
チンの動作を説明するフローチヤート、第22図
はタスク切換えルーチンの動作を説明するフロー
チヤート、第23図はポート3へのイベント入力
による割込み処理ルーチンの動作を説明するフロ
ーチヤート、第24図はタイマTMによる割込み
処理ルーチンの動作を説明するフローチヤートで
ある。 第6図において、システムに電源が投入される
と、本マルチ・タスク制御用素子1はリセツト動
作を行ない内部の各機能素子を初期化する(ステ
ツプ)。そして、マスタCPU2からコマンドが
コマンド/ステータス・レジスタCNSTに書込ま
れるのを待つ(ステツプ)。コマンドが書込ま
れると、各コマンド・コードに対応したコマンド
処理を行なう(ステツプ)。 コマンド0(コマンド名:INIT,第7図フロー
チヤート)は、マルチ・タスク制御用素子1の初
期化を行なうためのコマンドであり、マルチ・タ
スク制御用素子1がマスタCPU2に対して割込
みを発生するときにマスタCPU2へ出力するベ
クタ値、マルチ・タスク制御用素子1が管理する
ワーク・メモリ領域の先頭アドレスとその大き
さ、及びタスクの優先度を各タスクに対して登録
するためのコマンドである。 このコマンドが実行されると、入力データのエ
ラーを調査し(ステツプ)、もし入力データに
誤りがあれば、エラーコードをコマンド/ステー
タス・レジスタCNSTにセツトする(ステツプ
)。 入力データに誤りがなければ、コマンド・パラ
メータ・レジスタCPIOに送られたデータから、
割込みベクタ値を割込みベクタレジスタMIVに
書込み(ステツプ)、またワーク・メモリ領域
の先頭アドレスとその大きさのデータをもとにし
てメモリ・マツプMEMMAPを初期化する(ス
テツプ)。そして、書込まれたタスクの優先度
をもとにして各タスク制御ブロツクTCBを作成
する(ステツプ)。そして、優先度の高い順に
並べてレデイーQを構成する(ステツプ)。こ
のとき、タスク制御ブロツクTCB内の,に
よつて順序づけを行なう。生成後は正常終了コー
ドをコマンド/ステータス・レジスタCNSTにセ
ツトし(ステツプ)、内部演算制御回路CONT
のTSKCHGフラグをリセツトして(ステツプ
)、第6図のメインルーチンに戻る。 エラーコードをコマンド/ステータス・レジス
タCNSTにセツトした場合も同様にTSKCHGフ
ラグをリセツトしてメインルーチンに戻る。 コマンド1(コマンド名:TSTR,第8図フロ
ーチヤート)は、初期化したマルチ・タスク制御
用素子1を実行状態に移すためのコマンドであ
る。 このコマンド1では、コマンド0の処理が実行
済かどうかのチエツクを行ない(ステツプ)、
実行済の場合のみ、レデイーQの先頭に接続され
ているタスク(一番優先度の高いタスク)を実行
状態に移すためTSKCHGフラグ(内部演算制御
回路CONTの制御フラグ)をセツトして(ステ
ツプ)、第6図のメインルーチンに戻る。実行
済でない場合は、コマンド/ステータス・レジス
タCNSTにエラーコードをセツトし(ステツプ
)、メインルーチンに戻る。 以上のコマンド0,1およびマルチ・タスク制
御用素子1への書込み情報は、例えば第1図のプ
ログラム・メモリ3の初期化プログラムに予じめ
格納され、タスク内容に応じてプログラム変更が
可能であり、マルチ・タスク制御用素子1はこれ
により種々に初期化設定することができる。 コマンド2(コマンド名:TCRT,第9図タイ
ムチヤート)は初期設定の後、任意にタスクを生
成するためのコマンドであり、入力データとして
生成するタスクの番号およびその優先度が本素子
1のコマンド・パラメータ・レジスタCPIOに書
込まれる。 このコマンド2が実行されると、入力データに
エラーがないかの検査を行ない(ステツプ)、
エラーがあればコマンド/ステータス・レジスタ
CNSTにエラーコードを書込む(ステツプ)。
エラーがなければ、入力データで指定されたタス
クのタスク制御ブロツクTCBを生成する(ステ
ツプ)。 タスク制御ブロツクTCB中のタスク・ステー
タス(第3図参照)には次の4つのフラグが含
まれる。 RUNフラグはタスクが実行状態にあることを
示す。 READYフラグはタスクがレデイー状態にあつ
てレデイーQに接続されていることを示す。 PENDWフラグはメツセージ受信待と状態にあ
ることを示す。 SUSPENDフラグはタスクが停止状態にある
ことを示す。 上記タスク制御ブロツクTCBの生成時(ステ
ツプ)、同時にその中のREADYフラグをセツ
トする。 そして、タスクの優先度の高い順にレデイーQ
に再接続する(ステツプ)。次にコマンド/ス
テータス・レジスタCNSTに正常終了コードをセ
ツトし(ステツプ)、実行状態のタスクとレデ
イーQの先頭に接続されているタスクの優先度を
比較させるためのTSKCHGフラグをセツトして
(ステツプ)、第6図のメインルーチンに戻る。 コマンド3(コマンド名:TDEL,第10図タ
イムチヤート)は不要のタスクを消去するための
コマンドで、消去するタスクの番号を入力データ
として実行する。 入力データにエラーがないかの検査(ステツプ
)において、エラーがあればコマンド/ステー
タス・レジスタCNSTにエラーコードがセツトさ
れ(ステツプ)、第6図のメインルーチンに戻
る。 エラーがなければ、消去するタスクが占有して
いたワーク・メモリを解放するため、このタスク
のタスク制御ブロツクTCB中にある占有メモリ
先頭アドレスおよび占有メモリ・サイズを読
出し、このデータに基づいてメモリ・マツプ
MEMMAP上で対応した領域を“0”クリアす
る(ステツプ)。ついでこのタスクがレデイー
状態にあれば、消去するタスクのタスク制御ブロ
ツクTCBをレデイーQから切離し(ステツプ
)、このタスク制御ブロツクTCBのすべてをク
リアする(ステツプ〓〓)。終われば、コマンド/
ステータス・レジスタCNSTに正常終了コードを
セツトして(ステツプ〓〓)、メインルーチンに戻
る。 コマンド4(コマンド名:TRSM,第11図フ
ローチヤート)は、入力データで指定されたタス
ク番号を持つ待機または停止中のタスクをレデイ
ー状態(再起動可能状態)にするためのコマンド
である。タスク番号を入力データとして実行す
る。 コマンド4が実行されると、まず入力データに
エラーがないかの検査が行なわれ(ステツプ〓〓)、
エラーがあればコマンド/ステータス・レジスタ
CNSTにエラーコードを設定して(ステツプ〓〓)、
メインルーチンに戻る。 エラーがなければ、指定されたタスクの
PENDWフラグまたはSUSPENDフラグをリセ
ツトするとともにREADYフラグをセツトし、か
つこのタスク制御ブロツクTCBをタスクの優先
度の高い順序でレデイーQに接続する(ステツプ
〓〓)。そして、正常終了コードをコマンド/ステ
ータス・レジスタCNSTにセツトし(ステツプ
〓)、実行状態のタスクとレデイーQの先頭に接
続されているタスクの優先度を比較するため
TSKCHGフラグをセツトし(ステツプ)、メ
インルーチンに戻る。 コマンド5(コマンド名:TSPD,第12図フ
ローチヤート)は、入力データで指定されたタス
ク番号を持つ実行状態あるいはレデイー状態にあ
るタスクを停止状態にするためのコマンドであ
る。 このコマンド5が実行されると、入力データの
エラーを検査し、エラーがあればコマンド/ステ
ータス・レジスタCNSTにエラーコードを設定し
てメインルーチンに戻る(ステツプ,)。 エラーがなければ、まず、入力データによつ
て、停止状態になるタスクをポート3からの入力
信号(外部イベント)によりレデイー状態にする
(再起動)という指定がなされているかどうかの
チエツクを行なう(ステツプ〓〓)。外部イベント
の指定がなければステツプ〓〓の処理へスキツプす
る。指定がある場合は、他のタスクが既に外部イ
ベントを使用しているかどうかの検査を行ない
(ステツプ〓〓)、使用されていれば、コマンド/ス
テータス・レジスタCNSTにエラーコードをセツ
トして(ステツプ)メインルーチンに戻る。使
用されていなければ、ポート3の入力信号の遷移
による内部割込みをイネーブルにする(ステツプ
〓〓)。すなわち、本コマンド5の入力データ設定
により外部イベント起動の指定が可能である。 そして、スキツプした場合を含めて次に、その
タスク制御ブロツクTCB中のRUNフラグ(指定
したタスクが実行状態にある場合)または
READYフラグ(レデイー状態にある場合)をリ
セツトし、SUSPENDフラグをセツトする(ス
テツプ〓〓)。終われば、コマンド/ステータス・
レジスタCNSTに正常終了コードをセツトする
(ステツプ〓〓)。そして指定されたタスクがレデイ
ー状態にある場合を考慮して、このタスクをレデ
イーQから切離し、レデイーQに接続されている
タスク制御ブロツクTCBを再度優先度順になら
び換え(ステツプ〓〓)、実行状態のタスクとレデ
イーQの先頭に接続されているタスクの優先度を
比較するためのTSKCHGフラグをセツトして
(ステツプ〓〓)、メインルーチンに戻る。 コマンド6(コマンド名:TPRI,第13図フ
ローチヤート)は、入力データで指定された番号
のタスクの優先度を変更するコマンドである。 入力データにエラーがあるかの検査(ステツプ
〓〓)において、エラーがある場合はコマンド/ス
テータス・レジスタCNSTにエラーコードをセツ
トして(ステツプ〓〓)メインルーチンに戻る。 エラーがない場合、指定されたタスクのタスク
管理ブロツクTCB内の優先度(第3図参照)
を入力データの変更優先度の値に書換える(ステ
ツプ〓)。次に、レデイーQに接続されているタ
スク管理ブロツクTCBを優先度順にならび換え
(ステツプ〓)、コマンド/ステータス・レジスタ
CNSTに正常終了コードをセツトする(ステツプ
〓〓)。そして、実行状態のタスクとレデイーQの
先頭に接続されているタスクの優先度を比較する
ためにTSKCHGフラグをセツトして(ステツプ
〓〓)、メインルーチンに戻る。 コマンド7(コマンド名:TSLI,第14図フロ
ーチヤート)は、入力データで指定された優先度
を持つタスク群のマスタCPU占有時間を制限す
るためのコマンドである。すなわち、このコマン
ドは同一優先度のタスクの時分割処理を指定す
る。時分割処理は、指定した優先度より高い優先
度を持つレデイー状態のタスクが存在しない場合
に限り有効である。より高い優先度を持つレデイ
ー状態のタスクが存在すれば、そのタスクが実行
され時分割処理は無効となるが、高い優先度のタ
スクがなくなれば有効となる。 このコマンド7が実行されると、まず、入力デ
ータのエラーが検査される(ステツプ〓〓)。エラ
ーが検出された場合は、コマンド/ステータス・
レジスタCNSTにエラーコードがセツトされ(ス
テツプ〓〓)メインルーチンに戻る。 エラーが検出されなければ、入力データが時分
割処理をキヤンセルする指定であるのかどうかを
判定する(ステツプ〓〓)。キヤンセルの場合は、
内部演算制御回路CONT内にある時分割制御用
レジスタSLICNTおよびSLIPRIを“0”クリア
する(ステツプ〓〓,〓)。入力データが新たに時
分割処理の設定を指定する場合は、その入力デー
タからタスクのCPU占有時間を制御用レジスタ
SLICNTに設定し(ステツプ〓)、時分割処理を
行なうタスクの優先度をもう一つの制御用レジス
タSLIPRIに設定する(ステツプ〓〓)。そして最後
にコマンド/ステータス・レジスタCNSTに正常
終了コードをセツトして(ステツプ〓)メインル
ーチンに戻る。 コマンド8(コマンド名:CSET,第15図フ
ローチヤート)は、マルチ・タスク制御用素子1
内に設けられた時計に時刻を設定するためのコマ
ンドである。マスタCPU2から本素子1内のコ
マンド・パラメータ・レジスタCPIOに、入力デ
ータとして時、分,秒データを書込みコマンドを
実行する。 入力データのエラーが検査されて(ステツプ
〓〓)、エラーが検出された場合はコマンド/ステ
ータス・レジスタCNSTにエラーコードがセツト
されて(ステツプ〓)、メインルーチンに戻る。 エラーがなければ、システム・クロツク領域
SCAに時,分,秒のデータが移される(ステツ
プ)。そしてコマンド/ステータス・レジスタ
CNSTに正常終了コードをセツトして(ステツプ
〓〓)メインルーチンに戻る。この時計は後述する
タイマ割込みルーチンにより刻々計時される。 コマンド9(コマンド名:CGET,第16図フ
ローチヤート)は、上記の時計から現在の時刻を
読出すためのコマンドである。 このコマンド9が実行されると、システム・ク
ロツク領域SCAから時,分,秒のデータが、マ
スタCPU2からアクセス可能なコマンド・パラ
メータ・レジスタCPIOに移される。移した後は
コマンド/ステータス・レジスタCNSTに正常終
了コードをセツトして(ステツプ〓〓)メインルー
チンに戻る。 コマンド10(コマンド名:MALC,第17図フ
ローチヤート)は、マルチ・タスク制御用素子1
が管理しているワーク・メモリ領域の中から、コ
マンドを実行したタスクに対して要求されたサイ
ズのワーク・メモリの使用を許可するコマンドで
ある。コマンド・パラメータ・レジスタCPIOに
要求するワーク・メモリ数(100H単位)を書込
みコマンドを実行する。 コマンド10が実行されると、入力データのエラ
ー検出が行なわれる(ステツプ〓)。エラーが検
出されれば、コマンド/ステータス・レジスタ
CNSTにエラーコードをセツトして(ステツプ
〓)メインルーチンに戻る。 エラーが検出されなければ、メモリ・マツプ
MEMMAPを調査し、要求されたワーク・メモ
リが空いているかどうかのチエツクを行なう(ス
テツプ〓〓)。空き領域がなければコマンド/ステ
ータス・レジスタCNSTにメモリ占有不可コード
をセツトして(ステツプ〓〓)、メインルーチンに
戻る。空き領域が見つかれば、コマンドを実行し
たタスクが要求したサイズだけメモリ・マツプ
MEMMAP上の対応したビツトに“1”をセツ
トする(ステツプ〓)。そして、コマンドを実行
したタスクのタスク制御ブロツクTCB内の占有
メモリ先頭アドレスおよび占有メモリ・サイズ
の領域(第3図参照)にそれぞれの値を設定し
(ステツプ〓〓)、次にコマンド・パラメータ・レジ
スタCPIOに占有メモリ・先頭アドレスを書込む。
書込まれば、コマンド/ステータス・レジスタ
CNSTに正常終了コードをセツトし(ステツプ
〓〓)メインルーチンに戻る。 コマンド11(コマンド名:MREL,第18図フ
ローチヤート)は、占有していたワーク・メモリ
領域を開放するためのコマンドである。 コマンド11を実行したタスクがワーク・メモリ
を占有していなければ(ステツプ〓〓)、コマン
ド/ステータス・レジスタCNSTにエラーコード
をセツトして(ステツプ〓〓)メインルーチンに戻
る。 既にワーク・メモリが占有されていれば、コマ
ンドを実行したタスクのタスク制御ブロツク
TCB内に登録されている占有メモリ先頭アドレ
スおよび占有メモリ・サイズの領域の値を参
照し、メモリ・マツプMEMMAP上の対応した
ビツトを“0”にリセツトする(ステツプ〓)。
そして、タスク制御ブロツクTCB内の占有メモ
リ先頭アドレス及び占有メモリ・サイズの領
域をクリアする(ステツプ〓)。最後にコマン
ド/ステータス・レジスタCNSTに正常終了コー
ドをセツトして(ステツプ〓〓)、メインルーチン
に戻る。 上述のようにタスクからメモリを要求する場合
には、マルチ・タスク制御用素子1に対してコマ
ンド10(メモリ占有コマンド,MALC)を実行す
る。また、タスクが使用していたメモリが不要に
なり解放したい場合には、コマンド11(メモリ解
放コマンド,MREL)を実行する。 このようにマルチ・タスク制御用素子1は、こ
れらコマンド10,11によつて、予じて登録された
64Kバイトまでのワーク用メモリ領域を100Hバ
イト単位で使用中か否かを判断し、タスクから要
求されたサイズの空き領域を探し出して、タスク
に割付ける機能を有する。 この機能は、限られたメモリ空間を複数のタス
クで有効に利用するのに効果を発揮し、またお互
いのタスク間で同一メモリ領域を重複して使用す
ることを防止するのに役立つ。なお、マルチ・タ
スク制御用素子1へのワーク・メモリ領域の設定
は、マルチ・タスク制御用素子1の初期設定時
(コマンドOの実行時)に行なわれる。 コマンド12(コマンド名:PPOST,第19図
フローチヤート)は、本マルチ・タスク制御用素
子1内に設けられたメイルボツクスMBXと呼ば
れるメモリ領域に、データを送るためのコマンド
である。メイルボツクスMBXはこのコマンド12
を実行したタスクと別タスク(次に説明するコマ
ンド13実行)とのメツセージ中継点となる。5個
のメイルボツクスMBX1〜MBX5中の1個を
指定できる。コマンド・パラメータ・レジスタ
CPIOに使用するメイル・ボツクスMBXの番号,
および指定したメイル・ボツクスMBXへ送るデ
ータを書込み、コマンドを実行する。 コマンド12が実行されると、入力データのエラ
ーを検査し(ステツプ〓)、エラーが検出されれ
ばコマンド/ステータス・レジスタCNSTにエラ
ーコードをセツトして(ステツプ〓)メインルー
チンに戻る。 エラーが検出されなければ、送信データを指定
された番号のメイル・ボツクスMBXに書込む
(ステツプ〓〓)。そして次に、既にコマンド13が実
行され、コマンド12の実行によつてデータが指定
のメイル・ボツクスMBXに送られてくるのを待
つてくるタスクがあるかどうかを調査する(ステ
ツプ〓)。これはすべてのタスクのタスク制御ブ
ロツクTCB内のタスク・ステータ中の
PENDWフラグおよびメイル・ボツクス番号と
を参照して行なわれる。もし送信待ちのタスクが
ない場合はステツプ〓〓へスキツプする。送信待ち
のタスクがある場合(本実施例では1個のみを許
している)は、送信待ちのタスクのタスク制御ブ
ロツクTCB内のPENDWフラグをリセツト,ま
たREADYフラグをセツトし、レデイーQを優先
度順に接続しなおす(ステツプ〓〓)。 そして送信待ちのタスクがある場合、ない場合
共に、コマンド/ステータス・レジスタCNSTに
正常終了コードをセツト(ステツプ〓〓)、さらに
TSKCHGフラグをセツトして(ステツプ〓〓)メ
インルーチンに戻る。 コマンド13(コマンド名:PEND,第20図フ
ローチヤート)は別タスクより、指定したメイ
ル・ボツクスMBXを介してデータを受け取るコ
マンドである。コマンド・パラメータ・レジスタ
CPIOにデータを受け取るメイル・ボツクス
MBXの番号を書込みコマンドを実行する。コマ
ンド13が実行されると、まず入力データのエラー
検査が行なわれ(ステツプ〓〓)、エラーがあれば
コマンド/ステータス・レジスタCNSTにエラー
コードをセツトして(ステツプ〓〓)、メインルー
チンに戻る。 エラーが検出されなければ、指定したメイル・
ボツクスMBXにデータが既に書込まれているか
どうかチエツクする(ステツプ〓〓)。もし書込ま
れていなければ、RUNフラグをリセツト,
PENDWフラグをセツトし(ステツプ〓)、また
TSKCHGフラグをセツトする(ステツプ〓〓)。
そして次に、コマンド/ステータス・レジスタ
CNSTにデータ未着コードをセツトし(ステツプ
〓〓)、メインルーチンに戻る。既にデータが書込
まれていれば、コマンド・パラメータ・レジスタ
CPIOに指定したメイル・ボツクスMBXに書込
まれているデータを転送し(ステツプ〓〓)、コマ
ンド/ステータス・レジスタCNSTに正常終了コ
ードをセツトして(ステツプ〓)、メインルーチ
ンに戻る。 コマンド14(コマンド名:PMOD,第21図フ
ローチヤート)は、ポート1とポート2のデータ
入出力方向を設定するコマンドである。コマン
ド・パラメータ・レジスタCPIOにポート1とポ
ート2との入出力方向を指定するためのコードを
設定してコマンドを実行する。 コマンド・パラメータ・レジスタCPIOに設定
されたコードに基づきポート1とポート2の入出
力方向を指定し(ステツプ〓)、コマンド/ステ
ータス・レジスタCNSTに正常終了コードをセツ
トして(ステツプ〓)、メインルーチンに戻る。 タスクから発行された上記任意のコマンド0〜
14の処理ルーチンを実行し、第6図のメインルー
チンに戻ると、まずコマンド/ステータス・レジ
スタCNSTにエラーコードがセツトされているか
どうかの判定を行なう(ステツプ〓〓)。エラーコ
ードがセツトされていればステツプ〓〓へスキツプ
し、もしエラーコードがセツトされていなけれ
ば、次にTSKCHGフラグがセツトされているか
どうか判定する(ステツプ〓〓)。TSKCHGフラ
グが“0”であればステツプ〓〓へスキツプし、
“1”であればタスク切換えルーチンを実行する
(ステツプ〓〓、タスク切換えルーチンは第22図
のフローチヤートに詳しく述べられる)。ステツ
プ〓〓またはステツプ〓〓からスキツプして、あるい
はタスク切換えルーチン(ステツプ〓〓)が実行さ
れてメインルーチンに戻ると、次のコマンド受け
入れ基準を行ない(ステツプ〓〓)、TSKCHGフ
ラグをリセツトする(ステツプ〓〓)。そして、ス
テツプに戻り、次のコマンド受け入れ待ち状態
となる。 上記したようにコマンド処理ルーチンで
TSKCHGフラグがセツト(“1”)されれば、タ
スク切換ルーチンを実行する。第22図のフロー
チヤートにおいて、タスク切換えルーチンに入る
と、まずコマンド1(初期設定終了および実行開
始)の実行時かどうかのチエツクを行なう(ステ
ツプ〓〓)。 コマンド1の実行時であればステツプ 100 へ
スキツプし、以降の処理により、先にコマンド0
(初期設定)で登録したタスクの中から、レデイ
ー状態にありかつ優先度の最も高いタスクを実行
させるべくマスタCPU2に割込み信号を発生す
る。まず、レデイーQの先頭に接続されているタ
スクのタスク制御ブロツクTCBをレデイーQか
ら切離し(ステツプ 100 )、このタスク制御ブロ
ツクTCB内のタスク・スタツク・ポインタ
(第3図参照)の値を新スタツク・ポインタ・レ
ジスタSPNに書込む(ステツプ 101 )。そして
タスク制御ブロツクTCB内のタスク・ステータ
スにRUNフラグをセツトして(ステツプ102)、
マスタCPU2に対して割込み信号を発生す
る(ステツプ 102 )。 マスタCPU2は、この割込み信号に基づ
くマスタCPU2側のタスク切換え割込みルーチ
ンにより新しいタスクのスタツク・ポインタの値
を読込み、割込みルーチンのリターンと同時に、
マスタCPU2の管理下においてそのタスクを実
行する。 コマンド1の実行時以外では、タスクが実行状
態かどうか検査される(ステツプ〓〓)実行状態で
ない場合、ステツプ〓〓へスキツプし、旧スタツ
ク・ポインタ・レジスタSPBのデータを、前ま
で実行状態にあつたタスクのタスク制御ブロツク
TCB内のタスク・スタツク・ポインタ領域に
書込み、保存する。この後、ステツプ 100 〜
103 の処理を通して別のタスクを実行するため、
マルチ・タスク制御用素子1からマスタCPU2
に割込み信号を発生する。 タスクが実行状態(RUN状態)であれば、時
分割処理のタイム・アツプ時間かどうか検査され
る(ステツプ〓〓)。時分割処理指定のタスクがタ
イムアツプした時にはステツプ〓〓へスキツプす
る。このスキツプルーチンは後に説明する第24
図フローチヤートのタイマ割込み処理中でしか通
らない。 タイム・アツプ時でなければ、レデイーQに接
続されているタスクがあるかどうかの検査を行な
う(ステツプ〓〓)。なければ、すなわち、現在実
行状態のタスク以外に実行待ち(レデイー)状態
のタスクがなければ、第6図のメインルーチンに
戻る。レデイーQに接続されているタスクがあれ
ば、次に、実行状態のタスクの優先度とレデイー
Qの先頭に接続されているタスクの優先度とを比
較する(ステツプ〓〓)。実行状態のタスクの優先
度の方が高ければ、同じく第6図のメインルーチ
ンに戻る。ステツプ〓〓,〓〓でメインルーチンに戻
れば、割込み信号が発生されず、現在実行
中のタスクがそのまま実行を続行するととなる。 レデイーQの先頭に接続されているタスクの優
先度の方が高ければ、実行中のタスクのタスク制
御ブロツクTCBをレデイーQに接続するととも
に、RUNフラグをリセツトする(ステツプ〓〓)。
そして、旧スタツク・ポインタ・レジスタSPB
のデータをタスク・制御ブロツクTCBのタス
ク・スタツク・ポインタ領域に保存し(ステツ
プ〓〓)、以降のステツプ 100 〜 103 の処理を通
して割込みを発生させる。なお、ステツプ 100
〜 103 において、新しく実行状態となる別のタ
スクは、前述したようにレデイーQの先頭に接続
されているタスクで、コマンド実行等により最も
優先度が高くなつたタスクである。割込み信号
INTを発生した後は第6図のメインルーチンに
戻り、次のコマンド受け入れ準備を行なう(第6
図ステツプ〓〓)。 第23図,第24図は第6図のメインルーチン
に対する割込み処理ルーチンのフローチヤートで
ある。 第23図はポート3への入力による割込み処理
で、コマンド5(タスクの停止,第12図フロー
チヤート)によつて停止状態にあるタスクを外部
イベント起動するものである。 ポート3に入力されている信号の遷移によつて
このルーチンが起動される。このルーチンでは、
コマンド5で外部イベント起動を設定しているタ
スクのタスク制御ブロツクTCBを優先順でレデ
イーQに接続し(ステツプ 104 )、そのタスク制
御ブロツクTCB内のSUSPENDフラグをリセツ
ト,READYフラグをセツトする(ステツプ 105
)。すなわち、これによつて停止状態のタスク
が再起動可能状態となるわけで、これが終れば割
込み処理ルーチンからリターンする。 第24図はタイマによる割込み処理で、第2図
のタイマTMからの信号を内部割込み信号とし
て、これが一定時間単位で発生するとタイマ割込
み処理ルーチンに入る。 タイマTMから内部割込み信号が発生すると、
まず、システム・クロツク領域SCAに登録され
ている時計の値(時,分,秒のデータ)を進める
(ステツプ 106 )。次にコマンド7(タスクの時分
割処理の設定,第7図フローチヤート)で設定さ
れたレジスタSLIPRIに登録されている優先度と、
現在実行状態のタスクの優先度とを比較する(ス
テツプ 107 )。時分割処理は指定した優先度より
高いレデイー状態のタスクが存在しない場合に限
り有効である。より高い優先度を持つレデイー状
態のタスクが存在すれば、そのタスクが実行され
時分割処理は無効となるが、高い優先度のタスク
がなくなれば有効となる。上記ステツプ 107 の
比較は、レジスタSLIPRIに登録されている優先
度のタスクが実行中であるかどうか検査すること
と同等であり、時分割処理タスクが実行状態にな
い場合は直ちに割込み処理ルーチンからリターン
する。 レジスタSLIPRIに登録されている優先度と現
在実行状態のタスクの優先度と一致、つまり、現
在実行状態のタスクが時分割処理指定のタスクで
あれば、レジスタSLICNTで登録されている時
間が経過したかどうかの判定を行なう(ステツプ
108 )。経過していなければ、この割込み処理
ルーチンからリターンする。すなわち、マルチ・
タスク制御用素子1はメインルーチンに戻り次の
コマンド受け入れ待ち状態となり、マスタCPU
2は時分割処理指定の現在実行状態にあるタスク
を続けて実行する。 登録された時間が経過したときは、実行状態の
タスクのタスク制御ブロツクTCBをレデイーQ
の末尾に接続するとともに、RUNフラグをリセ
ツト,READYフラグをセツトし(ステツプ 109
)、第22図のタスク切換えルーチンをコール
する(ステツプ 110 )。 第22図フローチヤートにおいて、時分割処理
指定のタスクがタイム・アツプした場合は、ステ
ツプ〓〓からステツプ〓〓へスキツプする。そしてス
テツプ〓〓〜 103 の処理を行なう。これらによつ
て、前まで実行状態にあつたタスクのタスク・ス
タツク・ポインタ領域に旧スタツク・ポイン
タ・レジスタSPBのデータを保存する(ステツ
プ〓〓)とともに、時分割処理に指定された同じ優
先度を持つタスクのタスク制御ブロツクTCBを
レデイーQから切離し(ステツプ 100 )、このタ
スク制御ブロツクTCB内のタスク・スタツク・
ポインタ・レジスタSPNに書込む(ステツプ
101 )。そして最後にタスク・ステータスに
RUNフラグをセツトする(ステツプ 102 )。こ
うしたタスク切換えルーチンを行なつたのち割込
みからリターンする。マスタCPU2では上述し
たマルチ・タスク制御用素子1の動作により、時
分割処理に指定した別のタスクを実行することと
なる。 上述のように本実施例のマルチ・タスク制御用
素子1は同時に最大8個までのタスクをサポート
することができる。8個を越えるタスクをサポー
トさせるには、必要に応じてコマンド2(タスク
の生成),コマンド3(タスクの消去)によりタス
クを生成,消去し、タスクの入れ換えを行なえば
よい。そして、マルチ・タスク制御用素子1によ
り各タスクは優先度順にマスタCPU2の占有権
を割当てられる。また、コマンド7(タスクの時
分割処理の設定)により、同一優先度の複数のタ
スクを時分割方式でスケージユリングすることも
可能である。なお、各タスクの優先度はタスク生
成時に設定されるが、コマンド6(タスクの優先
度変更)によりマスタCPU2のプログラム実行
中にも変更可能である。 時分割処理の開始時、タスクの実行順序はコマ
ンド0(初期設定)またはコマンド2(タスクの生
成)により生成したタスクの順序に従う。タスク
実行中でコマンド7(タスクの時分割処理の設定)
を実行すれば、実行したタスクの優先度と時分割
指定優先度とが等しい場合には、実行した時点か
ら時分割処理が有効となる。 コマンド12(メツセージの送信),コマンド13
(メツセージの受信)により、マルチ・タスク制
御用素子1のメイル・ボツクスMBXを利用し
て、タスク間のデータ(メツセージ)の受授が行
なえる。 コマンド12を実行した際、実行したタスクより
も高い優先度を持つタスクが既にコマンド13を実
行して待機状態にあれば、タスク切換えにより待
機していたタスクが実行を開始する。低い優先度
をもつタスクがコマンド13により待機中であれ
ば、そのタスクはレデイー状態になるだけで、本
コマンド12を実行したタスクがそのまま実行を継
続する。コマンド12を実行した際、コマンド13が
実行されていなければ、データ(メツセージ)は
メイル・ボツクスMBXに保存され、同様にその
ままタスクの実行が継続される。 コマンド13を実行した際、既に指定したメイ
ル・ボツクスMBXにデータ(メツセージ)が届
いている場合には、そのタスクがコマンド・パラ
メータ・レジスタCPIOより、直ちに届いている
データ(メツセージ)を読出すことができる。 また、コマンド13の待機機能を利用すれば、タ
スク間のデータ通信だけでなく、タスク間の同期
および相互排除を行なうことが可能である。な
お、タスク間の同期および相互排除において、メ
イル・ボツクスMBXに書込まれるデータはダミ
ーデータで、実際のタスク処理には使用しなくて
もよい。 2個のタスクが処理の都合上、実行順序を制御
しなければならない場合がある。例えば、一方の
タスクの処理が終了するまで他方のタスクの処理
を行なわず待たせる場合、コマンド12,コマンド
13を次のように利用してお互いの同期をとること
ができる。
<Technical Field> The present invention relates to a computer peripheral device having a multi-task control function effective for a system management program of a microcomputer. <Prior art> In a microcomputer system, 1
In order to have a single CPU process multiple tasks simultaneously, multitasking control by the OS (operating system) is required. Conventionally, in multi-task control systems,
To perform data input/output from within a task,
I/O elements had to be separately attached externally, and task control had to be supported by system OS software. In order to control a task using an external event, an external interrupt routine is provided, and since external events cannot be included in the interrupt routine, the task is placed in a standby state with data reception capability, and when an external event occurs, A method is adopted in which each task is activated by sending data from the interrupt routine to the task waiting to receive data. Therefore, the overhead for external interrupts is very large. <Object of the invention> The present invention incorporates data input/output and multi-task control functions into one device, and if this device is used in a multi-task control system instead of conventional I/O elements, , it is possible to input and output parallel data like conventional I/O elements, and it also eliminates the need for software for multi-task control. In addition, by executing a command to wait for an external event in a task, the task is stopped until the external event occurs, and as soon as the external event occurs,
Since the task can be activated independently of the task being executed by the master CPU, the overhead for external interrupts can be reduced. <Example> An example of the present invention will be described below with reference to the drawings. 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. Master CPU2, 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 interconnected via bus 6 together with multi-task control element 1. connected to. Program memory 3 is
The initialization program for the multi-task control element 1 and the plurality of tasks are programmed independently. 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. FIG. 2 is a block diagram showing an example of the internal configuration of the multi-task control element 1. Multi-task control element 1 is master CPU 2
It has a group of registers that can be accessed from. 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. New stack pointer
Register SPN is used as task switching information to indicate the stack status of a task that will be newly executed.
This is a register for outputting the value of a pointer.
Also, the old stack pointer register SPB is
This register is used to input the value of the stack pointer of the task that has been in the execution state as task switching information. 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. 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. The task control block TCB (1-8) is a memory area for saving the state of a task. It is possible to handle up to eight tasks here.
Each block is assigned a task as shown in Figure 3.
Status, task priority, ready Q first
The number of the task connected to Lady Q, the number of the task connected later to Lady Q, the start address of the work memory occupied by the task, its size, the mail box number in use, and task execution interruption. It has an area for storing the current stack pointer value. The mail box MBX is a buffer memory area provided so that data can be exchanged between tasks. 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". 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. 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. 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. 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. 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. 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. 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 according to 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 processing routine by the timer TM. 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). 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. 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). 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. 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. 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. 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. 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. 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. 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). The task status in the task control block TCB (see FIG. 3) includes the following four flags. The RUN flag indicates that the task is in a running state. The READY flag indicates that the task is in a ready state and is connected to ready Q. The PENDW flag indicates that the device is waiting to receive a message. The SUSPEND flag indicates that the task is in a suspended state. When the task control block TCB is generated (step), the READY flag in it is set at the same time. Then, select the Lady Q tasks in order of priority.
(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. 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. 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. 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. 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. 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. 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, a 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. 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. 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 (step). If there is no error, first, it is checked 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 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. 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. 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. 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. 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 order of priority (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. 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. 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. 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. 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. 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. 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. Command 9 (command name: CGET, flowchart in FIG. 16) is a command for reading the current time from the above clock. 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. 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. 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. 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 area (see Figure 3) in the task control block TCB of the task that executed the command (Step 〓〓), and then set the command parameter. Write the occupied memory/start address to register CPIO.
If written, command/status register
Set a normal completion code in CNST (step 〓〓) and return to the main routine. Command 11 (command name: MREL, flowchart in FIG. 18) is a command for freeing the occupied work memory area. 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. If work memory is already occupied, the task control block of the task that executed the command
Referring to the values of the occupied memory start address and occupied memory size area registered in the TCB, the corresponding bit on the memory map MEMMAP is reset 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. 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). 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. 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 O). Command 12 (command name: PPOST, 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. Mailbox MBX uses this command 12
It serves as a message relay point between the task that executed the task and another task (command 13 execution, 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. 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. 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 mail box 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), the PENDW flag in the task control block TCB of the task waiting for transmission is reset, the READY flag is set, and Ready Q is given priority. Reconnect in order (step 〓〓). 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. 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. . 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. 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. Specify the input/output direction of ports 1 and 2 based on the code set in the command parameter register CPIO (Step 〓), set the normal completion code in the command/status register CNST (Step 〓), and then proceed to the main Return to routine. 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 1, the task switching routine is described in detail in the flowchart of FIG. 22). When returning to the main routine by skipping from Step〓〓 or Step〓〓, or after executing the task switching routine (Step〓〓), the next command acceptance criterion is performed (Step〓〓) and the TSKCHG flag is reset ( Step〓〓). Then, the process returns to the step and waits for the next command to be accepted. In the command processing routine as above
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 〓〓). 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). Then, the RUN flag is set in the task status in the task control block TCB (step 102),
An interrupt signal is generated to the master CPU 2 (step 102). 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. Except when command 1 is executed, it is checked whether the task is in the running state (Step 〓〓). If it is not in the running state, it skips to Step 〓〓 and the data in the old stack pointer register SPB is restored to the previous running state. Task control block of hot task
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. 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. 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 you return to the main routine with steps 〓〓〓〓〓〓, no interrupt signal will be generated and the task currently being executed will continue its execution. 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 and 24 are flowcharts of the interrupt processing routine for the main routine of FIG. 6. 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). 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 and set the READY flag in the task control block TCB (step 104). 105
). That is, this enables the stopped task to be restarted, and once this is completed, the interrupt processing routine returns. 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. 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 register SLIPRI is being executed, and if the time-sharing processing task is not in the execution state, immediately return from the interrupt handling routine. do. 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. 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). 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 to pointer register SPN (step
101). and finally to task status
Set the RUN flag (step 102). After performing such a task switching routine, the program returns from the interrupt. The master CPU 2 executes another task designated for time-sharing processing by the operation of the multi-task control element 1 described above. 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 of tasks), it is also possible to schedule a plurality of 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). 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. Command 12 (sending message), Command 13
(Message reception) allows the mail box MBX of the multi-task control element 1 to be used to exchange data (messages) between tasks. 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. 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. 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. There are cases where it is necessary to control the execution order of two tasks for processing reasons. For example, if you want to make the other task wait until the processing of one task is finished, use command 12, command
13 can be used as follows to synchronize each other.

【表】【table】

【表】【table】

【表】 上述のようにしてタスク間の同期および相互排
除を行なうこともできる。 なお、本実施例におけるマルチ・タスク制御用
素子1はハードウエアを1個のLSI上に集積化し
たものであるが、適宜回路要素を組合せ、装置と
するようにして何ら差支えない。 <発明の効果> 以上のように本発明によるデバイスは、マル
チ・タスク制御システムにおいて、本デバイスを
パラレル・データ入出力素子として使用できると
ともに、本デバイスで並行してマルチ・タスク制
御を行なうことができ、システムのスペース・フ
アクタが向上し、またマスタCPU側のソフトウ
エアの負担を軽減できる。さらに、本デバイス内
に用意された外部事象待ちのコマンド及び一部入
力ポートを用いることにより、外部割込みに対し
て、即応してタスクを起動可能状態とすることが
でき、外部割込みに対すオーバーヘツドを単縮す
ることができる。
[Table] It is also possible to perform synchronization and mutual exclusion between tasks as described above. 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. <Effects of the Invention> As described above, the device according to the present invention can be used as a parallel data input/output element in a multi-task control system, and can also perform multi-task control in parallel. This improves the system space factor and reduces the software burden on the master CPU. Furthermore, by using the external event waiting command and some input ports provided in this device, tasks can be made ready to start in response to external interrupts, reducing overhead for external interrupts. can be shortened.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は本発明のデバイスを使用したシステム
構成例を示す図、第2図は本発明の一実施例にお
けるデバイスの内部構成例を示すブロツク図、第
3図は第2図のタスク制御ブロツクTCB領域を
説明する図、第4図は第2図のメモリ・マツプ
MEMMAP領域を説明する図、第5図は本デバ
イスで使用されるコマンドと入力パラメータおよ
び出力パラメータを説明する図、第6図は本デバ
イスのメインルーチンの動作を説明するフローチ
ヤート、第7図〜第21図は各コマンドによる処
理ルーチンの動作を説明するフローチヤート、第
22図はタスク切換ルーチンの動作を説明するフ
ローチヤート、第23図はイベント入力による割
込み処理ルーチンの動作を説明するフローチヤー
ト、第24図はタイマ割込み処理ルーチンの動作
を説明するフローチヤートである。 1……マルチ・タスク制御用素子、2……マス
タCPU、3……プログラム・メモリ、4……デ
ータ・メモリ、INTC……割込み制御回路、
……割込み信号、TCB……タスク制御ブロツク、
CONT……内部演算制御回路、MIV……マスタ
割込み制御レジスタ、CPIO……コマンド・パラ
メータ・レジスタ、CNST……コマンド/ステー
タス・レジスタ、SPN……新スタツク・ポイン
タ・レジスタ、SPB……旧スタツク・ポイン
タ・レジスタ、P1D,P2D,P3D……入出
力ポート用データ・レジスタ。
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, 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 Pointer register, P1D, P2D, P3D...data register for input/output ports.

Claims (1)

【特許請求の範囲】[Claims] 1 単一のマスタCPUにより時分割実行される
複数のタスクの管理を上記マスタ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, which accepts commands from the task being executed by the master CPU and sends them to the master CPU according to the commands. A multi-task system comprising means for generating an interrupt to control the execution of the task, and parallel input/output port means capable of inputting and outputting data independently of the task control function using the commands. Control device.
JP58228123A 1983-11-30 1983-11-30 Multi-task controlling device Granted JPS60118939A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP58228123A JPS60118939A (en) 1983-11-30 1983-11-30 Multi-task controlling device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP58228123A JPS60118939A (en) 1983-11-30 1983-11-30 Multi-task controlling device

Publications (2)

Publication Number Publication Date
JPS60118939A JPS60118939A (en) 1985-06-26
JPH0348538B2 true JPH0348538B2 (en) 1991-07-24

Family

ID=16871568

Family Applications (1)

Application Number Title Priority Date Filing Date
JP58228123A Granted JPS60118939A (en) 1983-11-30 1983-11-30 Multi-task controlling device

Country Status (1)

Country Link
JP (1) JPS60118939A (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7380406B2 (en) * 2020-04-28 2023-11-15 株式会社デンソー Real-time arithmetic processing unit
JP7338548B2 (en) * 2020-04-28 2023-09-05 株式会社デンソー Real-time processor

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5716950U (en) * 1980-07-03 1982-01-28
JPS57131580U (en) * 1981-02-06 1982-08-16

Also Published As

Publication number Publication date
JPS60118939A (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
US6769121B1 (en) Program execution device and process migrating method thereof and storage medium which stores process migration control program
JPS6031648A (en) Controlling method of multitask
JP3113841B2 (en) Parallel transaction processing system
JP2005056067A (en) DMA transfer control device
JPH09311839A (en) Data sharing method
CN100429625C (en) Real-time Internal Simple Monitoring Method
EP0240616A1 (en) Method to test and set data in a record on disk in one atomic input/output operation
US5530871A (en) Asynchronous input and output control system
US6209001B1 (en) Back-up system capable of performing back-up operation at optional time
EP0285634B1 (en) Method to execute two instruction sequences in an order determined in advance
JPH0376500B2 (en)
JPH0348538B2 (en)
JPH0376499B2 (en)
JPH0376497B2 (en)
JPH0376498B2 (en)
JPS63305445A (en) Data writing system at power break
JPH0519179B2 (en)
JPS60163133A (en) Multi-task control element
JPS60114942A (en) Device for multi-task control
JP2998721B2 (en) An exclusive control method between a parallel processing program and a coprocessor and a computing system having the exclusive control function
JPS60215249A (en) Computer peripheral unit incorporating multi-task control element
JP2571260B2 (en) Operating environment selection processing method using logic clock
JPH07111711B2 (en) Processing end interrupt control system
JPS63137350A (en) Execution control system for channel program

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees