time_event.h

タイムイベント管理モジュール [詳細]

このグラフは、どのファイルから直接、間接的にインクルードされているかを示しています。

ソースコードを見る。

データ構造

struct  time_event_block
struct  time_event_node

マクロ定義

#define TMAX_RELTIM   ((((EVTTIM) 1) << (sizeof(EVTTIM) * CHAR_BIT - 1)) - 1)
#define base_time   ((EVTTIM)(next_time + (next_subtime > 0 ? 1 : 0)))

型定義

typedef UW EVTTIM
typedef void(*) CBACK (VP)
typedef time_event_block TMEVTB
typedef time_event_node TMEVTN

関数

void tmevt_initialize (void)
UINT tmevt_up (UINT index, EVTTIM time)
UINT tmevt_down (UINT index, EVTTIM time)
void tmevtb_insert (TMEVTB *tmevtb, EVTTIM time)
void tmevtb_delete (TMEVTB *tmevtb)
Inline void tmevtb_enqueue (TMEVTB *tmevtb, RELTIM time, CBACK callback, VP arg)
Inline void tmevtb_enqueue_evttim (TMEVTB *tmevtb, EVTTIM time, CBACK callback, VP arg)
Inline void tmevtb_dequeue (TMEVTB *tmevtb)

変数

TMEVTN tmevt_heap []
SYSTIM systim_offset
SYSTIM current_time
SYSTIM next_time
UINT next_subtime
UINT last_index


説明

タイムイベント管理モジュール

time_event.h で定義されています。


マクロ定義

#define base_time   ((EVTTIM)(next_time + (next_subtime > 0 ? 1 : 0)))

time_event.h122 行で定義されています。

参照元 sta_cyc()tmevtb_enqueue().

#define TMAX_RELTIM   ((((EVTTIM) 1) << (sizeof(EVTTIM) * CHAR_BIT - 1)) - 1)

time_event.h59 行で定義されています。

参照元 dly_tsk()tmevtb_enqueue().


型定義

typedef void(*) CBACK(VP)

time_event.h64 行で定義されています。

typedef UW EVTTIM

time_event.h54 行で定義されています。

typedef struct time_event_block TMEVTB

typedef struct time_event_node TMEVTN


関数

UINT tmevt_down ( UINT  index,
EVTTIM  time 
)

time_event.c165 行で定義されています。

参照先 EVTTIM_LEEVTTIM_LTlast_indexLCHILDTMEVT_NODE.

参照元 tmevtb_delete()tmevtb_delete_top().

00166 {
00167         UINT    child;
00168 
00169         while ((child = LCHILD(index)) <= last_index) {
00170                 /*
00171                  *  左右の子ノードのイベント発生時刻を比較し,早い方の
00172                  *  子ノードの位置を child に設定する.以下の子ノード
00173                  *  は,ここで選ばれた方の子ノードのこと.
00174                  */
00175                 if (child + 1 <= last_index
00176                         && EVTTIM_LT(TMEVT_NODE(child + 1).time,
00177                                   TMEVT_NODE(child).time)) {
00178                         child = child + 1;
00179                 }
00180 
00181                 /*
00182                  *  子ノードのイベント発生時刻の方が遅い(または同じ)
00183                  *  ならば,index が挿入位置なのでループを抜ける.
00184                  */
00185                 if (EVTTIM_LE(time, TMEVT_NODE(child).time)) {
00186                         break;
00187                 }
00188 
00189                 /*
00190                  *  子ノードを index の位置に移動させる.
00191                  */
00192                 TMEVT_NODE(index) = TMEVT_NODE(child);
00193                 TMEVT_NODE(index).tmevtb->index = index;
00194 
00195                 /*
00196                  *  index を子ノードの位置に更新.
00197                  */
00198                 index = child;
00199         }
00200         return(index);
00201 }

void tmevt_initialize ( void   ) 

time_event.c99 行で定義されています。

参照先 current_timelast_indexnext_subtimenext_timesystim_offsetTIC_DENOTIC_NUME.

参照元 kernel_start().

00100 {
00101         systim_offset = 0;
00102         current_time = 0;
00103 #if TIC_DENO == 1
00104         next_time = current_time + TIC_NUME;
00105 #else /* TIC_DENO == 1 */
00106         next_subtime += TIC_NUME;
00107         next_time = current_time + next_subtime / TIC_DENO;
00108         next_subtime %= TIC_DENO;
00109 #endif /* TIC_DENO == 1 */
00110         last_index = 0;
00111 }

UINT tmevt_up ( UINT  index,
EVTTIM  time 
)

time_event.c125 行で定義されています。

参照先 EVTTIM_LEPARENTTMEVT_NODE.

参照元 tmevtb_delete()tmevtb_insert().

00126 {
00127         UINT    parent;
00128 
00129         while (index > 1) {
00130                 /*
00131                  *  親ノードのイベント発生時刻の方が早い(または同じ)
00132                  *  ならば,index が挿入位置なのでループを抜ける.
00133                  */
00134                 parent = PARENT(index);
00135                 if (EVTTIM_LE(TMEVT_NODE(parent).time, time)) {
00136                         break;
00137                 }
00138 
00139                 /*
00140                  *  親ノードを index の位置に移動させる.
00141                  */
00142                 TMEVT_NODE(index) = TMEVT_NODE(parent);
00143                 TMEVT_NODE(index).tmevtb->index = index;
00144 
00145                 /*
00146                  *  index を親ノードの位置に更新.
00147                  */
00148                 index = parent;
00149         }
00150         return(index);
00151 }

void tmevtb_delete ( TMEVTB tmevtb  ) 

time_event.c239 行で定義されています。

参照先 EVTTIM_LTtime_event_block::indexlast_indexPARENTtmevt_down()TMEVT_NODEtmevt_up().

参照元 tmevtb_dequeue().

00240 {
00241         UINT    index = tmevtb->index;
00242         UINT    parent;
00243         EVTTIM  event_time = TMEVT_NODE(last_index).time;
00244 
00245         /*
00246          *  削除によりタイムイベントヒープが空になる場合は何もしない.
00247          */
00248         if (--last_index == 0) {
00249                 return;
00250         }
00251 
00252         /*
00253          *  削除したノードの位置に最後のノード(last_index + 1 の位置
00254          *  のノード)を挿入し,それを適切な位置へ移動させる.実際には,
00255          *  最後のノードを実際に挿入するのではなく,削除したノードの位
00256          *  置が空ノードになるので,最後のノードを挿入すべき位置へ向け
00257          *  て空ノードを移動させる.
00258          *  最後のノードのイベント発生時刻が,削除したノードの親ノード
00259          *  のイベント発生時刻より前の場合には,上に向かって挿入位置を
00260          *  探す.そうでない場合には,下に向かって探す.
00261          */
00262         if (index > 1 && EVTTIM_LT(event_time,
00263                                 TMEVT_NODE(parent = PARENT(index)).time)) {
00264                 /*
00265                  *  親ノードを index の位置に移動させる.
00266                  */
00267                 TMEVT_NODE(index) = TMEVT_NODE(parent);
00268                 TMEVT_NODE(index).tmevtb->index = index;
00269 
00270                 /*
00271                  *  削除したノードの親ノードから上に向かって挿入位置を
00272                  *  探す.
00273                  */
00274                 index = tmevt_up(parent, event_time);
00275         }
00276         else {
00277                 /*
00278                  *  削除したノードから下に向かって挿入位置を探す.
00279                  */
00280                 index = tmevt_down(index, event_time);
00281         }
00282 
00283         /*
00284          *  最後のノードを index の位置に挿入する.
00285          */ 
00286         TMEVT_NODE(index) = TMEVT_NODE(last_index + 1);
00287         TMEVT_NODE(index).tmevtb->index = index;
00288 }

関数の呼び出しグラフ:

Inline void tmevtb_dequeue ( TMEVTB tmevtb  ) 

time_event.h183 行で定義されています。

参照先 tmevtb_delete().

参照元 sta_cyc()stp_cyc()wait_cancel()wait_complete().

00184 {
00185         tmevtb_delete(tmevtb);
00186 }

関数の呼び出しグラフ:

Inline void tmevtb_enqueue ( TMEVTB tmevtb,
RELTIM  time,
CBACK  callback,
VP  arg 
)

time_event.h156 行で定義されています。

参照先 time_event_block::argassertbase_timetime_event_block::callbackTMAX_RELTIMtmevtb_insert().

参照元 dly_tsk()make_wait_tmout().

00157 {
00158         assert(time <= TMAX_RELTIM);
00159 
00160         tmevtb->callback = callback;
00161         tmevtb->arg = arg;
00162         tmevtb_insert(tmevtb, base_time + time);
00163 }

関数の呼び出しグラフ:

Inline void tmevtb_enqueue_evttim ( TMEVTB tmevtb,
EVTTIM  time,
CBACK  callback,
VP  arg 
)

time_event.h172 行で定義されています。

参照先 time_event_block::argtime_event_block::callbacktmevtb_insert().

参照元 tmevtb_enqueue_cyc().

00173 {
00174         tmevtb->callback = callback;
00175         tmevtb->arg = arg;
00176         tmevtb_insert(tmevtb, time);
00177 }

関数の呼び出しグラフ:

void tmevtb_insert ( TMEVTB tmevtb,
EVTTIM  time 
)

time_event.c214 行で定義されています。

参照先 time_event_block::indexlast_indexTMEVT_NODEtmevt_up().

参照元 tmevtb_enqueue()tmevtb_enqueue_evttim().

00215 {
00216         UINT    index;
00217 
00218         /*
00219          *  last_index をインクリメントし,そこから上に挿入位置を探す.
00220          */
00221         index = tmevt_up(++last_index, time);
00222 
00223         /*
00224          *  タイムイベントを index の位置に挿入する.
00225          */ 
00226         TMEVT_NODE(index).time = time;
00227         TMEVT_NODE(index).tmevtb = tmevtb;
00228         tmevtb->index = index;
00229 }

関数の呼び出しグラフ:


変数

time_event.c76 行で定義されています。

参照元 get_tim()isig_tim()set_tim()tmevt_initialize()vwri_log().

time_event.c81 行で定義されています。

参照元 isig_tim()tmevt_initialize()vxget_tim().

time_event.c69 行で定義されています。

参照元 get_tim()set_tim()tmevt_initialize()vwri_log()vxget_tim().


Copyright © 2006 by TAKAGI Nobuhisa.
Copyright © 2006 by Kijineko Inc..
このページは Mon Dec 18 17:21:01 2006 に Doxygen によって生成されました。
データ入力からプログラム開発まで!様々なスキルを持ったメンバーが登録しています【@SOHO】