JP2004013395A - Dma controller - Google Patents

Dma controller Download PDF

Info

Publication number
JP2004013395A
JP2004013395A JP2002164153A JP2002164153A JP2004013395A JP 2004013395 A JP2004013395 A JP 2004013395A JP 2002164153 A JP2002164153 A JP 2002164153A JP 2002164153 A JP2002164153 A JP 2002164153A JP 2004013395 A JP2004013395 A JP 2004013395A
Authority
JP
Japan
Prior art keywords
transfer
input
data
dma
output module
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.)
Pending
Application number
JP2002164153A
Other languages
Japanese (ja)
Inventor
Hiroyuki Furuya
古屋 浩之
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.)
Denso Corp
Original Assignee
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP2002164153A priority Critical patent/JP2004013395A/en
Publication of JP2004013395A publication Critical patent/JP2004013395A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Bus Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To detect an overrun error of vanishing transfer data when transferring DMA to a memory from an input-output module. <P>SOLUTION: The input-output module is provided with the shortest time setting register for setting the shortest time required for preparing the next transfer data, a counter timer and a comparing circuit for measuring elapsed time from reception of a DMA transfer request signal from the input-output module. The comparing circuit compares measuring time of the counter timer with the shortest time in the shortest register, and informs the occurrence of the overrun error by sending an interrupt signal to a CPU when the measuring time of the counter timer exceeds the shortest time. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、例えばマイクロコンピュータシステムのメモリと入出力モジュール間におけるデータのDMA転送を制御するDMAコントローラに関する。
【0002】
【従来の技術】
例えばマイクロコンピュータシステムにおいては、従来よりメモリと外部入出力モジュールとの間でDMA(Direct Memory Accessの略)転送と呼ばれる高速データ転送が広く採用されている。これはデータがCPUを経由せず、メモリと入出力モジュールとの間で直接転送される方式で、このデータ転送を制御する回路はDMAコントローラと呼ばれる。
【0003】
図5は、このようなDMAコントローラ100の内部構成例を示すブロック図であり、図6はこのDMAコントローラ100を用いたDMA転送回路の構成例である。DMA転送回路はCPU200、メモリ300、DMAコントローラ100、バスアービタ400、バス500、入出力モジュール600、700等で構成されている。入出力モジュール600、700は、例えばシリアル通信装置で、図示しない外部機器との間でシリアル通信によりデータの送受信を行なう。図6は入出力モジュールが2式の場合を例示している。
【0004】
また、DMA転送を制御するDMAコントローラ100は、DMA転送要求/許可判定回路101、バス権要求/許可判定回路102、起動制御回路103、アドレスカウンタ104、転送回数制御回路105、バスインターフェイス106等で構成されている。
【0005】
このような回路構成の下でのDMA転送の動作を、入出力モジュール600からメモリ300にデータを転送する場合を例に説明する。
まずCPU200は、メモリ300内に転送データを受け取るための書込領域を準備する。そして、その書込領域の先頭アドレスをDMAコントローラ100内のアドレスカウンタ104に、転送データ数を転送回数制御回路105に設定し、続いて転送方向や転送元、転送許可等の転送制御情報を起動制御回路103に設定する。
【0006】
これらの転送に必要な制御情報が設定されると、DMAコントローラ100は、入出力モジュール600からのDMA転送要求信号DREQ0の入力待ち状態となる。次いでCPU200は、入出力モジュール600に対して受信開始の許可信号をバス500経由で送る。バス500は、アドレスバス、データバス、制御信号線で構成されている。
【0007】
この受信開始の許可信号を受け取った入出力モジュール600は、図示しない外部機器からのデータの受信を開始し、受信した最初のデータを内部の出力レジスタにセットする。その上で、メモリ300へのDMA転送を開始してもらうべくDMA転送要求信号DREQ0をDMAコントローラ100内のDMA転送要求/許可判定回路101に出力する。DREQ0信号を受け取ったDMA転送要求/許可判定回路101は、受け取ったDREQ信号が先にCPUより転送制御情報の設定を受けた転送元からの要求信号であることを確認をする。
【0008】
確認後、DMA転送要求/許可判定回路101は、バス権を獲得するためにバス権要求/許可判定回路102を通して、バス権要求信号BREQをバスアービタ400に出力する。ここでバス権の獲得とは、通常、バス500を使用しているCPU200から、バス500の使用許可を得る(図6のスイッチ800をCPU200側からDMAコントローラ100側に切り換え、バス500をDMAコントローラ100に接続する)ことで、その調停(スイッチ800の制御)を行うのがバスアービタ400である。
【0009】
バス権要求信号BREQを受け取ったバスアービタ400は、CPU200に対してバス500の使用要求があったことを通報する。そして、予め決められた調停ロジックによりバス権をDMAコントローラ100に渡し(スイッチ800をDMAコントローラ100側に切り換え、バス500をDMAコントローラ100に接続する)、そのことを知らせるためにバス権許可信号BACKをDMAコントローラ100内のバス権要求/許可判定回路102に出力する。
【0010】
バス権許可信号BACKを受け取ったバス権要求/許可判定回路102は、それをDMA転送要求/許可判定回路101に通報し、通報を受けたDMA転送要求/許可判定回路101は、入出力モジュール600に対しDMA転送許可信号DACK0を出力する。
【0011】
入出力モジュール600は、DACK0信号を受けて内部の出力レジスタに準備していた最初の転送データを、バス500内のデータバス上に出力する。するとDMAコントローラ100は、バスインターフェース106を介してバス500内のアドレスバスと制御線を操作し、データバス500上に出力された転送データをアドレスカウンタ104に設定されていたメモリ300内書込領域の先頭アドレスに書き込む。
【0012】
こうして最初のデータの転送が終わると、アドレスカウンタ104内の先頭アドレスは+1され、転送回数制御回路105内の転送データ数は−1される。続いて、入出力モジュール600は、二番目に受信したデータを内部の出力レジスタにセットした上、次のDMA転送を開始してもらうべくDMA転送要求信号DREQ0を、再びDMAコントローラ100内のDMA転送要求/許可判定回路101に出力する。
【0013】
以下、前述と同じ一連の動作が繰り返し行なわれ、転送回数制御回路105の内容がゼロになった時点、即ち、最初に設定された転送データ数だけのデータ転送が終わった時点で、一連のDMA転送が終了する。以上の説明から分かるようにDMA転送では、CPU200はDMAコントローラ100と入出力モジュール600にDMA転送に必要な制御情報を設定して起動をかけるだけである。それ以降、指定データ数の転送が終了するまでの一連のデータ転送は、DMAコントローラ100の制御の下で行なわれる。そのデータ転送はCPU200を介さないで、メモリ300と入出力モジュール600との間の直接転送で行なわれるため、DMA転送によるデータ転送は転送速度が極めて速く、またCPU200の負荷が軽くなる利点がある。
【0014】
【発明が解決しようとする課題】
しかし、こうした高速に行なわれるDMA転送の際に、データの転送エラーが生ずることがある。その一つに、入力モジュール600、700におけるオーバーランエラーの発生による転送エラーがある。これは上述の例で言えば、入出力モジュール600の出力レジスタに準備されたデータの転送が完了する前に、入出力モジュール600が次のデータの受信を完了し、そのデータで出力レジスタの内容を更新しまう場合に生ずる転送エラーである。
【0015】
これを図3、図4のタイミングチャートを参照して説明する。入出力モジュール600は、最初に受信したデータAを内部の出力レジスタにセットする。それと同時にDMAコントローラ100に対してDMA転送要求信号DREQ0を出力し、自身は次のデータBの受信を始める。DMAコントローラ100は、バス権を獲得してDMA転送許可信号DACK0を“ High ”レベルにして入出力モジュールに出力する。DACK0信号を受けた入出力モジュール600が、出力レジスタ内のデータAをバス500に乗せると、DMAコントローラ100がバス500内のアドレスバスと制御線を操作してデータAをメモリ300に書き込む。書き込み終了でDMAコントローラ100は、DACK0信号を“ Low ”レベルに戻す。
【0016】
ここで、入出力モジュール600が次のデータBを受信するのにかかる時間をT1とし、DREQ0信号の“ High ”の立ち上がりからDACK0信号が“ Low ”に戻るまでの時間をT2とする。図3に示すように、T1>T2 であれば、DACK0信号が“ High ”レベルの期間中、出力レジスタ内にはデータAが保持されているため、そのデータAがメモリ300に正常に書き込まれる。
【0017】
しかし、DMA転送要求信号DREQ0が出力され、DMAコントローラ100がバスアービタ400にBREQ信号を出力してバス権を要求した時に、バス500の負荷が高かったとする。するとバスアービタ400がバス権許可信号BACKを直ぐには返せないことが起こる。こうした場合には図4に示すように、DACK0信号が出力されるタイミングが遅れて、T1<T2となる場合が生じ得る。
【0018】
このようなことが生ずると、DACK0が“ High ”レベルとなる前、あるいは“ High ”レベルの期間中に出力レジスタの内容が、次に送られるべきデータBに置き換わってしまう。すると、先に転送されるべきであったデータAはメモリ300に転送されずに消えてしまい、次のデータBがメモリ300に誤って転送されてしまうことになる。これがオーバーランエラーの発生による転送エラーである。
【0019】
入出力モジュール600が受信データBを出力レジスタにセットする際に、前のデータAのDMA転送が完了していることを確認する。即ち、前のデータAに対応するDACK0信号が一度“ High ”レベルとなった上で“ Low ”に戻ったことを確認する。それが確認できない場合にはオーバーランエラーの発生と判定してCPU200に割込み信号を送って知らせる。このようになっていれば、CPU200は、それに対応した処置をとることができる。しかし、数ある入出力モジュールの中には、回路の簡素化、コスト低減のためにこのような機能を持たないものがある。その場合には、CPU200がオーバーランの発生を認知することができず、誤った転送データに基づいてその後の処理を続けるという不具合が生ずる。
【0020】
本発明はこのような不具合に対処するためになされたもので、上述のようなオーバーランエラーの発生を入出力モジュールに代わって検出し、CPUに通報する機能を有するDMAコントローラを提供することを課題としている。
【0021】
【課題を解決するための手段】
上記目的を達成するために、本発明のDMAコントローラにおいては、入出力モジュールが次の転送データを準備するために必要な最短時間を設定する最短時間設定レジスタと、入出力モジュールからのDMA転送要求信号の受信からの経過時間を計測するカウンタタイマと、該カウンタタイマの計測時間と前記最短時間とを比較する比較回路とを設けた。そしてカウンタタイマの計測時間が前記最短時間を超えた時にCPUに割込み信号を送るように構成した。
【0022】
これにより、転送データの消失というオーバーランエラーが高い確率で発生しうる状態が生じたことをCPUが認識できるようになる。従ってCPUがオーバーランエラーの発生に気づかず、誤った転送データに基づいてその後の処理を進めてしまうという異常事態を回避することが可能になる。
【0023】
また、好ましくは、前記カウンタタイマは、入出力モジュールからのDMA転送要求信号を受けて、該カウンタタイマを一旦リセットする。そして直ちに計時用クロックパルスの計数を開始し、DMAコントローラから入出力モジュールへの1データのDMA転送終了により計数を停止すると良い。
【0024】
このように、計時用クロックパルスの計数開始直前にカウンタタイマをリセットすれば、前回のカウント数がリセットされて正確な計時が可能になる。また、DMA転送終了後の計数は、意味がないので計数を停止するのが好ましい。
【0025】
また、好ましくは前記カウンタタイマの内容をCPUに読み込めるように構成するとよい。
このように構成すれば、DMA転送要求開始から1データのDMA転送終了までに要した時間をCPUが認識できる効果がある。
【0026】
【発明の実施の形態】
本発明の実施の形態を実施例にもとづき図1、図2を参照して説明する。
図1は、本発明のDMAコントローラ1の内部回路構成の一例である。DMAコントローラ1は、DMA転送要求/許可判定回路2、バス権要求/許可判定回路3、起動制御回路4、アドレスカウンタ5、転送回数制御回路6、バスインターフェース7、オーバーラン検出回路8を備えている。オーバーラン検出回路8は、最短時間設定レジスタ8a、カウンタタイマ8b、比較回路8cを備えている。
【0027】
図2は、このDMAコントローラ1を用いたDMA転送回路の構成例である。このDMA転送回路は、図6の場合と同様に、DMAコントローラ1、CPU10、メモリ11、バスアービタ12、バス13、入出力モジュール14、15等で構成されている。ここで入出力モジュール14、15は、シリアル通信装置、フロッピーディスク装置等の外部入出力装置で、図2は入出力モジュールが2式の場合を例示している。
【0028】
以下、このような回路構成の下で、入出力モジュール14が受信(準備)したデータをメモリ11にDMA転送する場合の動作を説明する。
まずCPU10は、転送データを受け取るための書込領域をメモリ11内に準備する。そして、その書込領域の先頭アドレスをDMAコントローラ1内のアドレスカウンタ5に、転送データ数を転送回数制御回路6に、転送方向や転送元、転送許可等の制御情報を起動制御回路4に設定する。
【0029】
続いてCPU10は、入出力モジュール14が転送データを受信(準備)するのにかかると予測される最短時間(例えば、入出力モジュール14がシリアル通信モジュールの場合には、外部装置より1データを受信するのに要する最短時間)T1minを、オーバーラン検出回路8内の最短時間設定レジスタ8aに設定する。最短時間T1minは、図3に示すタイミングチャートで言えば、データB受信時間T1の予想される最小値である。その値は、各入出力モジュール毎に予めメモリ11に記憶させておく。
【0030】
これらの各制御情報が設定されると、DMAコントローラ1は、入出力モジュール14からのDMA転送要求信号DREQ0の入力待ち状態となる。次いでCPU10は、入出力モジュール14に対して受信開始の許可信号をバス13経由で送る。バス13は、アドレスバス、データバス、制御信号線で構成されている。
【0031】
この受信開始の許可信号を受け取った入出力モジュール14は、外部装置よりデータの受信を開始し、受信した最初のデータを内部の出力レジスタにセットする。そしてメモリ11へのDMA転送を開始してもらうべく、DMA転送要求信号DREQ0をDMAコントローラ1内のDMA転送要求/許可判定回路2に出力する。その後、入出力モジュール14は、次に転送するデータの受信(準備)を開始する。
【0032】
DREQ0信号を受け取ったDMA転送要求/許可判定回路2は、CPU10からバス権を獲得するためにバス権要求/許可判定回路3を通して、バス権要求信号BREQをバスアービタ12に出力する。
【0033】
これと同時にDMA転送要求/許可判定回路2は、カウンタタイマ8bに転送要求受付信号を送り、オーバーラン検出回路8内のカウンタタイマ8bを一旦リセットしてゼロにさせた上で、計数を開始させる。カウンタタイマ8は、計時用クロックパルス(図示しない)を計数し、計数開始からの経過時間、すなわち入出力モジュール14がDREQ0信号を出力してからの経過時間Telを計測する。
【0034】
このカウンタタイマ8bで計測された経過時間Telは、先に最短時間設定レジスタ8aに設定された最短時間T1minと比較回路8cにて比較される。そして
Tel≧T1min               (1)式
と判定された時に、比較回路8cよりバスインターフェース7とバス13内の制御線を通じてCPU10に割込み信号が送られるようになっている。
なお、カウンタタイマ8bの内容は、CPU10に読み込めるようにしておくと良い。
【0035】
これに続く動作は、最初のデータのDMA転送中に、上記(1)式の条件が成立する場合と成立しない場合とで分かれる。まず上記(1)式の条件が転送途中で成立しない場合の動作について説明する。
バス権要求信号BREQを受け取ったバスアービタ12は、CPU10に対してバス13の使用要求があったことを通報する。そして、予め決められた調停ロジックによりバス権をDMAコントローラ1に渡し(スイッチ16をDMAコントローラ1側に切り換え、バス13をDMAコントローラ1に接続する)、そのことを知らせるためにバス権許可信号BACKをバス権要求/判定回路3に出力する。
【0036】
バス権許可信号BACKを受け取ったバス権要求/許可判定回路3は、それをDMA転送要求/許可判定回路2に通報する。通報を受けたDMA転送要求/許可判定回路2は、入出力モジュール14に対しDMA転送許可信号DACK0を出力する。
【0037】
入出力モジュール14は、DACK0信号を受けて内部の出力レジスタに準備していた最初の転送データをバス13内のデータバス上に出力する。するとDMAコントローラ1は、バスインターフェース7を介してバス13内のアドレスバスと制御線を操作し、データバス上に出力された転送データをアドレスカウンタ5に設定されていた書込領域の先頭アドレスに書き込む。
書き込みが終了すると、DMA転送要求/許可判定回路2は、DACK0信号を“ Low ”レベルに戻す。それと同時、すなわち最初のデータの転送終了と同時にカウンタタイマ8bに転送許可終了信号を送って計数を停止させる。
【0038】
こうして最初のデータの転送が完了すると、アドレスカウンタ5内の先頭アドレスは+1され、転送回数制御回路6内の転送データ数は−1される。入出力モジュール14は、次に転送するデータを内部の出力レジスタに準備し、次のDMA転送を開始してもらうべくDMA転送要求信号DREQ0を、再びDMAコントローラ1内のDMA転送要求/許可判定回路2に出力する。以上の一連の動作タイミングは、前述した図3に示すものと同じである。
以下、このような一連の動作の繰り返しにより、転送回数制御回路6に最初に設定された転送データ数だけのデータ転送が行なわれ、一連のDMA転送が終了する。
【0039】
次に、前記(1)式の条件が転送途中で成立する場合の動作について説明する。これは図4に示したタイミングチャートに相当する場合である。
入出力モジュール14は、最初の転送データを内部の出力レジスタに設定する。そしてDMA転送を開始してもらうべくDMA転送要求信号DREQ0をDMAコントローラ1内のDMA転送要求/許可判定回路2に出力する。その後、入出力モジュール14は、次に転送するデータの受信(準備)を開始する。
【0040】
DREQ0信号を受けたDMA転送要求/許可判定回路2は、CPU10からバス権を獲得するためにバス権要求/許可判定回路3を通して、バス権要求信号BREQをバスアービタ12に送る。そしてバス権を得て、DACK0信号を入出力モジュール14に返す。しかし、本ケースの場合は、DACK0信号が出力し終えるまで、すなわちDACK0信号が一旦“ High ”レベルになった後、“ Low ”レベルに戻る前に前記(1)式の条件が成立する。
【0041】
前記(1)式の条件が成立した場合に、そのまま動作が継続されたとする。すると図4のタイミングチャートに示すように、DACK0信号によりメモリ11にデータが書き込まれる瞬間には、入出力モジュール14の出力レジスタの内容は、本来転送されるべきデータAではなく、次に転送されるべきデータBに置き換わっている可能性が高い(設定時間T1minは、T1の予想最短時間であるので、経過時間TelがT1minを超えても、出力レジスタ内にデータAが残っている場合もあり得る)。
【0042】
(1)式の条件が成立すると、直ちに比較回路8cより割込み信号がCPU10に送られる。これにより、CPU10は異常転送よるデータの消失、すなわちオーバーランエラーが高い確率で生じる状態が発生したことを認識することができる。
【0043】
CPU10がこのような状態の発生を認識せずに、その後の処理を進めれば、誤った転送データに基づく処理がなされて取り返しのつかない事態が発生し得る。しかし本発明の構成によれば、CPU10は、このような事態の発生を事前に認識することができる。従って、その後の処理を中止したり、あるいは転送データを破棄して入出力モジュール14に再度転送要求を発生させるなどの対策を採ることができ、取り返しのつかない事態を回避することが可能となる。
【図面の簡単な説明】
【図1】本発明のDMAコントローラの構成ブロック図である。
【図2】本発明のDMAコントローラを用いたDMA転送回路の構成例である。
【図3】DMA転送が正常に行われる場合のタイミングチャートである。
【図4】DMA転送にオーバーランエラーが発生する場合のタイミングチャートである。
【図5】従来技術を示す図1相当図である。
【図6】従来技術を示す図2相当図である。
【符号の説明】
図面中、1はDMAコントローラ、8はオーバーラン検出回路、8aは最短時間設定レジスタ、8bはカウンタタイマ、8cは比較回路、10はCPU、11はメモリ、12はバスアービタ、14、15は入出力モジュールである。
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a DMA controller which controls DMA transfer of data between a memory and an input / output module of a microcomputer system, for example.
[0002]
[Prior art]
For example, in a microcomputer system, high-speed data transfer called DMA (abbreviation of Direct Memory Access) transfer between a memory and an external input / output module has been widely adopted. This is a method in which data is directly transferred between a memory and an input / output module without passing through a CPU. A circuit that controls this data transfer is called a DMA controller.
[0003]
FIG. 5 is a block diagram showing an example of the internal configuration of such a DMA controller 100, and FIG. 6 is an example of the configuration of a DMA transfer circuit using the DMA controller 100. The DMA transfer circuit includes a CPU 200, a memory 300, a DMA controller 100, a bus arbiter 400, a bus 500, input / output modules 600 and 700, and the like. The input / output modules 600 and 700 are, for example, serial communication devices, and transmit and receive data to and from an external device (not shown) by serial communication. FIG. 6 illustrates a case where the number of input / output modules is two.
[0004]
The DMA controller 100 that controls the DMA transfer includes a DMA transfer request / permission determination circuit 101, a bus right request / permission determination circuit 102, an activation control circuit 103, an address counter 104, a transfer count control circuit 105, a bus interface 106, and the like. It is configured.
[0005]
The operation of the DMA transfer under such a circuit configuration will be described by taking as an example a case where data is transferred from the input / output module 600 to the memory 300.
First, the CPU 200 prepares a write area in the memory 300 for receiving transfer data. Then, the start address of the write area is set in the address counter 104 in the DMA controller 100, and the number of transfer data is set in the transfer count control circuit 105. Then, transfer control information such as the transfer direction, the transfer source, and the transfer permission is activated. It is set in the control circuit 103.
[0006]
When the control information necessary for these transfers is set, the DMA controller 100 waits for the input of the DMA transfer request signal DREQ0 from the input / output module 600. Next, the CPU 200 sends a reception start permission signal to the input / output module 600 via the bus 500. The bus 500 includes an address bus, a data bus, and a control signal line.
[0007]
The input / output module 600 that has received the reception start permission signal starts receiving data from an external device (not shown) and sets the first received data in an internal output register. Then, a DMA transfer request signal DREQ0 is output to the DMA transfer request / permission determination circuit 101 in the DMA controller 100 so that the DMA transfer to the memory 300 is started. The DMA transfer request / permission determination circuit 101 that has received the DREQ0 signal confirms that the received DREQ signal is a request signal from the transfer source that has previously received the setting of the transfer control information from the CPU.
[0008]
After the confirmation, the DMA transfer request / permission determination circuit 101 outputs a bus right request signal BREQ to the bus arbiter 400 through the bus right request / permission determination circuit 102 to acquire the bus right. Here, the acquisition of the bus right generally means that the use permission of the bus 500 is obtained from the CPU 200 using the bus 500 (the switch 800 in FIG. 6 is switched from the CPU 200 to the DMA controller 100 and the bus 500 is transferred to the DMA controller 100). It is the bus arbiter 400 that performs arbitration (control of the switch 800) by connecting to the bus arbiter 400.
[0009]
The bus arbiter 400 that has received the bus right request signal BREQ notifies the CPU 200 that the use of the bus 500 has been requested. Then, the bus right is transferred to the DMA controller 100 by a predetermined arbitration logic (switch 800 is switched to the DMA controller 100 side, and bus 500 is connected to the DMA controller 100). To the bus right request / permission determination circuit 102 in the DMA controller 100.
[0010]
The bus right request / permission determination circuit 102 that has received the bus right permission signal BACK reports this to the DMA transfer request / permission determination circuit 101, and the DMA transfer request / permission determination circuit 101 that has received the notification sends the input / output module 600 Output a DMA transfer permission signal DACK0.
[0011]
The input / output module 600 receives the DACK0 signal and outputs the first transfer data prepared in the internal output register onto the data bus in the bus 500. Then, the DMA controller 100 operates the address bus and control lines in the bus 500 via the bus interface 106, and transfers the transfer data output on the data bus 500 to the write area in the memory 300 set in the address counter 104. Write to the start address of
[0012]
When the transfer of the first data is completed, the top address in the address counter 104 is incremented by one, and the number of data transferred in the transfer number control circuit 105 is decremented by one. Subsequently, the input / output module 600 sets the second received data in the internal output register, and then sends the DMA transfer request signal DREQ0 again so as to start the next DMA transfer. Output to the request / permission determination circuit 101.
[0013]
Thereafter, the same series of operations as described above are repeatedly performed, and when the contents of the transfer number control circuit 105 become zero, that is, when the data transfer of the initially set transfer data number is completed, a series of DMAs is performed. The transfer ends. As can be understood from the above description, in the DMA transfer, the CPU 200 simply sets the control information necessary for the DMA transfer in the DMA controller 100 and the input / output module 600 and starts the operation. Thereafter, a series of data transfer until the transfer of the designated number of data is completed is performed under the control of the DMA controller 100. Since the data transfer is performed by direct transfer between the memory 300 and the input / output module 600 without passing through the CPU 200, the data transfer by the DMA transfer has an advantage that the transfer speed is extremely high and the load on the CPU 200 is reduced. .
[0014]
[Problems to be solved by the invention]
However, during such a high-speed DMA transfer, a data transfer error may occur. One of them is a transfer error due to occurrence of an overrun error in the input modules 600 and 700. This means that, in the above example, before the transfer of the data prepared in the output register of the input / output module 600 is completed, the input / output module 600 completes the reception of the next data, and that data is used as the content of the output register. Is a transfer error that occurs when the data is updated.
[0015]
This will be described with reference to the timing charts of FIGS. The input / output module 600 sets the initially received data A in an internal output register. At the same time, it outputs a DMA transfer request signal DREQ0 to the DMA controller 100, and starts receiving the next data B itself. The DMA controller 100 acquires the bus right, sets the DMA transfer permission signal DACK0 to the “High” level, and outputs the signal to the input / output module. When the input / output module 600 that has received the DACK0 signal puts the data A in the output register onto the bus 500, the DMA controller 100 operates the address bus and control lines in the bus 500 to write the data A into the memory 300. At the end of the writing, the DMA controller 100 returns the DACK0 signal to the “Low” level.
[0016]
Here, the time required for the input / output module 600 to receive the next data B is T1, and the time from the rising of the DREQ0 signal “High” to the return of the DACK0 signal to “Low” is T2. As shown in FIG. 3, if T1> T2, the data A is normally written in the memory 300 because the data A is held in the output register during the period when the DACK0 signal is at the “High” level. .
[0017]
However, it is assumed that when the DMA transfer request signal DREQ0 is output and the DMA controller 100 outputs the BREQ signal to the bus arbiter 400 to request the bus right, the load on the bus 500 is high. Then, the bus arbiter 400 cannot immediately return the bus right grant signal BACK. In such a case, as shown in FIG. 4, the timing at which the DACK0 signal is output may be delayed, so that T1 <T2.
[0018]
When such a situation occurs, the contents of the output register are replaced with data B to be transmitted next before DACK0 goes to the “High” level or during the period of the “High” level. Then, the data A, which should have been transferred earlier, disappears without being transferred to the memory 300, and the next data B is erroneously transferred to the memory 300. This is a transfer error due to the occurrence of an overrun error.
[0019]
When the input / output module 600 sets the reception data B in the output register, it confirms that the DMA transfer of the previous data A has been completed. That is, it is confirmed that the DACK0 signal corresponding to the previous data A has once become "High" level and then returned to "Low". If this cannot be confirmed, it is determined that an overrun error has occurred, and an interrupt signal is sent to the CPU 200 to notify it. If this is the case, the CPU 200 can take a corresponding measure. However, some input / output modules do not have such a function in order to simplify circuits and reduce costs. In that case, the CPU 200 cannot recognize the occurrence of the overrun, and a problem occurs that the subsequent processing is continued based on the erroneous transfer data.
[0020]
SUMMARY OF THE INVENTION The present invention has been made in order to cope with such a problem, and it is an object of the present invention to provide a DMA controller having a function of detecting the occurrence of the overrun error as described above in place of the input / output module and reporting the occurrence to the CPU. It is an issue.
[0021]
[Means for Solving the Problems]
In order to achieve the above object, in the DMA controller of the present invention, a minimum time setting register for setting a minimum time required for the input / output module to prepare the next transfer data, a DMA transfer request from the input / output module. A counter timer for measuring an elapsed time from the reception of the signal and a comparison circuit for comparing the measured time of the counter timer with the shortest time are provided. Then, an interrupt signal is sent to the CPU when the measurement time of the counter timer exceeds the minimum time.
[0022]
As a result, the CPU can recognize that a state has occurred in which an overrun error of loss of transfer data can occur with a high probability. Therefore, it is possible to avoid an abnormal situation in which the CPU does not notice the occurrence of the overrun error and proceeds with subsequent processing based on erroneous transfer data.
[0023]
Preferably, the counter timer resets the counter timer once upon receiving a DMA transfer request signal from the input / output module. Then, the counting of the clock pulse is started immediately, and the counting is preferably stopped when the DMA transfer of one data from the DMA controller to the input / output module is completed.
[0024]
As described above, if the counter timer is reset immediately before the counting of the clock pulse for clocking is started, the previous count number is reset and accurate clocking can be performed. The counting after the end of the DMA transfer is meaningless, so it is preferable to stop counting.
[0025]
Preferably, the contents of the counter timer may be read into the CPU.
With this configuration, the CPU can recognize the time required from the start of the DMA transfer request to the end of the DMA transfer of one data.
[0026]
BEST MODE FOR CARRYING OUT THE INVENTION
An embodiment of the present invention will be described based on an example with reference to FIGS.
FIG. 1 is an example of an internal circuit configuration of a DMA controller 1 according to the present invention. The DMA controller 1 includes a DMA transfer request / permission determination circuit 2, a bus right request / permission determination circuit 3, an activation control circuit 4, an address counter 5, a transfer count control circuit 6, a bus interface 7, and an overrun detection circuit 8. I have. The overrun detection circuit 8 includes a shortest time setting register 8a, a counter timer 8b, and a comparison circuit 8c.
[0027]
FIG. 2 shows a configuration example of a DMA transfer circuit using the DMA controller 1. This DMA transfer circuit includes a DMA controller 1, a CPU 10, a memory 11, a bus arbiter 12, a bus 13, input / output modules 14, 15, and the like, as in the case of FIG. Here, the input / output modules 14 and 15 are external input / output devices such as a serial communication device and a floppy disk device, and FIG. 2 illustrates a case where there are two input / output modules.
[0028]
Hereinafter, an operation when the input / output module 14 performs DMA transfer of the data received (prepared) to the memory 11 under such a circuit configuration will be described.
First, the CPU 10 prepares a writing area for receiving the transfer data in the memory 11. Then, the start address of the write area is set in the address counter 5 in the DMA controller 1, the number of transfer data is set in the transfer count control circuit 6, and the control information such as the transfer direction, transfer source and transfer permission is set in the start control circuit 4. I do.
[0029]
Subsequently, the CPU 10 determines the shortest time that the input / output module 14 is expected to receive (prepare) to receive the transfer data (for example, when the input / output module 14 is a serial communication module, it receives one data from an external device). Is set in the shortest time setting register 8 a in the overrun detection circuit 8. The shortest time T1min is the expected minimum value of the data B reception time T1 in the timing chart shown in FIG. The value is stored in the memory 11 in advance for each input / output module.
[0030]
When these pieces of control information are set, the DMA controller 1 waits for the input of the DMA transfer request signal DREQ0 from the input / output module 14. Next, the CPU 10 sends a reception start permission signal to the input / output module 14 via the bus 13. The bus 13 includes an address bus, a data bus, and a control signal line.
[0031]
The input / output module 14, which has received the reception start permission signal, starts receiving data from an external device, and sets the first received data in an internal output register. Then, a DMA transfer request signal DREQ0 is output to the DMA transfer request / permission determination circuit 2 in the DMA controller 1 so that the DMA transfer to the memory 11 is started. Thereafter, the input / output module 14 starts receiving (preparing) the next data to be transferred.
[0032]
The DMA transfer request / permission determination circuit 2 that has received the DREQ0 signal outputs the bus right request signal BREQ to the bus arbiter 12 through the bus right request / permission determination circuit 3 in order to acquire the bus right from the CPU 10.
[0033]
At the same time, the DMA transfer request / permission determination circuit 2 sends a transfer request acceptance signal to the counter timer 8b, resets the counter timer 8b in the overrun detection circuit 8 once to zero, and starts counting. . The counter timer 8 counts a clock pulse (not shown) for counting a time, and measures an elapsed time from the start of counting, that is, an elapsed time Tel from when the input / output module 14 outputs the DREQ0 signal.
[0034]
The elapsed time Tel measured by the counter timer 8b is compared with the shortest time T1min previously set in the shortest time setting register 8a by the comparison circuit 8c. When it is determined that Tel ≧ T1min (1), an interrupt signal is sent from the comparison circuit 8c to the CPU 10 through the bus interface 7 and the control line in the bus 13.
It is preferable that the contents of the counter timer 8b can be read by the CPU 10.
[0035]
Subsequent operations are divided into a case where the condition of the above expression (1) is satisfied and a case where the condition is not satisfied during the first data DMA transfer. First, the operation when the condition of the above equation (1) is not satisfied during transfer will be described.
The bus arbiter 12 that has received the bus right request signal BREQ notifies the CPU 10 that the use of the bus 13 has been requested. Then, the bus right is transferred to the DMA controller 1 by a predetermined arbitration logic (switch 16 is switched to the DMA controller 1 side, and bus 13 is connected to the DMA controller 1). To the bus right request / determination circuit 3.
[0036]
The bus right request / permission determination circuit 3 that has received the bus right permission signal BACK reports this to the DMA transfer request / permission determination circuit 2. The DMA transfer request / permission determination circuit 2 that has received the notification outputs the DMA transfer permission signal DACK0 to the input / output module 14.
[0037]
The input / output module 14 receives the DACK0 signal and outputs the first transfer data prepared in the internal output register onto the data bus in the bus 13. Then, the DMA controller 1 operates the address bus and the control line in the bus 13 via the bus interface 7 to transfer the transfer data output on the data bus to the head address of the write area set in the address counter 5. Write.
When the writing is completed, the DMA transfer request / permission determination circuit 2 returns the DACK0 signal to the “Low” level. At the same time, that is, simultaneously with the end of the transfer of the first data, a transfer permission end signal is sent to the counter timer 8b to stop counting.
[0038]
When the transfer of the first data is completed in this way, the top address in the address counter 5 is incremented by one, and the number of transfer data in the transfer number control circuit 6 is decremented by one. The input / output module 14 prepares data to be transferred next in an internal output register, and sends a DMA transfer request signal DREQ0 again to start the next DMA transfer, to the DMA transfer request / permission determination circuit in the DMA controller 1. Output to 2. The above series of operation timings are the same as those shown in FIG. 3 described above.
Thereafter, by repeating such a series of operations, data transfer is performed for the number of transfer data initially set in the transfer number control circuit 6, and a series of DMA transfer ends.
[0039]
Next, the operation when the condition of the above equation (1) is satisfied during the transfer will be described. This is a case corresponding to the timing chart shown in FIG.
The input / output module 14 sets the first transfer data in an internal output register. Then, a DMA transfer request signal DREQ0 is output to the DMA transfer request / permission determination circuit 2 in the DMA controller 1 so as to start the DMA transfer. Thereafter, the input / output module 14 starts receiving (preparing) the next data to be transferred.
[0040]
The DMA transfer request / permission determination circuit 2 that has received the DREQ0 signal sends the bus right request signal BREQ to the bus arbiter 12 through the bus right request / permission determination circuit 3 to acquire the bus right from the CPU 10. Then, it acquires the bus right and returns the DACK0 signal to the input / output module 14. However, in this case, the condition of the above expression (1) is satisfied until the output of the DACK0 signal is completed, that is, after the DACK0 signal once becomes the “High” level and before returning to the “Low” level.
[0041]
It is assumed that the operation is continued as it is when the condition of the expression (1) is satisfied. Then, as shown in the timing chart of FIG. 4, at the moment when the data is written to the memory 11 by the DACK0 signal, the contents of the output register of the input / output module 14 are not the data A to be transferred but the data to be transferred next. There is a high possibility that the data A has been replaced with the data B to be set. (Since the set time T1min is the shortest expected time of T1, the data A may remain in the output register even if the elapsed time Tel exceeds T1min. obtain).
[0042]
As soon as the condition of the expression (1) is satisfied, an interrupt signal is sent to the CPU 10 from the comparison circuit 8c. As a result, the CPU 10 can recognize that data has been lost due to abnormal transfer, that is, a state in which an overrun error has a high probability has occurred.
[0043]
If the CPU 10 proceeds with the subsequent processing without recognizing the occurrence of such a state, an irreversible situation may occur in which processing based on incorrect transfer data is performed. However, according to the configuration of the present invention, the CPU 10 can recognize in advance that such a situation has occurred. Accordingly, it is possible to take measures such as aborting the subsequent processing or discarding the transfer data and generating a transfer request again to the input / output module 14, thereby avoiding an irreversible situation. .
[Brief description of the drawings]
FIG. 1 is a configuration block diagram of a DMA controller of the present invention.
FIG. 2 is a configuration example of a DMA transfer circuit using a DMA controller of the present invention.
FIG. 3 is a timing chart when DMA transfer is performed normally.
FIG. 4 is a timing chart when an overrun error occurs in a DMA transfer.
FIG. 5 is a diagram corresponding to FIG. 1 showing a conventional technique.
FIG. 6 is a diagram corresponding to FIG. 2, showing a conventional technique.
[Explanation of symbols]
In the drawing, 1 is a DMA controller, 8 is an overrun detection circuit, 8a is a shortest time setting register, 8b is a counter timer, 8c is a comparison circuit, 10 is a CPU, 11 is a memory, 12 is a bus arbiter, and 14 and 15 are input / output. Module.

Claims (3)

入出力モジュールとメモリ間のデータのDMA転送を制御するDMAコントローラであって、
前記入出力モジュールが次の転送データを準備するために必要な最短時間を設定する最短時間設定レジスタと、
前記入出力モジュールからのDMA転送要求信号の受信からの経過時間を計測するカウンタタイマと、
前記カウンタタイマの計測時間と前記最短時間とを比較して前記計測時間が前記最短時間を超えた時にCPUに割込み信号を送る比較回路と、
を備えたことを特徴とするDMAコントローラ。
A DMA controller for controlling DMA transfer of data between an input / output module and a memory,
A minimum time setting register that sets the minimum time required for the input / output module to prepare the next transfer data;
A counter timer for measuring an elapsed time since receiving the DMA transfer request signal from the input / output module;
A comparison circuit that compares the measurement time of the counter timer with the minimum time and sends an interrupt signal to the CPU when the measurement time exceeds the minimum time;
A DMA controller comprising:
前記カウンタタイマは、前記入出力モジュールからの前記DMA転送要求信号を受けて該カウンタタイマをリセットした後、直ちに計時用クロックパルスの計数を開始し、前記DMAコントローラから前記入出力モジュールへの1データのDMA転送終了により計数を停止することを特徴とする請求項1に記載のDMAコントローラ。After receiving the DMA transfer request signal from the input / output module and resetting the counter timer, the counter timer immediately starts counting clock pulses for clocking, and outputs one data from the DMA controller to the input / output module. 2. The DMA controller according to claim 1, wherein counting is stopped when the DMA transfer is completed. 前記カウンタタイマの内容をCPUに読み込めるようにしたことを特徴とする請求項1または2に記載のDMAコントローラ。3. The DMA controller according to claim 1, wherein the content of the counter timer can be read into a CPU.
JP2002164153A 2002-06-05 2002-06-05 Dma controller Pending JP2004013395A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002164153A JP2004013395A (en) 2002-06-05 2002-06-05 Dma controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002164153A JP2004013395A (en) 2002-06-05 2002-06-05 Dma controller

Publications (1)

Publication Number Publication Date
JP2004013395A true JP2004013395A (en) 2004-01-15

Family

ID=30432379

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002164153A Pending JP2004013395A (en) 2002-06-05 2002-06-05 Dma controller

Country Status (1)

Country Link
JP (1) JP2004013395A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007003986A1 (en) 2005-06-30 2007-01-11 Freescale Semiconductor, Inc. Device and method for controlling an execution of a dma task
US7930444B2 (en) 2005-06-30 2011-04-19 Freescale Semiconductor, Inc. Device and method for controlling multiple DMA tasks
US8239587B2 (en) 2006-01-18 2012-08-07 Freescale Semiconductor, Inc. Device having data sharing capabilities and a method for sharing data
US8572296B2 (en) 2005-06-30 2013-10-29 Freescale Semiconductor, Inc. Device and method for arbitrating between direct memory access task requests

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007003986A1 (en) 2005-06-30 2007-01-11 Freescale Semiconductor, Inc. Device and method for controlling an execution of a dma task
US7930444B2 (en) 2005-06-30 2011-04-19 Freescale Semiconductor, Inc. Device and method for controlling multiple DMA tasks
US8001430B2 (en) 2005-06-30 2011-08-16 Freescale Semiconductor, Inc. Device and method for controlling an execution of a DMA task
US8572296B2 (en) 2005-06-30 2013-10-29 Freescale Semiconductor, Inc. Device and method for arbitrating between direct memory access task requests
US8239587B2 (en) 2006-01-18 2012-08-07 Freescale Semiconductor, Inc. Device having data sharing capabilities and a method for sharing data

Similar Documents

Publication Publication Date Title
JP3604398B2 (en) High-speed parallel packetized module arbitration control and data bus
US7702841B2 (en) Semiconductor integrated circuit and image processing apparatus having the same
KR100267130B1 (en) Pci bus system
JP4063529B2 (en) Bus system and retry method
US7124232B2 (en) Bus connection circuit and bus connection system having plural request queues, a bus interface portion outputting request signals, an arbiter performing arbitration of plural requests and a bus interface portion outputting a request signal indicating allocation of pre-fetch buffers corresponding to arbitrated requests
KR930002787B1 (en) Universal peripheral controller self-configuring bootloadable ramware
US4120029A (en) Method and apparatus for recovering a signal transferred over a common bus in a data processing system
US6697904B1 (en) Preventing starvation of agents on a bus bridge
JP2004013395A (en) Dma controller
US5694586A (en) Controller using time-domain filter connected to a signal line to control a time at which signal line is sampled for receipt of information transfer signal
US20010004749A1 (en) Arbitration of control chipsets in bus transaction
JPS6043546B2 (en) Data transfer error handling method
US5377334A (en) Fast asynchronous resource master-slave combination
US7043595B2 (en) Data transfer control device
US5664213A (en) Input/output (I/O) holdoff mechanism for use in a system where I/O device inputs are fed through a latency introducing bus
JP2002269032A (en) Bus arbiter
US10983927B2 (en) Electronic device for recovering from buffer overrun in a bus system
JPS5818727A (en) Method and apparatus for self-control of dispersion type priority competition
US6408353B1 (en) Microcomputer having sampling function of retry requesting signal in syncronization with strobe signal
CN114884768B (en) Detection device, system and detection method for bus idle state
US11775037B2 (en) Method of resetting a master device of a system on chip and corresponding system on chip
JP3300016B2 (en) Communication interface, recording device, and communication control method
JP2012182721A (en) Image forming apparatus and control method thereof
JP2007095089A (en) Bus arbiter
JP4152387B2 (en) Bus system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040708

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20061024

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20061107

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061221

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070130

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20070731