tkernel_2/driver/tef_em1d/kbpd/src/statmach.h | bare source | permlink (0.02 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * T-Kernel 2.0 Software Package 4: * 5: * Copyright 2011 by Ken Sakamura. 6: * This software is distributed under the latest version of T-License 2.x. 7: *---------------------------------------------------------------------- 8: * 9: * Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17. 10: * Modified by TRON Forum(http://www.tron.org/) at 2015/06/01. 11: * 12: *---------------------------------------------------------------------- 13: */ 14: 15: /* 16: * statmach.h 17: * 18: * KB/PD device manager 19: * defitinition for enableware function (state machine) 20: */ 21: 22: #define MaxKey 20 /* maximum number of simultaneous key presses */ 23: 24: /* 25: * alarm management information 26: */ 27: #define NumOfAlmMsgBuf (2) 28: 29: typedef struct { 30: ID almno; /* alarm handler number */ 31: UW setTime; /* alarm set time */ 32: TimeoutMsg msg[NumOfAlmMsgBuf]; /* timeout message */ 33: } AlarmState; 34: 35: /* 36: * PD button status 37: */ 38: typedef enum { 39: BS_RELEASE, /* release status */ 40: BS_ONTIME, /* ON effective time wait */ 41: BS_PRESS, /* press state */ 42: BS_OFFTIME, /* OFF effective time wait */ 43: BS_INVTIME, /* ineffective time wait */ 44: BS_ERROR /* error */ 45: } BState; 46: 47: /* 48: * PD button status 49: */ 50: typedef struct { 51: BState state; /* button status */ 52: AlarmState alm; /* alarm management information */ 53: ButtonKind button; /* button kind */ 54: BOOL butdown; /* TRUE while the button is down */ 55: } PdButState; 56: 57: /* 58: * key state 59: */ 60: typedef enum { 61: /* state of direct key input */ 62: KS_RELEASE = 0x00, /* release status */ 63: KS_ONTIME, /* ON effective time wait */ 64: KS_CONTIME, /* wait for simultaneous presses */ 65: KS_PRESS, /* press state */ 66: KS_OFFTIME, /* OFF effective time wait */ 67: KS_INVTIME, /* ineffective time wait */ 68: KS_ERROR, /* error */ 69: 70: /* shift key status */ 71: SS_RELEASE = 0x10, /* release status */ 72: SS_ONTIME, /* ON effective time wait */ 73: SS_PRESS, /* press state */ 74: SS_OFFTIME, /* OFF effective time wait */ 75: SS_ERROR /* error */ 76: } KState; 77: 78: /* 79: * state of direct key input 80: */ 81: typedef struct { 82: KpMetaBut meta; /* meta key status */ 83: BOOL keydown:1; /* TRUE while the key is down */ 84: BOOL invpress:1; /* key press while waiting during ineffective time */ 85: } InkeyState; 86: 87: /* 88: * shift key status 89: */ 90: typedef struct { 91: ShiftKeyKind skind:8; /* type of shift key */ 92: UW pressCount:8; /* press count */ 93: UW pressTime; /* the initial time at which the key was pressed */ 94: } SKeyState; 95: 96: /* 97: * key status 98: */ 99: typedef struct { 100: QUEUE q; 101: KeyTop keytop; /* key top information */ 102: H /*KState*/ state; /* key state */ 103: UW kbsel:1; /* keyboard selection when the key was pressed */ 104: AlarmState alm; /* alarm management information */ 105: union { 106: InkeyState i; /* state of direct key input */ 107: SKeyState s; /* shift key status */ 108: } u; 109: } KeyState; 110: 111: /* 112: * state of the state machine 113: */ 114: typedef struct { 115: KeyState key[MaxKey]; /* key status */ 116: QUEUE useq; /* used KeyState queue */ 117: QUEUE freq; /* unused KeyState queue */ 118: CommonMsg spressMsg; /* PIC_SPRESS message area */ 119: CommonMsg keyupMsg; /* PIC_KEYUP message area */ 120: W keyPress:8; /* number of ordinary keys pressed */ 121: PdButState pdBut[NumOfPdBut]; /* PD button status */ 122: KpPdInStat pdInStat; /* PD attribute data */ 123: } StateMachine; 124: #define StatMach ( kpMgrInfo.statMach )