gonzui


Format: Advanced Search

tkernel_2/include/device/kbpd.hbare sourcepermlink (0.02 seconds)

Search this content:

    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 T-Engine Forum at 2013/03/02.
   11:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   12:  *
   13:  *----------------------------------------------------------------------
   14:  */
   15: 
   16: /*
   17:  *      kbpd.h
   18:  *
   19:  *       KB/PD driver
   20:  */
   21: 
   22: #ifndef __DEVICE_KBPD_H__
   23: #define __DEVICE_KBPD_H__
   24: 
   25: #include <basic.h>
   26: #include <tk/devmgr.h>
   27: 
   28: #ifdef __cplusplus
   29: extern "C" {
   30: #endif
   31: 
   32: /* KBPD attribute data number */
   33: typedef enum {
   34:         DN_KPEVENT     = TDN_EVENT,        /* message buffer for event notification
   35:                                                 data: ID          RW */
   36:         DN_KPINPUT     = -100,             /* input mail box
   37:                                                 data: ID          R  */
   38:         DN_KPSTAT      = -101,              /* KB/PD status
   39:                                                 data: KPstat              RW */
   40:         DN_KEYMAP      = -102,              /* keymap
   41:                                                 data: KeyMap              R  */
   42:         DN_KEYTAB      = -103,              /* keytable
   43:                                                 data: KeyTab              RW */
   44:         DN_KEYMODE     = -104,             /* key mode
   45:                                                 data: KeyMode             RW */
   46:         DN_PDMODE      = -105,              /* PD mode
   47:                                                 data: PdMode              RW */
   48:         DN_PDRANGE     = -106,             /* PD range
   49:                                                 data: PdRange             RW */
   50:         DN_PDSIM       = -107,               /* PD simulation
   51:                                                 data: W                   RW */
   52:         DN_PDSIMINH    = -108,            /* temporary prohibition of PD simulation
   53:                                                 data: BOOL                RW */
   54:         DN_KEYID       = -109,               /* keyboard ID
   55:                                                 data: UW          RW */
   56:         DN_KPMETABUT   = -110,           /* meta key / button status
   57:                                                 data: MetaBut[2]   W */
   58:         DN_KEYDEF_S    = -200,            /* keyboard definition 1 (-200 - -327) */
   59:         DN_KEYDEF_E    = -327,            /*        data: KeyDef           RW */
   60:         DN_KEYDEF2_S   = -400,           /* keyboard definition 2 (-400 - - 527) */
   61:         DN_KEYDEF2_E   = -527            /*        data: KeyDef           RW */
   62: } KPDataNo;
   63: 
   64: /* DN_KPSTAT:   KB/PD status (RW) */
   65: typedef enum {
   66:         HiraMode       = 0,  /* Japanese Hiragana */
   67:         AlphaMode      = 1, /* English (lower case) */
   68:         KataMode       = 2,  /* Japanese katakana */
   69:         CapsMode       = 3   /* English (upper case) */
   70: } InputMode;
   71: 
   72: typedef enum {
   73:         PdSim_Off      = 0, /* PD simulation OFF */
   74:         PdSim_Std      = 1, /* standard PD simulation */
   75:         PdSim_MainBut  = 2,     /* main button PD simulation */
   76:         PdSim_TenKey   = 3       /* ten key PD simulation */
   77: } PdSimMode;
   78: 
   79: typedef struct {
   80: #if BIGENDIAN
   81:         UW     rsv1:8;             /* reserved (0)                */
   82:         UW     pdsim:2;    /* PD simulation (PdSimMode) */
   83:         UW     nodsp:1;    /* hide pointer      */
   84:         UW     rsv2:3;             /* reserved (0)                */
   85:         UW     kbsel:1;    /* select keyboard     */
   86:         UW     han:1;              /* hankaku mode               */
   87: 
   88:         UW     tcmd:1;             /* command temporary shift      */
   89:         UW     text:1;             /* expansion temporary shift */
   90:         UW     trsh:1;             /* shift right temporary shift    */
   91:         UW     tlsh:1;             /* shift left temporary shift    */
   92: 
   93:         UW     lcmd:1;             /* command simple lock     */
   94:         UW     lext:1;             /* expansion simple lock      */
   95:         UW     lrsh:1;             /* shift right simple lock    */
   96:         UW     llsh:1;             /* left shift simple lock */
   97: 
   98:         UW     cmd:1;              /* command shift                */
   99:         UW     ext:1;              /* extended shift                */
  100:         UW     rsh:1;              /* right shift          */
  101:         UW     lsh:1;              /* left shift          */
  102: 
  103:         UW     mode:2;             /* key input mode (InputMode) */
  104: 
  105:         UW     sub:1;              /* subbutton                */
  106:         UW     main:1;             /* main button                */
  107: #else
  108:         UW     main:1;             /* main button                */
  109:         UW     sub:1;              /* subbutton                */
  110: 
  111:         UW     mode:2;             /* key input mode (InputMode) */
  112: 
  113:         UW     lsh:1;              /* left shift          */
  114:         UW     rsh:1;              /* right shift          */
  115:         UW     ext:1;              /* extended shift                */
  116:         UW     cmd:1;              /* command shift                */
  117: 
  118:         UW     llsh:1;             /* left shift simple lock */
  119:         UW     lrsh:1;             /* shift right simple lock    */
  120:         UW     lext:1;             /* expansion simple lock      */
  121:         UW     lcmd:1;             /* command simple lock     */
  122: 
  123:         UW     tlsh:1;             /* shift left temporary shift    */
  124:         UW     trsh:1;             /* shift right temporary shift    */
  125:         UW     text:1;             /* expansion temporary shift */
  126:         UW     tcmd:1;             /* command temporary shift      */
  127: 
  128:         UW     han:1;              /* hankaku mode               */
  129:         UW     kbsel:1;    /* select keyboard     */
  130:         UW     rsv2:3;             /* reserved (0)                */
  131:         UW     nodsp:1;    /* hide pointer      */
  132:         UW     pdsim:2;    /* PD simulation (PdSimMode) */
  133:         UW     rsv1:8;             /* reserved (0)                */
  134: #endif
  135: } MetaBut;
  136: 
  137: typedef struct {
  138:         H      xpos;                /* x coordinate             */
  139:         H      ypos;                /* y coordinate               */
  140:         MetaBut        stat;          /* meta / button status    */
  141: } KPStat;
  142: 
  143: /* DN_KEYMAP:  keymap (R) */
  144: #ifndef __keymap__
  145: #define __keymap__
  146: #define KEYMAX          256
  147: 
  148: typedef UB      KeyMap[KEYMAX/8];
  149: #endif /* __keymap__ */
  150: 
  151: /* DN_KEYTAB:   keytable (RW) */
  152: #ifndef __keytab__
  153: #define __keytab__
  154: #define KCTSEL          64
  155: #define KCTMAX          4000
  156: 
  157: typedef struct {
  158:         W      keymax;              /* maximum number of keys      */
  159:         W      kctmax;              /* real number of keymaps      */
  160:         UH     kctsel[KCTSEL];     /* number of translation table             */
  161:         UH     kct[KCTMAX];        /* translation table itself (variable length)    */
  162: } KeyTab;
  163: #endif /* __keytab__ */
  164: 
  165: /* DN_KEYDEF:   keyboard definition (RW) */
  166: #define DN_KEYDEF(kid)          ( DN_KEYDEF_S - (kid) )
  167: #define DN_KEYDEF2(kid)         ( DN_KEYDEF2_S - (kid) )
  168: typedef struct {
  169:         W      keytopofs;   /* offset value */
  170:         KeyTab keytab;         /* key table (variable length) */
  171: } KeyDef;
  172: 
  173: /* keyboard ID (0x00 - 0x7F) */
  174: #define KID_unknown     0x00        /* undefined keyboard */
  175: #define KID_TRON_JP     0x01        /* Japanese TRON keyboard */
  176: #define KID_IBM_EG      0x40 /* IBM 101 (and friends) English keyboard */
  177: #define KID_IBM_JP      0x41 /* IBM 106 (and friends) Japanese keyboard */
  178:  
  179: /* DN_KEYMODE:  key mode (RW) */
  180: typedef struct {
  181:         MSEC   ontime;           /* ON effective interval     */
  182:         MSEC   offtime;  /* OFF effective interval      */
  183:         MSEC   invtime;  /* invalid interval          */
  184:         MSEC   contime;  /* simultaneous key press interval        */
  185:         MSEC   sclktime; /* short click interval      */
  186:         MSEC   dclktime; /* double click interval      */
  187:         BOOL   tslock;           /* temporary shift      */
  188: } KeyMode;
  189: 
  190: #define KB_MAXTIME      10000
  191: 
  192: /* DN_PDMODE:   PD mode (RW) */
  193: typedef struct {
  194: #if BIGENDIAN
  195:         UW     rsv1:17;    /* reserved (0)                */
  196:         UW     wheel:1;    /* wheel          */
  197:         UW     qpress:1;   /* quick press      */
  198:         UW     reverse:1;  /* left and right reversal          */
  199:         UW     accel:3;    /* accelleration         */
  200:         UW     absolute:1; /* absolute / relative                */
  201:         UW     rate:4;             /* scan speed                */
  202:         UW     sense:4;    /* sensitivity                    */
  203: #else
  204:         UW     sense:4;    /* sensitivity                    */
  205:         UW     rate:4;             /* scan speed                */
  206:         UW     absolute:1; /* absolute / relative                */
  207:         UW     accel:3;    /* accelleration         */
  208:         UW     reverse:1;  /* left and right reversal          */
  209:         UW     qpress:1;   /* quick press      */
  210:         UW     wheel:1;    /* wheel          */
  211:         UW     rsv1:17;    /* reserved (0)                */
  212: #endif
  213: } PdAttr;
  214: 
  215: typedef struct {
  216:         MSEC   ontime;           /* ON effective interval               */
  217:         MSEC   offtime;  /* OFF effective interval      */
  218:         MSEC   invtime;  /* invalid interval          */
  219:         MSEC   timeout;  /* timeout period      */
  220:         PdAttr attr;           /* PD attribute          */
  221: } PdMode;
  222: 
  223: #define PD_MAXTIME      10000
  224: 
  225: /* DN_PDRANGE:  PD range (RW) */
  226: typedef struct {
  227:         H      xmax;                /* maximum x coordinate       */
  228:         H      ymax;                /* maximum y coordinate        */
  229: } PdRange;
  230: 
  231: /* event notification */
  232: typedef struct {
  233:         T_DEVEVT       h;    /* standard header               */
  234:         UH             keytop;    /* key top code     */
  235:         UH             code;      /* character code                */
  236:         MetaBut                stat; /* meta key status                */
  237: } KeyEvt;
  238: 
  239: typedef struct {
  240:         T_DEVEVT       h;    /* standard header               */
  241:         KPStat         stat;  /* PD position / button status    */
  242: } PdEvt;
  243: 
  244: typedef struct {
  245:         T_DEVEVT       h;    /* standard header               */
  246:         H              wheel;      /* wheel rotation amount      */
  247:         H              rsv[3];     /* reserved (0)                */
  248: } PdEvt2;
  249: 
  250: /*
  251:         (tkse/extension/typedef.h)
  252: */
  253: /* point */
  254: #ifndef __pnt__
  255: #define __pnt__
  256: typedef struct point {
  257:         H      x;   /* horizontal coordinate value*/
  258:         H      y;   /* vertical coordinate value */
  259: } PNT;
  260: #endif  /* __pnt__ */
  261: 
  262: #ifdef __cplusplus
  263: }
  264: #endif
  265: #endif /* __DEVICE_KBPD_H__ */