home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 202.img / SCO386N2.TD0 / usr / include / sys / keyboard.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-18  |  3.6 KB  |  126 lines

  1. /*
  2.  *    @(#) keyboard.h 2.2 88/05/18 
  3.  *
  4.  *    Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987.
  5.  *    Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987.
  6.  *    This Module contains Proprietary Information of
  7.  *    The Santa Cruz Operation, Microsoft Corporation
  8.  *    and AT&T, and should be treated as Confidential.
  9.  */
  10.  
  11. /*
  12.  *    User level include file for: 
  13.  *    PC monitor keyboard related defines and variables.
  14.  *
  15.  */
  16.  
  17. #define NUM_KEYS    256    /* Max number of possible physical keys */
  18. #define NUM_STATES    8    /* Number of key states */
  19. #define NFKEYS        96
  20.  
  21. #define    NUM_KEYS_21    111    /* Max number of keys under 2.1.x */
  22.  
  23. #define MIOC    ('k' << 8)
  24.  
  25. /* GET/SET FKEY in machdep.h are (MIOC|0) and (MIOC|1) */
  26. /* GIO/PIO _SCRNMAP in console.h are (MIOC|2) and (MIOC|3) */
  27.  
  28. #define GIO_STRMAP_21    (MIOC|4)    /* Get 2.1 function key string table */
  29. #define PIO_STRMAP_21    (MIOC|5)    /* Put 2.1 function key string table */
  30.  
  31. #define GIO_KEYMAP    (MIOC|6)    /* Get keyboard map table */
  32. #define PIO_KEYMAP    (MIOC|7)    /* Put keyboard map table */
  33.  
  34. #define GIO_KEYMAP_21    (MIOC|8)    /* Get 2.1 keyboard map table */
  35. #define PIO_KEYMAP_21    (MIOC|9)    /* Put 2.1 keyboard map table */
  36.  
  37. #define SETLOCKLOCK    (MIOC|10)    /* global cap/num lock on/off */
  38.  
  39. #define GIO_STRMAP    (MIOC|11)    /* Get function key string table */
  40. #define PIO_STRMAP    (MIOC|12)    /* Put function key string table */
  41.  
  42. #define    KBIO_SETMODE    (MIOC|13)    /* Put AT keyboard into XT | AT mode */
  43. #define    KBIO_GETMODE    (MIOC|14)    /* Get the AT/XT keyboard mode */
  44.  
  45. /* keyboard mode -- set by KBIO_MODE */
  46. #define    KBM_XT    0    /* XT keyboard mode */
  47. #define    KBM_AT    1    /* AT keyboard mode */
  48.  
  49. #ifdef M_I386
  50. #pragma pack(2)
  51. #endif
  52.  
  53. struct keymap {
  54.     short  n_keys ;
  55.     struct key_t {
  56.         unsigned char map[NUM_STATES];
  57.         unsigned char spcl;
  58.         unsigned char flgs;
  59.     } key[NUM_KEYS+1];
  60. };
  61. typedef struct keymap keymap_t;
  62.  
  63. #ifdef M_I386
  64. #pragma pack()
  65. #endif
  66.  
  67. /* key map table flags */
  68. #define    KMF_CLOCK    0x01        /* affected by caps lock */
  69. #define    KMF_NLOCK    0x02        /* affected by num lock */
  70.  
  71. #define    L_O    0
  72. #define    L_C    1
  73. #define    L_N    2
  74. #define    L_B    3
  75.  
  76. #define NORMAL        0
  77. #define SHIFT        1
  78. #define CTRL        2
  79. #define    SHFCTL        3
  80. #define ALT        4
  81. #define    ALTSHF        5
  82. #define    ALTCTL        6
  83. #define    ALTSHFCTL    7
  84.  
  85. /***************** Special range macros and keys *****************/
  86.  
  87. #define    IS_SPECIAL(km, c, i)    ( (km).key[(c)].spcl & (0x80>>(i)) )
  88.  
  89. #define    K_NOP    0    /* Keys with no function */
  90. #define K_LSH    2    /* Left shift */
  91. #define K_RSH    3    /* Right shift */
  92. #define K_CLK    4    /* Caps lock */
  93. #define K_NLK    5    /* Num lock */
  94. #define K_SLK    6    /* Scroll lock */
  95. #define    K_BTAB    8    /* Back tab */
  96. #define K_ALT    7    /* Alt */
  97. #define    K_LALT    K_ALT    /* Left Alt */
  98. #define    K_RALT    124    /* Right Alt */
  99. #define K_CTL    9    /* Control */
  100. #define    K_LCTL    K_CTL    /* Left Ctrl */
  101. #define    K_RCTL    123    /* Right Ctrl */
  102. #define K_NXSC    10    /* Switch to next screen */
  103. #define K_SCRF    11    /* Switch to first screen */
  104. #define    K_SCRL    26    /* Switch to last screen */
  105. #define    K_FUNF    27    /* First function key */
  106. #define    K_FUNL    122    /* Last function key */
  107.  
  108. /***************** Expanded function and screen key macros ***************/
  109.  
  110. #define    NSTRKEYS    (K_FUNL-K_FUNF+1)
  111. #define STRTABLN_21    256    /* max length of the sum of all strings */
  112. #define STRTABLN    512    /* max length of the sum of all strings */
  113.  
  114. #define    FKEYSTART    0    /* The F1 key is string key #0 */
  115.  
  116. #define    IS_SCRKEY(x)    ( ((x) >= K_SCRF) && ((x) <= K_SCRL) )
  117. #define    IS_FUNKEY(x)    ( ((x) >= K_FUNF) && ((x) <= K_FUNL) )
  118.  
  119. typedef unsigned char strmap_t[STRTABLN];
  120.  
  121. /***************** Special system scan codes ****************************/
  122.  
  123. #define    KBD_OVERRUN    -1    /* keyboard imput data queue has been overrun */
  124. #define    KBD_BREAK    0x4000    /* key make/break flag (make=0/break=1) */
  125. #define    KBD_SCMASK    0xff    /* scan code mask */
  126.