tkernel_2/driver/tef_em1d/kbpd/src/devevt.h | bare source | permlink (0.00 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: * devevt.h 17: * 18: * KB/PD device manager 19: * definitions for data used for events from I/O driver 20: * definitions for data used for additional events used only inside manager 21: */ 22: 23: /* 24: * data type for data used for additional events used only inside manager 25: */ 26: typedef enum { 27: PIC_TIMEOUT = -1, /* timeout */ 28: PIC_SPRESS = -2, /* shift press */ 29: PIC_KEYUP = -3 /* key up */ 30: } PseudoInputCmd; 31: 32: typedef struct { 33: T_MSG head; 34: struct { 35: UW read:1; /* already read flag */ 36: InputCmd cmd:7; /* command */ 37: UW rsv1:4; 38: DevError err:4; /* device error */ 39: UW rsv2:16; 40: } cmd; 41: } CommonMsg; 42: 43: /* 44: * types of timeouts 45: */ 46: typedef enum { 47: TMO_KEY = 0, /* >= 0 : key (KeyState number) */ 48: TMO_MAIN = -1, /* PD main button */ 49: TMO_SUB = -2 /* PD subbutton */ 50: } TimeoutKind; 51: 52: #define KeyTmoutKind(i) ((TimeoutKind)(TMO_KEY + (i))) 53: #define PdButTmoutKind(i) ((TimeoutKind)(TMO_MAIN - (i))) 54: 55: /* 56: * timeout status 57: */ 58: typedef struct { 59: UW read:1; /* already read flag */ 60: InputCmd cmd:7; /* = PIC_TIMEOUT */ 61: UW rsv1:4; /* reserved(0) */ 62: DevError err:4; /* error status */ 63: UW rsv2:8; /* reserved(0) */ 64: TimeoutKind kind:8; /* types of timeouts */ 65: } TimeoutStat; 66: 67: /* 68: * timeout messasges 69: */ 70: typedef struct { 71: T_MSG head; 72: TimeoutStat stat; 73: UW time; /* timeout generated time */ 74: } TimeoutMsg; 75: 76: /* 77: * receive data structure 78: */ 79: typedef union { 80: CommonMsg head; /* commoh header */ 81: 82: /* received data from I/O driver */ 83: PdInput pd; /* PD input data */ 84: PdInput2 pd2; /* PD input data 2 */ 85: KeyInput kb; /* KB input data */ 86: FlgInput flg; /* register flag for command */ 87: 88: /* special data used inside manager */ 89: TimeoutMsg tmout; /* timeout */ 90: CommonMsg spress; /* shift press */ 91: } ReceiveData; 92: 93: /* 94: * extract keytop information from device event 95: */ 96: Inline KeyTop toKeyTop( KeyInput *msg ) 97: { 98: KeyTop keytop; 99: 100: keytop.w = 0; 101: keytop.u.tenkey = msg->stat.tenkey; 102: keytop.u.kid = msg->stat.kbid; 103: keytop.u.kcode = msg->keytop; 104: 105: return keytop; 106: }