JP2000259429A - Device and method for managing timer - Google Patents

Device and method for managing timer

Info

Publication number
JP2000259429A
JP2000259429A JP11065502A JP6550299A JP2000259429A JP 2000259429 A JP2000259429 A JP 2000259429A JP 11065502 A JP11065502 A JP 11065502A JP 6550299 A JP6550299 A JP 6550299A JP 2000259429 A JP2000259429 A JP 2000259429A
Authority
JP
Japan
Prior art keywords
timer
queue
time
timer queue
event
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
JP11065502A
Other languages
Japanese (ja)
Inventor
Atsushi Kamoki
厚志 鴨木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP11065502A priority Critical patent/JP2000259429A/en
Publication of JP2000259429A publication Critical patent/JP2000259429A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To operate plural various systems with one timer device by unitarily managing the timer events of plural systems. SOLUTION: Timer queue elements 535 or the like of one (sub) system are respectively connected in the shape of queue and managed for each (sub) system by a timer queue managing table 532 or the like. The (sub) system is managed by a timer managing table 530 or the like for each (sub) system and each (sub) system is managed by a system queue managing table 510. An idle timer queue 520 successively connects used timer queues. In the case of connecting a novel timer queue element to a timer queue element 540 or the like, when there is the timer queue element 535 or the like, that novel timer queue element is connected by calculating a differential timer value but when there is no timer queue element, that novel timer queue element is connected to the head of the timer queue 540 or the like. Thus, plural timer queues are integrated, timer events are unitarily managed and plural various (sub) systems can be operated with one timer device.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、タイマー管理装置
および方法、特に通信、計測・制御システムなどにおい
て、1つのタイマによって複数の異なるシステムのタイ
マ制御を行ってタイマ資源を効率的に使用するタイマ管
理装置および方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a timer management apparatus and method, and more particularly, to a timer for controlling timers of a plurality of different systems by a single timer and efficiently using timer resources in a communication, measurement and control system or the like. The present invention relates to a management device and a method.

【0002】[0002]

【従来の技術】従来、通信、計測・制御等でスケジュー
リングなどのシステム制御を行う場合、またはリアルタ
イムオペレーティングシステム(OS)でタスク管理を行
う場合等において使用されていたタイマ管理方法には、
主として3つの方法があった。以下この3つの方法を順
に説明する。
2. Description of the Related Art Conventionally, a timer management method used when performing system control such as scheduling in communication, measurement / control, or the like, or when performing task management using a real-time operating system (OS), includes:
There were mainly three methods. Hereinafter, these three methods will be described in order.

【0003】(1)イベントタイマー管理テーブルを使
う方法。 1つのシステムは、機能により分割された複数の処理単
位(タスク)から構成されており、1つのタスクは複数
の動作状態を有している。
(1) A method using an event timer management table. One system is composed of a plurality of processing units (tasks) divided by function, and one task has a plurality of operation states.

【0004】図17は、タスクの状態遷移を示す。図1
7に示されるように、1つのタスクは複数の動作状態を
持っており、この動作状態には実行状態(RUN)17
00、実行待ち状態(READY)1710、休眠状態
(WAIT)1720の3つの状態がある。各タスクは
その動作状況に応じて、実行状態1700と休眠状態と
の間(1725、1735)、休眠状態1720と実行
待ち状態1710との間(1745、1755)および
実行待ち状態1710と実行状態との間(1715、1
705)で、その動作状態を変化(遷移)させる。サブ
システムにおいて、実行状態(RUN)1700のタス
ク数は必ず1である。割込み等のイベントが発生する
と、実行状態1700または実行待ち状態1710にあ
る複数のタスクの内、最も優先順位の高いタスクがOS
によって選択(ディスパッチ)されて実行状態へ遷移等
する(1715)。実行状態1700のタスクは、ディ
スパッチされずに実行権を他のタスクに奪われた場合ま
たは自らイベント待ちをしたい場合等には、休眠状態1
720に遷移する。休眠状態1720のタスクは、イベ
ントの発生または実行状態にあるタスクからの起床指示
を受けた場合に実行待ち状態または実行状態へ遷移する
(1745、1735)。
FIG. 17 shows a state transition of a task. FIG.
As shown in FIG. 7, one task has a plurality of operation states, and this operation state includes an execution state (RUN) 17.
00, an execution waiting state (READY) 1710, and a sleep state (WAIT) 1720. Depending on the operation state, each task is between the execution state 1700 and the sleep state (1725, 1735), between the sleep state 1720 and the execution wait state 1710 (1745, 1755), and the execution wait state 1710 and the execution state. Between (1715, 1
In 705), the operation state is changed (transitioned). In the subsystem, the number of tasks in the execution state (RUN) 1700 is always one. When an event such as an interrupt occurs, the task having the highest priority among the plurality of tasks in the execution state 1700 or the execution waiting state 1710 becomes the OS
Is selected (dispatched) to make a transition to an execution state (1715). The task in the execution state 1700 is in the sleep state 1 if the execution right is deprived to another task without being dispatched, or if the user himself wants to wait for an event.
Transition is made to 720. The task in the sleep state 1720 transitions to the execution wait state or the execution state when an event occurs or a wake-up instruction is received from the task in the execution state (1745, 1735).

【0005】上述のタスクに関する識別情報等を管理す
る従来の方法を以下に説明する。図18はタスクをタイ
マ使用者と考えた場合の、従来のリアルタイムOSにお
けるタイマイベントのタイマー管理テーブルを示す。図
18(A)において、タイマ管理テーブル1850の中の
タイマ使用者(タスク)の識別情報1800には、タス
クID(タスク番号)、タスクの実行優先順位、タスク
毎のスタックポインタ等が記録されている。タイマ値1
810は、動作中のタイマの残動作時間を表している。
タイマ値1810が0より大きいタスクはタイマイベン
ト待ちであり、タスクの動作状態1820は休眠状態
(WAIT)である。タイマ値1810が0より大きいタス
クがCPUの実行権を獲得することはない。タイマ値1
810が0のタスクの動作状態1820は、実行状態
(RUN)1700または実行待ち状態(READY)17
10である。タスクは、システムコールを発して休眠状
態1720に入るが、1つのタスクが同時に2つ以上の
タイマイベントを待って休眠状態1720に入ることは
無いものとする。すなわちタスクが休眠状態1720か
ら脱するように起動をかけるタイマイベントは1つのみ
であり、したがって、タイマイベントはタスク毎に1つ
存在するものとする。タイマイベント(タイマ割込み)
は一定時間毎に発生するものとする。この一定時間と
は、多くのOSの場合約10ms程度である。タイマイ
ベントを発行し登録した発行元タスクまたはタイマイベ
ントが発生した時にその通知を受ける通知先タスクへ、
タイマイベントの発生を何らかの信号により通知する機
能があるOSの場合、タスクはタイマイベントの発生を
待って休眠状態1720へ遷移する必要はない。このよ
うなOSの場合、タスクは休眠状態1720へ遷移せず
に複数のタイマイベントの発生を同時に待つことができ
る。一般的にはタイマイベントの発生(以下、「タイム
アップ」という)の通知はメールボックスで行われる。
複数のタイマイベントの発生を待つ例としては、1つ目
のタイマイベントの発生により装置の電源をオンにし、
2つ目のタイマイベントの発生により装置の電源をオフ
にする場合、または1つ目のタイマイベントAが発生す
る前にある処理を終了できれば正常終了としてタイマイ
ベントAを削除するが、タイマイベントAが発生してしま
うと異常であるとして停止処理を開始し、2つ目のタイ
マイベントBが発生してしまうと停止処理も失敗したも
のとして緊急停止させる等がある。
A conventional method for managing identification information and the like relating to the above-described task will be described below. FIG. 18 shows a timer management table of a timer event in a conventional real-time OS when a task is considered as a timer user. In FIG. 18A, in a timer management table 1850, a timer user (task) identification information 1800 records a task ID (task number), a task execution priority, a stack pointer for each task, and the like. I have. Timer value 1
Reference numeral 810 represents the remaining operation time of the operating timer.
A task whose timer value 1810 is greater than 0 is waiting for a timer event, and the operation state 1820 of the task is in a sleep state (WAIT). A task whose timer value 1810 is larger than 0 does not acquire the execution right of the CPU. Timer value 1
The operation state 1820 of a task whose 810 is 0 is an execution state (RUN) 1700 or an execution waiting state (READY) 17
It is 10. A task issues a system call to enter sleep state 1720, but it is assumed that one task does not enter sleep state 1720 waiting for two or more timer events at the same time. In other words, it is assumed that there is only one timer event that activates a task so as to exit sleep state 1720, and therefore, one timer event exists for each task. Timer event (timer interrupt)
Occur at regular intervals. This fixed time is about 10 ms in many OSs. To the issuing task that issued and registered the timer event or the notification destination task that receives notification when the timer event occurred,
In the case of an OS having a function of notifying the occurrence of a timer event by any signal, the task does not need to transition to the sleep state 1720 after the occurrence of the timer event. In the case of such an OS, the task can simultaneously wait for the occurrence of a plurality of timer events without transitioning to the sleep state 1720. Generally, the notification of the occurrence of a timer event (hereinafter referred to as “time-up”) is performed in a mailbox.
As an example of waiting for the occurrence of a plurality of timer events, the device is turned on by the occurrence of the first timer event,
When the power of the apparatus is turned off by the occurrence of the second timer event, or when a certain process can be completed before the first timer event A occurs, the timer event A is deleted as a normal end. When the timer event B occurs, the stop processing is started as an abnormal state, and when the second timer event B occurs, the stop processing is considered to have failed and the emergency stop is performed.

【0006】図18(B)は、上述のようにタスクが複数
のタイマイベントの発生を待つ場合のタイマ管理テーブ
ルを示す。図18(B)に示されるように、タイマ管理テ
ーブル1800はセル1830ないしセル1835をキ
ュー状に接続した構造(以下「タイマキュー」という)
となり、図18(A)のタイマ値1810(図18(B)の
符号1825)の部分にタイナキューへの先頭アドレス
(ポインタ)が置かれている。このように実際のタイマ
はタイマキューに接続されている。
FIG. 18B shows a timer management table when a task waits for a plurality of timer events to occur as described above. As shown in FIG. 18B, the timer management table 1800 has a structure in which cells 1830 to 1835 are connected in a queue (hereinafter referred to as “timer queue”).
The head address (pointer) to the timer queue is located at the timer value 1810 (reference numeral 1825 in FIG. 18B) of FIG. 18A. Thus, the actual timer is connected to the timer queue.

【0007】図19は、従来のタイマ割込み処理を説明
するためのシステム1(1900)およびシステム2
(1910)の2つのサブシステムから構成されるシス
テムの例を示し、図20は従来のタイマ割込み処理のフ
ローチャートを示す。以下では図19および図20を用
いて従来のタイマ割込みの処理を説明する。図19に示
されるように、タイマ管理テーブル1920には各シス
テム1900、1910毎にタイマー使用者(タスク)
の識別情報(タスクID)1800およびタイマー値1
810等が記録されている。各システム1900、19
10は、タイマ管理テーブル1920へタイマイベント
登録1905を行い、各システム1900、1910へ
タイムアップ1915が通知される。タイマー装置19
30からの割込み1925(通常は10ms程度の周期
的割り込み)によって、タイマーテーブル1920のタ
イマ値1810が処理される。タイマ割り込み1925
が発生すると、タイマ値1810が0より大きいすべて
のタスクのタイマ値1810を1つ減らす(デクリメン
トする)。初めからタイマ値1810がゼロのタスクに
対しては何もしない。この処理は、登録されている全タ
スクについて行われる(図20のステップS202ない
しS208)。タイマ割込1925の処理において、タ
イマー値1810を1だけデクリメントして0になった
タスク、すなわちタイマち1810が1→0に変化した
タスクに対し、タスクの状態をタイマイベント待ち状態
(WAIT)1720から実行待ち状態(READY)
1710に遷移させる(ステップS208、S20
9)。タイマ割り込み1925において、タイマ値18
10のデクリメント処理(ステップS206)がすべて
終了と判断されると(ステップS202)、リアルタイ
ムOS等のディスパッチ処理へ戻る(ステップS20
3)。ディスパッチ処理ではOSの処理の一部として、
タイマ割り込み1925の処理を完了した時点で最も実
行優先順位の高いタスクにCPUの実行権をわたす。具
体的には、タイマ使用者(タスク)の識別情報1800
の中のスタックポインタ情報(タスクのコンテキスト
(context:実行文脈))を復元して、すなわちCPUの
スタックポインタレジスタに設定して、最も実行優先順
位の高いタスクに実行を移す。
FIG. 19 shows a system 1 (1900) and a system 2 for explaining conventional timer interrupt processing.
(1910) shows an example of a system composed of two subsystems, and FIG. 20 shows a flowchart of a conventional timer interrupt process. Hereinafter, a conventional timer interrupt process will be described with reference to FIGS. As shown in FIG. 19, the timer management table 1920 includes a timer user (task) for each system 1900, 1910.
Identification information (task ID) 1800 and timer value 1
810 etc. are recorded. Each system 1900, 19
10 registers a timer event 1905 in the timer management table 1920 and notifies each system 1900, 1910 of the time-up 1915. Timer device 19
The timer value 1810 of the timer table 1920 is processed by an interrupt 1925 from 30 (usually a periodic interrupt of about 10 ms). Timer interrupt 1925
Occurs, the timer value 1810 of all tasks whose timer value 1810 is greater than 0 is decremented by one (decrement). It does nothing for tasks whose timer value 1810 is zero from the beginning. This process is performed for all registered tasks (steps S202 to S208 in FIG. 20). In the processing of the timer interrupt 1925, the task state is changed to the timer event wait state (WAIT) 1720 for the task in which the timer value 1810 is decremented by 1 to 0, that is, the task in which the timer 1810 changes from 1 to 0. Waiting for execution (READY)
Transition to 1710 (steps S208, S20
9). In the timer interrupt 1925, the timer value 18
When it is determined that all the decrement processings of Step 10 (Step S206) are completed (Step S202), the process returns to the dispatch processing of the real-time OS or the like (Step S20).
3). In the dispatch process, as part of the OS process,
When the processing of the timer interrupt 1925 is completed, the execution right of the CPU is given to the task having the highest execution priority. Specifically, identification information 1800 of the timer user (task)
Is restored in the stack pointer information (context: execution context) of the task, that is, set in the stack pointer register of the CPU, and the execution is shifted to the task having the highest execution priority.

【0008】図20を用いて上述のタスク割り込み処理
をより詳細に説明する。タイマーイベント(タイマー割
込)が発生するとタイマーテーブル1850または19
20の先頭から以下の動作を行う。初期設定(ステップ
S200)および全タイマイベントの終了判断(ステッ
プS202)後、タイマーが使用中かどうか判定する
(ステップS204)。タイマーが使用中の場合とは、
タイマーテーブル11850等におけるタイマー値18
10が1以上の場合である。タイマーが使用中の場合
は、タイマー値1810をマイナス1する(ステップS
206)。タイマー値1810が0になった場合はタイ
ムアップ処理を行う(ステップS208、S209)。
タイムアップ処理S209は上述のようにタイマイベン
トを登録したタスクヘタイマイベントの発生を通知する
処理である。タイマイベントの通知方式としては上述の
ようにメールボックスを用いたり、タイマテーブル18
50等の中にイベントフラグを立ててOSに処理させた
りする方法等がある。全タイマイベントの処理が終了す
るとOSのディスパッチャにジャンプする。
The above-described task interrupt processing will be described in more detail with reference to FIG. When a timer event (timer interrupt) occurs, the timer table 1850 or 19
The following operation is performed from the top of 20. After the initial setting (step S200) and the end determination of all timer events (step S202), it is determined whether the timer is in use (step S204). When the timer is in use,
Timer value 18 in timer table 11850 etc.
10 is 1 or more. If the timer is in use, the timer value 1810 is decremented by 1 (step S
206). When the timer value 1810 becomes 0, a time-up process is performed (steps S208 and S209).
The time-up process S209 is a process of notifying the task in which the timer event has been registered as described above of the occurrence of the timer event. As a notification method of the timer event, a mailbox is used as described above, or the timer table 18 is used.
For example, there is a method of setting an event flag in 50 or the like and causing the OS to process the event flag. When the processing of all the timer events is completed, the process jumps to the OS dispatcher.

【0009】上述のように、従来の方法においても1個
のタイマーにより複数のタスクを管理することは可能で
ある。しかし、従来の方法では複数のサブシステムから
なるシステムに対しては、タイマテーブル1920上に
複数のサブシステムが混在することになり、複数のシス
テム間の管理方法が非常に複雑なものとなるという問題
があった。すなわち、一つのタイマ管理テーブル中に異
なるシステムが混在することになり、あるシステムの運
転状態が別の他のシステムのタイマの管理に影響を与え
ることがあった。さらにある1つのシステムが実行を中
断した楊台、中断したシステムも稼働中のシステムも同
一のタイマテーブル1920上に混在することになって
しまうこととなる。動作を中断しているシステムのタイ
マをタイムアップさせることはできないため、タイマテ
ーブル1920におけるデクリメント処理S206は稼
働中のシステムのタスクに対してだけ行い、停止中また
は中断中のシステムに対応するタイマテーブル1920
は変化させないという処理を行わなければならない。こ
のように従来の方法においては、タイマ割込みを複数の
システム毎に別々に用意していたため、複数のシステム
間の管理方法が非常に複雑なものとなるという問題があ
った。
As described above, even in the conventional method, it is possible to manage a plurality of tasks by one timer. However, in the conventional method, for a system including a plurality of subsystems, a plurality of subsystems are mixed on the timer table 1920, and the management method between the plurality of systems becomes very complicated. There was a problem. In other words, different systems are mixed in one timer management table, and the operating state of one system may affect the management of the timer of another system. Further, the system in which the execution of one system is suspended, the suspended system, and the operating system are mixed on the same timer table 1920. Since the timer of the system in which the operation is suspended cannot be timed up, the decrement processing S206 in the timer table 1920 is performed only for the task of the operating system, and the timer table corresponding to the stopped or suspended system is used. 1920
Must be changed. As described above, in the conventional method, since the timer interrupt is separately prepared for each of a plurality of systems, there is a problem that a management method between the plurality of systems becomes very complicated.

【0010】(2)タイマキュー(差分タイマキュー)
を使用する方法。 図21は従来使用されている差分タイマキューのデータ
構造を示す。図21に示されるように、各システムのタ
イマイベント1(2118)等、タイマイベント1(2
118)等の発生時間間隔のタイマ値2016等および
次のシステムのタイマイベントへのポインタ(チェーン
情報)2114等を1つのセル2110等として、キュ
ー構造体(タイマキュー)2100を形成している。例
えば、セル2110はシステム1のセルであり、次にシ
ステム2のセル2120が接続されている。先頭セル2
110は先頭キュー2102に接続されており、空きキ
ュー2104には空きセル(不図示)の先頭セルが接続
されている。
(2) Timer queue (difference timer queue)
How to use. FIG. 21 shows a data structure of a difference timer queue conventionally used. As shown in FIG. 21, timer event 1 (2118) such as timer event 1 (2118) of each system
A queue structure (timer queue) 2100 is formed by using a timer value 2016 of an occurrence time interval such as 118) and a pointer (chain information) 2114 to a timer event of the next system as one cell 2110 and the like. For example, cell 2110 is a cell of system 1 and cell 2120 of system 2 is connected next. First cell 2
110 is connected to the head queue 2102, and the empty queue 2104 is connected to the head cell of an empty cell (not shown).

【0011】図22はタイマキュー2100の設定方法
を通して差分タイマの動作を示す。図22において、横
軸は時間軸であり、全イベント発生時間の基準時間を時
間軸上で0とする。縦軸は4つの時間待ちタイマイベン
ト(70ms、100ms、150ms、200ms)
を示す。これらの4つのタイマイベントは同時に動作を
開始させたものとする。ハードウェアの時間計測単位
(時間分解能)は、10msとする。図22のい示され
る4つのタイマイベント1ないし4は、設定時間の小さ
いものから順にタイムアップする。例えば、タイマイベ
ント1の70msタイマイベントよりタイマイベント4
の200msタイマイベントが先にタイムアップするこ
とはない。4つのタイマイベント1ないし4は、時間軸
上で、70ms、30ms、50ms、50msの間隔
で発生する。すなわち各々の発生時刻はTE1(70m
s)、TE2(100ms)、TE3(150ms)お
よびTE4(200ms)の時刻である。したがってタ
イマキュー2100の先頭には、イベント1(211
8)のタイマ値2116が70msのセル2110を接
続する。2番目に接続するセル2120のタイマ値21
26には、タイマイベント2(2128)とタイマイベ
ント1(2118)の発生時刻の差分であるTE2−T
E1=100−70=30msを設定する。この差分値
のことを差分タイマ値という。3番目以降も同様であ
る。こうすることにより、一番目のセル2110がタイ
ムアップしたときには70ms経過し、そこから2番目
のセル2120がタイムアップするとさらに30ms経
過するので、時間ゼロ(タイマ発行時)から2番めのセ
ル2120がタイムアップするまで、70+30=10
0msだけ経過したことなる。同様に3番めのセル21
30、4番目のセル2140も、1つ前のセルのタイム
アップ時刻からの差分をタイマ値2126等として設定
すれば所要のタイマ動作を実現することができる。
FIG. 22 shows the operation of the difference timer through the setting method of the timer queue 2100. In FIG. 22, the horizontal axis is the time axis, and the reference time of all event occurrence times is set to 0 on the time axis. The vertical axis shows four wait timer events (70 ms, 100 ms, 150 ms, 200 ms)
Is shown. It is assumed that these four timer events have started operation at the same time. The time measurement unit (time resolution) of the hardware is 10 ms. The four timer events 1 to 4 shown in FIG. 22 time up in ascending order of the set time. For example, the timer event 4 is changed from the timer event 1 of the 70 ms timer event.
The 200 ms timer event does not time out first. The four timer events 1 to 4 occur at intervals of 70 ms, 30 ms, 50 ms, and 50 ms on the time axis. That is, each occurrence time is TE1 (70 m
s), TE2 (100 ms), TE3 (150 ms) and TE4 (200 ms). Therefore, at the head of the timer queue 2100, event 1 (211
8) Connect the cell 2110 whose timer value 2116 is 70 ms. Timer value 21 of cell 2120 connected second
26 is a difference between the occurrence times of the timer event 2 (2128) and the timer event 1 (2118).
Set E1 = 100−70 = 30 ms. This difference value is called a difference timer value. The same applies to the third and subsequent ones. By doing so, 70 ms elapses when the first cell 2110 times out, and 30 ms elapses when the second cell 2120 times out therefrom. Therefore, the second cell 2120 from time zero (when a timer is issued) Until the time is up, 70 + 30 = 10
This means that 0 ms has elapsed. Similarly, the third cell 21
The 30th and 4th cells 2140 can also realize a required timer operation if the difference from the time-up time of the immediately preceding cell is set as a timer value 2126 or the like.

【0012】以下の表1に、図22における数値の計算
方法を示す。
Table 1 below shows a method of calculating numerical values in FIG.

【0013】[0013]

【表1】 [Table 1]

【0014】表1において、タイムアップ時間はイベン
ト毎のタイムアップ時間(開始時刻を0とする)を示
す。設定値はタイマキューに設定されるタイマ値を示
し、差分値は相対時間を示す。
In Table 1, the time-up time indicates a time-up time (start time is set to 0) for each event. The set value indicates a timer value set in the timer queue, and the difference value indicates a relative time.

【0015】図23は従来の差分タイマキューを用いた
処理のフローチャートを示す。図23において、タイマ
キュー2100に有効なタイマイベントが1つ以上つな
がっているかどうかチェックする(ステップS23
0)。ここで「有効な」とはタイマキューの要素である
各セル(以下「タイマキュー要素」という)のタイマ値
が0より大きい(タイマ値>0)ことをいう。有効なタ
イマキュー要素が一つも接続されていない場合、処理を
終了する。そうでない場合、タイマイベントを待ってい
る持っているタスクに対して信号を送る(ステップS2
32)。タイムアップした先頭のタイマキュー要素をタ
イマキューから外し、その後に他のタイマキュー要素か
接続されていれば、そのタイマキュー要素をタイマキュ
ー管理テーブルの先頭に登録する(ステップS23
6)。タイマキュ−先頭のタイマキュー要素のタイマ値
をハードウェアタイマに設定する(ステップS23
8)。
FIG. 23 shows a flowchart of a conventional process using a difference timer queue. In FIG. 23, it is checked whether one or more valid timer events are connected to the timer queue 2100 (step S23).
0). Here, “valid” means that the timer value of each cell (hereinafter, “timer queue element”) that is an element of the timer queue is larger than 0 (timer value> 0). If no valid timer queue element is connected, the process ends. If not, a signal is sent to the task having the task waiting for the timer event (step S2).
32). The timer queue element whose time is up is removed from the timer queue, and if another timer queue element is connected thereafter, the timer queue element is registered at the head of the timer queue management table (step S23).
6). The timer value of the first timer queue element of the timer queue is set in the hardware timer (step S23).
8).

【0016】上述のように、従来の方法においても1個
のタイマーにより複数のタスクを管理することは可能で
ある。しかし、従来の方法では複数のサブシステムから
なるシステムに対しては、一つのタイマキュー中に異な
るシステムが混在することになり、あるシステムの運転
状態が別の他のシステムのタイマの管理に影響を与える
ことがあった。ある1つのシステムが実行を中断した楊
台、中断したシステムも稼働中のシステムも同一のタイ
マキュー中に混在することになってしまうこととなるの
で、あるシステムが停止中であれば、必ずしも先頭キュ
ーがタイムアップしなくなる。したがって稼動中のシス
テムを探索する必要が生じた。動作を中断しているシス
テムのタイマをタイムアップさせることはできないた
め、タイマキューにおけるキューからの取り外し処理は
稼働中のシステムのタスクに対してだけ行い、停止中ま
たは中断中のシステムに対応するタイマイベントは変化
させないという処理を行わなければならないという問題
があった。したがって従来の方法においては、タイマ
(割込み)を複数のシステム毎に別々に用意等していた
ため、複数のシステム間の管理方法が非常に複雑なもの
となるという問題があった。さらに、サブシステムごと
休止してしまった場合、例えば2システム運転から1シ
ステム運転へと変化した場合、タイマキュー中に無効な
データ(休止中のシステムに対応するデータ)が接続し
ていることになるため、タイマキューから外す処理(デ
キュー操作)が複雑になる。あるタイマキュー要素の直
後のチェーン情報だけではタイマキューからデキューす
る操作ができず、結果として何らかの方法によりチェー
ン情報をたどって該当する休止システムのタイマキュー
要素を探さなくてはいけないという問題があった。
As described above, even in the conventional method, it is possible to manage a plurality of tasks by one timer. However, in the conventional method, for a system consisting of multiple subsystems, different systems are mixed in one timer queue, and the operating status of one system affects the management of timers in another system. Was given. If one system has suspended its execution, the suspended system and the running system will be mixed in the same timer queue. The queue does not time up. Therefore, it became necessary to search for an operating system. Since the timer of the system whose operation is suspended cannot be timed up, removal from the queue in the timer queue is performed only for the task of the running system, and the timer corresponding to the stopped or suspended system is There was a problem that a process of not changing the event had to be performed. Therefore, in the conventional method, since a timer (interrupt) is separately prepared for each of a plurality of systems, there is a problem that a management method between the plurality of systems becomes very complicated. Furthermore, when all subsystems have been suspended, for example, when the operation has changed from two-system operation to one-system operation, invalid data (data corresponding to the inactive system) is connected in the timer queue. Therefore, the process of dequeuing from the timer queue (dequeue operation) becomes complicated. There was a problem that the operation of dequeuing from the timer queue could not be performed only with the chain information immediately after a certain timer queue element, and as a result, it was necessary to follow the chain information in some way to find the corresponding timer queue element of the pause system. .

【0017】(3)周期起動イベントに対するタスク管
理テーブル。 定期監視動作、例えば一定時間毎の状態確認動作のよう
に一定時間毎に動作、起動を行いたいタイマイベントに
対する従来の管理方法について説明する。
(3) A task management table for a periodic activation event. A conventional management method for a timer event that is desired to be operated and started at regular intervals, such as a periodic monitoring operation, for example, a state confirmation operation at regular intervals, will be described.

【0018】図24は従来の周期起動タスクの管理テー
ブル2450を示す。図24において、タイマ使用者
(タスク)の識別情報2400には周期起動タスクの初
期設定時に周期起動時間等を記録しておく。タイマ値2
410は、残動作タイマ値である。タイマ値2410が
0のタスクは動作中ではないタスクを示す。タイマ値2
410は、定時タイマ割込み(10ms割込み)が入る
毎にマイナス1される。タイマ値2410が0になった
ことを検出され瞬間に、タスクはタイマイベントの発生
を通知される。タイマ値2410にはタイマ使用者(タ
スク)の識別情報2400の周期起動時間を再設定され
る。タイマイベントの発生を通知されたタスクは、タス
ク動作を実行し終了すれば、実行待ち状態1710に戻
る。すなわち実行権を放棄してディスパッチャにジャン
プする。
FIG. 24 shows a conventional periodic startup task management table 2450. In FIG. 24, the periodic start time and the like are recorded in the timer user (task) identification information 2400 at the time of initial setting of the periodic start task. Timer value 2
410 is a remaining operation timer value. A task whose timer value 2410 is 0 indicates a task that is not running. Timer value 2
410 is decremented by one every time a regular timer interrupt (10 ms interrupt) is input. As soon as the timer value 2410 is detected to be 0, the task is notified of the occurrence of a timer event. In the timer value 2410, the cycle start time of the identification information 2400 of the timer user (task) is reset. When the task notified of the occurrence of the timer event executes the task operation and ends, the task returns to the execution waiting state 1710. That is, the execution right is abandoned and the process jumps to the dispatcher.

【0019】図25(A)、(B)は従来のタスク管理
方法におけるタスクの動作を示す。周期起動タスクは複
数存在しうるがお互いに非同期である。図25(A)に
示されるように、TE10、TE20は周期起動タスク
の起動時刻であり、周期起動時間2500は本例では、
TE20−TE10=15−5=10msであり、タス
ク動作時間2550はTE15−TE10=10−5=
5msである。このように周期起動時間2500>タス
ク動作時間2550の場合には、周期起動タスクの動作
中にタイマ値2410が設定されて1ずつデクリメント
されていっても周期起動時間2500よりも短いタスク
時間2550でタスク動作が終了するためシステムの動
作には何の問題も発生しない。一方図25(B)に示さ
れるように、2度目のタスク起動時刻がTE25の時刻
であり、タスク動作時間2600がTE25−TE10
=20−5=15msの場合、周期起動時間2500<
タスク動作時間2600であるため周期起動時刻に起動
されたタスクが周期起動時間2500内に完了しない。
したがってTE20の時刻においてタスクが2重に起動
されることとなり、システムの動作に悪影響が出るとい
う問題があった。
FIGS. 25A and 25B show the operation of a task in a conventional task management method. There can be a plurality of periodic tasks, but they are asynchronous with each other. As shown in FIG. 25A, TE10 and TE20 are the activation times of the periodic activation task, and the periodic activation time 2500 is
TE20−TE10 = 15−5 = 10 ms, and the task operation time 2550 is TE15−TE10 = 10−5 =
5 ms. As described above, when the periodic startup time 2500> the task operation time 2550, even if the timer value 2410 is set and decremented by 1 during the operation of the periodic startup task, the task time 2550 is shorter than the periodic startup time 2500. Since the task operation is completed, no problem occurs in the operation of the system. On the other hand, as shown in FIG. 25B, the second task activation time is the time of TE25, and the task operation time 2600 is TE25-TE10.
= 20-5 = 15 ms, the cycle start time 2500 <
Since the task operation time is 2600, the task started at the periodic start time does not complete within the periodic start time 2500.
Therefore, the task is started twice at the time of TE20, and there is a problem that the operation of the system is adversely affected.

【0020】上述のように従来の方法では、周期的な動
作、例えば、ls毎に動作状態を表示する等の周期起動
タスクのための管理テーブル2450を、タイマイベン
トを管理するためのタイマテーブル1850等と別に用
意する必要があった。周期起動動作は、タイマテーブル
1850等とは独立した機能として独立した管理テーブ
ル2450等により処理されていた。つまり、2種類の
タイマテーブル管理方法が必要であるという問題があっ
た。このように従来のタイマ管理方法では、周期起動タ
イマイベントは、周期的ではないワンショット型のタイ
マイベント処理とは分離して、独立して管理されてい
た。さらに、周期起動タイマイベント同士も独立して動
作していたため、同じ周期起動を持つ周期起動イベント
であっても、両者にタイマイベントの発生するタイミン
グの差である時間的位相差があれば、タイマイベントの
同時発生(同時処理)を行わせることはできなかった。
このためタイマ割込みの回数が増大する傾向にあり、タ
イマ割込みによるシステムの消費電流が増大する傾向が
あるという問題があった。例えばシステムが携帯電話シ
ステムである場合、通話中であっても通話回線はハード
ウェア的に保持されるため、通話中であっても何もする
ことが無ければCPUは休眠状態(WAIT)へ遷移
し、省電力化を行っている。すなわち、タスクだけでは
なくCPUそのものもスリープ(WAIT)させること
により省電力化を図っている。したがってタイマ割込み
等によりCPUが起動されると消費電力が増大するた
め、このタイマ割込みの回数が増えると、確実に消費電
力が増えるという問題があった。さらに、従来のタイマ
管理方法では、ハードウェア的に設定された時間計測範
囲よりも長い時間を図る場合には、ハードウェア上のタ
イマ管理とは別に、ソフトウェアによってビットサイズ
の大きいカウンタを設け長時間タイマイベントに対応し
ていた。このため、ハードウェア上の時間単位や時間計
測範囲が変わると、ソフトウェアによるタイマのカウン
ト処理も影響を受けていた。さらに、従来のタイマ管理
方法では、時間計測時の許容誤差という概念がなく、単
純にハードウェア的に設定されたタイマ時間の終了(タ
イムアップ)をもってタイマイベントを発生させてい
た。このため、あるタイマイベントがタイムアップした
とき、その近傍に(すぐ後に)同時にタイムアップさせ
ても時間計測上許容誤差範囲内となるタイマイベントが
接続されていたとしてもデキュー処理できなかった。す
なわち従来のタイマ管理方法では、時間的にごく近傍の
イベントを統合する機能が無いという問題があった。
As described above, in the conventional method, the management table 2450 for periodic operation, for example, a periodic activation task such as displaying the operation state every ls, is replaced with the timer table 1850 for managing timer events. It was necessary to prepare separately. The periodic activation operation has been processed by the independent management table 2450 or the like as a function independent of the timer table 1850 or the like. That is, there is a problem that two types of timer table management methods are required. As described above, in the conventional timer management method, the periodic start timer event is managed separately from the non-periodic one-shot type timer event processing. In addition, since the periodic activation timer events also operate independently, even if the periodic activation events have the same periodic activation, if the two have a temporal phase difference that is the difference between the timings at which the timer events occur, the timer is activated. It was not possible to make events occur simultaneously (simultaneous processing).
Therefore, there has been a problem that the number of timer interrupts tends to increase, and the current consumption of the system due to the timer interrupt tends to increase. For example, if the system is a mobile phone system, the call line is held in hardware even during a call, so if there is nothing to do even during the call, the CPU transitions to the sleep state (WAIT). Power saving. That is, not only the task but also the CPU itself is set to sleep (WAIT) to save power. Therefore, when the CPU is started by a timer interrupt or the like, the power consumption increases. Therefore, when the number of times of the timer interrupt increases, the power consumption surely increases. Furthermore, in the conventional timer management method, when a time longer than the time measurement range set by hardware is set, a counter having a large bit size is provided by software separately from the timer management on hardware. The timer event was supported. Therefore, when the time unit or the time measurement range on the hardware changes, the counting process of the timer by the software is also affected. Further, in the conventional timer management method, there is no concept of an allowable error at the time of time measurement, and a timer event is generated simply when a timer time set (time-up) is set in hardware. For this reason, when a certain timer event has timed out, the dequeuing process could not be performed even if a timer event within an allowable error range in terms of time measurement is connected even if the time up is performed near (immediately later) at the same time. That is, the conventional timer management method has a problem that there is no function of integrating events that are very close in time.

【0021】[0021]

【発明が解決しようとする課題】上述のように従来のタ
イマ管理方法には、複数のサブシステムからなるシステ
ムに対して1つのタイマテーブル上に複数のサブシステ
ムを混在させていたため、複数のシステム間の管理方法
が非常に複雑なものとなるという問題があった。1個の
タイマーにより複数のタスクを管理することはできるも
のの、一つのタイマキュー中に異なるシステムが混在す
ることになり、あるシステムの運転状態が別の他のシス
テムのタイマの管理に影響を与えることがあった。さら
に周期起動タスクのための管理テーブルを、タイマイベ
ントを管理するためのタイマテーブルとは別に用意する
必要があった。同じ周期起動を持つ周期起動イベントで
あっても、時間的位相差がある場合はタイマイベントの
同時発生を行わせることがはできなかったため、タイマ
割込みの回数が増大する傾向にあり、タイマ割込みによ
るシステムの消費電流が増大する傾向があるという問題
があった。さらにハードウェアタイマのビット数の制限
によりソフトウェアを用いて長時間タイマイベントに対
応していたが、ハードウェア上条件が変わると、ソフト
ウェアによる処理も影響を受けていた。時間計測時の許
容誤差という概念がないため、時間的にごく近傍のタイ
マイベントを統合する機能が無いという問題があった。
As described above, in the conventional timer management method, a plurality of subsystems are mixed on one timer table for a system including a plurality of subsystems. There was a problem that the management method between them became very complicated. Although a plurality of tasks can be managed by one timer, different systems are mixed in one timer queue, and the operation state of one system affects the management of timers of another system. There was something. Furthermore, it is necessary to prepare a management table for the periodic activation task separately from a timer table for managing the timer event. Even in the case of periodic activation events having the same periodic activation, if there is a temporal phase difference, simultaneous occurrence of timer events could not be performed, and the number of timer interrupts tends to increase. There is a problem that current consumption of the system tends to increase. Furthermore, the hardware timer was used to respond to a long-time timer event by limiting the number of bits of the hardware timer. However, if conditions on the hardware changed, processing by the software was also affected. Since there is no concept of an allowable error at the time of time measurement, there is a problem that there is no function of integrating timer events that are very close in time.

【0022】そこで、本発明の目的は、上記問題を解決
するためになされたものであり、複数システムのタイマ
イベントを一元的に管理することにより、一つのタイマ
ー装置で複数の異なるシステム動作を実現することがで
きるタイマ管理装置および方法を提供することにある。
本発明の他の目的は、周期起動タイマイベントをワンシ
ョット型タイマイベントと同様に扱うことにより、周期
起動タイマイベントとワンショット型タイマイベントの
管理を一元化し、さらに時間的位相差がある場合であっ
てもタイマイベントの同時発生を行わせることができ、
タイマ割込みの回数を減らしてタイマ割込みによるシス
テムの消費電流を減らすことができるタイマ管理装置お
よび方法を提供することにある。本発明の他の目的は、
長時間タイマイベントを周期起動タイマイベント化する
ことにより、ハードウェアタイマのビット数内で長時間
タイマイベントを扱うことができるタイマ管理装置およ
び方法を提供することにある。さらに本発明の他の目的
は、タイマ値の精度を利用することにより、時間的にご
く近傍のタイマイベントを統合することができるタイマ
管理装置および方法を提供することにある。
An object of the present invention is to solve the above-mentioned problem, and realizes a plurality of different system operations with one timer device by integrally managing timer events of a plurality of systems. It is an object of the present invention to provide an apparatus and a method for managing a timer.
Another object of the present invention is to treat periodical timer events in the same manner as one-shot timer events, thereby unifying the management of periodic timer events and one-shot timer events, and furthermore, when there is a temporal phase difference. Even if there is a timer event,
It is an object of the present invention to provide a timer management apparatus and a timer management method capable of reducing the number of timer interrupts to reduce the current consumption of the system due to the timer interrupts. Another object of the present invention is to
An object of the present invention is to provide a timer management device and method capable of handling a long timer event within the number of bits of a hardware timer by converting a long timer event into a periodic start timer event. It is still another object of the present invention to provide a timer management apparatus and method that can integrate timer events that are very close in time by utilizing the accuracy of a timer value.

【0023】[0023]

【課題を解決するための手段】本発明のタイマ管理装置
は、タイマイベントを待ち行列により管理するタイマ管
理装置であって、該タイマ管理装置は、タイマイベント
に対応するタイマキュー要素をタイマイベントの発行元
別に待ち行列により保持する1つ以上のタイマキュー手
段であって、該タイマキュー要素はタイマイベントのタ
イムアップ時刻と該タイマキューに接続された時刻との
差分をタイマ値として有するものと、タイマ割込みが発
生した場合、1つ以上の前記タイマキュー手段につい
て、別個のタイマキュー手段の先頭に保持された別個の
タイマキュー要素が有するタイマ値の中で最小のタイマ
値を有する最小タイマキュー要素を選択する選択手段
と、前記最小タイマキュー要素を保持するタイマキュー
手段について、該最小タイマキュー要素の次に保持され
たタイマキュー要素を先頭に保持し、該最小タイマキュ
ー要素を該タイマキュー手段から削除する並べ替え手段
と、前記最小タイマキュー要素が保持されたタイマキュ
ー手段と異なる他のタイマキュー手段について、各タイ
マキュー手段の先頭に保持された各タイマキュー要素が
有するタイマ値から前記最小のタイマ値を減じた値を新
たにタイマ値として再設定する再設定手段とを備えたも
のである。ここで、本発明のタイマ管理装置は、前記別
個のタイマキュー手段に各々対応する別個のタイマキュ
ー管理テーブル手段と、前記別個のタイマキュー管理テ
ーブル手段を所定の順に管理するシステムキュー管理テ
ーブル手段とをさらに備え、前記選択手段は、該所定の
順に別個の前記タイマキュー管理テーブル手段を選択
し、選択された別個の前記タイマキュー管理テーブル手
段に対応する別個の前記タイマキュー手段について最小
タイマキュー要素を選択するものである。ここで、本発
明のタイマ管理装置は、前記システムキュー管理テーブ
ル手段は、前記タイマキュー管理テーブルに対応するタ
イマイベントの発行元の動作状態が変化した場合、前記
タイマキュー管理テーブルとは異なる他のタイマキュー
管理テーブルを独立して管理するものである。ここで、
本発明のタイマ管理装置は、前記システムキュー管理テ
ーブル手段は、前記タイマキュー管理テーブルに対応す
るタイマイベントの発行元の存在状態が変化した場合、
前記タイマキュー管理テーブルとは異なる他のタイマキ
ュー管理テーブルを独立して管理するものである。ここ
で、本発明のタイマ管理装置は、前記並べ替え手段は、
前記タイマキュー手段から削除された前記最小タイマキ
ュー要素が所定の周期時間毎に起動される周期的タイマ
イベントに対応する場合、削除された前記最小タイマキ
ュー要素を前記タイマキュー手段中の該所定の周期時間
後に対応する位置に再接続するものである。ここで、本
発明のタイマ管理装置は、タイマイベントに対応するタ
イマキュー要素を新たに前記タイマキュー手段へ接続す
る接続手段をさらに備え、該接続手段は、第1周期時間
毎に起動される周期的タイマイベントに対応した第1タ
イマキュー要素が既に前記タイマキュー手段に接続され
ている状態で、第1周期時間と所定の関係を有する第2
周期時間毎に起動される周期的タイマイベントに対応し
た第2タイマキュー要素を新たに前記タイマキュー手段
に接続する場合、第1タイマキュー要素の最も早いタイ
ムアップ時刻と第2タイマキュー要素の第1回目のタイ
ムアップ時刻を同時刻にする接続をし、1回のタイマ割
込みで第1タイマキュー要素および第2タイマキュー要
素を同時にタイムアップさせる回数を増やし、タイマ割
込みによる消費電流を減らすものである。ここで、本発
明のタイマ管理装置は、第2周期時間の有する第1周期
時間との前記所定の関係は第2周期時間が第1周期時間
の倍数である関係であり、前記接続手段は、第1タイマ
キュー要素がタイムアップする最も早い時刻から現時刻
を引いた値を第2タイマキュー要素の第1回目のタイマ
値として接続し、第1タイマキュー要素のタイムアップ
時刻と第2タイマキュー要素のタイムアップ時刻を同時
刻にするものである。ここで、本発明のタイマ管理装置
は、第2周期時間の有する第1周期時間との前記所定の
関係は第2周期時間が第1周期時間の約数である関係で
あり、前記接続手段は、第1タイマキュー要素がタイム
アップする最も早い時刻から第2周期時間の整数倍を引
いた時刻が現時刻より遅くならない最も早い時刻に第2
タイマキュー要素を接続するものである。ここで、本発
明のタイマ管理装置は、第2周期時間の有する第1周期
時間との前記所定の関係は第2周期時間が第1周期時間
と互いに素である関係であり、前記接続手段は、第1周
期時間と第2周期時間との最小公倍数となる周期時間毎
に第1タイマキュー要素と第2タイマキュー要素とが同
時にタイムアップするように接続するものである。ここ
で、本発明のタイマ管理装置は、所定の起動時間を有す
るタイマイベントに対応するタイマキュー要素を新たに
前記タイマキュー手段へ接続する接続手段をさらに備
え、該接続手段は、前記タイマキュー要素を前記所定の
起動時間に基づく周期時間と繰り返し回数を有し、該周
期時間毎に該繰り返し回数分起動される周期的タイマイ
ベントに対応する周期的タイマキュー要素に変換して接
続するものである。ここで、本発明のタイマ管理装置
は、前記タイマキュー要素は前記タイマ値に対する許容
誤差をさらに備え、前記並べ替え手段は、前記最小タイ
マキュー要素を保持するタイマキュー手段について、該
最小タイマキュー要素の次に保持されたタイマキュー要
素の有する前記許容誤差が前記タイマ値から前記最小の
タイマ値を減じた値より小さい場合、該次に保持された
タイマキュー要素を該最小タイマキュー要素と共に該タ
イマキュー手段から削除するものである。
SUMMARY OF THE INVENTION A timer management device according to the present invention is a timer management device for managing a timer event in a queue, and the timer management device stores a timer queue element corresponding to the timer event in the timer event. One or more timer queue means for holding in a queue for each issuer, wherein the timer queue element has a difference between a time-up time of a timer event and a time connected to the timer queue as a timer value; When a timer interrupt occurs, for one or more of the timer queue means, the minimum timer queue element having the smallest timer value among the timer values of the separate timer queue elements held at the head of the separate timer queue means And a timer queue unit that holds the minimum timer queue element. A rearranging unit that holds the timer queue element held next to the Ima queue element at the head and deletes the minimum timer queue element from the timer queue unit; and a reordering unit that is different from the timer queue unit that holds the minimum timer queue element. And a resetting means for resetting a value obtained by subtracting the minimum timer value from the timer value of each timer queue element held at the head of each timer queue means as a new timer value. Things. Here, the timer management device of the present invention includes a separate timer queue management table means corresponding to each of the separate timer queue means, and a system queue management table means for managing the separate timer queue management table means in a predetermined order. The selection means selects the separate timer queue management table means in the predetermined order, and selects the minimum timer queue element for the separate timer queue means corresponding to the selected separate timer queue management table means. Is to select. Here, in the timer management device of the present invention, the system queue management table means may be configured such that, when an operation state of a source of a timer event corresponding to the timer queue management table changes, another system different from the timer queue management table. The timer queue management table is independently managed. here,
The timer management device of the present invention, wherein the system queue management table means, when the presence state of the issue source of the timer event corresponding to the timer queue management table changes,
Another timer queue management table different from the timer queue management table is independently managed. Here, in the timer management device of the present invention, the rearranging unit includes:
When the minimum timer queue element deleted from the timer queue means corresponds to a periodic timer event started every predetermined period of time, the deleted minimum timer queue element is deleted from the predetermined queue in the timer queue means. After the cycle time, it is reconnected to the corresponding position. Here, the timer management device of the present invention further comprises a connection means for newly connecting a timer queue element corresponding to a timer event to the timer queue means, wherein the connection means is activated every first cycle time. In a state where the first timer queue element corresponding to the dynamic timer event is already connected to the timer queue means, the second timer having a predetermined relationship with the first cycle time
When a second timer queue element corresponding to a periodic timer event started every cycle time is newly connected to the timer queue means, the earliest time-up time of the first timer queue element and the second timer queue element A connection in which the first time-up time is set to the same time, the number of times that the first timer queue element and the second timer queue element are simultaneously timed up by one timer interrupt is increased, and the current consumption due to the timer interrupt is reduced. is there. Here, in the timer management device of the present invention, the predetermined relationship with the first cycle time of the second cycle time is a relationship in which the second cycle time is a multiple of the first cycle time, and the connection unit includes: A value obtained by subtracting the current time from the earliest time at which the first timer queue element times out is connected as the first timer value of the second timer queue element, and the time-up time of the first timer queue element and the second timer queue are connected. The element time-up time is set to the same time. Here, in the timer management device of the present invention, the predetermined relationship with the first cycle time of the second cycle time is a relationship in which the second cycle time is a divisor of the first cycle time, and The time obtained by subtracting an integral multiple of the second cycle time from the earliest time at which the first timer queue element times up is the second time at the earliest time at which the time is not later than the current time.
It connects timer queue elements. Here, in the timer management device of the present invention, the predetermined relationship with the first cycle time of the second cycle time is a relationship in which the second cycle time is relatively prime to the first cycle time, and the connection means The first timer queue element and the second timer queue element are connected so as to simultaneously time-up at every cycle time that is the least common multiple of the first cycle time and the second cycle time. Here, the timer management device of the present invention further includes a connection unit for newly connecting a timer queue element corresponding to a timer event having a predetermined activation time to the timer queue unit, wherein the connection unit includes the timer queue element. Has a cycle time and a number of repetitions based on the predetermined activation time, and is connected to a periodic timer queue element corresponding to a periodic timer event activated by the number of repetitions for each of the cycle times. . Here, in the timer management device of the present invention, the timer queue element further includes an allowable error with respect to the timer value, and the rearranging unit includes a timer queue unit that holds the minimum timer queue element. If the allowable error of the next held timer queue element is smaller than the value obtained by subtracting the minimum timer value from the timer value, the next held timer queue element together with the minimum timer queue element is replaced by the timer. It is to be deleted from the queue means.

【0024】本発明のタイマ管理方法は、タイマイベン
トを待ち行列により管理するタイマ管理方法であって、
該タイマ管理方法は、タイマイベントに対応し、該タイ
マイベントのタイムアップ時間に応じたタイマ値を有す
るタイマキュー要素を該タイマイベントの発行元別に待
ち行列により1つ以上のタイマキュー手段に保持するス
テップと、タイマイベントに応じたタイマ割込みが発生
した場合、1つ以上の前記タイマキュー手段について、
別個のタイマキュー手段の先頭に保持された別個のタイ
マキュー要素が有するタイマ値の中で最小のタイマ値を
有する最小タイマキュー要素を選択する選択ステップ
と、前記最小タイマキュー要素を保持するタイマキュー
手段について、該最小タイマキュー要素の次に保持され
たタイマキュー要素を先頭に保持し、該最小タイマキュ
ー要素を該タイマキュー手段から削除する並べ替えステ
ップと、前記最小タイマキュー要素が保持されたタイマ
キュー手段と異なる他のタイマキュー手段について、各
タイマキュー手段の先頭に保持された各タイマキュー要
素が有するタイマ値から前記最小のタイマ値を減じた値
を新たにタイマ値として再設定する再設定ステップとを
備えたものである。
A timer management method according to the present invention is a timer management method for managing timer events by a queue,
In the timer management method, a timer queue element corresponding to a timer event and having a timer value corresponding to the time-up time of the timer event is held in one or more timer queue means by a queue for each issue source of the timer event. Steps, and when a timer interrupt occurs in response to a timer event, for one or more of the timer queue means,
A selecting step of selecting a minimum timer queue element having a minimum timer value among timer values of the separate timer queue elements held at the head of the separate timer queue means, and a timer queue holding the minimum timer queue element Means for rearranging the timer queue element held next to the minimum timer queue element at the head and deleting the minimum timer queue element from the timer queue means; and storing the minimum timer queue element. For another timer queue means different from the timer queue means, a value obtained by subtracting the minimum timer value from the timer value of each timer queue element held at the head of each timer queue means as a new timer value is reset. And a setting step.

【0025】[0025]

【発明の実施の形態】以下、図面を参照して、本発明の
実施の形態を詳細に説明する。図1ないし図5は本発明
の実施の形態1ないし5において共通して用いられるデ
ータ構造体を示す。図1ないし図5に示されるデータ構
造体によって、1個のハードウェアタイマで複数のシス
テム、複数の時間精度、複数の動作、例えばワンショッ
ト動作、周期動作、長時間動作等を実現する。ここで、
ワンショット動作とはタイマキューにおいて1回だけ動
作するタイマイベント(以下「ワンショット型タイマイ
ベント」という)の動作であり、周期動作とはタイマキ
ューにおいて複数回繰り返し動作するタイマイベント
(以下「周期タイマイベント」という)の動作であり、
長時間動作とはタイマキューにおいてハードウェアタイ
マのカウント数が他のタイマイベントよりも比較的長い
タイマイベント(以下「長期タイマイベント」という)
の動作である。これらの動作を実現するために、複数の
等分タイマキューを用いて、1つのシステム内でのタイ
マイベントの発生タイミングを合わせるタイマキュー内
の時間的位相合わせ、および複数のシステム間でのタイ
マイベントの発生タイミングを合わせるタイマキュー間
の時間的位相合せを行う。
Embodiments of the present invention will be described below in detail with reference to the drawings. 1 to 5 show data structures commonly used in the first to fifth embodiments of the present invention. The data structures shown in FIGS. 1 to 5 realize a plurality of systems, a plurality of time accuracies, and a plurality of operations, such as a one-shot operation, a periodic operation, and a long-time operation, with one hardware timer. here,
The one-shot operation is an operation of a timer event that operates only once in a timer queue (hereinafter, referred to as a “one-shot type timer event”), and the periodic operation is a timer event that operates multiple times in a timer queue (hereinafter, a “periodic timer event”). Event ").
A long-term operation is a timer event in which the count of the hardware timer in the timer queue is relatively longer than other timer events (hereinafter referred to as “long-term timer event”).
Operation. To realize these operations, a plurality of equally-divided timer queues are used to adjust the timing of timer events in one system. Is performed between the timer queues that match the timing of the occurrence of the above.

【0026】図1は、サブシステム毎のタイマキューの
構造を示す。図1に示されるように、サブシステムのタ
イマイベント1(118)等、タイマイベント1(11
8)等の発生時間間隔のタイマ値116等および次のタ
イマイベントへのポインタ(チェーン情報)114等を
1つのセル(タイマキュー要素)110等として、キュ
ー構造体(タイマキュー)100を形成している。例え
ば、タイマキュー要素110の次にタイマキュー要素1
20が接続されている。図1では図示されていないがタ
イマキューは双方向の線形リスト構造である。先頭タイ
マキュー要素110は先頭キュー102に接続されてお
り、空きキュー104には空きセル(不図示)の先頭セ
ルが接続されている。
FIG. 1 shows the structure of a timer queue for each subsystem. As shown in FIG. 1, timer event 1 (11), such as
The queue structure (timer queue) 100 is formed by using the timer value 116 and the like of the occurrence time interval such as 8) and the pointer (chain information) 114 to the next timer event as one cell (timer queue element) 110 and the like. ing. For example, after the timer queue element 110, the timer queue element 1
20 are connected. Although not shown in FIG. 1, the timer queue has a bidirectional linear list structure. The first timer queue element 110 is connected to the first queue 102, and the first cell of an empty cell (not shown) is connected to the empty queue 104.

【0027】図2はタイマキュー要素のデータ構造を示
す。図2において、前方リンク202はタイマキュー内
の前方タイマキュー要素へのポインタ、後方リンク20
4はタイマキュー内の後方タイマキュー要素へのポイン
タ、タイマID206はタイマイベント、したがって当
該タイマキュー要素の識別子、タイマ種別・精度208
は動作中のハードウェアタイマのビット幅またはタイマ
カウント単位(分解能、精度等)、タイマ値210は設
定するタイマ値である。タイマ値210は本明細書にお
いては差分タイマ値を用いるが、本発明は差分タイマ値
に限定されるものではない。さらに図2において、通知
先情報212はタイマイベントを発行したオブジェクト
のID、タイマ動作種別214はワンショット動作、周
期動作または長時間ワンショット動作(長時間動作でか
つワンショット動作)の種別、周期起動時間216は周
期動作を行う周期タイマイベントの周期起動時間または
長時間ワンショット動作を行う長時間タイマイベントの
初期設定値(後述の実施の形態4で示されるように長時
間タイマイベントは周期タイマイベント化される)、周
期起動カウンタ218は周期起動タイマイベントまたは
長時間タイマイベントの繰り返し回数、システム種別2
20は誤接続を検出するための動作中のシステム種別で
ある。タイマキュー要素200にはさらのその他のタイ
マキュー要素に関する情報を設定することもできる。
FIG. 2 shows the data structure of the timer queue element. In FIG. 2, the forward link 202 is a pointer to the forward timer queue element in the timer queue, the backward link 20.
4 is a pointer to a backward timer queue element in the timer queue, timer ID 206 is a timer event, and therefore an identifier of the timer queue element, timer type / accuracy 208
Is the bit width or timer count unit (resolution, accuracy, etc.) of the operating hardware timer, and the timer value 210 is the timer value to be set. Although the timer value 210 uses a difference timer value in this specification, the present invention is not limited to the difference timer value. Further, in FIG. 2, the notification destination information 212 is the ID of the object that has issued the timer event, and the timer operation type 214 is the type and cycle of one-shot operation, periodic operation or long-time one-shot operation (long-time operation and one-shot operation). The activation time 216 is a periodic activation time of a periodic timer event that performs a periodic operation or an initial setting value of a long timer event that performs a long one-shot operation (as described in a fourth embodiment described below, the long timer event is a periodic timer event). Event), the cycle start counter 218 stores the number of repetitions of the cycle start timer event or long time timer event,
Reference numeral 20 denotes an operating system type for detecting an erroneous connection. The timer queue element 200 can also set information on other timer queue elements.

【0028】タイマキューの先頭タイマキュー要素の前
にはタイマキュー管理テーブルがある。このタイマキュ
ー管理テーブルは図1における先頭キュー102が該当
する。
A timer queue management table is provided before the head timer queue element of the timer queue. This timer queue management table corresponds to the head queue 102 in FIG.

【0029】図3はタイマキュー管理テーブルの前に接
続され、タイマキューを管理するタイマ管理テーブルの
データ構造を示す。タイマ管理テーブルはシステム毎に
用意される。図3において、前システムへのポインタ3
02は当該タイマ管理テ−ブル300により管理される
システムの前のシステムへのポインタ(リンク)、次シ
ステムへのポインタ304は当該タイマ管理テ−ブル3
00により管理されるシステムの次のシステムへのポイ
ンタ(リンク)、先頭キューへのポインタ306は当該
システムのタイマキュー管理テ−ブルへのポインタ、シ
ステムの動作状態308はシステムの動作中、停止中等
のシステムの動作状態を表示するためのフラグまたはス
テータス、システム種別310は動作中のシステム種別
である。タイマ管理テーブル300にはさらのその他の
当該システムに関する情報を設定することもできる。
FIG. 3 shows the data structure of the timer management table connected before the timer queue management table and managing the timer queue. The timer management table is prepared for each system. In FIG. 3, a pointer 3 to the previous system
02 is a pointer (link) to the system before the system managed by the timer management table 300, and pointer 304 to the next system is the timer management table 3
The pointer (link) to the system next to the system managed by 00, the pointer to the first queue 306 is the pointer to the timer queue management table of the system, and the operation state 308 of the system is the operation of the system, the operation is stopped, etc. The flag or status for displaying the operation state of the system, and the system type 310 is the type of the operating system. In the timer management table 300, other information on the system can be set.

【0030】図4は各システム毎のタイマ管理テーブル
300を管理するシステムキュー管理テーブルのデータ
構造を示す。図4において、システムへのリンク情報4
02はシステムキュー管理テーブル400が管理する各
システムをサブシステムとし、これらのサブシステムか
ら構成されるシステムを全体として1つのシステムとし
た場合、他のシステムへのポインタである。さらに図4
において、先頭キューへのポインタ404は先頭(サ
ブ)システムのタイマ管理テーブル300へのポイン
タ、空きキューへのポインタ406は空きタイマキュー
へのポインタ、システムの動作状態408は全体として
1つのシステムとした場合における当該システムの動作
中、停止中または中断中等の状態、その他管理情報41
0は当該システムの他の情報、システム種別412は動
作中の当該システム種別である。
FIG. 4 shows a data structure of a system queue management table for managing the timer management table 300 for each system. In FIG. 4, link information 4 to the system
Reference numeral 02 denotes a pointer to another system when each system managed by the system queue management table 400 is a subsystem, and when a system including these subsystems is a single system as a whole. FIG. 4
, The pointer 404 to the first queue is a pointer to the timer management table 300 of the first (sub) system, the pointer 406 to the empty queue is a pointer to the empty timer queue, and the operating state 408 of the system is one system as a whole. Status of the system in operation, stopped or suspended, and other management information 41
0 is other information of the system, and system type 412 is the type of the system in operation.

【0031】図5は上述のシステムキュー管理テーブル
400、タイマ管理テーブル300、タイマキュー管理
テーブルおよびタイマキュー等の制御構造の関連を示
す。図5に示されるように、1つの(サブ)システムの
タイマキュー要素535等は各々キュー状に接続され、
このキューはタイマキュー管理テーブル532等によっ
て(サブ)システム毎に管理される。タイマキューとい
う場合、このタイマ管理テーブル532等を含む全体5
40等を指すが、単にタイマキュー要素535から始ま
るキューを指す場合もある。(サブ)システムは、(サ
ブ)システム毎のタイマ管理テーブル530等によって
管理され、各(サブ)システムはシステムキュー管理テ
ーブル510によって管理される。(サブ)システムの
例としては、符号分割多重(Code Division Multiple A
ccess : CDMA)システム、ディジタル携帯電話/自
動車電話(Personal Digital Cellular : PDC)シス
テムまたはPHS(Personal Handyphone System)等が
ある。空きタイマキュー520は、タイマがカウントア
ップして処理が終了したタイマキュー要素、つまり使い
終わったタイマキュー要素が接続されていく。空きタイ
マキュー要素が無くなると新規のタイマイベントは発行
できないため、適宜ガーベッジコレクション等を行う。
新規なタイマキュー要素をタイマキュー540等に接続
する場合、タイマキュー540等にタイマキュー要素5
35等がある場合は差分タイマ値を計算して新規なタイ
マキュー要素をタイマキューに接続する。一方タイマキ
ュー要素が無い場合は、タイマキュー540等の先頭に
タイマ値210をそのまま設定して新規なタイマキュー
要素をそのまま接続する。
FIG. 5 shows the relationship between the control structures of the system queue management table 400, the timer management table 300, the timer queue management table, the timer queue, and the like. As shown in FIG. 5, timer queue elements 535 etc. of one (sub) system are each connected in a queue,
This queue is managed for each (sub) system by the timer queue management table 532 and the like. In the case of a timer queue, the timer queue including the timer management table 532 and the like
40, etc., but may simply refer to a queue starting from the timer queue element 535. The (sub) systems are managed by a timer management table 530 for each (sub) system, and each (sub) system is managed by a system queue management table 510. An example of a (sub) system is Code Division Multiple A
ccess: CDMA) system, digital mobile phone / Personal Digital Cellular (PDC) system or PHS (Personal Handyphone System). The empty timer queue 520 is connected to a timer queue element whose timer has counted up and whose processing has been completed, that is, a used timer queue element. Since no new timer event can be issued if there are no empty timer queue elements, garbage collection or the like is performed as appropriate.
When a new timer queue element is connected to the timer queue 540 or the like, the timer queue element 5 is added to the timer queue 540 or the like.
If there are 35 or the like, a difference timer value is calculated and a new timer queue element is connected to the timer queue. On the other hand, when there is no timer queue element, the timer value 210 is set at the head of the timer queue 540 or the like, and a new timer queue element is connected as it is.

【0032】実施の形態1.実施の形態1は、複数の
(サブ)システムのタイマキューを統合し、複数の(サ
ブ)システムのタイマイベントを一元的に管理すること
により、一つのタイマー装置で複数の異なる(サブ)シ
ステムの動作を実現することができるタイマ管理装置お
よび方法を示す。以下では、特に明示されない限りシス
テムといえばタイマ管理テーブル530等で管理される
各システムを指す。システムキュー管理テーブル510
で管理される全体として1つのシステムとの関係に及ぶ
場合は、全体として1つのシステムをシステムといい、
タイマ管理テーブル530等で管理される各システムを
サブシステムという。実施の形態1ではシステム毎のタ
イマキュー間の時間的位相合わせ方法、およびタイマイ
ベントが発生した時に、該タイマイベントに対応するシ
ステムの先頭タイマキュー要素を外す操作を中心として
説明する。制御データ構造は、図1ないし5で示された
データ構造等を使用する。
Embodiment 1 In Embodiment 1, the timer queues of a plurality of (sub) systems are integrated and the timer events of a plurality of (sub) systems are centrally managed, so that one timer device can be used. 1 shows a timer management device and method capable of realizing the operation of a plurality of different (sub) systems. Hereinafter, unless otherwise specified, a system refers to each system managed by the timer management table 530 or the like. System queue management table 510
In the case where a relationship with one system as a whole is managed by the system, one system as a whole is called a system,
Each system managed by the timer management table 530 or the like is called a subsystem. The first embodiment mainly describes a method of adjusting the temporal phase between timer queues of each system and an operation of removing a head timer queue element of a system corresponding to the timer event when the timer event occurs. The control data structure uses the data structure shown in FIGS.

【0033】図6は、3つの(サブ)システム1ないし
3が存在する場合において、時刻Tiでタイマ割込みが
発生した状態のタイムチャートを示す。各システム1な
いし3は、各々図5におけるタイマキュー540ないし
580を有しており、各タイマキュー540等は、各シ
ステム1ないし3毎に独立である。図6において、時刻
Tiでタイマ割込みが発生した場合、各システム毎のタ
イマキュー540等の先頭のタイマキュー要素535等
を比較して最小のタイマ値210を有するタイマキュー
要素を選択する。図5の例では、システム1の先頭タイ
マキュー要素535のタイマ値210は10、システム
2の先頭タイマキュー要素555のタイマ値210は
7、システム3の先頭タイマキュー要素575のタイマ
値210は3であるため、システム3のタイマ値210
の3が最小である。したがって、システム3の先頭タイ
マキュー要素575がタイムアップしたと判断できる。
そこでシステム3の先頭タイマキュー要素575をタイ
マキュー580から外して、次のタイマキュー要素57
7(タイマ値210は2)をシステム3の先頭タイマキ
ュー要素とする。外されたタイマキュー要素は空きタイ
マキュー520に接続される。以上のようにしてシステ
ム3におけるタイマキュー要素575のタイムアップ時
の操作が完了する。この時システム1とシステム2のタ
イマキュー要素535および555はタイムアップして
いないが、各先頭タイマキュー要素のタイムアップ時間
はシステム3の先頭タイマキュー要素575のタイマ値
210である3の時間経過分だけ少なくする必要があ
る。そこでシステム1、2の各先頭タイマキュー要素5
35および555から、タイムアップしたシステム3の
タイマキュー要素575のタイマ値210の3を引いた
値をタイマ値210として再設定する。システム1の場
合タイマ値210は10−3=7、システム2の場合タ
イマ値210は、7−3=4が新しいタイマ値となり、
各々先頭タイマキュー要素535、555のタイマ値2
10の内容となる。各システム1ないし3の先頭タイマ
キュー要素のタイマ値210を再設定した後、その値の
最小のものをハードウェアタイマに設定し、タイマテー
ブル処理を完了する。本例の場合、システム3のタイマ
値210が2と最小であるため、ハードウェアタイマに
は2が設定される。本例では、1つのタイマキュー要素
575だけタイムアップしたが、設定されているタイマ
値210によっては、複数のシステムのタイマキュー要
素が同時にタイムアップすることがある。この場合は、
タイムアップしたタイマキュー要素はすべてタイマキュ
ー540等から外す処理を行う。
FIG. 6 is a time chart showing a state where a timer interrupt has occurred at time Ti when three (sub) systems 1 to 3 are present. Each of the systems 1 to 3 has a timer queue 540 to 580 in FIG. 5, respectively. The timer queues 540 and the like are independent for each of the systems 1 to 3. In FIG. 6, when a timer interrupt occurs at time Ti, a timer queue element having the minimum timer value 210 is selected by comparing the first timer queue element 535 of the timer queue 540 and the like of each system. In the example of FIG. 5, the timer value 210 of the first timer queue element 535 of the system 1 is 10, the timer value 210 of the first timer queue element 555 of the system 2 is 7, and the timer value 210 of the first timer queue element 575 of the system 3 is 3 Therefore, the timer value 210 of the system 3
3 is the minimum. Therefore, it can be determined that the time of the head timer queue element 575 of the system 3 has expired.
Therefore, the first timer queue element 575 of the system 3 is removed from the timer queue 580, and the next timer queue element 57 is removed.
7 (the timer value 210 is 2) is the first timer queue element of the system 3. The removed timer queue element is connected to the empty timer queue 520. As described above, the operation at the time of the timer queue element 575 in the system 3 is completed. At this time, the timer queue elements 535 and 555 of the system 1 and the system 2 have not timed up. It needs to be reduced by minutes. Therefore, the first timer queue element 5 of each of the systems 1 and 2
A value obtained by subtracting 3 from the timer value 210 of the timer queue element 575 of the system 3 whose time has expired from 35 and 555 is reset as the timer value 210. In the case of the system 1, the timer value 210 is 10−3 = 7, and in the case of the system 2, the timer value 210 is 7−3 = 4.
Timer value 2 of each of the first timer queue elements 535 and 555
The content is 10. After resetting the timer value 210 of the head timer queue element of each of the systems 1 to 3, the minimum value is set as the hardware timer, and the timer table processing is completed. In the case of this example, since the timer value 210 of the system 3 is a minimum of 2, the hardware timer is set to 2. In this example, only one timer queue element 575 times up, but depending on the set timer value 210, the timer queue elements of a plurality of systems may time up simultaneously. in this case,
All the timer queue elements whose time is up are removed from the timer queue 540 or the like.

【0034】図7は本実施の形態1における処理をフロ
ーチャートで示す。図7において、各システム間でタイ
マーキュー540等の先頭タイマキュー要素535等の
値を比較する。ただし、タイマ管理テーブル530等の
システムの動作状態308により、システムが停止中ま
たは実装されていない場合、タイマキュー540等に有
効なタイマキュー要素が無い場合等で動作していないタ
イマキュー540等に対しては処理を行わない。この場
合は、タイマ管理テーブル530等の次システムへのポ
インタ304をたどって次のシステムのタイマキュー5
60等の処理を行う。同時にシステム種別310を記録
しておく(ステップS70)。タイマがタイムアップし
た時、先頭タイマキュー要素575等のタイマ値210
が最小のタイマキュー要素575等がタイムアップした
タイマキュー要素であるので、このタイマキュー要素5
75等タイマキュー580等から外す。2つのシステム
が同時にタイムアップする場合、すなわち先頭タイマキ
ュー要素575等の値が同じ場合は2つのタイマキュー
要素575等を外す。3つ以上同じ場合も同様に外す。
上述のシステム間でのタイマ値210の比較は、タイマ
管理テーブル530等の次システムへのポインタ304
をたどることにより行われる。したがってシステムを構
成するサブシステムの数によって本実施の形態の処理方
法が影響を受けることはない。システムの動作中にある
サブシステムが停止または削除されても、次システムへ
のポインタ304をたどって探索される際にそのシステ
ムがスキップされるだけであるため、他の動作中のサブ
システムの処理に影響を与えることはない。次に全サブ
システムの先頭タイマキュー要素535等のタイマ値2
10を補正する。初期設定としてシステム番号カウンタ
iをゼロクリアする(ステップS72)。全サブシステ
ムに対しての処理が終了するまでステップS76からS
79の処理を繰り返す(ステップS74)。まず、サブ
システムがタイムアップしたサブシステムかどうかを判
定する(ステップS76)。もしタイムアップしたサブ
システムならばタイマ値210の調整は不要であるの
で、ステップS79へとぶ。そうでない場合は、タイム
アップしてタイマキュー580等から外されたタイマキ
ュー要素575等の差分タイマ値210を、他のタイム
アップしなかったサブシステムの先頭タイマキュー要素
555等の差分タイマ値210から引く(ステップS7
8)。このデクリメントによりサブシステム間のタイマ
キュー540等ーの時間位相を合わせることができる。
次のサブシステムの先頭タイマキュー要素535等のタ
イマ値210の調整を行うために、システム番号カウン
タiに1を加算する(ステップS79)。ステップS7
4へ戻り、全サブシステムについて完了した場合は、先
頭タイマキュー要素555等のタイマ値210の内最小
の値を探して、ハードウェアタイマに設定する。
FIG. 7 is a flowchart showing the processing in the first embodiment. In FIG. 7, the values of the head timer queue element 535 of the timer queue 540 and the like are compared between the respective systems. However, depending on the operation state 308 of the system such as the timer management table 530, when the system is stopped or not mounted, the timer queue 540 or the like not operating when there is no valid timer queue element in the timer queue 540 or the like. No processing is performed for this. In this case, the pointer 304 to the next system in the timer management table 530 or the like is traced, and the timer queue 5 of the next system is read.
A process such as 60 is performed. At the same time, the system type 310 is recorded (step S70). When the timer times out, the timer value 210 such as the first timer queue element 575
Is the timer queue element whose time is up, such as the smallest timer queue element 575,
Remove it from timer queue 580 etc. When the two systems time up simultaneously, that is, when the values of the first timer queue element 575 and the like are the same, the two timer queue elements 575 and the like are removed. If three or more are the same, remove them in the same way.
The comparison of the timer value 210 between the above systems is performed by comparing the pointer 304 to the next system in the timer management table 530 or the like.
This is done by following Therefore, the processing method of the present embodiment is not affected by the number of subsystems constituting the system. Stopping or deleting a subsystem while the system is operating will only cause that system to be skipped when tracing the pointer 304 to the next system, so that processing of other operating subsystems Does not affect Next, the timer value 2 of the head timer queue element 535 etc. of all subsystems
Correct 10 As an initial setting, the system number counter i is cleared to zero (step S72). Until the processing for all subsystems is completed, steps S76 to S76 are performed.
Step 79 is repeated (step S74). First, it is determined whether or not the subsystem is a subsystem that has timed out (step S76). If the subsystem has timed out, the adjustment of the timer value 210 is unnecessary, and the process jumps to step S79. Otherwise, the difference timer value 210 of the timer queue element 575 or the like removed from the timer queue 580 or the like after the time-up is replaced with the difference timer value 210 of the head timer queue element 555 or the like of another subsystem that did not time-up. (Step S7)
8). By this decrement, the time phases of the timer queues 540 and the like between the subsystems can be adjusted.
In order to adjust the timer value 210 of the head timer queue element 535 of the next subsystem, etc., 1 is added to the system number counter i (step S79). Step S7
Returning to step 4, when the processing has been completed for all subsystems, a minimum value is searched for among the timer values 210 such as the head timer queue element 555 and the like, and the hardware timer is set.

【0035】上述の実施の形態1において、サブシステ
ムごと削除する場合は、先頭タイマキュー要素535等
をシステムキュー管理テーブル510につないで、その
タイマキュー管理テーブル532等の内容を空にするだ
けで実現できる。逆にシステムを新規に増設する場合
は、独立の新規なタイマキュー、タイマキュー管理テー
ブルおよびタイマ管理テーブルを生成して、このタイマ
管理テーブルをシステムキュー管理テーブル510の管
理する他のサブシステムのタイマ管理テ−ブルのリスト
に追加し、新規なシステムの動作状態を示すシステムの
動作状態308を動作中にするだけで実現できる。した
がって、既存の他の部分に全く影響を与えずに新規シス
テムの増設を行うことができる。
In the first embodiment, when deleting each subsystem, it is only necessary to connect the first timer queue element 535 and the like to the system queue management table 510 and empty the contents of the timer queue management table 532 and the like. realizable. Conversely, when a system is newly added, a new independent timer queue, a timer queue management table, and a timer management table are generated, and the timer management table is stored in a timer of another subsystem managed by the system queue management table 510. This can be realized by simply adding the system to the list of management tables and setting the system operation state 308 indicating the operation state of the new system to "operating". Accordingly, a new system can be added without affecting other existing parts at all.

【0036】以上より、実施の形態1によれば、複数の
サブシステムのタイマイベントを各サブシステム毎のタ
イマキューを用いて一元的に管理することにより、一つ
のハードウェアタイマーで複数の異なるサブシステムの
動作を実現することができる。
As described above, according to the first embodiment, the timer events of a plurality of subsystems are centrally managed using the timer queue of each subsystem, so that a single hardware timer can manage a plurality of different subsystems. The operation of the system can be realized.

【0037】実施の形態2.実施の形態2は、周期タイ
マイベントを一般のワンショット型タイマイベントと同
様に扱うことにり、周期タイマイベントとワンショット
型タイマイベントの管理を一元化することができるタイ
マ管理装置および方法を示す。以下、本実施の形態2を
図8ないし11を用いて説明する。制御データ構造は、
図1ないし5で示されたデータ構造等を使用する。タイ
マキュー540等において、1回だけ動作するワンショ
ット型タイマイベントと設定値により繰返し動作する周
期タイマイベントとを同時に扱うために、図2のタイマ
キュー要素200中に動作識別情報をタイマ動作種別2
14、周期起動時間216として設けている。タイマ動
作種別214が周期動作であるタイマキュー要素(以下
「周期タイマキュー要素」という。これと区別するため
にワンショット型タイマイベントに対応するタイマキュ
ー要素を特にワンショット型タイマキュー要素とい
う。)は、周期起動時間216毎に周期起動される。
Second Embodiment In the second embodiment, the management of the periodic timer event and the one-shot timer event can be unified by treating the periodic timer event in the same manner as a general one-shot timer event. 1 shows a timer management device and method. Hereinafter, the second embodiment will be described with reference to FIGS. The control data structure is
The data structure shown in FIGS. 1 to 5 is used. In the timer queue 540 or the like, in order to simultaneously handle a one-shot type timer event that operates only once and a periodic timer event that operates repeatedly according to a set value, the operation identification information is stored in the timer queue element 200 of FIG.
14, the cycle start time 216 is provided. A timer queue element whose timer operation type 214 is a periodic operation (hereinafter, referred to as a “periodic timer queue element”. A timer queue element corresponding to a one-shot timer event is particularly referred to as a one-shot timer queue element to be distinguished therefrom) Are periodically activated every cycle activation time 216.

【0038】図8は実施の形態2における周期タイマイ
ベントの動作を示す。図8において、タイマキューの先
頭の周期タイマキュー要素802(周期起動時間216
=10)がタイムアップしたとする。この時、周期タイ
マキュー要素802は、タイマキューの先頭から外され
るが、周期起動時間216(=10)後には再び起動さ
れるため、タイマキューの周期起動時間216(=1
0)後の位置810に再接続される。図8に示されるよ
うに、ワンショット型タイマキュー要素804、806
の後に周期起動のタイマ値を3として再接続される。
FIG. 8 shows the operation of the periodic timer event in the second embodiment. In FIG. 8, a periodic timer queue element 802 (a periodic activation time 216
= 10) has timed out. At this time, the periodic timer queue element 802 is removed from the head of the timer queue, but is activated again after the periodic activation time 216 (= 10).
0) Reconnect to later position 810. As shown in FIG. 8, one-shot timer queue elements 804, 806
After that, the connection is re-established with the timer value of the periodic activation set to 3.

【0039】図9は図8の動作をタイムチャートで示
す。図9に示されるように、周期タイマキュー要素80
2がタイムアップする時刻をTA、ワンショットタイマ
キュー要素804がタイムアップする時刻をTB、ワン
ショットタイマキュー要素806がタイムアップする時
刻をTC、ワンショットタイマキュー要素808がタイ
ムアップする時刻をTEとすると、再接続すべき周期タ
イマキュー要素810はその周期起動時間216が10
であるから、10−2−5=3の時間だけ経過した時刻
Dの位置に、タイマ値210を3に設定して再接続す
ればよいことがわかる。周期タイマキュー要素810を
再設定した後のタイマキューを、図10に示す。
FIG. 9 is a time chart showing the operation of FIG. As shown in FIG. 9, the periodic timer queue element 80
The time at which the time 2 is up is T A , the time at which the one-shot timer queue element 804 times up is T B , the time at which the one-shot timer queue element 806 times up is T C , and the one-shot timer queue element 808 times up. Assuming that the time is TE , the periodic timer queue element 810 to be reconnected has a periodic activation time 216 of 10
Since it is the position of the time T D which has elapsed 10-2-5 = 3 time, the timer value 210 it is understood that it may be re-connected using the 3. The timer queue after resetting the periodic timer queue element 810 is shown in FIG.

【0040】図11は、実施の形態2における周期タイ
マイベントの処理をフローチャートで示す。図11にお
いて、タイマがタイムアップした時、タイマ発行元へイ
ベント通知を行う(ステップS110)。この処理はワ
ンシヨット動作のタイマイベントと同じ処理である。次
に、周期タイマイベントのタイムアップかどうかを判断
し(ステップS112)、そうであればタイムアップし
た周期タイマイベントをタイマキューに再接続する(ス
テップS114)。周期タイマキュー要素の次のタイマ
キュー要素が無かった場合は、周期タイマイベントが再
びタイマキューの先頭に接続されることになる。最後に
先頭タイマキュー要素のタイマ値210をハードウェア
タイマに設定する(ステップS116)。ステップS1
12で周期タイマイベントのタイムアップでない場合は
直接ステップS116へとぶ。
FIG. 11 is a flowchart showing the processing of a periodic timer event in the second embodiment. In FIG. 11, when the timer expires, an event is notified to the timer issuer (step S110). This process is the same as the one-shot operation timer event. Next, it is determined whether the time of the periodic timer event has expired (step S112), and if so, the periodic timer event whose time has expired is reconnected to the timer queue (step S114). If there is no timer queue element next to the periodic timer queue element, the periodic timer event will be connected to the head of the timer queue again. Finally, the timer value 210 of the first timer queue element is set as a hardware timer (step S116). Step S1
If it is not time-up of the periodic timer event at 12, the process directly goes to step S116.

【0041】本実施の形態2によれば、同一の周期タイ
マイベントがタイマキュー上に2つ以上存在しないので
メモリを節約でき、かつタイマキューを探索する時間の
節約を図ることができる。周期タイマイベントを停止す
る場合は、タイマキュー上からその周期タイマイベント
を1つだけ削除すればよい。さらに、本実施の形態2に
より、ハードウェア的にタイマの最大カウント数(タイ
マのビット幅)が少ない場合でも、タイマキュー要素を
周期的に使うことにより、ハードウェア上の制約を無く
すことができる。例えば、タイマの分解能が10msで
周期起動時間が1時間を最長すると、1時間=60
(分)×60(秒/分)×100(カウント/秒)=3
60,000カウントであるから、この1時間の長期タ
イマイベントを実現するハードウェアタイマには約20
ビット必要となる。一方、実施の形態2によりこの周期
起動時間が1時間の長期タイマイベントを周期化して、
例えば10ms分解能で1分を最長とする周期タイマキ
ュー要素を用いると、1分=60秒×100(カウント
/秒)=6,000カウントとなる。したがって、この
1時間の長期タイマイベントを実現するハードウェアタ
イマは16ビットのビット幅で実現可能となり、約4ビ
ット少なくて済む。
According to the second embodiment, since two or more identical periodic timer events do not exist in the timer queue, memory can be saved and time for searching the timer queue can be saved. To stop the periodic timer event, only one of the periodic timer event needs to be deleted from the timer queue. Furthermore, according to the second embodiment, even when the maximum count number of the timer (the bit width of the timer) is small in hardware, hardware restrictions can be eliminated by using the timer queue element periodically. . For example, when the resolution of the timer is 10 ms and the cycle start time is the longest for one hour, one hour = 60
(Minute) × 60 (second / minute) × 100 (count / second) = 3
Since the count is 60,000, the hardware timer that realizes this one-hour long-term timer event has about 20
A bit is needed. On the other hand, according to the second embodiment, the long-term timer event having a periodic start time of one hour is cycled,
For example, if a periodic timer queue element with a maximum of 1 minute at a resolution of 10 ms is used, 1 minute = 60 seconds × 100 (counts / second) = 6,000 counts. Therefore, the hardware timer for realizing the one-hour long-term timer event can be realized with a bit width of 16 bits, and can be reduced by about 4 bits.

【0042】以上より、実施の形態2によれば、周期タ
イマイベントをワンショット型のタイマイベント化する
ことにより、一般のワンショット型タイマイベントと同
様に扱うことができるため、周期タイマイベントとワン
ショット型タイマイベントの管理を一元化することがで
きる。
As described above, according to the second embodiment, by converting a periodic timer event into a one-shot type timer event, it can be handled in the same manner as a general one-shot type timer event. Shot type timer event management can be unified.

【0043】実施の形態3.実施の形態3は、周期タイ
マイベント間の時間的位相合わせを行うことによってハ
ードウェアタイマのタイムアップ回数を減らすことがで
きるタイマ管理装置および方法を示す。以下、本実施の
形態3を図12(A)、(B)を用いて説明する。制御
データ構造は、図1ないし5で示されたデータ構造等を
使用する。
Embodiment 3 Embodiment 3 shows a timer management apparatus and method capable of reducing the number of times the hardware timer times out by performing temporal phase adjustment between periodic timer events. Hereinafter, the third embodiment will be described with reference to FIGS. The control data structure uses the data structure shown in FIGS.

【0044】図12(A)、(B)は実施の形態3にお
ける周期タイマイベントの動作をタイムチャートで示
す。図12(A)に示すように、例えば、周期起動時間
216が1秒毎の周期タイマイベント1と周期起動時間
216が2秒毎の周期タイマイベント2があるものとす
る。この場合、時間的位相合わせができていないと、す
なわちタイマイベント1とタイマイベント2とが非同期
であると、タイマイベント1がT2、T3、T5、T6
およびT8の計5回発生し、タイマイベント2がT1、
T4およびT7の計3回発生し、総計8回発生してい
る。
FIGS. 12A and 12B are time charts showing the operation of the periodic timer event in the third embodiment. As shown in FIG. 12A, for example, it is assumed that there is a periodic timer event 1 in which the periodic activation time 216 is every 1 second and a periodic timer event 2 in which the periodic activation time 216 is every 2 seconds. In this case, if the time phase adjustment is not performed, that is, if the timer event 1 and the timer event 2 are asynchronous, the timer event 1 becomes T2, T3, T5, and T6.
And T8, a total of 5 times, and timer event 2 is T1,
It occurs three times, T4 and T7, a total of eight times.

【0045】一方、図12(B)に示すように2つの周
期タイマイベント1およびタイマイベント2が発生する
時間的位相を合わせることによって、タイミングT1
2、T14およびT16で2つのタイマイベント1とタ
イマイベント2とを同時にタイムアップさせることがで
きる。これによって、タイマイベントの発生回数を8回
から5回に減らすことができる。以下、2つのタイマイ
ベントの時間的位相を合わせる方法について説明する。
図12(B)に示されるように、周期タイマイベント2
を起動させる時(Tz)は、タイマキュー上ですでに動
いている他の周期タイマイベント1の時間的位相に合わ
せてタイマイベント2の発行時間を調整し、タイマキュ
ーに接続を行う。タイマイベント2の登録を行う時(T
z)、他の周期タイマイベント1のタイムアップ時間T
12とTzとの差分Δt=T12−Tzを計算して、こ
のΔtを周期タイマイベント2の初めの(1回目の)タ
イマ値210として設定する。すなわちタイマ値210
=Δt、タイマ動作種別214=周期、周期起動時間2
16=周期起動したい時間等に設定する。このように他
の周期タイマイベント1の発生周期(=1)に同期する
ように、最初の1回だけタイマイベント2のタイマ値2
10を本来の周期起動時間216(=2)ではなくΔt
に設定する。T12で一度同期がとれると、後はT1
4、T16とも同期がとれていくことになる。この結果
ハードウェアタイマが発生するタイマ割り込みの回数を
減らすことができる。したがってタイマ割込み等により
CPUが起動されて消費される電力を減らすことができ
るため、携帯電話等の電池駆動型のシステムの場合には
大きく省電力化を測ることができる。
On the other hand, as shown in FIG. 12 (B), by adjusting the time phases at which the two periodic timer events 1 and 2 occur, the timing T1
At 2, T14 and T16, two timer events 1 and 2 can be simultaneously timed up. As a result, the number of occurrences of the timer event can be reduced from eight to five. Hereinafter, a method of adjusting the time phases of two timer events will be described.
As shown in FIG. 12B, the period timer event 2
Is activated (Tz), the issuance time of the timer event 2 is adjusted in accordance with the temporal phase of another periodic timer event 1 already running on the timer queue, and connection is made to the timer queue. When registering timer event 2 (T
z), time-up time T of other periodic timer event 1
The difference Δt between T 12 and Tz is calculated, and the Δt is set as the first (first) timer value 210 of the periodic timer event 2. That is, the timer value 210
= Δt, timer operation type 214 = cycle, cycle start time 2
16 = set to the time or the like to start periodically. As described above, the timer value of the timer event 2 is set only once at the first time so as to synchronize with the generation cycle (= 1) of the other periodic timer event 1.
10 is Δt instead of the original periodic start time 216 (= 2)
Set to. Once synchronization is achieved at T12,
4. Both T16 and T16 are synchronized. As a result, the number of timer interrupts generated by the hardware timer can be reduced. Therefore, since the power consumed by the activation of the CPU by a timer interrupt or the like can be reduced, the power saving can be largely measured in the case of a battery-driven system such as a mobile phone.

【0046】例えば、周期起動時間216が6の周期タ
イマイベントに周期起動時間216が12の周期タイマ
イベントと72のタイマイベントが追加される場合の動
作を説明する。周期起動時間216が6の周期に時間的
位相を合わせて、周期起動時間216が12,起動時間
216が72のタイマイベントを発行する。両タイマイ
ベントに対応するタイマキュー要素がタイマキューに接
続される。この場合、周期起動時間216の6、12、
72には最大公約数6があるので、周期起動時間216
が12、72の2つのタイマイベントを追加しても、C
PUがタイマイベントを処理するために起動される回数
は増えない。最大公約数があれば、メモリ等の条件を除
いて追加されるタイマイベントの数に制限はない。
For example, an operation in a case where a period timer event having a period start time 216 and a period timer event having a period start time 216 is added to a period timer event having a period start time 216 of 6 will be described. A timer event having a cycle start time 216 of 12 and a start time 216 of 72 is issued by adjusting the time phase to the cycle of the cycle start time 216 of 6. Timer queue elements corresponding to both timer events are connected to the timer queue. In this case, 6, 12, of the cycle start time 216,
Since 72 has a greatest common divisor of 6, the cyclic start time 216
Adds two timer events, 12, and 72,
The number of times that the PU is activated to process the timer event does not increase. If there is a greatest common divisor, there is no limit to the number of timer events to be added except for conditions such as memory.

【0047】逆に周期起動時間216が72のイベント
に周期起動時間216が6のタイマイベントを接続する
場合も同様である。周期起動時間216が72のイベン
トに周期起動時間216が6のタイマイベントを接続す
る場合、72と6との最大公約数は6であるので、周期
起動時間216が72のタイマイベントがタイムアップ
する時刻tから6×n時間を引いた数が0になる最大の
nを与えるタイミングで、周期起動時間216が6のイ
ベントを発行してタイマキューに接続すればよい。最大
のnを与えるタイミングとするのは、最も早いタイミン
グとするためである。
Conversely, the same applies to the case where a timer event whose cycle start time 216 is 6 is connected to an event whose cycle start time 216 is 72. In the case where a timer event whose cycle start time 216 is 6 is connected to an event whose cycle start time 216 is 72, since the greatest common divisor of 72 and 6 is 6, the timer event whose cycle start time 216 is 72 times out. At the timing when the maximum n obtained by subtracting 6.times.n time from the time t becomes 0, an event whose cycle start time 216 is 6 may be issued and connected to the timer queue. The timing for giving the maximum n is the earliest timing.

【0048】周期起動時間216が互いに素な場合の例
を示す。周期起動時間216が5のタイマイベントが動
作中に、周期起動時間216が3のタイマイベントを発
行するものとする。このとき周期起動時間216が5の
イベントと周期起動時間216が3のイベントとは互い
に素である、すなわち互いに素数で公約数かない。この
場合は、周期起動時間216が3と5との最小公倍数1
5(3×5)となる時間に2つのタイマイベントの発生
が重なるように、周期起動時間216が3のタイマイベ
ントの発行タイミングを調整すればよい。
An example in which the cycle start times 216 are disjoint is shown. It is assumed that a timer event whose periodical start time 216 is 3 is issued while a timer event whose periodical start time 216 is 5 is operating. At this time, the event whose cycle start time 216 is 5 and the event whose cycle start time 216 is 3 are relatively prime, that is, they are prime numbers and have no common divisor. In this case, the cycle start time 216 is the least common multiple of 1 between 3 and 5.
The issue timing of the timer event whose cycle start time 216 is 3 may be adjusted so that the occurrence of the two timer events overlaps the time of 5 (3 × 5).

【0049】以上より、実施の形態3によれば、周期タ
イマイベント間の時間的位相合わせを行うことによって
ハードウェアタイマのタイムアップ回数を減らすことが
できるため、タイマ割込み等によりCPUが起動されて
消費される電力を減らすことができる。
As described above, according to the third embodiment, the number of times the hardware timer times out can be reduced by performing the temporal phase adjustment between the periodic timer events, so that the CPU is activated by a timer interrupt or the like. Power consumption can be reduced.

【0050】実施の形態4.実施の形態4は、長時間ワ
ンショットタイマイベントを周期タイマイベント化する
ことによって、ハードウェアタイマの最大カウント数以
上の長時間タイマを実現することができるタイマ管理装
置および方法を示す。以下、本実施の形態4を図13
(A)ないし(C)、図14を用いて説明する。制御デ
ータ構造は、図1ないし5で示されたデータ構造等を使
用する。
Fourth Embodiment A fourth embodiment is directed to a timer management device capable of realizing a long timer having a count equal to or greater than the maximum count of a hardware timer by converting a long one-shot timer event into a periodic timer event. And the method. Hereinafter, the fourth embodiment will be described with reference to FIG.
(A) to (C) will be described with reference to FIG. The control data structure uses the data structure shown in FIGS.

【0051】図13(A)ないし(C)は、実施の形態
4における周期タイマイベントの動作をタイムチャート
で示す。図13(A)ないし(C)において、周期タイ
マイベントの繰返し周期を200msとし、長時間タイ
マ1050msを実現する場合について動作を説明す
る。この繰返し周期は、ハードウェアタイマの最長計測
範囲(ビット幅によって決まる範囲)によって決められ
ることが望ましい。
FIGS. 13A to 13C are time charts showing the operation of the periodic timer event in the fourth embodiment. 13 (A) to 13 (C), the operation will be described for a case where the repetition period of the periodic timer event is 200 ms and a long time timer of 1050 ms is realized. This repetition cycle is desirably determined by the longest measurement range (range determined by the bit width) of the hardware timer.

【0052】図13(A)は初回の長時間タイマイベン
ト1300の動作を示す。図13(A)に示されるよう
に、長時間タイマ1050msを繰り返し周期200m
sと繰り返し回数(回)に分解し、剰余がある場合はこ
の剰余を初回のタイマ値1310として設定する。上記
の例では長時間タイマ1050ms=200ms×5
(回)+50であるため、剰余が50であることよりタ
イマ値1310の初回設定値は50msとなる。タイマ
動作種別1311は長時間に設定する。周期起動時間1
312は初回タイマ値1310と同様に初回は50ms
に設定し、繰り返し回数1314は6回(=5回+1
回)と設定する。繰返し回数1314は、処理の都合上
1回余分に設定する。
FIG. 13A shows the operation of the first long time timer event 1300. As shown in FIG. 13 (A), the long-time timer 1050 ms is repeated for a period of 200 m.
It is decomposed into s and the number of repetitions (times), and if there is a remainder, this remainder is set as the first timer value 1310. In the above example, the long-time timer 1050ms = 200ms × 5
(Times) +50, and the first set value of the timer value 1310 is 50 ms because the remainder is 50. The timer operation type 1311 is set to a long time. Cycle start time 1
312 is 50 ms for the first time, like the initial timer value 1310
And the number of repetitions 1314 is 6 (= 5 + 1
Times). The number of repetitions 1314 is set one extra for convenience of processing.

【0053】図13(B)は1回目のタイムアップがあ
った場合の長時間タイマイベント1328の動作を示
す。図13(B)において、1回目のタイムアップ時の
経過時間は、1回目にタイマ値1310に設定した50
msである。長時間タイマイベントの残りの動作は、2
00msの繰り返し周期を繰り返し回数5回分タイムア
ップすればよい。この設定では図13(A)の剰余50
msの分ですでに1回タイムアップしており、その後繰
り返し周期200msで5回タイムアップすることにな
るため、計6回(=1+5)のタイムアップを行うこと
になる。これが繰返し回数1314を1回余分に設定し
た理由である。1回目の再接続処理は、まずタイムアッ
プした周期タイマキュー要素1300を外し、次に元か
ら接続されていた先頭タイマキュー要素1302から起
算して繰り返し周期が200msとなる位置に周期タイ
マキュー要素1328を再接続する。図13(B)の例
では、200ms−タイマキュー要素1302のタイマ
値(=10)−タイマキュー要素1304のタイマ値
(=20)−タイマキュー要素1306のタイマ値(=
100)=70となるため、タイマキュー要素1328
のタイマ値1330には70が設定される。周期起動時
間1332は200msと設定し、周期カウンタ133
4は5回に設定される。
FIG. 13B shows the operation of the long timer event 1328 when the first time-up occurs. In FIG. 13B, the elapsed time at the time of the first time-up is equal to the timer value 1310 set at the first time.
ms. The remaining operation of the long timer event is 2
What is necessary is to increase the time of the repetition cycle of 00 ms by five times. In this setting, the remainder 50 in FIG.
Since the time has already expired once for the time of ms, and the time has expired five times with the repetition period of 200 ms thereafter, the time is increased six times (= 1 + 5) in total. This is the reason why the number of repetitions 1314 is set one extra. In the first reconnection process, first, the period timer queue element 1300 whose time has expired is removed, and then the period timer queue element 1328 is located at a position where the repetition period becomes 200 ms starting from the head timer element 1302 connected from the beginning. To reconnect. In the example of FIG. 13B, 200 ms—the timer value of the timer queue element 1302 (= 10) —the timer value of the timer queue element 1304 (= 20) —the timer value of the timer queue element 1306 (=
100) = 70, so the timer queue element 1328
The timer value 1330 is set to 70. The cycle start time 1332 is set to 200 ms, and the cycle counter 133
4 is set to 5 times.

【0054】図13(C)は2回目のタイムアップがあ
った場合の長時間タイマイベント1348の動作を示
す。図13(C)において、まずタイムアップした周期
タイマキュー要素1330を外し、次に接続されていた
先頭タイマキュー要素1342から起算して繰り返し周
期が200msとなる位置に周期タイマキュー要素13
48を再接続する。図13(C)の例では、200ms
−タイマキュー要素1342のタイマ値(=80)−タ
イマキュー要素1344のタイマ値(=30)−タイマ
キュー要素1346のタイマ値(=10)=80となる
ため、タイマキュー要素1348のタイマ値1350に
は80が設定される。周期起動時間1352は200m
sのままであり、周期カウンタ1354は4回に設定さ
れる。周期カウンタ1354を1だけデクリメントする
と4となるが、まだ0とはならないので、図13(C)
と同様にして周期起動時間200msで設定し直してタ
イマキューに接続しなおす。以下5回目のタイムアップ
まで同様に繰り返す。6回目のタイムアップがあった場
合は、周期カウンタを1だけデクリメントすると0にな
るので、長時間ワンショットタイマイベントは完了した
ことになる。したがってこのときのタイマキュー要素を
タイマキューから外せばよく、周期タイマイベントのタ
イマキューへの再接続はもう必要ない。上述のように、
本実施の形態4のポイントは、初めの1回目に剰余をタ
イマ値として設定することにある。2回目以降の設定は
周期起動時間を設定する。設定する値が異なるが設定処
理方法は毎回同じである。
FIG. 13C shows the operation of the long timer event 1348 when the second time-up occurs. In FIG. 13C, first, the period timer queue element 1330 whose time has expired is removed, and the period timer queue element 1330 is located at a position where the repetition period becomes 200 ms starting from the head timer queue element 1342 connected thereto.
48 is reconnected. In the example of FIG. 13C, 200 ms
-Timer value of timer queue element 1342 (= 80)-Timer value of timer queue element 1344 (= 30)-Timer value of timer queue element 1346 (= 10) = 80, so timer value 1350 of timer queue element 1348 Is set to 80. The cycle start time 1352 is 200m
s, and the cycle counter 1354 is set to four times. When the period counter 1354 is decremented by 1, the value becomes 4, but it does not become 0 yet.
In the same manner as described above, the timer is set again at the cycle start time of 200 ms, and the timer queue is connected again. The same is repeated until the fifth time-up. When the sixth time-up occurs, the period counter is decremented by 1 and becomes 0, which means that the one-shot timer event has been completed for a long time. Therefore, the timer queue element at this time only needs to be removed from the timer queue, and reconnection of the periodic timer event to the timer queue is no longer necessary. As mentioned above,
The point of the fourth embodiment is that the remainder is set as a timer value at the first time. For the second and subsequent settings, the cycle start time is set. Although the value to be set is different, the setting processing method is the same every time.

【0055】図14は実施の形態4における処理のフロ
ーチャートを示す。図14において、周期カウンタ13
32等が0であるか否かを判断し(ステップS14
0)、0出ない場合はさらに剰余が0であるか否かを判
断する(ステップS140)。初回は剰余が0ではない
ため剰余値を元にタイマキューに接続する(ステップS
148)。1回目のタイムアップ以降は剰余値が0であ
るため、周期カウンタの値から1だけ引く(ステップS
144)。次に周期起動時間1332等を元にタイマキ
ューに再接続する(ステップS146)。周期カウンタ
が0になれば処理は終了である。
FIG. 14 shows a flowchart of the process in the fourth embodiment. In FIG. 14, the period counter 13
It is determined whether 32 or the like is 0 (step S14).
0), if not 0, it is further determined whether or not the remainder is 0 (step S140). In the first time, since the remainder is not 0, it is connected to the timer queue based on the remainder value (step S
148). Since the remainder value is 0 after the first time-up, 1 is subtracted from the value of the cycle counter (step S
144). Next, reconnection to the timer queue is performed based on the periodic activation time 1332 and the like (step S146). The process ends when the cycle counter becomes 0.

【0056】以上より、実施の形態4によれば、長時間
ワンショットタイマイベントを周期タイマイベント化す
ることによって、ハードウェアタイマの最大カウント数
以上の長時間タイマを実現することができる。
As described above, according to the fourth embodiment, by converting a long-time one-shot timer event into a periodic timer event, it is possible to realize a long-time timer that is equal to or more than the maximum count of the hardware timer.

【0057】実施の形態5.実施の形態5は、タイマキ
ューに接続されるタイマ値の精度を利用して一度にキュ
ーを外し、タイマイベントを統合化することできるタイ
マ管理装置および方法を示す。以下、本実施の形態5を
図15および図16を用いて説明する。制御データ構造
は、図1ないし5で示されたデータ構造等を使用する。
タイマ精度208には使用目的によって要求される精度
にばらつきがあるため、本実施の形態5では、この精度
のバラツキを利用してタイマイベントの発生回数を減ら
すものである。例えば、10msecタイマイベントが
タイムアップした時、その近傍にタイマ精度208が1
分であり、かつタイマ値210が1時間のタイマイベン
トがあった場合、10msecタイマイベントがタイム
アップすると同時に1時間タイマイベントをタイマキュ
ーから外しても、タイマの要求精度上、何ら問題ないと
考えられる。このような場合、タイマキューから外す、
すなわちタイムアップさせることによって、省電力化を
図ることができる。
Fifth Embodiment A fifth embodiment shows a timer management apparatus and method which can remove a queue at a time by using the accuracy of a timer value connected to a timer queue and integrate timer events. Hereinafter, the fifth embodiment will be described with reference to FIGS. 15 and 16. The control data structure uses the data structure shown in FIGS.
Since the accuracy required for the timer accuracy 208 varies depending on the purpose of use, in the fifth embodiment, the variation in the accuracy is used to reduce the number of occurrences of the timer event. For example, when a 10 msec timer event times out, the timer accuracy 208 becomes 1 near the timer event.
If the timer event is a minute and the timer value 210 is 1 hour, even if the 1 m timer event is removed from the timer queue at the same time as the 10 msec timer event times out, there is no problem in the required accuracy of the timer. Can be In such a case, remove it from the timer queue,
That is, power saving can be achieved by increasing the time.

【0058】図15は本実施の形態5の動作原理を示
す。図15に示されるように、タイマキュー要素A15
00は差分タイマ値210が100で動作するタイマイ
ベントに対応し、次に差分タイマ値210が2のタイマ
キュー要素B1510が接続されている。ここで先頭の
タイマキュー要素A1500がタイムアップしたとする
と、タイマキュー要素B1510を同時にタイムアップ
させたとしても、タイマキュー要素B1510のタイマ
値210は2であり許容誤差は10であるため、タイマ
キュー要素B1510の要求精度上何ら問題はない。こ
のようにタイマキュー要素A1500とタイマキュー要
素B1510とを同時にタイマキューーから外すことに
よって消費電力を削減することができる。図16は本実
施の形態5における処理のフローチャートを示す。図1
6に示されるように、まず先頭のタイマキュー要素外す
(ステップS160)。次のタイマキュー要素のタイマ
値と精度とを比較して(ステップS162)、タイマ値
が精度より小さい場合は、当該次のタイマキュー要素を
同時に外す(ステップS164)。この後、次の次にあ
たるタイマキュー要素をタイマキューの先頭の要素とす
るように接続する(ステップS168)。これによりこ
の先頭のタイマキュー要素のタイマ値がハードウェアタ
イマに設定される。ステップS162でタイマ値が精度
より大きい場合は何もしないで終了する。図16では図
示されていないが、本タイマテーブル処理が繰り返し呼
ばれることにより、タイマキュー要素のタイマ値が精度
より小さいタイマキュー要素を同時にタイムアップさせ
ていくことができる。
FIG. 15 shows the operation principle of the fifth embodiment. As shown in FIG. 15, the timer queue element A15
00 corresponds to a timer event in which the differential timer value 210 operates at 100, and the timer queue element B1510 having the differential timer value 210 of 2 is connected next. Here, assuming that the first timer queue element A 1500 has timed out, the timer value 210 of the timer queue element B 1510 is 2 and the allowable error is 10, even if the timer queue element B 1510 is simultaneously timed up. There is no problem in the required accuracy of the element B1510. Thus, power consumption can be reduced by simultaneously removing the timer queue element A1500 and the timer queue element B1510 from the timer queue. FIG. 16 shows a flowchart of the process in the fifth embodiment. FIG.
6, the first timer queue element is removed (step S160). The timer value of the next timer queue element is compared with the precision (step S162), and if the timer value is smaller than the precision, the next timer queue element is simultaneously removed (step S164). Thereafter, the connection is made such that the next next timer queue element is the first element of the timer queue (step S168). As a result, the timer value of the first timer queue element is set in the hardware timer. If the timer value is greater than the accuracy in step S162, the process ends without doing anything. Although not shown in FIG. 16, the timer table processing is repeatedly called, so that the timer queue elements whose timer values of the timer queue elements are smaller than the precision can be simultaneously timed up.

【0059】以上より、実施の形態5によれば、1つの
タイマイベントで同時に2つ以上のタイマ処理をおこな
うことができるため、タイマ割込み回数を減らすことが
でき、消費電流の低減化を達成することができる。
As described above, according to the fifth embodiment, two or more timer processes can be performed simultaneously by one timer event, so that the number of timer interrupts can be reduced and the current consumption can be reduced. be able to.

【0060】[0060]

【発明の効果】以上説明したように、本発明のタイマ管
理装置および方法によれば、複数システムのタイマイベ
ントを一元的に管理することにより、一つのタイマー装
置で複数の異なるシステム動作を実現することができる
タイマ管理装置および方法を提供することができる。周
期起動タイマイベントをワンショット型タイマイベント
と同様に扱うことにより、周期起動タイマイベントとワ
ンショット型タイマイベントの管理を一元化し、さらに
時間的位相差がある場合であってもタイマイベントの同
時発生を行わせることができ、タイマ割込みの回数を減
らしてタイマ割込みによるシステムの消費電流を減らす
ことができるタイマ管理装置および方法を提供すること
ができる。長時間タイマイベントを周期起動タイマイベ
ント化することにより、ハードウェアタイマのビット数
内で長時間タイマイベントを扱うことができるタイマ管
理装置および方法を提供することができる。さらに、タ
イマ値の精度を利用することにより、時間的にごく近傍
のタイマイベントを統合することができるタイマ管理装
置および方法を提供することができる。
As described above, according to the timer management apparatus and method of the present invention, a plurality of different system operations are realized by one timer apparatus by integrally managing the timer events of a plurality of systems. And a timer management device and method capable of performing the same. By treating periodic start timer events in the same way as one-shot timer events, management of periodic start timer events and one-shot timer events is unified, and even when there is a temporal phase difference, timer events occur simultaneously. Can be performed, and a timer management device and method can be provided which can reduce the number of timer interrupts and reduce the current consumption of the system due to the timer interrupts. By converting a long-time timer event into a periodic start timer event, it is possible to provide a timer management device and method capable of handling a long-time timer event within the number of bits of a hardware timer. Furthermore, by using the accuracy of the timer value, it is possible to provide a timer management device and method that can integrate timer events that are very close in time.

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

【図1】 実施の形態1ないし5におけるサブシステム
毎のタイマキューの構造を示す図である。
FIG. 1 is a diagram showing a structure of a timer queue for each subsystem according to the first to fifth embodiments.

【図2】 実施の形態1ないし5におけるタイマキュー
要素のデータ構造を示す図である。
FIG. 2 is a diagram showing a data structure of a timer queue element in the first to fifth embodiments.

【図3】 実施の形態1ないし5におけるタイマキュー
を管理するタイマ管理テーブルのデータ構造を示す図で
ある。
FIG. 3 is a diagram showing a data structure of a timer management table for managing a timer queue according to the first to fifth embodiments.

【図4】 実施の形態1ないし5における各システム毎
のタイマ管理テーブルを管理するシステムキュー管理テ
ーブルのデータ構造を示す図である。
FIG. 4 is a diagram showing a data structure of a system queue management table for managing a timer management table for each system according to the first to fifth embodiments.

【図5】 実施の形態1ないし5におけるシステムキュ
ー管理テーブル、タイマ管理テーブル、タイマキュー管
理テーブルおよびタイマキュー等の制御構造の関連を示
す図である。
FIG. 5 is a diagram showing the relationship between control structures such as a system queue management table, a timer management table, a timer queue management table, and a timer queue in the first to fifth embodiments.

【図6】 実施の形態1において、時刻Tiでタイマ割
込みが発生した状態を示すタイムチャートである。
FIG. 6 is a time chart showing a state in which a timer interrupt has occurred at time Ti in the first embodiment.

【図7】 実施の形態1における処理を示すフローチャ
ートである。
FIG. 7 is a flowchart showing a process according to the first embodiment.

【図8】 実施の形態2における周期タイマイベントの
動作を示す図である。
FIG. 8 is a diagram illustrating an operation of a periodic timer event according to the second embodiment.

【図9】 図8の動作を示すタイムチャートである。FIG. 9 is a time chart showing the operation of FIG.

【図10】 実施の形態2における周期タイマキュー要
素を再設定した後のタイマキューを示す図である。
FIG. 10 is a diagram showing a timer queue after resetting a periodic timer queue element according to the second embodiment.

【図11】 実施の形態2における周期タイマイベント
の処理を示すフローチャートである。
FIG. 11 is a flowchart showing processing of a periodic timer event according to the second embodiment.

【図12】 実施の形態3における周期タイマイベント
の動作を示すタイムチャートである。
FIG. 12 is a time chart illustrating an operation of a periodic timer event according to the third embodiment.

【図13】 実施の形態4における周期タイマイベント
の動作を示すタイムチャートである。
FIG. 13 is a time chart illustrating an operation of a periodic timer event according to the fourth embodiment.

【図14】 実施の形態4における処理のフローチャー
トである。
FIG. 14 is a flowchart of a process according to the fourth embodiment.

【図15】 実施の形態5の動作原理を示す図である。FIG. 15 is a diagram illustrating an operation principle of the fifth embodiment.

【図16】 実施の形態5における処理のフローチャー
トである。
FIG. 16 is a flowchart of a process according to the fifth embodiment.

【図17】 タスクの状態遷移を示す図である。FIG. 17 is a diagram showing a state transition of a task.

【図18】 従来リアルタイムOSにおけるタイマイベ
ントのタイマー管理テーブルを示す図である。
FIG. 18 is a diagram illustrating a timer management table of a timer event in a conventional real-time OS.

【図19】 従来のタイマ割込み処理を説明するための
2つのサブシステムから構成されるシステムの例を示す
図である。
FIG. 19 is a diagram illustrating an example of a system including two subsystems for explaining conventional timer interrupt processing.

【図20】 従来のタイマ割込み処理のフローチャート
である。
FIG. 20 is a flowchart of a conventional timer interrupt process.

【図21】 従来使用されている差分タイマキューのデ
ータ構造を示す図である。
FIG. 21 is a diagram showing a data structure of a difference timer queue conventionally used.

【図22】 従来のタイマキューの設定方法を通して差
分タイマの動作を説明する図である。
FIG. 22 is a diagram illustrating the operation of a difference timer through a conventional timer queue setting method.

【図23】 従来の差分タイマキューを用いた処理のフ
ローチャートである。
FIG. 23 is a flowchart of a conventional process using a difference timer queue.

【図24】 従来の周期起動タスクの管理テーブルを示
す図である。
FIG. 24 is a diagram showing a conventional management table of periodic activation tasks.

【図25】 従来のタスク管理方法におけるタスクの動
作を示す図である。
FIG. 25 is a diagram showing an operation of a task in a conventional task management method.

【符号の説明】 100、540、560、580、2100 タイマキ
ュー、 102、2102 先頭キュー、 104、5
20、2104 空きキュー、 110、200、53
5、555、575、577 タイマキュー要素、 3
00、530、550、570、1920 タイマ管理
テーブル、 400、510 システムキュー管理テー
ブル、 532、552、572 タイマキュー管理
テーブル、 802、810 周期タイマキュー要素、
804、806、808、1302、1304、13
06、1342、1344、1346、1500、15
10 ワンショット型タイマキュー要素、 1300、
1328、1348 長時間タイマキュー要素、 17
00 実行状態、 1710 実行待ち状態、 172
0 休眠状態、 1850、2450 タイマテーブ
ル、 1900、1910 システム、 2500 周
期起動時間、 2550、2600 タスク動作時間。
[Description of Signs] 100, 540, 560, 580, 2100 Timer queue, 102, 2102 Head queue, 104, 5
20, 2104 free queue, 110, 200, 53
5, 555, 575, 577 timer queue element, 3
00, 530, 550, 570, 1920 Timer management table, 400, 510 System queue management table, 532, 552, 572 Timer queue management table, 802, 810 Period timer queue element,
804, 806, 808, 1302, 1304, 13
06, 1342, 1344, 1346, 1500, 15
10 One-shot type timer queue element, 1300,
1328, 1348 Long time timer queue element, 17
00 execution state, 1710 execution waiting state, 172
0 Sleeping state, 1850, 2450 timer table, 1900, 1910 system, 2500 cycle start time, 2550, 2600 task operation time.

Claims (12)

【特許請求の範囲】[Claims] 【請求項1】 タイマイベントを待ち行列により管理す
るタイマ管理装置であって、該タイマ管理装置は、 タイマイベントに対応するタイマキュー要素をタイマイ
ベントの発行元別に待ち行列により保持する1つ以上の
タイマキュー手段であって、該タイマキュー要素はタイ
マイベントのタイムアップ時刻と該タイマキューに接続
された時刻との差分をタイマ値として有するものと、 タイマ割込みが発生した場合、1つ以上の前記タイマキ
ュー手段について、別個のタイマキュー手段の先頭に保
持された別個のタイマキュー要素が有するタイマ値の中
で最小のタイマ値を有する最小タイマキュー要素を選択
する選択手段と、 前記最小タイマキュー要素を保持するタイマキュー手段
について、該最小タイマキュー要素の次に保持されたタ
イマキュー要素を先頭に保持し、該最小タイマキュー要
素を該タイマキュー手段から削除する並べ替え手段と、 前記最小タイマキュー要素が保持されたタイマキュー手
段と異なる他のタイマキュー手段について、各タイマキ
ュー手段の先頭に保持された各タイマキュー要素が有す
るタイマ値から前記最小のタイマ値を減じた値を新たに
タイマ値として再設定する再設定手段とを備えたことを
特徴とするタイマ管理装置。
1. A timer management device for managing timer events by means of a queue, wherein the timer management device stores one or more timer queue elements corresponding to the timer events in a queue for each of the sources of the timer events. Timer queue means, wherein the timer queue element has, as a timer value, a difference between a time-up time of a timer event and a time at which the timer queue is connected to the timer queue; Selecting means for selecting the smallest timer queue element having the smallest timer value among the timer values of the separate timer queue elements held at the head of the separate timer queue means; For the timer queue means for holding the timer queue, the timer queue held next to the minimum timer queue element Rearranging means for holding the queue element at the head and deleting the minimum timer queue element from the timer queue means; and timer queue means different from the timer queue means holding the minimum timer queue element. A timer management device comprising: resetting means for resetting a value obtained by subtracting the minimum timer value from the timer value of each timer queue element held at the head of the means as a new timer value.
【請求項2】 前記別個のタイマキュー手段に各々対応
する別個のタイマキュー管理テーブル手段と、 前記別個のタイマキュー管理テーブル手段を所定の順に
管理するシステムキュー管理テーブル手段とをさらに備
え、前記選択手段は、該所定の順に別個の前記タイマキ
ュー管理テーブル手段を選択し、選択された別個の前記
タイマキュー管理テーブル手段に対応する別個の前記タ
イマキュー手段について最小タイマキュー要素を選択す
ることを特徴とする請求項1記載のタイマ管理装置。
2. The system further comprising: separate timer queue management table means respectively corresponding to the separate timer queue means; and system queue management table means for managing the separate timer queue management table means in a predetermined order. Means for selecting the separate timer queue management table means in the predetermined order and selecting a minimum timer queue element for the separate timer queue means corresponding to the selected separate timer queue management table means. The timer management device according to claim 1, wherein
【請求項3】 前記システムキュー管理テーブル手段
は、前記タイマキュー管理テーブルに対応するタイマイ
ベントの発行元の動作状態が変化した場合、前記タイマ
キュー管理テーブルとは異なる他のタイマキュー管理テ
ーブルを独立して管理することを特徴とする請求項2記
載のタイマ管理装置。
3. The system queue management table means, when an operation state of a timer event issuing source corresponding to the timer queue management table changes, separates another timer queue management table different from the timer queue management table. 3. The timer management device according to claim 2, wherein the timer management device manages the timer.
【請求項4】 前記システムキュー管理テーブル手段
は、前記タイマキュー管理テーブルに対応するタイマイ
ベントの発行元の存在状態が変化した場合、前記タイマ
キュー管理テーブルとは異なる他のタイマキュー管理テ
ーブルを独立して管理することを特徴とする請求項2記
載のタイマ管理装置。
4. The system queue management table means according to claim 1, wherein, when the presence state of the issue source of the timer event corresponding to the timer queue management table changes, another timer queue management table different from the timer queue management table becomes independent. 3. The timer management device according to claim 2, wherein the timer management device manages the timer.
【請求項5】 前記並べ替え手段は、前記タイマキュー
手段から削除された前記最小タイマキュー要素が所定の
周期時間毎に起動される周期的タイマイベントに対応す
る場合、削除された前記最小タイマキュー要素を前記タ
イマキュー手段中の該所定の周期時間後に対応する位置
に再接続することを特徴とする請求項1記載のタイマ管
理装置。
5. The reordering means, wherein when the minimum timer queue element deleted from the timer queue means corresponds to a periodic timer event activated every predetermined period of time, the deleted minimum timer queue element is deleted. 2. The timer management apparatus according to claim 1, wherein an element is reconnected to a position in the timer queue means corresponding to the predetermined period of time.
【請求項6】 タイマイベントに対応するタイマキュー
要素を新たに前記タイマキュー手段へ接続する接続手段
をさらに備え、 該接続手段は、第1周期時間毎に起動される周期的タイ
マイベントに対応した第1タイマキュー要素が既に前記
タイマキュー手段に接続されている状態で、第1周期時
間と所定の関係を有する第2周期時間毎に起動される周
期的タイマイベントに対応した第2タイマキュー要素を
新たに前記タイマキュー手段に接続する場合、第1タイ
マキュー要素の最も早いタイムアップ時刻と第2タイマ
キュー要素の第1回目のタイムアップ時刻を同時刻にす
る接続をし、1回のタイマ割込みで第1タイマキュー要
素および第2タイマキュー要素を同時にタイムアップさ
せる回数を増やし、タイマ割込みによる消費電流を減ら
すことを特徴とする請求項1記載のタイマ管理装置。
6. A connection device for connecting a timer queue element corresponding to a timer event to the timer queue unit, the connection unit corresponding to a periodic timer event activated every first period of time. A second timer queue element corresponding to a periodic timer event activated every second cycle time having a predetermined relationship with the first cycle time in a state where the first timer queue element is already connected to the timer queue means; Is newly connected to the timer queue means, a connection is made so that the earliest time-up time of the first timer queue element and the first time-up time of the second timer queue element are the same, and one timer Increase the number of times that the first timer queue element and the second timer queue element are simultaneously timed up by an interrupt, and reduce the current consumption due to the timer interrupt Timer management apparatus according to claim 1, wherein the door.
【請求項7】 第2周期時間の有する第1周期時間との
前記所定の関係は第2周期時間が第1周期時間の倍数で
ある関係であり、前記接続手段は、第1タイマキュー要
素がタイムアップする最も早い時刻から現時刻を引いた
値を第2タイマキュー要素の第1回目のタイマ値として
接続し、第1タイマキュー要素のタイムアップ時刻と第
2タイマキュー要素のタイムアップ時刻を同時刻にする
ことを特徴とする請求項6記載のタイマ管理装置。
7. The predetermined relationship between the second cycle time and the first cycle time is a relationship in which the second cycle time is a multiple of the first cycle time, and the connection means includes a first timer queue element. The value obtained by subtracting the current time from the earliest time when the time is up is connected as the first timer value of the second timer queue element, and the time up time of the first timer queue element and the time up time of the second timer queue element are calculated. 7. The timer management device according to claim 6, wherein the timers are set at the same time.
【請求項8】 第2周期時間の有する第1周期時間との
前記所定の関係は第2周期時間が第1周期時間の約数で
ある関係であり、前記接続手段は、第1タイマキュー要
素がタイムアップする最も早い時刻から第2周期時間の
整数倍を引いた時刻が現時刻より遅くならない最も早い
時刻に第2タイマキュー要素を接続することを特徴とす
る請求項6記載のタイマ管理装置。
8. The predetermined relationship between the second cycle time and the first cycle time, wherein the second cycle time is a divisor of the first cycle time, and the connecting means includes a first timer queue element. 7. The timer management apparatus according to claim 6, wherein the second timer queue element is connected to the earliest time at which the time obtained by subtracting an integral multiple of the second cycle time from the earliest time at which the time is up does not become later than the current time. .
【請求項9】 第2周期時間の有する第1周期時間との
前記所定の関係は第2周期時間が第1周期時間と互いに
素である関係であり、前記接続手段は、第1周期時間と
第2周期時間との最小公倍数となる周期時間毎に第1タ
イマキュー要素と第2タイマキュー要素とが同時にタイ
ムアップするように接続することを特徴とする請求項6
記載のタイマ管理装置。
9. The predetermined relationship between the second cycle time and the first cycle time is a relationship in which the second cycle time is relatively prime to the first cycle time, and the connection means includes a first cycle time and a first cycle time. 7. The connection according to claim 6, wherein the first timer queue element and the second timer queue element are simultaneously connected at every cycle time that is a least common multiple of the second cycle time.
The timer management device according to the above.
【請求項10】 所定の起動時間を有するタイマイベン
トに対応するタイマキュー要素を新たに前記タイマキュ
ー手段へ接続する接続手段をさらに備え、該接続手段
は、前記タイマキュー要素を前記所定の起動時間に基づ
く周期時間と繰り返し回数を有し、該周期時間毎に該繰
り返し回数分起動される周期的タイマイベントに対応す
る周期的タイマキュー要素に変換して接続することを特
徴とする請求項1記載のタイマ管理装置。
10. A connection means for newly connecting a timer queue element corresponding to a timer event having a predetermined activation time to said timer queue means, said connection means connecting said timer queue element to said predetermined activation time. 2. A periodic timer queue element corresponding to a periodic timer event that is activated by the number of repetitions for each of the periodic times, and is connected thereto. Timer management device.
【請求項11】 前記タイマキュー要素は前記タイマ値
に対する許容誤差をさらに備え、 前記並べ替え手段は、前記最小タイマキュー要素を保持
するタイマキュー手段について、該最小タイマキュー要
素の次に保持されたタイマキュー要素の有する前記許容
誤差が前記タイマ値から前記最小のタイマ値を減じた値
より小さい場合、該次に保持されたタイマキュー要素を
該最小タイマキュー要素と共に該タイマキュー手段から
削除することを特徴とする請求項1記載のタイマ管理装
置。
11. The timer queue element further includes an allowable error with respect to the timer value, wherein the rearranging unit is configured to hold the minimum timer queue element next to the minimum timer queue element. When the allowable error of the timer queue element is smaller than a value obtained by subtracting the minimum timer value from the timer value, deleting the next held timer queue element together with the minimum timer queue element from the timer queue means. The timer management device according to claim 1, wherein:
【請求項12】 タイマイベントを待ち行列により管理
するタイマ管理方法であって、該タイマ管理方法は、 タイマイベントに対応し、該タイマイベントのタイムア
ップ時間に応じたタイマ値を有するタイマキュー要素を
該タイマイベントの発行元別に待ち行列により1つ以上
のタイマキュー手段に保持するステップと、 タイマイベントに応じたタイマ割込みが発生した場合、
1つ以上の前記タイマキュー手段について、別個のタイ
マキュー手段の先頭に保持された別個のタイマキュー要
素が有するタイマ値の中で最小のタイマ値を有する最小
タイマキュー要素を選択する選択ステップと、 前記最小タイマキュー要素を保持するタイマキュー手段
について、該最小タイマキュー要素の次に保持されたタ
イマキュー要素を先頭に保持し、該最小タイマキュー要
素を該タイマキュー手段から削除する並べ替えステップ
と、 前記最小タイマキュー要素が保持されたタイマキュー手
段と異なる他のタイマキュー手段について、各タイマキ
ュー手段の先頭に保持された各タイマキュー要素が有す
るタイマ値から前記最小のタイマ値を減じた値を新たに
タイマ値として再設定する再設定ステップとを備えたこ
とを特徴とするタイマ管理方法。
12. A timer management method for managing timer events by means of a queue, wherein the timer management method includes a timer queue element corresponding to a timer event and having a timer value corresponding to a time-up time of the timer event. Holding in one or more timer queue means by a queue for each issuer of the timer event, and when a timer interrupt corresponding to the timer event occurs,
Selecting, for one or more of the timer queue means, a minimum timer queue element having a minimum timer value among timer values of the separate timer queue elements held at the head of the separate timer queue means; A timer queue means for holding the minimum timer queue element, a rearranging step of holding the timer queue element held next to the minimum timer queue element at the head and deleting the minimum timer queue element from the timer queue means; A value obtained by subtracting the minimum timer value from the timer value of each timer queue element held at the head of each timer queue means for another timer queue means different from the timer queue means holding the minimum timer queue element. Resetting step of resetting a new timer value as a timer value. Management method.
JP11065502A 1999-03-11 1999-03-11 Device and method for managing timer Pending JP2000259429A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP11065502A JP2000259429A (en) 1999-03-11 1999-03-11 Device and method for managing timer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP11065502A JP2000259429A (en) 1999-03-11 1999-03-11 Device and method for managing timer

Publications (1)

Publication Number Publication Date
JP2000259429A true JP2000259429A (en) 2000-09-22

Family

ID=13288928

Family Applications (1)

Application Number Title Priority Date Filing Date
JP11065502A Pending JP2000259429A (en) 1999-03-11 1999-03-11 Device and method for managing timer

Country Status (1)

Country Link
JP (1) JP2000259429A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6260642A (en) * 1985-09-11 1987-03-17 日立電線株式会社 Composite waterproof sheet
JP2005235228A (en) * 2004-02-20 2005-09-02 Sony Computer Entertainment Inc Method and apparatus for task management in multiprocessor system
US7050940B2 (en) 2004-03-17 2006-05-23 International Business Machines Corporation Method and system for maintaining and examining timers for network connections
JP2006134318A (en) * 2004-10-21 2006-05-25 General Electric Co <Ge> Event based operating system, method and apparatus for instrumentation and control systems
US7536580B2 (en) 2006-02-20 2009-05-19 Fujitsu Limited System and method for generating timer output corresponding to timer request from plurality of processes
JP2010033245A (en) * 2008-07-28 2010-02-12 Nippon Signal Co Ltd:The Duplicated data processing circuit
JP2011186591A (en) * 2010-03-05 2011-09-22 Renesas Electronics Corp Processor and control method therefor
US8028292B2 (en) 2004-02-20 2011-09-27 Sony Computer Entertainment Inc. Processor task migration over a network in a multi-processor system
CN103150246A (en) * 2011-12-07 2013-06-12 索尼电脑娱乐公司 Electronic device and method for setting time of timer
JP2015022649A (en) * 2013-07-22 2015-02-02 大日本印刷株式会社 Processing unit, processing method and processing program
WO2015071978A1 (en) * 2013-11-13 2015-05-21 富士通株式会社 Event management program, event management method, and distributed system
US20160302255A1 (en) * 2015-04-10 2016-10-13 Kabushiki Kaisha Toshiba Sensor data collecting device
JP2018503276A (en) * 2014-09-26 2018-02-01 インテル コーポレイション Variable interval for periodic positioning requests for multiple clients

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6260642A (en) * 1985-09-11 1987-03-17 日立電線株式会社 Composite waterproof sheet
JP2005235228A (en) * 2004-02-20 2005-09-02 Sony Computer Entertainment Inc Method and apparatus for task management in multiprocessor system
JP4526412B2 (en) * 2004-02-20 2010-08-18 株式会社ソニー・コンピュータエンタテインメント Task management method and apparatus in multiprocessor system
US8028292B2 (en) 2004-02-20 2011-09-27 Sony Computer Entertainment Inc. Processor task migration over a network in a multi-processor system
US7050940B2 (en) 2004-03-17 2006-05-23 International Business Machines Corporation Method and system for maintaining and examining timers for network connections
JP2006134318A (en) * 2004-10-21 2006-05-25 General Electric Co <Ge> Event based operating system, method and apparatus for instrumentation and control systems
US7536580B2 (en) 2006-02-20 2009-05-19 Fujitsu Limited System and method for generating timer output corresponding to timer request from plurality of processes
JP2010033245A (en) * 2008-07-28 2010-02-12 Nippon Signal Co Ltd:The Duplicated data processing circuit
JP2011186591A (en) * 2010-03-05 2011-09-22 Renesas Electronics Corp Processor and control method therefor
JP2013120130A (en) * 2011-12-07 2013-06-17 Sony Computer Entertainment Inc Electronic equipment and timer time setting method
CN103150246A (en) * 2011-12-07 2013-06-12 索尼电脑娱乐公司 Electronic device and method for setting time of timer
US9292071B2 (en) 2011-12-07 2016-03-22 Sony Corporation Electronic device and method for setting time of timer
JP2015022649A (en) * 2013-07-22 2015-02-02 大日本印刷株式会社 Processing unit, processing method and processing program
WO2015071978A1 (en) * 2013-11-13 2015-05-21 富士通株式会社 Event management program, event management method, and distributed system
JP6056986B2 (en) * 2013-11-13 2017-01-11 富士通株式会社 Event management program, event management method, and distributed system
US9733997B2 (en) 2013-11-13 2017-08-15 Fujitsu Limited Event management method and distributed system
JP2018503276A (en) * 2014-09-26 2018-02-01 インテル コーポレイション Variable interval for periodic positioning requests for multiple clients
US20160302255A1 (en) * 2015-04-10 2016-10-13 Kabushiki Kaisha Toshiba Sensor data collecting device
CN106055068A (en) * 2015-04-10 2016-10-26 株式会社东芝 Sensor data collecting device
US9839064B2 (en) 2015-04-10 2017-12-05 Kabushiki Kaisha Toshiba Sensor data collecting device
CN106055068B (en) * 2015-04-10 2019-06-11 株式会社东芝 Sensor data collection device

Similar Documents

Publication Publication Date Title
EP2230603B1 (en) Method and apparatus for timing and event processing in wireless systems
JP2000259429A (en) Device and method for managing timer
JP2002517035A (en) Distributed computing environment using real-time scheduling logic and time-deterministic architecture
TWI441083B (en) Apparatus for performing timer management and associated method
US6434708B1 (en) Programmable timer &amp; methods for scheduling time slices executed by a controller circuit
US8458508B2 (en) Information processing device which specifies a waiting time until execution of a given event and makes a system call
CN116089049B (en) Asynchronous parallel I/O request-based process synchronous scheduling method, device and equipment
US7085948B2 (en) Method, apparatus, and computer program product for implementing time synchronization correction in computer systems
CN114546926A (en) Core cluster synchronization, control method, data processing method, core, device, and medium
JP3123998B2 (en) Single-chip microcomputer with built-in A / D conversion function
US20050177660A1 (en) Method and system for merged rate-smoothing buffer with burst buffer
JP3075646B2 (en) Task activation method
JP2002358139A (en) Low power consumption processor
JP2003162412A (en) Power-saving circuit for cpu
JPS60187277A (en) Drive device for motor
JPH07325800A (en) Data flow processor
CN115551059A (en) Communication method and device of multi-mode chip, electronic equipment and readable storage medium
JPH1063545A (en) Information storing device
JP2008243220A (en) Information processing communication device
JPH0432922A (en) Interface control circuit
JPH04271448A (en) Bus monitoring device
JPS6013216B2 (en) complex computing device
JPH04313124A (en) Task execution control system
JPH07281991A (en) Data transfer device
JPH04255126A (en) Data sampling system