aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kbd_kern.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/kbd_kern.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/kbd_kern.h')
-rw-r--r--include/linux/kbd_kern.h157
1 files changed, 157 insertions, 0 deletions
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
new file mode 100644
index 000000000000..7428198111eb
--- /dev/null
+++ b/include/linux/kbd_kern.h
@@ -0,0 +1,157 @@
1#ifndef _KBD_KERN_H
2#define _KBD_KERN_H
3
4#include <linux/tty.h>
5#include <linux/interrupt.h>
6#include <linux/keyboard.h>
7
8extern struct tasklet_struct keyboard_tasklet;
9
10extern int shift_state;
11
12extern char *func_table[MAX_NR_FUNC];
13extern char func_buf[];
14extern char *funcbufptr;
15extern int funcbufsize, funcbufleft;
16
17/*
18 * kbd->xxx contains the VC-local things (flag settings etc..)
19 *
20 * Note: externally visible are LED_SCR, LED_NUM, LED_CAP defined in kd.h
21 * The code in KDGETLED / KDSETLED depends on the internal and
22 * external order being the same.
23 *
24 * Note: lockstate is used as index in the array key_map.
25 */
26struct kbd_struct {
27
28 unsigned char lockstate;
29/* 8 modifiers - the names do not have any meaning at all;
30 they can be associated to arbitrarily chosen keys */
31#define VC_SHIFTLOCK KG_SHIFT /* shift lock mode */
32#define VC_ALTGRLOCK KG_ALTGR /* altgr lock mode */
33#define VC_CTRLLOCK KG_CTRL /* control lock mode */
34#define VC_ALTLOCK KG_ALT /* alt lock mode */
35#define VC_SHIFTLLOCK KG_SHIFTL /* shiftl lock mode */
36#define VC_SHIFTRLOCK KG_SHIFTR /* shiftr lock mode */
37#define VC_CTRLLLOCK KG_CTRLL /* ctrll lock mode */
38#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
39 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
40
41 unsigned char ledmode:2; /* one 2-bit value */
42#define LED_SHOW_FLAGS 0 /* traditional state */
43#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
44#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */
45
46 unsigned char ledflagstate:4; /* flags, not lights */
47 unsigned char default_ledflagstate:4;
48#define VC_SCROLLOCK 0 /* scroll-lock mode */
49#define VC_NUMLOCK 1 /* numeric lock mode */
50#define VC_CAPSLOCK 2 /* capslock mode */
51#define VC_KANALOCK 3 /* kanalock mode */
52
53 unsigned char kbdmode:2; /* one 2-bit value */
54#define VC_XLATE 0 /* translate keycodes using keymap */
55#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
56#define VC_RAW 2 /* raw (scancode) mode */
57#define VC_UNICODE 3 /* Unicode mode */
58
59 unsigned char modeflags:5;
60#define VC_APPLIC 0 /* application key mode */
61#define VC_CKMODE 1 /* cursor key mode */
62#define VC_REPEAT 2 /* keyboard repeat */
63#define VC_CRLF 3 /* 0 - enter sends CR, 1 - enter sends CRLF */
64#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */
65};
66
67extern struct kbd_struct kbd_table[];
68
69extern int kbd_init(void);
70
71extern unsigned char getledstate(void);
72extern void setledstate(struct kbd_struct *kbd, unsigned int led);
73
74extern int do_poke_blanked_console;
75
76extern void (*kbd_ledfunc)(unsigned int led);
77
78extern void set_console(int nr);
79extern void schedule_console_callback(void);
80
81static inline void set_leds(void)
82{
83 tasklet_schedule(&keyboard_tasklet);
84}
85
86static inline int vc_kbd_mode(struct kbd_struct * kbd, int flag)
87{
88 return ((kbd->modeflags >> flag) & 1);
89}
90
91static inline int vc_kbd_led(struct kbd_struct * kbd, int flag)
92{
93 return ((kbd->ledflagstate >> flag) & 1);
94}
95
96static inline void set_vc_kbd_mode(struct kbd_struct * kbd, int flag)
97{
98 kbd->modeflags |= 1 << flag;
99}
100
101static inline void set_vc_kbd_led(struct kbd_struct * kbd, int flag)
102{
103 kbd->ledflagstate |= 1 << flag;
104}
105
106static inline void clr_vc_kbd_mode(struct kbd_struct * kbd, int flag)
107{
108 kbd->modeflags &= ~(1 << flag);
109}
110
111static inline void clr_vc_kbd_led(struct kbd_struct * kbd, int flag)
112{
113 kbd->ledflagstate &= ~(1 << flag);
114}
115
116static inline void chg_vc_kbd_lock(struct kbd_struct * kbd, int flag)
117{
118 kbd->lockstate ^= 1 << flag;
119}
120
121static inline void chg_vc_kbd_slock(struct kbd_struct * kbd, int flag)
122{
123 kbd->slockstate ^= 1 << flag;
124}
125
126static inline void chg_vc_kbd_mode(struct kbd_struct * kbd, int flag)
127{
128 kbd->modeflags ^= 1 << flag;
129}
130
131static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag)
132{
133 kbd->ledflagstate ^= 1 << flag;
134}
135
136#define U(x) ((x) ^ 0xf000)
137
138/* keyboard.c */
139
140struct console;
141
142int getkeycode(unsigned int scancode);
143int setkeycode(unsigned int scancode, unsigned int keycode);
144void compute_shiftstate(void);
145
146/* defkeymap.c */
147
148extern unsigned int keymap_count;
149
150/* console.c */
151
152static inline void con_schedule_flip(struct tty_struct *t)
153{
154 schedule_work(&t->flip.work);
155}
156
157#endif