Blame view

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