~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/kbd_kern.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php