1 /* $NetBSD: tpctl.h,v 1.5 2008/05/10 15:31:05 martin Exp $ */
4 * Copyright (c) 2002, 2003 TAKEMRUA Shin
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of The NetBSD Foundation nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
35 #include <sys/queue.h>
36 #include <dev/wscons/wsconsio.h>
37 #include <dev/wscons/wsdisplay_usl_io.h>
38 #include <dev/hpc/hpcfbio.h>
40 #define MAXDATALEN 128
41 #define TPCTL_DB_FILENAME "/etc/tpctl.dat"
42 #define TPCTL_TMP_FILENAME "tpctl.tmp"
43 #define TPCTL_TP_DEVICE "/dev/wsmux0"
44 #define TPCTL_FB_DEVICE "/dev/ttyE0"
47 enum tpctl_data_type
{
52 enum tpctl_data_ERROR
{
60 struct tpctl_data_elem
{
61 enum tpctl_data_type type
;
62 TAILQ_ENTRY(tpctl_data_elem
) link
;
64 struct wsmouse_calibcoords calibcoords
;
69 TAILQ_HEAD(,tpctl_data_elem
) list
;
74 char id
[WSMOUSE_ID_MAXLEN
];
77 typedef u_int32_t fb_pixel_t
;
81 struct hpcfb_fbconf conf
;
82 unsigned char *baseaddr
;
83 fb_pixel_t
*linecache
, *workbuf
;
84 fb_pixel_t white
, black
;
88 int init_data(struct tpctl_data
*);
89 int read_data(const char *, struct tpctl_data
*);
90 int write_data(const char *, struct tpctl_data
*);
91 void write_coords(FILE *, char *, struct wsmouse_calibcoords
*);
92 void free_data(struct tpctl_data
*);
93 int replace_data(struct tpctl_data
*, char *, struct wsmouse_calibcoords
*);
94 struct wsmouse_calibcoords
*search_data(struct tpctl_data
*, char *);
96 int tp_init(struct tp
*, int);
97 int tp_setrawmode(struct tp
*);
98 int tp_setcalibcoords(struct tp
*, struct wsmouse_calibcoords
*);
99 int tp_flush(struct tp
*);
100 int tp_get(struct tp
*, int *, int *, int (*)(void *), void *);
101 int tp_waitup(struct tp
*, int, int (*)(void *), void *);
103 int fb_dispmode(struct fb
*, int);
104 int fb_init(struct fb
*, int);
105 void fb_getline(struct fb
*, int);
106 void fb_putline(struct fb
*, int);
107 void fb_fetchline(struct fb
*, int);
108 void fb_flush(struct fb
*);
109 void fb_drawline(struct fb
*, int, int, int, int, fb_pixel_t
);
110 void fb_drawpixel(struct fb
*, int, int, fb_pixel_t
);
112 #endif /* __TPCTL_TP_H__ */