Merge "virtio-9p: enable the virtfs on Windows." into tizen
[sdk/emulator/qemu.git] / tizen / src / hw / maru_virtio_touchscreen.h
1 /*
2  * Maru Virtio Touchscreen Device
3  *
4  * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
5  *
6  * Contact:
7  *  GiWoong Kim <giwoong.kim@samsung.com>
8  *  YeongKyoon Lee <yeongkyoon.lee@samsung.com>
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
23  *
24  * Contributors:
25  * - S-Core Co., Ltd
26  *
27  */
28
29
30 #ifndef MARU_TOUCHSCREEN_H_
31 #define MARU_TOUCHSCREEN_H_
32
33 #include "ui/console.h"
34 #include "hw/virtio/virtio.h"
35
36 #define TYPE_VIRTIO_TOUCHSCREEN "virtio-touchscreen-device"
37 #define VIRTIO_TOUCHSCREEN(obj) \
38         OBJECT_CHECK(VirtIOTouchscreen, (obj), TYPE_VIRTIO_TOUCHSCREEN)
39
40 #define TOUCHSCREEN_OPTION_NAME "max_point"
41 #define DEFAULT_MAX_FINGER (1)
42
43 typedef struct VirtIOTouchscreen {
44     VirtIODevice vdev;
45     /* simply a queue into which buffers are posted
46     by the guest for consumption by the host */
47     VirtQueue *vq;
48     bool waitBuf;
49
50     QEMUBH *bh;
51     DeviceState *qdev;
52     QEMUPutMouseEntry *eh_entry;
53
54     unsigned int max_finger;
55 } VirtIOTouchscreen;
56
57 /* This structure must match the kernel definitions */
58 typedef struct EmulTouchEvent {
59     uint16_t x, y, z;
60     uint8_t state;
61 } EmulTouchEvent;
62
63 VirtIODevice *maru_virtio_touchscreen_init(DeviceState *dev);
64 void maru_virtio_touchscreen_exit(VirtIODevice *vdev);
65
66 void virtio_touchscreen_event(void *opaque, int x, int y, int z, int buttons_state);
67 void maru_virtio_touchscreen_notify(void);
68
69 #endif /* MARU_TOUCHSCREEN_H_ */