Home | History | Annotate | Line # | Download | only in tpctl
tpctl.h revision 1.4
      1  1.4    martin /*	$NetBSD: tpctl.h,v 1.4 2008/04/29 06:53:04 martin Exp $	*/
      2  1.1  takemura 
      3  1.1  takemura /*-
      4  1.2  takemura  * Copyright (c) 2002, 2003 TAKEMRUA Shin
      5  1.1  takemura  * All rights reserved.
      6  1.1  takemura  *
      7  1.1  takemura  * Redistribution and use in source and binary forms, with or without
      8  1.1  takemura  * modification, are permitted provided that the following conditions
      9  1.1  takemura  * are met:
     10  1.1  takemura  * 1. Redistributions of source code must retain the above copyright
     11  1.1  takemura  *    notice, this list of conditions and the following disclaimer.
     12  1.1  takemura  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  takemura  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  takemura  *    documentation and/or other materials provided with the distribution.
     15  1.1  takemura  *
     16  1.1  takemura  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17  1.1  takemura  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  1.1  takemura  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  1.1  takemura  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20  1.1  takemura  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  1.1  takemura  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  1.1  takemura  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  1.1  takemura  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  1.1  takemura  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  1.1  takemura  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1  takemura  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1  takemura  */
     28  1.1  takemura 
     29  1.1  takemura #ifndef __TPCTL_H__
     30  1.1  takemura #define __TPCTL_H__
     31  1.1  takemura 
     32  1.1  takemura #include <sys/queue.h>
     33  1.1  takemura #include <dev/wscons/wsconsio.h>
     34  1.1  takemura #include <dev/wscons/wsdisplay_usl_io.h>
     35  1.1  takemura #include <dev/hpc/hpcfbio.h>
     36  1.1  takemura 
     37  1.1  takemura #define MAXDATALEN		128
     38  1.1  takemura #define TPCTL_DB_FILENAME	"/etc/tpctl.dat"
     39  1.1  takemura #define TPCTL_TMP_FILENAME	"tpctl.tmp"
     40  1.1  takemura #define TPCTL_TP_DEVICE		"/dev/wsmux0"
     41  1.1  takemura #define TPCTL_FB_DEVICE		"/dev/ttyE0"
     42  1.1  takemura 
     43  1.1  takemura 
     44  1.1  takemura enum tpctl_data_type {
     45  1.1  takemura 	TPCTL_CALIBCOORDS,
     46  1.1  takemura 	TPCTL_COMMENT,
     47  1.1  takemura };
     48  1.1  takemura 
     49  1.1  takemura enum tpctl_data_ERROR {
     50  1.1  takemura 	ERR_NONE,
     51  1.1  takemura 	ERR_NOFILE,
     52  1.1  takemura 	ERR_IO,
     53  1.1  takemura 	ERR_SYNTAX,
     54  1.1  takemura 	ERR_DUPNAME,
     55  1.1  takemura };
     56  1.1  takemura 
     57  1.1  takemura struct tpctl_data_elem {
     58  1.1  takemura 	enum tpctl_data_type type;
     59  1.1  takemura 	TAILQ_ENTRY(tpctl_data_elem) link;
     60  1.1  takemura 	char *name;
     61  1.1  takemura 	struct wsmouse_calibcoords calibcoords;
     62  1.1  takemura };
     63  1.1  takemura 
     64  1.1  takemura struct tpctl_data {
     65  1.1  takemura 	int lineno;
     66  1.1  takemura 	TAILQ_HEAD(,tpctl_data_elem) list;
     67  1.1  takemura };
     68  1.1  takemura 
     69  1.1  takemura struct tp {
     70  1.1  takemura 	int fd;
     71  1.2  takemura 	char id[WSMOUSE_ID_MAXLEN];
     72  1.1  takemura };
     73  1.1  takemura 
     74  1.1  takemura typedef u_int32_t fb_pixel_t;
     75  1.1  takemura struct fb {
     76  1.1  takemura 	int fd;
     77  1.1  takemura 	int dispmode;
     78  1.1  takemura 	struct hpcfb_fbconf conf;
     79  1.1  takemura 	unsigned char *baseaddr;
     80  1.1  takemura 	fb_pixel_t *linecache, *workbuf;
     81  1.1  takemura 	fb_pixel_t white, black;
     82  1.1  takemura 	int linecache_y;
     83  1.1  takemura };
     84  1.1  takemura 
     85  1.1  takemura int init_data(struct tpctl_data *);
     86  1.1  takemura int read_data(char *, struct tpctl_data *);
     87  1.1  takemura int write_data(char *, struct tpctl_data *);
     88  1.1  takemura void write_coords(FILE *, char *, struct wsmouse_calibcoords *);
     89  1.1  takemura void free_data(struct tpctl_data *);
     90  1.1  takemura int replace_data(struct tpctl_data *, char *, struct wsmouse_calibcoords *);
     91  1.1  takemura struct wsmouse_calibcoords *search_data(struct tpctl_data *, char *);
     92  1.1  takemura 
     93  1.1  takemura int tp_init(struct tp *, int);
     94  1.1  takemura int tp_setrawmode(struct tp *);
     95  1.1  takemura int tp_setcalibcoords(struct tp *, struct wsmouse_calibcoords *);
     96  1.1  takemura int tp_flush(struct tp *);
     97  1.1  takemura int tp_get(struct tp *, int *, int *, int (*)(void *), void *);
     98  1.1  takemura int tp_waitup(struct tp *, int, int (*)(void *), void *);
     99  1.1  takemura 
    100  1.1  takemura int fb_dispmode(struct fb *, int);
    101  1.1  takemura int fb_init(struct fb *, int);
    102  1.1  takemura void fb_getline(struct fb *, int);
    103  1.1  takemura void fb_putline(struct fb *, int);
    104  1.1  takemura void fb_fetchline(struct fb *, int);
    105  1.1  takemura void fb_flush(struct fb *);
    106  1.1  takemura void fb_drawline(struct fb *, int, int, int, int, fb_pixel_t);
    107  1.1  takemura void fb_drawpixel(struct fb *, int, int, fb_pixel_t);
    108  1.1  takemura 
    109  1.3       uwe #endif /* __TPCTL_TP_H__ */
    110