2 * linux/include/linux/xenkbd.h -- Xen virtual keyboard/mouse
6 * Anthony Liguori <aliguori@us.ibm.com>
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive for
13 #ifndef _LINUX_XENKBD_H
14 #define _LINUX_XENKBD_H
16 #include <asm/types.h>
20 #define XENKBD_IN_EVENT_SIZE 40
22 #define XENKBD_TYPE_MOTION 1 /* mouse movement event */
23 #define XENKBD_TYPE_BUTTON 2 /* mouse button event */
24 #define XENKBD_TYPE_KEY 3 /* keyboard event */
28 __u8 type; /* XENKBD_TYPE_MOTION */
29 __s16 rel_x; /* relative X motion */
30 __s16 rel_y; /* relative Y motion */
35 __u8 type; /* XENKBD_TYPE_BUTTON */
36 __u8 pressed; /* 1 if pressed; 0 otherwise */
37 __u8 button; /* the button (0, 1, 2 is right, middle, left) */
42 __u8 type; /* XENKBD_TYPE_KEY */
43 __u8 pressed; /* 1 if pressed; 0 otherwise */
44 __u16 keycode; /* KEY_* from linux/input.h */
50 struct xenkbd_motion motion;
51 struct xenkbd_button button;
52 struct xenkbd_key key;
53 char _[XENKBD_IN_EVENT_SIZE];
58 #define XENKBD_OUT_EVENT_SIZE 40
60 union xenkbd_out_event
63 char _[XENKBD_OUT_EVENT_SIZE];
68 #define XENKBD_IN_RING_SIZE 2048
69 #define XENKBD_IN_RING_LEN (XENKBD_IN_RING_SIZE / XENKBD_IN_EVENT_SIZE)
70 #define XENKBD_IN_RING_OFFS 1024
71 #define XENKBD_IN_RING(page) \
72 ((union xenkbd_in_event *)((char *)(page) + XENKBD_IN_RING_OFFS))
73 #define XENKBD_IN_RING_REF(page, idx) \
74 (XENKBD_IN_RING((page))[(idx) % XENKBD_IN_RING_LEN])
76 #define XENKBD_OUT_RING_SIZE 1024
77 #define XENKBD_OUT_RING_LEN (XENKBD_OUT_RING_SIZE / XENKBD_OUT_EVENT_SIZE)
78 #define XENKBD_OUT_RING_OFFS (XENKBD_IN_RING_OFFS + XENKBD_IN_RING_SIZE)
79 #define XENKBD_OUT_RING(page) \
80 ((union xenkbd_out_event *)((char *)(page) + XENKBD_OUT_RING_OFFS))
81 #define XENKBD_OUT_RING_REF(page, idx) \
82 (XENKBD_OUT_RING((page))[(idx) % XENKBD_OUT_RING_LEN])
86 __u32 in_cons, in_prod;
87 __u32 out_cons, out_prod;
90 void xenkbd_resume(void);