9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _SYS_KBD_H
  27 #define _SYS_KBD_H
  28 
  29 #pragma ident   "%Z%%M% %I%     %E% SMI"        /* SunOS4.0 1.18 */
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 /*
  36  * Following #defines are related to the older keyboards which
  37  * are no longer supported by kb module.  The #defines ane left
  38  * for older programs to still compile.
  39  */
  40 #define KB_KLUNK        0x00            /* Micro Switch 103SD32-2 */
  41 #define KB_VT100        0x01            /* Keytronics VT100 compatible */
  42 #define KB_SUN2         0x02            /* Sun-2 custom keyboard */
  43 #define KB_VT220        0x81            /* Emulation VT220 */
  44 #define KB_VT220I       0x82            /* International VT220 Emulation */
  45 
  46 #define NOTPRESENT      0xFF            /* Keyboard is not plugged in */
  47 #define KBD_CMD_LED1    0x04            /* Turn on LED 1 for Sun-2 */
  48 #define KBD_CMD_NOLED1  0x05            /* Turn off LED 1 for Sun-2 */
  49 #define KBD_CMD_LED2    0x06            /* Turn on LED 2 for Sun-2 */
  50 #define KBD_CMD_NOLED2  0x07            /* Turn off LED 2 for Sun-2 */
 
 208 #define UPMASK          0x0080
 209 
 210 /*
 211  * This defines the format of translation tables.
 212  *
 213  * A translation table is KEYMAP_SIZE "entries", each of which is 2 bytes
 214  * (unsigned shorts).  The top 8 bits of each entry are decoded by
 215  * a case statement in getkey.c.  If the entry is less than 0x100, it
 216  * is sent out as an EUC character (possibly with bucky bits
 217  * OR-ed in).  "Special" entries are 0x100 or greater, and
 218  * invoke more complicated actions.
 219  *
 220  * The KEYMAP_SIZE is dependent upon the keyboard type.  For example, the
 221  * Sun Type 4/5 keyboards have a KEYMAP_SIZE of 128 where a USB keyboard
 222  * has a KEYMAP_SIZE of 255.  Instead of defining a KEYMAP_SIZE per
 223  * keyboard type, a keyboard specific module/driver may supply the value
 224  * at run time by defining the KEYMAP_SIZE_VARIABLE and filling in the
 225  * keyboard struct appropriately.
 226  */
 227 
 228 #ifdef KEYMAP_SIZE_VARIABLE
 229 
 230 typedef unsigned short keymap_entry_t;
 231 
 232 #else
 233 #define KEYMAP_SIZE     128
 234 
 235 struct keymap {
 236         unsigned short  keymap[KEYMAP_SIZE];    /* maps keycodes to actions */
 237 };
 238 
 239 #endif
 240 
 241 /*
 242  * This structure is used for "exception" cases for key sequences that
 243  * we want to map, that should not be handled by keymap entries (For
 244  * example: using Control-Shift-F1 on PC's for the compose key).
 245  */
 246 struct exception_map {
 247         /*
 248          * these are the modifier keys that we "care" about
 249          */
 250         unsigned int exc_care;
 251 
 252         /*
 253          * This is the mask of modifier keys that we want to match
 254          */
 255         unsigned int exc_mask;
 256 
 257         /*
 258          * This is the key that we want to match.
 259          */
 260         int exc_key;
 261 
 262         /*
 263          * This is our translated version of the matching sequence.
 264          */
 265         unsigned short exc_entry;
 266 };
 267 
 268 /*
 269  * A keyboard is defined by its keymaps and what state it resets at idle.
 270  *
 271  * The masks k_idleshifts and k_idlebuckys are AND-ed with the current
 272  * state of  shiftmask  and  buckybits  when a "keyboard idle" code
 273  * is received.  This ensures that where we "think" the shift & bucky
 274  * keys are, more accurately reflects where they really are, since the
 275  * keyboard knows better than us.  However, some keyboards don't know
 276  * about shift states that should be remembered across idles.  Such
 277  * shifts are described by k_toggleshifts.  k_toggleshifts are used to
 278  * identify such shifts.  A toggle shift state is maintained separately
 279  * from the general shift state.  The toggle shift state is OR-ed
 280  * with the state general shift state when an idle is received.
 281  * k_toggleshifts should not appear in the k_up table.
 282  */
 283 struct keyboard {
 284 #ifdef KEYMAP_SIZE_VARIABLE
 285         int             k_keymap_size;  /* Number of entries in keymaps */
 
 302         int             k_idleshifts;   /* Shifts that keep across idle */
 303         int             k_idlebuckys;   /* Bucky bits that keep across idle */
 304         unsigned char   k_abort1;       /* 1st key of abort sequence */
 305         unsigned char   k_abort1a;      /* alternate 1st key */
 306         unsigned char   k_abort2;       /* 2nd key of abort sequence */
 307         int             k_toggleshifts; /* Shifts that toggle on down from */
 308                                         /* kbd and keep across idle */
 309         struct exception_map *k_except; /* Oddball cases */
 310         unsigned char   k_newabort1;    /* 1st key of new abort sequence */
 311         unsigned char   k_newabort1a;   /* alternate 1st key */
 312         unsigned char   k_newabort2;    /* 2nd key of new abort sequence */
 313 };
 314 
 315 /*
 316  * Define the compose sequence structure.  First and second
 317  * ASCII chars of 0 indicate the end of the table.
 318  */
 319 struct compose_sequence_t {
 320         unsigned char   first;  /* first ASCII char after COMPOSE key */
 321         unsigned char   second; /* second ASCII char after COMPOSE key */
 322         unsigned char   iso;    /* equivalent ISO code */
 323 };
 324 
 325 /*
 326  * Define the floating accent sequence structure.
 327  */
 328 struct fltaccent_sequence_t {
 329         unsigned short  fa_entry;       /* floating accent keymap entry */
 330         unsigned char   ascii;          /* ASCII char after FA-type key */
 331         unsigned char   iso;            /* equivalent ISO code */
 332 };
 333 
 334 /*
 335  * The "special" entries' top 4 bits are defined below.  Generally they are
 336  * used with a 4-bit parameter (such as a bit number) in the low 4 bits.
 337  * The bytes whose top 4 bits are 0x0 thru 0x7 happen to be ascii
 338  * characters.  They are not special cased, but just normal cased.
 339  */
 340 
 341 #define SHIFTKEYS       0x100   /* thru 0x10F.  This key helps to determine */
 342                                 /* the translation table used.  The bit */
 343                                 /* position of its bit in "shiftmask" */
 344                                 /* is added to the entry, eg */
 345                                 /* SHIFTKEYS+LEFTCTRL.  When this entry is */
 346                                 /* invoked, the bit in "shiftmask" is */
 347                                 /* toggled.  Depending which tables you put */
 348                                 /* it in, this works well for hold-down */
 349                                 /* keys or press-on, press-off keys.  */
 350 #define BUCKYBITS       0x200   /* thru 0x20F.  This key determines the state */
 351                                 /* of one of the "bucky" bits above the */
 352                                 /* returned ASCII character.  This is */
 353                                 /* basically a way to pass mode-key-up/down */
 354                                 /* information back to the caller with each */
 355                                 /* "real" key depressed.  The concept, and */
 356                                 /* name "bucky" (derivation unknown) comes */
 357                                 /* from the MIT/SAIL "TV" system...they had */
 358                                 /* TOP, META, CTRL, and a few other bucky */
 359                                 /* bits.  The bit position of its bit in */
 360                                 /* "buckybits", minus 7, is added to the */
 361                                 /* entry; eg bit 0x00000400 is BUCKYBITS+3. */
 362                                 /* The "-7" prevents us from messing up the */
 363                                 /* ASCII char, and gives us 16 useful bucky */
 364                                 /* bits.  When this entry is invoked, */
 365                                 /* the designated bit in "buckybits" is */
 366                                 /* toggled.  Depending which tables you put */
 367                                 /* it in, this works well for hold-down */
 368                                 /* keys or press-on, press-off keys.  */
 369 #define FUNNY           0x300   /* thru 0x30F.  This key does one of 16 funny */
 370                                 /* things based on the low 4 bits: */
 371 #define NOP             0x300   /* This key does nothing. */
 372 #define OOPS            0x301   /* This key exists but is undefined. */
 373 #define HOLE            0x302   /* This key does not exist on the keyboard. */
 374                                 /* Its position code should never be */
 375                                 /* generated.  This indicates a software/ */
 376                                 /* hardware mismatch, or bugs. */
 377 #define RESET           0x306   /* Kbd was just reset */
 378 #define ERROR           0x307   /* Kbd just detected an internal error */
 379 #define IDLE            0x308   /* Kbd is idle (no keys down) */
 380 #define COMPOSE         0x309   /* This key is the Compose key. */
 381 #define NONL            0x30A   /* This key not affected by Num Lock */
 382 /* Combinations 0x30B to 0x30F are reserved for non-parameterized functions */
 383 
 384 #define FA_CLASS        0x400   /* thru 0x40F.  These are for "floating */
 385                                 /* accent" characters.  The low-order 4 bits */
 386                                 /* select one of those characters. */
 387 /* Definitions for the individual floating accents: */
 388 #define FA_UMLAUT       0x400   /* umlaut accent */
 389 #define FA_CFLEX        0x401   /* circumflex accent */
 390 #define FA_TILDE        0x402   /* tilde accent */
 391 #define FA_CEDILLA      0x403   /* cedilla accent */
 392 #define FA_ACUTE        0x404   /* acute accent */
 393 #define FA_GRAVE        0x405   /* grave accent */
 394 
 395 #define STRING          0x500   /* thru 0x50F.  The low-order 4 bits index */
 396                                 /* a table select a string to be returned, */
 397                                 /* char by char.  Each entry the table is */
 398                                 /* null terminated. */
 399 #define KTAB_STRLEN     10      /* Maximum string length (including null) */
 400 /* Definitions for the individual string numbers: */
 401 #define HOMEARROW       0x00
 402 #define UPARROW         0x01
 403 #define DOWNARROW       0x02
 404 #define LEFTARROW       0x03
 405 #define RIGHTARROW      0x04
 406 /* string numbers 5 thru F are available to users making custom entries */
 407 
 408 /*
 409  * In the following function key groupings, the low-order 4 bits indicate
 410  * the function key number within the group, and the next 4 bits indicate
 411  * the group.
 412  */
 413 #define FUNCKEYS        0x600
 414 #define LEFTFUNC        0x600   /* thru 0x60F.  The "left" group. */
 415 #define RIGHTFUNC       0x610   /* thru 0x61F.  The "right" group. */
 416 #define TOPFUNC         0x620   /* thru 0x62F.  The "top" group. */
 417 #define BOTTOMFUNC      0x630   /* thru 0x63F.  The "bottom" group. */
 418 #define LF(n)           (LEFTFUNC+(n)-1)
 419 #define RF(n)           (RIGHTFUNC+(n)-1)
 420 #define TF(n)           (TOPFUNC+(n)-1)
 421 #define BF(n)           (BOTTOMFUNC+(n)-1)
 422 
 423 /*
 424  * The actual keyboard positions may not be on the left/right/top/bottom
 425  * of the physical keyboard (although they usually are).
 426  * What is important is that we have reserved 64 keys for function keys.
 427  *
 428  * Normally, striking a function key will cause the following escape sequence
 429  * to be sent through the character stream:
 430  *      ESC[0..9z
 431  * where ESC is a single escape character and 0..9 indicate some number of
 432  * digits needed to encode the function key as a decimal number.
 433  */
 434 #define PADKEYS         0x700
 435 #define PADEQUAL        0x700           /* keypad = */
 436 #define PADSLASH        0x701           /* keypad / */
 437 #define PADSTAR         0x702           /* keypad * */
 438 #define PADMINUS        0x703           /* keypad - */
 439 #define PADSEP          0x704           /* keypad,  */
 440 #define PAD7            0x705           /* keypad 7 */
 441 #define PAD8            0x706           /* keypad 8 */
 442 #define PAD9            0x707           /* keypad 9 */
 443 #define PADPLUS         0x708           /* keypad + */
 444 #define PAD4            0x709           /* keypad 4 */
 445 #define PAD5            0x70A           /* keypad 5 */
 446 #define PAD6            0x70B           /* keypad 6 */
 447 #define PAD1            0x70C           /* keypad 1 */
 448 #define PAD2            0x70D           /* keypad 2 */
 449 #define PAD3            0x70E           /* keypad 3 */
 450 #define PAD0            0x70F           /* keypad 0 */
 451 #define PADDOT          0x710           /* keypad . */
 452 #define PADENTER        0x711           /* keypad Enter */
 453 
 454 #ifdef  __cplusplus
 455 }
 456 #endif
 457 
 458 #endif  /* _SYS_KBD_H */
 | 
 
 
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _SYS_KBD_H
  27 #define _SYS_KBD_H
  28 
  29 #ifdef  __cplusplus
  30 extern "C" {
  31 #endif
  32 
  33 /*
  34  * Following #defines are related to the older keyboards which
  35  * are no longer supported by kb module.  The #defines ane left
  36  * for older programs to still compile.
  37  */
  38 #define KB_KLUNK        0x00            /* Micro Switch 103SD32-2 */
  39 #define KB_VT100        0x01            /* Keytronics VT100 compatible */
  40 #define KB_SUN2         0x02            /* Sun-2 custom keyboard */
  41 #define KB_VT220        0x81            /* Emulation VT220 */
  42 #define KB_VT220I       0x82            /* International VT220 Emulation */
  43 
  44 #define NOTPRESENT      0xFF            /* Keyboard is not plugged in */
  45 #define KBD_CMD_LED1    0x04            /* Turn on LED 1 for Sun-2 */
  46 #define KBD_CMD_NOLED1  0x05            /* Turn off LED 1 for Sun-2 */
  47 #define KBD_CMD_LED2    0x06            /* Turn on LED 2 for Sun-2 */
  48 #define KBD_CMD_NOLED2  0x07            /* Turn off LED 2 for Sun-2 */
 
 206 #define UPMASK          0x0080
 207 
 208 /*
 209  * This defines the format of translation tables.
 210  *
 211  * A translation table is KEYMAP_SIZE "entries", each of which is 2 bytes
 212  * (unsigned shorts).  The top 8 bits of each entry are decoded by
 213  * a case statement in getkey.c.  If the entry is less than 0x100, it
 214  * is sent out as an EUC character (possibly with bucky bits
 215  * OR-ed in).  "Special" entries are 0x100 or greater, and
 216  * invoke more complicated actions.
 217  *
 218  * The KEYMAP_SIZE is dependent upon the keyboard type.  For example, the
 219  * Sun Type 4/5 keyboards have a KEYMAP_SIZE of 128 where a USB keyboard
 220  * has a KEYMAP_SIZE of 255.  Instead of defining a KEYMAP_SIZE per
 221  * keyboard type, a keyboard specific module/driver may supply the value
 222  * at run time by defining the KEYMAP_SIZE_VARIABLE and filling in the
 223  * keyboard struct appropriately.
 224  */
 225 
 226 typedef unsigned int keymap_entry_t;
 227 #ifdef KEYMAP_SIZE_VARIABLE
 228 
 229 
 230 #else
 231 #define KEYMAP_SIZE     128
 232 
 233 struct keymap {
 234         keymap_entry_t  keymap[KEYMAP_SIZE];    /* maps keycodes to actions */
 235 };
 236 
 237 #endif
 238 
 239 /*
 240  * This structure is used for "exception" cases for key sequences that
 241  * we want to map, that should not be handled by keymap entries (For
 242  * example: using Control-Shift-F1 on PC's for the compose key).
 243  */
 244 struct exception_map {
 245         /*
 246          * these are the modifier keys that we "care" about
 247          */
 248         unsigned int exc_care;
 249 
 250         /*
 251          * This is the mask of modifier keys that we want to match
 252          */
 253         unsigned int exc_mask;
 254 
 255         /*
 256          * This is the key that we want to match.
 257          */
 258         int exc_key;
 259 
 260         /*
 261          * This is our translated version of the matching sequence.
 262          */
 263         keymap_entry_t exc_entry;
 264 };
 265 
 266 /*
 267  * A keyboard is defined by its keymaps and what state it resets at idle.
 268  *
 269  * The masks k_idleshifts and k_idlebuckys are AND-ed with the current
 270  * state of  shiftmask  and  buckybits  when a "keyboard idle" code
 271  * is received.  This ensures that where we "think" the shift & bucky
 272  * keys are, more accurately reflects where they really are, since the
 273  * keyboard knows better than us.  However, some keyboards don't know
 274  * about shift states that should be remembered across idles.  Such
 275  * shifts are described by k_toggleshifts.  k_toggleshifts are used to
 276  * identify such shifts.  A toggle shift state is maintained separately
 277  * from the general shift state.  The toggle shift state is OR-ed
 278  * with the state general shift state when an idle is received.
 279  * k_toggleshifts should not appear in the k_up table.
 280  */
 281 struct keyboard {
 282 #ifdef KEYMAP_SIZE_VARIABLE
 283         int             k_keymap_size;  /* Number of entries in keymaps */
 
 300         int             k_idleshifts;   /* Shifts that keep across idle */
 301         int             k_idlebuckys;   /* Bucky bits that keep across idle */
 302         unsigned char   k_abort1;       /* 1st key of abort sequence */
 303         unsigned char   k_abort1a;      /* alternate 1st key */
 304         unsigned char   k_abort2;       /* 2nd key of abort sequence */
 305         int             k_toggleshifts; /* Shifts that toggle on down from */
 306                                         /* kbd and keep across idle */
 307         struct exception_map *k_except; /* Oddball cases */
 308         unsigned char   k_newabort1;    /* 1st key of new abort sequence */
 309         unsigned char   k_newabort1a;   /* alternate 1st key */
 310         unsigned char   k_newabort2;    /* 2nd key of new abort sequence */
 311 };
 312 
 313 /*
 314  * Define the compose sequence structure.  First and second
 315  * ASCII chars of 0 indicate the end of the table.
 316  */
 317 struct compose_sequence_t {
 318         unsigned char   first;  /* first ASCII char after COMPOSE key */
 319         unsigned char   second; /* second ASCII char after COMPOSE key */
 320         keymap_entry_t  utf8;   /* equivalent UTF-8 code */
 321 };
 322 
 323 /*
 324  * Define the floating accent sequence structure.
 325  */
 326 struct fltaccent_sequence_t {
 327         keymap_entry_t  fa_entry;       /* floating accent keymap entry */
 328         unsigned char   ascii;          /* ASCII char after FA-type key */
 329         keymap_entry_t  utf8;           /* equivalent UTF-8 code */
 330 };
 331 
 332 /*
 333  * The top byte is used to store the flags, leaving 24 bits for char.
 334  */
 335 #define KEYCHAR(c)      ((c) & 0x00ffffff)
 336 #define KEYFLAGS(c)     ((c) & ~0x00ffffff)
 337 
 338 /*
 339  * The "special" entries' top 4 bits are defined below.  Generally they are
 340  * used with a 4-bit parameter (such as a bit number) in the low 4 bits.
 341  * The bytes whose top 4 bits are 0x0 thru 0x7 happen to be ascii
 342  * characters.  They are not special cased, but just normal cased.
 343  */
 344 
 345 #define SPECIAL(h, l)   (((h) << 24) | (l))
 346 
 347 #define SHIFTKEYS SPECIAL(0x1, 0)
 348                                 /* thru 0x10F.  This key helps to determine */
 349                                 /* the translation table used.  The bit */
 350                                 /* position of its bit in "shiftmask" */
 351                                 /* is added to the entry, eg */
 352                                 /* SHIFTKEYS+LEFTCTRL.  When this entry is */
 353                                 /* invoked, the bit in "shiftmask" is */
 354                                 /* toggled.  Depending which tables you put */
 355                                 /* it in, this works well for hold-down */
 356                                 /* keys or press-on, press-off keys.  */
 357 #define BUCKYBITS SPECIAL(0x2, 0)
 358                                 /* thru 0x20F.  This key determines the state */
 359                                 /* of one of the "bucky" bits above the */
 360                                 /* returned ASCII character.  This is */
 361                                 /* basically a way to pass mode-key-up/down */
 362                                 /* information back to the caller with each */
 363                                 /* "real" key depressed.  The concept, and */
 364                                 /* name "bucky" (derivation unknown) comes */
 365                                 /* from the MIT/SAIL "TV" system...they had */
 366                                 /* TOP, META, CTRL, and a few other bucky */
 367                                 /* bits.  The bit position of its bit in */
 368                                 /* "buckybits", minus 7, is added to the */
 369                                 /* entry; eg bit 0x00000400 is BUCKYBITS+3. */
 370                                 /* The "-7" prevents us from messing up the */
 371                                 /* ASCII char, and gives us 16 useful bucky */
 372                                 /* bits.  When this entry is invoked, */
 373                                 /* the designated bit in "buckybits" is */
 374                                 /* toggled.  Depending which tables you put */
 375                                 /* it in, this works well for hold-down */
 376                                 /* keys or press-on, press-off keys.  */
 377 #define FUNNY SPECIAL(0x3, 0)   /* thru 0x30F.  This key does one of 16 funny */
 378                                 /* things based on the low 4 bits: */
 379 #define NOP SPECIAL(0x3, 0x0)   /* This key does nothing. */
 380 #define OOPS SPECIAL(0x3, 0x1) /* This key exists but is undefined. */
 381 #define HOLE SPECIAL(0x3, 0x2) /* This key does not exist on the keyboard. */
 382                                 /* Its position code should never be */
 383                                 /* generated.  This indicates a software/ */
 384                                 /* hardware mismatch, or bugs. */
 385 #define RESET SPECIAL(0x3, 0x6) /* Kbd was just reset */
 386 #define ERROR SPECIAL(0x3, 0x7) /* Kbd just detected an internal error */
 387 #define IDLE SPECIAL(0x3, 0x8) /* Kbd is idle (no keys down) */
 388 #define COMPOSE SPECIAL(0x3, 0x9) /* This key is the Compose key. */
 389 #define NONL SPECIAL(0x3, 0xA) /* This key not affected by Num Lock */
 390 /* Combinations 0x30B to 0x30F are reserved for non-parameterized functions */
 391 
 392 #define FA_CLASS SPECIAL(0x4, 0)
 393                                 /* thru 0x40F.  These are for "floating */
 394                                 /* accent" characters.  The low-order 4 bits */
 395                                 /* select one of those characters. */
 396 /* Definitions for the individual floating accents: */
 397 #define FA_UMLAUT SPECIAL(0x4, 0x0)     /* umlaut accent */
 398 #define FA_CFLEX SPECIAL(0x4, 0x1)      /* circumflex accent */
 399 #define FA_TILDE SPECIAL(0x4, 0x2)      /* tilde accent */
 400 #define FA_CEDILLA SPECIAL(0x4, 0x3)    /* cedilla accent */
 401 #define FA_ACUTE SPECIAL(0x4, 0x4)      /* acute accent */
 402 #define FA_GRAVE SPECIAL(0x4, 0x5)      /* grave accent */
 403 #define FA_MACRON SPECIAL(0x4, 0x6)     /* macron accent */
 404 #define FA_BREVE SPECIAL(0x4, 0x7)      /* breve accent */
 405 #define FA_DOT SPECIAL(0x4, 0x8)        /* dot accent */
 406 #define FA_SLASH SPECIAL(0x4, 0x9)      /* slash accent */
 407 #define FA_RING SPECIAL(0x4, 0xa)       /* ring accent */
 408 #define FA_APOSTROPHE SPECIAL(0x4, 0xb) /* apostrophe accent */
 409 #define FA_DACUTE SPECIAL(0x4, 0xc)     /* double acute accent */
 410 #define FA_OGONEK SPECIAL(0x4, 0xd)     /* ogonek accent */
 411 #define FA_CARON SPECIAL(0x4, 0xe)      /* caron accent */
 412 
 413 #define STRING SPECIAL(0x5, 0)  /* thru 0x50F.  The low-order 4 bits index */
 414                                 /* a table select a string to be returned, */
 415                                 /* char by char.  Each entry the table is */
 416                                 /* null terminated. */
 417 #define KTAB_STRLEN     10      /* Maximum string length (including null) */
 418 /* Definitions for the individual string numbers: */
 419 #define HOMEARROW       0x00
 420 #define UPARROW         0x01
 421 #define DOWNARROW       0x02
 422 #define LEFTARROW       0x03
 423 #define RIGHTARROW      0x04
 424 /* string numbers 5 thru F are available to users making custom entries */
 425 
 426 /*
 427  * In the following function key groupings, the low-order 4 bits indicate
 428  * the function key number within the group, and the next 4 bits indicate
 429  * the group.
 430  */
 431 #define FUNCKEYS        SPECIAL(0x6, 0)
 432 #define LEFTFUNC SPECIAL(0x6, 0x0)      /* thru 0x60F.  The "left" group. */
 433 #define RIGHTFUNC SPECIAL(0x6, 0x10)    /* thru 0x61F.  The "right" group. */
 434 #define TOPFUNC SPECIAL(0x6, 0x20)      /* thru 0x62F.  The "top" group. */
 435 #define BOTTOMFUNC SPECIAL(0x6, 0x30)   /* thru 0x63F.  The "bottom" group. */
 436 #define LF(n)           (LEFTFUNC+(n)-1)
 437 #define RF(n)           (RIGHTFUNC+(n)-1)
 438 #define TF(n)           (TOPFUNC+(n)-1)
 439 #define BF(n)           (BOTTOMFUNC+(n)-1)
 440 
 441 /*
 442  * The actual keyboard positions may not be on the left/right/top/bottom
 443  * of the physical keyboard (although they usually are).
 444  * What is important is that we have reserved 64 keys for function keys.
 445  *
 446  * Normally, striking a function key will cause the following escape sequence
 447  * to be sent through the character stream:
 448  *      ESC[0..9z
 449  * where ESC is a single escape character and 0..9 indicate some number of
 450  * digits needed to encode the function key as a decimal number.
 451  */
 452 #define PADKEYS         SPECIAL(0x7, 0)
 453 #define PADEQUAL SPECIAL(0x7, 0x00)             /* keypad = */
 454 #define PADSLASH SPECIAL(0x7, 0x01)             /* keypad / */
 455 #define PADSTAR SPECIAL(0x7, 0x02)              /* keypad * */
 456 #define PADMINUS SPECIAL(0x7, 0x03)             /* keypad - */
 457 #define PADSEP SPECIAL(0x7, 0x04)               /* keypad,  */
 458 #define PAD7 SPECIAL(0x7, 0x05)         /* keypad 7 */
 459 #define PAD8 SPECIAL(0x7, 0x06)         /* keypad 8 */
 460 #define PAD9 SPECIAL(0x7, 0x07)         /* keypad 9 */
 461 #define PADPLUS SPECIAL(0x7, 0x08)              /* keypad + */
 462 #define PAD4 SPECIAL(0x7, 0x09)         /* keypad 4 */
 463 #define PAD5 SPECIAL(0x7, 0x0A)         /* keypad 5 */
 464 #define PAD6 SPECIAL(0x7, 0x0B)         /* keypad 6 */
 465 #define PAD1 SPECIAL(0x7, 0x0C)         /* keypad 1 */
 466 #define PAD2 SPECIAL(0x7, 0x0D)         /* keypad 2 */
 467 #define PAD3 SPECIAL(0x7, 0x0E)         /* keypad 3 */
 468 #define PAD0 SPECIAL(0x7, 0x0F)         /* keypad 0 */
 469 #define PADDOT SPECIAL(0x7, 0x10)               /* keypad . */
 470 #define PADENTER SPECIAL(0x7, 0x11)             /* keypad Enter */
 471 
 472 #ifdef  __cplusplus
 473 }
 474 #endif
 475 
 476 #endif  /* _SYS_KBD_H */
 |