debuggers.hg

view xenolinux-2.4.21-sparse/include/asm-xeno/keyboard.h @ 672:2e36bfa1978c

bitkeeper revision 1.353 (3f13c7d5NDWHAyq2VYrx7Mqs7QYIfQ)

vga.h, keyboard.h, setup.c, ioport.c:
Cleanups.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jul 15 09:22:29 2003 +0000 (2003-07-15)
parents d2aad5afa33c
children 3dce70f5b210
line source
1 /* xenolinux/include/asm-xeno/keyboard.h */
2 /* Portions copyright (c) 2003 James Scott, Intel Research Cambridge */
3 /* Talks to hypervisor to get PS/2 keyboard and mouse events, and send keyboard and mouse commands */
5 /* Based on:
6 * linux/include/asm-i386/keyboard.h
7 *
8 * Created 3 Nov 1996 by Geert Uytterhoeven
9 */
11 #ifndef _XENO_KEYBOARD_H
12 #define _XENO_KEYBOARD_H
14 #ifdef __KERNEL__
16 #include <linux/kernel.h>
17 #include <linux/ioport.h>
18 #include <linux/kd.h>
19 #include <linux/pm.h>
20 #include <asm/io.h>
23 #define KEYBOARD_IRQ _EVENT_KBD
24 #define AUX_IRQ _EVENT_KBD
26 /* THIS SECTION RELATIVELY UNTOUCHED */
28 extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
29 extern int pckbd_getkeycode(unsigned int scancode);
30 extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
31 char raw_mode);
32 extern char pckbd_unexpected_up(unsigned char keycode);
33 extern void pckbd_leds(unsigned char leds);
34 extern void pckbd_init_hw(void);
35 extern int pckbd_pm_resume(struct pm_dev *, pm_request_t, void *);
37 extern pm_callback pm_kbd_request_override;
38 extern unsigned char pckbd_sysrq_xlate[128];
40 #define kbd_setkeycode pckbd_setkeycode
41 #define kbd_getkeycode pckbd_getkeycode
42 #define kbd_translate pckbd_translate
43 #define kbd_unexpected_up pckbd_unexpected_up
44 #define kbd_leds pckbd_leds
45 #define kbd_init_hw pckbd_init_hw
46 #define kbd_sysrq_xlate pckbd_sysrq_xlate
48 #define SYSRQ_KEY 0x54
51 /* THIS SECTION TALKS TO XEN TO DO PS2 SUPPORT */
52 #include <asm/hypervisor-ifs/kbd.h>
53 #include <asm/hypervisor-ifs/hypervisor-if.h>
55 #define kbd_controller_present xen_kbd_controller_present
57 static inline int xen_kbd_controller_present ()
58 {
59 return start_info.flags & SIF_CONSOLE;
60 }
62 /* resource allocation */
63 #define kbd_request_region() do { } while (0)
64 #define kbd_request_irq(handler) request_irq(_EVENT_KBD, handler, 0, "PS/2 kbd", NULL)
66 /* could implement these with command to xen to filter mouse stuff... */
67 #define aux_request_irq(hand, dev_id) 0
68 #define aux_free_irq(dev_id) do { } while(0)
70 /* Some stoneage hardware needs delays after some operations. */
71 #define kbd_pause() do { } while(0)
73 static unsigned char kbd_current_scancode = 0;
75 static unsigned char kbd_read_input(void)
76 {
77 return kbd_current_scancode;
78 }
80 static unsigned char kbd_read_status(void)
81 {
82 long res;
83 res = HYPERVISOR_kbd_op(KBD_OP_READ,0);
84 if ( res<0 )
85 {
86 kbd_current_scancode = 0;
87 return 0; /* error with our request - wrong domain? */
88 }
89 kbd_current_scancode = KBD_CODE_SCANCODE(res);
90 return KBD_CODE_STATUS(res);
91 }
94 #define kbd_write_output(val) HYPERVISOR_kbd_op(KBD_OP_WRITEOUTPUT, val);
95 #define kbd_write_command(val) HYPERVISOR_kbd_op(KBD_OP_WRITECOMMAND, val);
98 #endif /* __KERNEL__ */
99 #endif /* _XENO_KEYBOARD_H */