📄 evtmgr.h
字号:
/* *---------------------------------------------------------------------- * T-Kernel / Standard Extension * * Copyright (C) 2006 by Ken Sakamura. All rights reserved. * T-Kernel / Standard Extension is distributed * under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * * Version: 1.00.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* * evtmgr.h (event) * * Event management * Common definition */#ifndef _EM_EVTMGR_H_#define _EM_EVTMGR_H_#define DEBUG_MODULE "(event)"#include <basic.h>#include <tk/tkernel.h>#include <tk/util.h>#include <extension/errno.h>#include <extension/event.h>#include <sys/util.h>#include <longlong.h>#include <libstr.h>#include <sys/syslog.h>#include <sys/debug.h>#include <sys/util.h>#include <sys/tkseconf.h>#include <sys/tksedev.h>typedef longlong SYSTIME; /* Time (The total number of milliseconds) *//* * Device event */typedef union EmDevEvt { T_DEVEVT_ID c; /* Common format */ KeyEvt k; /* Key event */ PdEvt p; /* PD event */ PdEvt2 p2; /* PD extended event */ ExDevEvt ex; /* Extended Device event */ VB buf[64];} EmDevEvt;#include "evtque.h"#include "evtmsg.h"#define InvalidID (0) /* Invalid ID *//* * Event management common information */typedef struct EmInfo { FastLock lock; /* For exclusive access */ ID evtRcvTskID; /* Device event receiving task */ ID evtRcvMbf; /* For the device event receiving Message buffer */ /* Event queue */ EvtQue evtQue; /* Event message request */ EvtMsgEntry *evtMsgEntry; /* List for request registration */ W evtMsgMask; /* Type of the requested event (OR) */ /* Key repeat */ W repeatOffset; /* Time until the first repeat (Milliseconds) */ W repeatInterval; /* Repeat interval after the first repeat (Milliseconds) */ KeyMap repeatKeymap; /* Repeat key */ /* System configuration information */ PRI evtRcvTskPri; /* Priority of the device event receiving task */ W maxEvtQue; /* Maximum size of the event queue */ W maxEvtMsg; /* The maximum number of registrations of the event message request */ UW evtLifeTime; /* Automatic event expiration time (Milliseconds) */} EmInfo;IMPORT EmInfo emInfo;/* * Lock at the access to the common information (EmInfo) */#define LockEmInfo() Lock(&emInfo.lock)#define UnlockEmInfo() Unlock(&emInfo.lock)#define LOCK_EM(exp) { LockEmInfo(); exp; UnlockEmInfo(); }#define Enter LockEmInfo()#define Exit { UnlockEmInfo(); return; }#define Return(val) { UnlockEmInfo(); return (val); }/* * Obtain the current value of the event timer. */Inline UW getEvtTime( SYSTIME *now ){ SYSTIM tm; tk_get_otm(&tm); if ( now != NULL ) { hilo_ll(*now, tm.hi, tm.lo); } return tm.lo;}/* * Bit test */Inline W BTST( VP base, W offset ){ return ((UB*)base)[(UW)offset >> 3] & (0x80U >> (offset & 7));}/* * Error code related */#define EC_MASK (0xffff0000U)#define ED_MASK (0x0000ffffU)#define toERR(class,detail) ((ER)(class))/* * And all the rest */#define max(a,b) (( (a) > (b) )? (a): (b))#define min(a,b) (( (a) < (b) )? (a): (b))#define xchg(a,b) { typeof (a) _tmp; _tmp = (a); (a) = (b); (b) = _tmp; }/* ------------------------------------------------------------------------ *//* * Device event receiving task */IMPORT void emEventReceiveTask( void );#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -