root/drivers/char/kbd_kern.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. set_leds
  2. vc_kbd_mode
  3. vc_kbd_led
  4. set_vc_kbd_mode
  5. set_vc_kbd_led
  6. clr_vc_kbd_mode
  7. clr_vc_kbd_led
  8. chg_vc_kbd_lock
  9. chg_vc_kbd_slock
  10. chg_vc_kbd_mode
  11. chg_vc_kbd_led

   1 #ifndef _KBD_KERN_H
   2 #define _KBD_KERN_H
   3 
   4 #include <linux/interrupt.h>
   5 #include <linux/keyboard.h>
   6 
   7 extern int shift_state;
   8 
   9 extern char *func_table[MAX_NR_FUNC];
  10 extern char func_buf[];
  11 extern char *funcbufptr;
  12 extern int funcbufsize, funcbufleft;
  13 
  14 /*
  15  * kbd->xxx contains the VC-local things (flag settings etc..)
  16  *
  17  * Note: externally visible are LED_SCR, LED_NUM, LED_CAP defined in kd.h
  18  *       The code in KDGETLED / KDSETLED depends on the internal and
  19  *       external order being the same.
  20  *
  21  * Note: lockstate is used as index in the array key_map.
  22  */
  23 struct kbd_struct {
  24 
  25         unsigned char lockstate;
  26 /* 8 modifiers - the names do not have any meaning at all;
  27    they can be associated to arbitrarily chosen keys */
  28 #define VC_SHIFTLOCK    KG_SHIFT        /* shift lock mode */
  29 #define VC_ALTGRLOCK    KG_ALTGR        /* altgr lock mode */
  30 #define VC_CTRLLOCK     KG_CTRL         /* control lock mode */
  31 #define VC_ALTLOCK      KG_ALT          /* alt lock mode */
  32 #define VC_SHIFTLLOCK   KG_SHIFTL       /* shiftl lock mode */
  33 #define VC_SHIFTRLOCK   KG_SHIFTR       /* shiftr lock mode */
  34 #define VC_CTRLLLOCK    KG_CTRLL        /* ctrll lock mode */
  35 #define VC_CTRLRLOCK    KG_CTRLR        /* ctrlr lock mode */
  36         unsigned char slockstate;       /* for `sticky' Shift, Ctrl, etc. */
  37 
  38         unsigned char ledmode:2;        /* one 2-bit value */
  39 #define LED_SHOW_FLAGS 0        /* traditional state */
  40 #define LED_SHOW_IOCTL 1        /* only change leds upon ioctl */
  41 #define LED_SHOW_MEM 2          /* `heartbeat': peek into memory */
  42 
  43         unsigned char ledflagstate:3;   /* flags, not lights */
  44         unsigned char default_ledflagstate:3;
  45 #define VC_SCROLLOCK    0       /* scroll-lock mode */
  46 #define VC_NUMLOCK      1       /* numeric lock mode */
  47 #define VC_CAPSLOCK     2       /* capslock mode */
  48 
  49         unsigned char kbdmode:2;        /* one 2-bit value */
  50 #define VC_XLATE        0       /* translate keycodes using keymap */
  51 #define VC_MEDIUMRAW    1       /* medium raw (keycode) mode */
  52 #define VC_RAW          2       /* raw (scancode) mode */
  53 #define VC_UNICODE      3       /* Unicode mode */
  54 
  55         unsigned char modeflags:5;
  56 #define VC_APPLIC       0       /* application key mode */
  57 #define VC_CKMODE       1       /* cursor key mode */
  58 #define VC_REPEAT       2       /* keyboard repeat */
  59 #define VC_CRLF         3       /* 0 - enter sends CR, 1 - enter sends CRLF */
  60 #define VC_META         4       /* 0 - meta, 1 - meta=prefix with ESC */
  61 };
  62 
  63 extern struct kbd_struct kbd_table[];
  64 
  65 extern int kbd_init(void);
  66 
  67 extern unsigned char getledstate(void);
  68 extern void setledstate(struct kbd_struct *kbd, unsigned int led);
  69 
  70 extern inline void set_leds(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  71 {
  72         mark_bh(KEYBOARD_BH);
  73 }
  74 
  75 extern inline int vc_kbd_mode(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
  76 {
  77         return ((kbd->modeflags >> flag) & 1);
  78 }
  79 
  80 extern inline int vc_kbd_led(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
  81 {
  82         return ((kbd->ledflagstate >> flag) & 1);
  83 }
  84 
  85 extern inline void set_vc_kbd_mode(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
  86 {
  87         kbd->modeflags |= 1 << flag;
  88 }
  89 
  90 extern inline void set_vc_kbd_led(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
  91 {
  92         kbd->ledflagstate |= 1 << flag;
  93 }
  94 
  95 extern inline void clr_vc_kbd_mode(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
  96 {
  97         kbd->modeflags &= ~(1 << flag);
  98 }
  99 
 100 extern inline void clr_vc_kbd_led(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
 101 {
 102         kbd->ledflagstate &= ~(1 << flag);
 103 }
 104 
 105 extern inline void chg_vc_kbd_lock(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
 106 {
 107         kbd->lockstate ^= 1 << flag;
 108 }
 109 
 110 extern inline void chg_vc_kbd_slock(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
 111 {
 112         kbd->slockstate ^= 1 << flag;
 113 }
 114 
 115 extern inline void chg_vc_kbd_mode(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
 116 {
 117         kbd->modeflags ^= 1 << flag;
 118 }
 119 
 120 extern inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag)
     /* [previous][next][first][last][top][bottom][index][help] */
 121 {
 122         kbd->ledflagstate ^= 1 << flag;
 123 }
 124 
 125 #define U(x) ((x) ^ 0xf000)
 126 
 127 #endif

/* [previous][next][first][last][top][bottom][index][help] */