Merge branch 'tizen_qemu_2.0' 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 "hw/virtio/virtio.h"
34
35 #define TYPE_VIRTIO_TOUCHSCREEN "virtio-touchscreen-device"
36 #define VIRTIO_TOUCHSCREEN(obj) \
37         OBJECT_CHECK(VirtIOTouchscreen, (obj), TYPE_VIRTIO_TOUCHSCREEN)
38
39 #define TOUCHSCREEN_OPTION_NAME "max_point"
40 #define DEFAULT_MAX_FINGER (1)
41
42 typedef struct VirtIOTouchscreen {
43     VirtIODevice vdev;
44     /* simply a queue into which buffers are posted
45     by the guest for consumption by the host */
46     VirtQueue *vq;
47     bool waitBuf;
48
49     QEMUBH *bh;
50     DeviceState *qdev;
51
52     unsigned int max_finger;
53 } VirtIOTouchscreen;
54
55 /* This structure must match the kernel definitions */
56 typedef struct EmulTouchEvent {
57     uint16_t x, y, z;
58     uint8_t state;
59 } EmulTouchEvent;
60
61 void virtio_touchscreen_event(int x, int y, int z, int buttons_state);
62 void maru_virtio_touchscreen_notify(void);
63
64 #endif /* MARU_TOUCHSCREEN_H_ */