gonzui


Format: Advanced Search

tkernel_2/driver/tef_em1d/lowkbpd/src/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 TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:         kbpd.h          KB/PD real I/O driver : header file
   17:  *
   18:  */
   19: #include        <tk/tkernel.h>
   20: #include        <tk/util.h>
   21: #include        <sys/util.h>
   22: #include        <device/lowkbpd.h>
   23: #include        <device/kbpd.h>
   24: #include        <device/sdrvif.h>
   25: #include        <libstr.h>
   26: 
   27: #ifdef  DEBUG
   28: #define DP(exp) printf exp
   29: #else
   30: #define DP(exp)
   31: #endif
   32: 
   33: /*
   34:         structure of message sent to the upper KB/PD driver
   35: */
   36: typedef union {
   37:         PdInput                p;            /* PD input                       */
   38:         PdInput2       p2;           /* PD input 2                    */
   39:         KeyInput       k;            /* key input                      */
   40:         FlgInput       f;            /* event flag registration        */
   41: } RawEvt;
   42: 
   43: /*
   44:         input message buffer (used internally)
   45: */
   46: typedef struct {
   47:         W      id;                  /* = HWKB or HWPD              */
   48:         UB     dt[8];                      /* input data                      */
   49: } hwMsg;
   50: 
   51: typedef union {
   52:         hwMsg  hw;                      /* input data from H/W           */
   53: } InMsg;
   54: 
   55: #define HWKB            (-100)            /* H/W KB data            */
   56: #define HWPD            (-101)            /* H/W PD data           */
   57: 
   58: #define MAX_INMSG       128           /* maximum number of received messages */
   59: 
   60: /*
   61:         global variables
   62: */
   63: IMPORT  ID       CmdTsk;                       /* command processing task ID */
   64: IMPORT  ID       CmdFlg;                       /* event flag ID for sending command */
   65: IMPORT  ID       EvtMbx;                       /* MBOX ID for sending event                */
   66: IMPORT  ID       InpMbf;                       /* input MBUF ID                    */
   67: 
   68: IMPORT  BOOL     Suspended;          /* suspended                        */
   69: 
   70: IMPORT  UW       InpMode;              /* input mode                        */
   71: IMPORT  UW       KbdId;                        /* keyboard ID              */
   72: IMPORT  W        PdSense;               /* sensitivity (0-15), acceleration(0-7) */
   73: 
   74: IMPORT  PRI      TaskPri;             /* task priority */
   75: 
   76: #define NumLockON       0x10          /* NumLock ON internal input mode */
   77: 
   78: /*
   79:         task information
   80: */
   81: #define DEF_PRIORITY            25        /* default priority */
   82: #ifdef  DEBUG
   83: #define TASK_STKSZ              3072        /* stack size */
   84: #else
   85: #define TASK_STKSZ              2048        /* stack size */
   86: #endif
   87: 
   88: /*
   89:         command
   90: */
   91: #define DC_OPEN         1
   92: #define DC_SUSPEND      2
   93: #define DC_RESUME       3
   94: 
   95: /*
   96:  *      PD attribute
   97:  */
   98: #define PD_WHEEL        0x4000         /* Wheel (0: disabled)         */
   99: #define PD_QPRESS       0x2000                /* Quick press (0: disabled)  */
  100: #define PD_REV          0x1000          /* Flip horizontally            */
  101: #define PD_ACMSK        0x0e00         /* Acceleration (mask)         */
  102: #define PD_ABS          0x0100          /* Absolute coordinate type     */
  103: #define PD_REL          0x0000          /* Relative coordinate type     */
  104: #define PD_SCMSK        0x00f0         /* Scanning speed (mask)       */
  105: #define PD_SNMSK        0x000f         /* Sensitivity (mask)          */
  106: 
  107: /*
  108:         external functions
  109: */
  110: /* main.C */
  111: IMPORT  INT      kpCreTask(W name, FP entry);
  112: IMPORT  ER       main(INT ac, UB *av[]);
  113: 
  114: /* common.c */
  115: IMPORT  void*    MemAlloc(W size);
  116: IMPORT  void     MemFree(void *ptr);
  117: IMPORT  ER       kpSendMsg(RawEvt *msg);
  118: IMPORT  void     kpScalingPos(RawEvt *evt, W x, W y, PNT *fract, W x_max);
  119: IMPORT  void     kpSendPdEvt(RawEvt *evt, UW *lsts, RawEvt *last);
  120: IMPORT  void     kpSendWheelEvt(W z);
  121: IMPORT  void     kpSendMouseEvt(W but, W x, W y, W z, UW *lsts);
  122: IMPORT  void     kpSendKeyEvt(W sts, W keycode);
  123: IMPORT  ER       kpSendDrvCmd(UW cmd);
  124: IMPORT  void     kpDataTask(void);
  125: IMPORT  void     kpCmdTask(void);
  126: 
  127: /* hwkbpd.c */
  128: IMPORT  ER       hwInit(W cmd);
  129: IMPORT  void     hwImode(W inpmd);
  130: IMPORT  void     hwProc(InMsg *msg);