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
19
20
21
22
23
24
25
26struct kbd_struct {
27
28 unsigned char lockstate;
29
30
31#define VC_SHIFTLOCK KG_SHIFT
32#define VC_ALTGRLOCK KG_ALTGR
33#define VC_CTRLLOCK KG_CTRL
34#define VC_ALTLOCK KG_ALT
35#define VC_SHIFTLLOCK KG_SHIFTL
36#define VC_SHIFTRLOCK KG_SHIFTR
37#define VC_CTRLLLOCK KG_CTRLL
38#define VC_CTRLRLOCK KG_CTRLR
39 unsigned char slockstate;
40
41 unsigned char ledmode:2;
42#define LED_SHOW_FLAGS 0
43#define LED_SHOW_IOCTL 1
44#define LED_SHOW_MEM 2
45
46 unsigned char ledflagstate:4;
47 unsigned char default_ledflagstate:4;
48#define VC_SCROLLOCK 0
49#define VC_NUMLOCK 1
50#define VC_CAPSLOCK 2
51#define VC_KANALOCK 3
52
53 unsigned char kbdmode:2;
54#define VC_XLATE 0
55#define VC_MEDIUMRAW 1
56#define VC_RAW 2
57#define VC_UNICODE 3
58
59 unsigned char modeflags:5;
60#define VC_APPLIC 0
61#define VC_CKMODE 1
62#define VC_REPEAT 2
63#define VC_CRLF 3
64#define VC_META 4
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 int 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#define BRL_UC_ROW 0x2800
139
140
141
142struct console;
143
144int getkeycode(unsigned int scancode);
145int setkeycode(unsigned int scancode, unsigned int keycode);
146void compute_shiftstate(void);
147
148
149
150extern unsigned int keymap_count;
151
152
153
154static inline void con_schedule_flip(struct tty_struct *t)
155{
156 unsigned long flags;
157 spin_lock_irqsave(&t->buf.lock, flags);
158 if (t->buf.tail != NULL)
159 t->buf.tail->commit = t->buf.tail->used;
160 spin_unlock_irqrestore(&t->buf.lock, flags);
161 schedule_delayed_work(&t->buf.work, 0);
162}
163
164
165extern int mac_hid_mouse_emulate_buttons(int, unsigned int, int);
166
167#endif
168