Home | History | Annotate | Line # | Download | only in tpctl
      1  1.6    nonaka /*	$NetBSD: tpctl.h,v 1.6 2009/04/28 10:57:24 nonaka 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.5    martin  * 3. Neither the name of The NetBSD Foundation nor the names of its
     16  1.5    martin  *    contributors may be used to endorse or promote products derived
     17  1.5    martin  *    from this software without specific prior written permission.
     18  1.1  takemura  *
     19  1.1  takemura  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.1  takemura  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1  takemura  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1  takemura  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.1  takemura  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1  takemura  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1  takemura  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1  takemura  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1  takemura  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1  takemura  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1  takemura  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1  takemura  */
     31  1.1  takemura 
     32  1.1  takemura #ifndef __TPCTL_H__
     33  1.1  takemura #define __TPCTL_H__
     34  1.1  takemura 
     35  1.1  takemura #include <sys/queue.h>
     36  1.1  takemura #include <dev/wscons/wsconsio.h>
     37  1.1  takemura #include <dev/wscons/wsdisplay_usl_io.h>
     38  1.1  takemura #include <dev/hpc/hpcfbio.h>
     39  1.1  takemura 
     40  1.1  takemura #define MAXDATALEN		128
     41  1.1  takemura #define TPCTL_DB_FILENAME	"/etc/tpctl.dat"
     42  1.1  takemura #define TPCTL_TMP_FILENAME	"tpctl.tmp"
     43  1.1  takemura #define TPCTL_TP_DEVICE		"/dev/wsmux0"
     44  1.1  takemura #define TPCTL_FB_DEVICE		"/dev/ttyE0"
     45  1.1  takemura 
     46  1.1  takemura 
     47  1.1  takemura enum tpctl_data_type {
     48  1.1  takemura 	TPCTL_CALIBCOORDS,
     49  1.1  takemura 	TPCTL_COMMENT,
     50  1.1  takemura };
     51  1.1  takemura 
     52  1.1  takemura enum tpctl_data_ERROR {
     53  1.1  takemura 	ERR_NONE,
     54  1.1  takemura 	ERR_NOFILE,
     55  1.1  takemura 	ERR_IO,
     56  1.1  takemura 	ERR_SYNTAX,
     57  1.1  takemura 	ERR_DUPNAME,
     58  1.1  takemura };
     59  1.1  takemura 
     60  1.1  takemura struct tpctl_data_elem {
     61  1.1  takemura 	enum tpctl_data_type type;
     62  1.1  takemura 	TAILQ_ENTRY(tpctl_data_elem) link;
     63  1.1  takemura 	char *name;
     64  1.1  takemura 	struct wsmouse_calibcoords calibcoords;
     65  1.1  takemura };
     66  1.1  takemura 
     67  1.1  takemura struct tpctl_data {
     68  1.1  takemura 	int lineno;
     69  1.1  takemura 	TAILQ_HEAD(,tpctl_data_elem) list;
     70  1.1  takemura };
     71  1.1  takemura 
     72  1.1  takemura struct tp {
     73  1.1  takemura 	int fd;
     74  1.2  takemura 	char id[WSMOUSE_ID_MAXLEN];
     75  1.1  takemura };
     76  1.1  takemura 
     77  1.1  takemura typedef u_int32_t fb_pixel_t;
     78  1.1  takemura struct fb {
     79  1.1  takemura 	int fd;
     80  1.1  takemura 	int dispmode;
     81  1.1  takemura 	struct hpcfb_fbconf conf;
     82  1.1  takemura 	unsigned char *baseaddr;
     83  1.1  takemura 	fb_pixel_t *linecache, *workbuf;
     84  1.1  takemura 	fb_pixel_t white, black;
     85  1.1  takemura 	int linecache_y;
     86  1.1  takemura };
     87  1.1  takemura 
     88  1.1  takemura int init_data(struct tpctl_data *);
     89  1.6    nonaka int read_data(const char *, struct tpctl_data *);
     90  1.6    nonaka int write_data(const char *, struct tpctl_data *);
     91  1.1  takemura void write_coords(FILE *, char *, struct wsmouse_calibcoords *);
     92  1.1  takemura void free_data(struct tpctl_data *);
     93  1.1  takemura int replace_data(struct tpctl_data *, char *, struct wsmouse_calibcoords *);
     94  1.1  takemura struct wsmouse_calibcoords *search_data(struct tpctl_data *, char *);
     95  1.1  takemura 
     96  1.1  takemura int tp_init(struct tp *, int);
     97  1.1  takemura int tp_setrawmode(struct tp *);
     98  1.1  takemura int tp_setcalibcoords(struct tp *, struct wsmouse_calibcoords *);
     99  1.1  takemura int tp_flush(struct tp *);
    100  1.1  takemura int tp_get(struct tp *, int *, int *, int (*)(void *), void *);
    101  1.1  takemura int tp_waitup(struct tp *, int, int (*)(void *), void *);
    102  1.1  takemura 
    103  1.1  takemura int fb_dispmode(struct fb *, int);
    104  1.1  takemura int fb_init(struct fb *, int);
    105  1.1  takemura void fb_getline(struct fb *, int);
    106  1.1  takemura void fb_putline(struct fb *, int);
    107  1.1  takemura void fb_fetchline(struct fb *, int);
    108  1.1  takemura void fb_flush(struct fb *);
    109  1.1  takemura void fb_drawline(struct fb *, int, int, int, int, fb_pixel_t);
    110  1.1  takemura void fb_drawpixel(struct fb *, int, int, fb_pixel_t);
    111  1.1  takemura 
    112  1.3       uwe #endif /* __TPCTL_TP_H__ */
    113