#ifndef __TPCTL_H__
#define __TPCTL_H__
#include <sys/queue.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplay_usl_io.h>
#include <dev/hpc/hpcfbio.h>
#define MAXDATALEN 128
#define TPCTL_DB_FILENAME "/etc/tpctl.dat"
#define TPCTL_TMP_FILENAME "tpctl.tmp"
#define TPCTL_TP_DEVICE "/dev/wsmux0"
#define TPCTL_FB_DEVICE "/dev/ttyE0"
enum tpctl_data_type {
TPCTL_CALIBCOORDS,
TPCTL_COMMENT,
};
enum tpctl_data_ERROR {
ERR_NONE,
ERR_NOFILE,
ERR_IO,
ERR_SYNTAX,
ERR_DUPNAME,
};
struct tpctl_data_elem {
enum tpctl_data_type type;
TAILQ_ENTRY(tpctl_data_elem) link;
char *name;
struct wsmouse_calibcoords calibcoords;
};
struct tpctl_data {
int lineno;
TAILQ_HEAD(,tpctl_data_elem) list;
};
struct tp {
int fd;
char id[WSMOUSE_ID_MAXLEN];
};
typedef u_int32_t fb_pixel_t;
struct fb {
int fd;
int dispmode;
struct hpcfb_fbconf conf;
unsigned char *baseaddr;
fb_pixel_t *linecache, *workbuf;
fb_pixel_t white, black;
int linecache_y;
};
int init_data(struct tpctl_data *);
int read_data(const char *, struct tpctl_data *);
int write_data(const char *, struct tpctl_data *);
void write_coords(FILE *, char *, struct wsmouse_calibcoords *);
void free_data(struct tpctl_data *);
int replace_data(struct tpctl_data *, char *, struct wsmouse_calibcoords *);
struct wsmouse_calibcoords *search_data(struct tpctl_data *, char *);
int tp_init(struct tp *, int);
int tp_setrawmode(struct tp *);
int tp_setcalibcoords(struct tp *, struct wsmouse_calibcoords *);
int tp_flush(struct tp *);
int tp_get(struct tp *, int *, int *, int (*)(void *), void *);
int tp_waitup(struct tp *, int, int (*)(void *), void *);
int fb_dispmode(struct fb *, int);
int fb_init(struct fb *, int);
void fb_getline(struct fb *, int);
void fb_putline(struct fb *, int);
void fb_fetchline(struct fb *, int);
void fb_flush(struct fb *);
void fb_drawline(struct fb *, int, int, int, int, fb_pixel_t);
void fb_drawpixel(struct fb *, int, int, fb_pixel_t);
#endif