2 * kbdif.h -- Xen virtual keyboard/mouse
4 * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
5 * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
12 #ifndef __XEN_PUBLIC_IO_KBDIF_H__
13 #define __XEN_PUBLIC_IO_KBDIF_H__
15 #include <asm/types.h>
17 /* In events (backend -> frontend) */
20 * Frontends should ignore unknown in events.
23 /* Pointer movement event */
24 #define XENKBD_TYPE_MOTION 1
25 /* Event type 2 currently not used */
26 /* Key event (includes pointer buttons) */
27 #define XENKBD_TYPE_KEY 3
29 * Pointer position event
30 * Capable backend sets feature-abs-pointer in xenstore.
31 * Frontend requests ot instead of XENKBD_TYPE_MOTION by setting
32 * request-abs-update in xenstore.
34 #define XENKBD_TYPE_POS 4
38 __u8 type; /* XENKBD_TYPE_MOTION */
39 __s32 rel_x; /* relative X motion */
40 __s32 rel_y; /* relative Y motion */
45 __u8 type; /* XENKBD_TYPE_KEY */
46 __u8 pressed; /* 1 if pressed; 0 otherwise */
47 __u32 keycode; /* KEY_* from linux/input.h */
50 struct xenkbd_position
52 __u8 type; /* XENKBD_TYPE_POS */
53 __s32 abs_x; /* absolute X position (in FB pixels) */
54 __s32 abs_y; /* absolute Y position (in FB pixels) */
57 #define XENKBD_IN_EVENT_SIZE 40
62 struct xenkbd_motion motion;
63 struct xenkbd_key key;
64 struct xenkbd_position pos;
65 char pad[XENKBD_IN_EVENT_SIZE];
68 /* Out events (frontend -> backend) */
71 * Out events may be sent only when requested by backend, and receipt
72 * of an unknown out event is an error.
73 * No out events currently defined.
76 #define XENKBD_OUT_EVENT_SIZE 40
78 union xenkbd_out_event
81 char pad[XENKBD_OUT_EVENT_SIZE];
86 #define XENKBD_IN_RING_SIZE 2048
87 #define XENKBD_IN_RING_LEN (XENKBD_IN_RING_SIZE / XENKBD_IN_EVENT_SIZE)
88 #define XENKBD_IN_RING_OFFS 1024
89 #define XENKBD_IN_RING(page) \
90 ((union xenkbd_in_event *)((char *)(page) + XENKBD_IN_RING_OFFS))
91 #define XENKBD_IN_RING_REF(page, idx) \
92 (XENKBD_IN_RING((page))[(idx) % XENKBD_IN_RING_LEN])
94 #define XENKBD_OUT_RING_SIZE 1024
95 #define XENKBD_OUT_RING_LEN (XENKBD_OUT_RING_SIZE / XENKBD_OUT_EVENT_SIZE)
96 #define XENKBD_OUT_RING_OFFS (XENKBD_IN_RING_OFFS + XENKBD_IN_RING_SIZE)
97 #define XENKBD_OUT_RING(page) \
98 ((union xenkbd_out_event *)((char *)(page) + XENKBD_OUT_RING_OFFS))
99 #define XENKBD_OUT_RING_REF(page, idx) \
100 (XENKBD_OUT_RING((page))[(idx) % XENKBD_OUT_RING_LEN])
104 __u32 in_cons, in_prod;
105 __u32 out_cons, out_prod;