1 /* $NetBSD: kbdif.h,v 1.3 2008/05/04 19:56:29 cegger Exp $ */
3 * kbdif.h -- Xen virtual keyboard/mouse
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
23 * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
24 * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
27 #ifndef __XEN_PUBLIC_IO_KBDIF_H__
28 #define __XEN_PUBLIC_IO_KBDIF_H__
30 /* In events (backend -> frontend) */
33 * Frontends should ignore unknown in events.
36 /* Pointer movement event */
37 #define XENKBD_TYPE_MOTION 1
38 /* Event type 2 currently not used */
39 /* Key event (includes pointer buttons) */
40 #define XENKBD_TYPE_KEY 3
42 * Pointer position event
43 * Capable backend sets feature-abs-pointer in xenstore.
44 * Frontend requests ot instead of XENKBD_TYPE_MOTION by setting
45 * request-abs-update in xenstore.
47 #define XENKBD_TYPE_POS 4
51 uint8_t type
; /* XENKBD_TYPE_MOTION */
52 int32_t rel_x
; /* relative X motion */
53 int32_t rel_y
; /* relative Y motion */
54 int32_t rel_z
; /* relative Z motion (wheel) */
59 uint8_t type
; /* XENKBD_TYPE_KEY */
60 uint8_t pressed
; /* 1 if pressed; 0 otherwise */
61 uint32_t keycode
; /* KEY_* from linux/input.h */
64 struct xenkbd_position
66 uint8_t type
; /* XENKBD_TYPE_POS */
67 int32_t abs_x
; /* absolute X position (in FB pixels) */
68 int32_t abs_y
; /* absolute Y position (in FB pixels) */
69 int32_t rel_z
; /* relative Z motion (wheel) */
72 #define XENKBD_IN_EVENT_SIZE 40
77 struct xenkbd_motion motion
;
78 struct xenkbd_key key
;
79 struct xenkbd_position pos
;
80 char pad
[XENKBD_IN_EVENT_SIZE
];
83 /* Out events (frontend -> backend) */
86 * Out events may be sent only when requested by backend, and receipt
87 * of an unknown out event is an error.
88 * No out events currently defined.
91 #define XENKBD_OUT_EVENT_SIZE 40
93 union xenkbd_out_event
96 char pad
[XENKBD_OUT_EVENT_SIZE
];
101 #define XENKBD_IN_RING_SIZE 2048
102 #define XENKBD_IN_RING_LEN (XENKBD_IN_RING_SIZE / XENKBD_IN_EVENT_SIZE)
103 #define XENKBD_IN_RING_OFFS 1024
104 #define XENKBD_IN_RING(page) \
105 ((union xenkbd_in_event *)((char *)(page) + XENKBD_IN_RING_OFFS))
106 #define XENKBD_IN_RING_REF(page, idx) \
107 (XENKBD_IN_RING((page))[(idx) % XENKBD_IN_RING_LEN])
109 #define XENKBD_OUT_RING_SIZE 1024
110 #define XENKBD_OUT_RING_LEN (XENKBD_OUT_RING_SIZE / XENKBD_OUT_EVENT_SIZE)
111 #define XENKBD_OUT_RING_OFFS (XENKBD_IN_RING_OFFS + XENKBD_IN_RING_SIZE)
112 #define XENKBD_OUT_RING(page) \
113 ((union xenkbd_out_event *)((char *)(page) + XENKBD_OUT_RING_OFFS))
114 #define XENKBD_OUT_RING_REF(page, idx) \
115 (XENKBD_OUT_RING((page))[(idx) % XENKBD_OUT_RING_LEN])
119 uint32_t in_cons
, in_prod
;
120 uint32_t out_cons
, out_prod
;
131 * indent-tabs-mode: nil