- Stephen Rothwell: APM updates
[davej-history.git] / include / linux / kbd_kern.h
blobef922b03977af3a83eb7935c7e538679942ba7d3
1 #ifndef _KBD_KERN_H
2 #define _KBD_KERN_H
4 #include <linux/interrupt.h>
5 #include <linux/keyboard.h>
7 extern struct tasklet_struct keyboard_tasklet;
9 extern int shift_state;
11 extern char *func_table[MAX_NR_FUNC];
12 extern char func_buf[];
13 extern char *funcbufptr;
14 extern int funcbufsize, funcbufleft;
17 * kbd->xxx contains the VC-local things (flag settings etc..)
19 * Note: externally visible are LED_SCR, LED_NUM, LED_CAP defined in kd.h
20 * The code in KDGETLED / KDSETLED depends on the internal and
21 * external order being the same.
23 * Note: lockstate is used as index in the array key_map.
25 struct kbd_struct {
27 unsigned char lockstate;
28 /* 8 modifiers - the names do not have any meaning at all;
29 they can be associated to arbitrarily chosen keys */
30 #define VC_SHIFTLOCK KG_SHIFT /* shift lock mode */
31 #define VC_ALTGRLOCK KG_ALTGR /* altgr lock mode */
32 #define VC_CTRLLOCK KG_CTRL /* control lock mode */
33 #define VC_ALTLOCK KG_ALT /* alt lock mode */
34 #define VC_SHIFTLLOCK KG_SHIFTL /* shiftl lock mode */
35 #define VC_SHIFTRLOCK KG_SHIFTR /* shiftr lock mode */
36 #define VC_CTRLLLOCK KG_CTRLL /* ctrll lock mode */
37 #define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
38 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
40 unsigned char ledmode:2; /* one 2-bit value */
41 #define LED_SHOW_FLAGS 0 /* traditional state */
42 #define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
43 #define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */
45 unsigned char ledflagstate:3; /* flags, not lights */
46 unsigned char default_ledflagstate:3;
47 #define VC_SCROLLOCK 0 /* scroll-lock mode */
48 #define VC_NUMLOCK 1 /* numeric lock mode */
49 #define VC_CAPSLOCK 2 /* capslock mode */
51 unsigned char kbdmode:2; /* one 2-bit value */
52 #define VC_XLATE 0 /* translate keycodes using keymap */
53 #define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
54 #define VC_RAW 2 /* raw (scancode) mode */
55 #define VC_UNICODE 3 /* Unicode mode */
57 unsigned char modeflags:5;
58 #define VC_APPLIC 0 /* application key mode */
59 #define VC_CKMODE 1 /* cursor key mode */
60 #define VC_REPEAT 2 /* keyboard repeat */
61 #define VC_CRLF 3 /* 0 - enter sends CR, 1 - enter sends CRLF */
62 #define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */
65 extern struct kbd_struct kbd_table[];
67 extern int kbd_init(void);
69 extern unsigned char getledstate(void);
70 extern void setledstate(struct kbd_struct *kbd, unsigned int led);
72 extern struct tasklet_struct console_tasklet;
74 extern int do_poke_blanked_console;
76 extern void (*kbd_ledfunc)(unsigned int led);
78 extern inline void show_console(void)
80 do_poke_blanked_console = 1;
81 tasklet_schedule(&console_tasklet);
84 extern inline void set_console(int nr)
86 want_console = nr;
87 tasklet_schedule(&console_tasklet);
90 extern inline void set_leds(void)
92 tasklet_schedule(&keyboard_tasklet);
95 extern inline int vc_kbd_mode(struct kbd_struct * kbd, int flag)
97 return ((kbd->modeflags >> flag) & 1);
100 extern inline int vc_kbd_led(struct kbd_struct * kbd, int flag)
102 return ((kbd->ledflagstate >> flag) & 1);
105 extern inline void set_vc_kbd_mode(struct kbd_struct * kbd, int flag)
107 kbd->modeflags |= 1 << flag;
110 extern inline void set_vc_kbd_led(struct kbd_struct * kbd, int flag)
112 kbd->ledflagstate |= 1 << flag;
115 extern inline void clr_vc_kbd_mode(struct kbd_struct * kbd, int flag)
117 kbd->modeflags &= ~(1 << flag);
120 extern inline void clr_vc_kbd_led(struct kbd_struct * kbd, int flag)
122 kbd->ledflagstate &= ~(1 << flag);
125 extern inline void chg_vc_kbd_lock(struct kbd_struct * kbd, int flag)
127 kbd->lockstate ^= 1 << flag;
130 extern inline void chg_vc_kbd_slock(struct kbd_struct * kbd, int flag)
132 kbd->slockstate ^= 1 << flag;
135 extern inline void chg_vc_kbd_mode(struct kbd_struct * kbd, int flag)
137 kbd->modeflags ^= 1 << flag;
140 extern inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag)
142 kbd->ledflagstate ^= 1 << flag;
145 #define U(x) ((x) ^ 0xf000)
147 /* keyboard.c */
149 struct console;
151 int getkeycode(unsigned int scancode);
152 int setkeycode(unsigned int scancode, unsigned int keycode);
153 void compute_shiftstate(void);
154 int keyboard_wait_for_keypress(struct console *);
156 /* defkeymap.c */
158 extern unsigned int keymap_count;
160 /* console.c */
162 extern task_queue con_task_queue;
164 extern inline void con_schedule_flip(struct tty_struct *t)
166 queue_task(&t->flip.tqueue, &con_task_queue);
167 tasklet_schedule(&console_tasklet);
170 #endif