ANSI KNF.

This commit is contained in:
uch 2001-06-04 18:59:31 +00:00
parent 842b6023c3
commit 859a6a49b2
17 changed files with 343 additions and 513 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bivideovar.h,v 1.1 2001/02/22 18:37:54 uch Exp $ */
/* $NetBSD: bivideovar.h,v 1.2 2001/06/04 18:59:31 uch Exp $ */
/*
* Copyright (c) 2000 Takemura Shin
@ -28,4 +28,4 @@
*/
extern int bivideo_dont_attach;
int bivideo_getcnfb __P((struct hpcfb_fbconf* fb));
int bivideo_getcnfb(struct hpcfb_fbconf *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: btnmgr.c,v 1.1 2001/02/22 18:37:54 uch Exp $ */
/* $NetBSD: btnmgr.c,v 1.2 2001/06/04 18:59:31 uch Exp $ */
/*-
* Copyright (c) 1999
@ -79,18 +79,10 @@ struct btnmgr_softc {
#endif
};
/*
static struct btnmgr_softc *the_btnmgr_sc;
*/
/*
void btnmgrattach __P((int));
*/
int btnmgrmatch __P((struct device *, struct cfdata *, void *));
void btnmgrattach __P((struct device *, struct device *, void *));
char* btnmgr_name __P((long));
static int btnmgr_hook __P((void *, int, long, void *));
int btnmgrmatch(struct device *, struct cfdata *, void *);
void btnmgrattach(struct device *, struct device *, void *);
char *btnmgr_name(long);
static int btnmgr_hook(void *, int, long, void *);
/*
* global/static data
@ -100,9 +92,9 @@ struct cfattach btnmgr_ca = {
};
/* wskbd accessopts */
int btnmgr_wskbd_enable __P((void *, int));
void btnmgr_wskbd_set_leds __P((void *, int));
int btnmgr_wskbd_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
int btnmgr_wskbd_enable(void *, int);
void btnmgr_wskbd_set_leds(void *, int);
int btnmgr_wskbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
const struct wskbd_accessops btnmgr_wskbd_accessops = {
btnmgr_wskbd_enable,
@ -137,15 +129,15 @@ static const int n_button_config =
#define KC(n) KS_KEYCODE(n)
static const keysym_t btnmgr_keydesc_default[] = {
/* pos normal shifted */
KC(1), KS_Escape,
KC(28), KS_Return,
KC(57), KS_Cmd, KS_Cmd_BacklightToggle,
KC(67), KS_f9,
KC(68), KS_f10,
KC(72), KS_KP_Up,
KC(80), KS_KP_Down,
KC(87), KS_f11,
KC(88), KS_f12,
KC(1), KS_Escape,
KC(28), KS_Return,
KC(57), KS_Cmd, KS_Cmd_BacklightToggle,
KC(67), KS_f9,
KC(68), KS_f10,
KC(72), KS_KP_Up,
KC(80), KS_KP_Down,
KC(87), KS_f11,
KC(88), KS_f12,
};
#undef KC
#define KBD_MAP(name, base, map) \
@ -165,10 +157,7 @@ struct wskbd_mapdata btnmgr_keymapdata = {
* function bodies
*/
int
btnmgrmatch(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
btnmgrmatch(struct device *parent, struct cfdata *match, void *aux)
{
struct mainbus_attach_args *ma = aux;
@ -179,9 +168,7 @@ btnmgrmatch(parent, match, aux)
}
void
btnmgrattach(parent, self, aux)
struct device *parent, *self;
void *aux;
btnmgrattach(struct device *parent, struct device *self, void *aux)
{
int id;
struct btnmgr_softc *sc = (struct btnmgr_softc *)self;
@ -195,8 +182,8 @@ btnmgrattach(parent, self, aux)
for (id = 0; id <= CONFIG_HOOK_MAX_ID; id++)
if (button_config[id].name != NULL)
sc->sc_hook_tag = config_hook(CONFIG_HOOK_BUTTONEVENT,
id, CONFIG_HOOK_SHARE,
btnmgr_hook, sc);
id, CONFIG_HOOK_SHARE,
btnmgr_hook, sc);
/*
* attach wskbd
@ -210,11 +197,7 @@ btnmgrattach(parent, self, aux)
}
static int
btnmgr_hook(ctx, type, id, msg)
void *ctx;
int type;
long id;
void *msg;
btnmgr_hook(void *ctx, int type, long id, void *msg)
{
struct btnmgr_softc *sc = ctx;
@ -228,35 +211,32 @@ btnmgr_hook(ctx, type, id, msg)
int n;
u_char data[16];
n = pckbd_encode(evtype, button_config[id].keycode,
data);
data);
wskbd_rawinput(sc->sc_wskbddev, data, n);
} else
#endif
wskbd_input(sc->sc_wskbddev, evtype,
wskbd_input(sc->sc_wskbddev, evtype,
button_config[id].keycode);
}
if (id == CONFIG_HOOK_BUTTONEVENT_POWER && msg)
config_hook_call(CONFIG_HOOK_PMEVENT,
CONFIG_HOOK_PMEVENT_SUSPENDREQ, NULL);
CONFIG_HOOK_PMEVENT_SUSPENDREQ, NULL);
return (0);
}
char*
btnmgr_name(id)
long id;
btnmgr_name(long id)
{
if (id < n_button_config)
return button_config[id].name;
return (button_config[id].name);
return ("unknown");
}
int
btnmgr_wskbd_enable(scx, on)
void *scx;
int on;
btnmgr_wskbd_enable(void *scx, int on)
{
struct btnmgr_softc *sc = scx;
@ -272,9 +252,7 @@ btnmgr_wskbd_enable(scx, on)
}
void
btnmgr_wskbd_set_leds(scx, leds)
void *scx;
int leds;
btnmgr_wskbd_set_leds(void *scx, int leds)
{
/*
* We have nothing to do.
@ -282,12 +260,8 @@ btnmgr_wskbd_set_leds(scx, leds)
}
int
btnmgr_wskbd_ioctl(scx, cmd, data, flag, p)
void *scx;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
btnmgr_wskbd_ioctl(void *scx, u_long cmd, caddr_t data, int flag,
struct proc *p)
{
#ifdef WSDISPLAY_COMPAT_RAWKBD
struct btnmgr_softc *sc = scx;
@ -295,10 +269,10 @@ btnmgr_wskbd_ioctl(scx, cmd, data, flag, p)
switch (cmd) {
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_HPC_BTN;
return 0;
return (0);
case WSKBDIO_SETLEDS:
DPRINTF(("%s(%d): no LED\n", __FILE__, __LINE__));
return 0;
return (0);
case WSKBDIO_GETLEDS:
DPRINTF(("%s(%d): no LED\n", __FILE__, __LINE__));
*(int *)data = 0;
@ -307,7 +281,7 @@ btnmgr_wskbd_ioctl(scx, cmd, data, flag, p)
case WSKBDIO_SETMODE:
sc->sc_rawkbd = (*(int *)data == WSKBD_RAW);
DPRINTF(("%s(%d): rawkbd is %s\n", __FILE__, __LINE__,
sc->sc_rawkbd ? "on" : "off"));
sc->sc_rawkbd ? "on" : "off"));
return (0);
#endif
}
@ -316,48 +290,31 @@ btnmgr_wskbd_ioctl(scx, cmd, data, flag, p)
#ifdef notyet
int
btnmgropen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
btnmgropen(dev_t dev, int flag, int mode, struct proc *p)
{
return (EINVAL);
}
int
btnmgrclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
btnmgrclose(dev_t dev, int flag, int mode, struct proc *p)
{
return (EINVAL);
}
int
btnmgrread(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
btnmgrread(dev_t dev, struct uio *uio, int flag)
{
return (EINVAL);
}
int
btnmgrwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
btnmgrwrite(dev_t dev, struct uio *uio, int flag)
{
return (EINVAL);
}
int
btnmgrioctl(dev, cmd, data, flag, p)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
btnmgrioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
{
return (EINVAL);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: button.c,v 1.3 2001/05/01 00:25:16 takemura Exp $ */
/* $NetBSD: button.c,v 1.4 2001/06/04 18:59:31 uch Exp $ */
/*-
* Copyright (c) 1999-2001
@ -59,40 +59,31 @@ struct button_softc {
config_hook_tag sc_ghook_tag;
};
static int button_match __P((struct device *, struct cfdata *,
void *));
static void button_attach __P((struct device *, struct device *,
void *));
static int button_intr __P((void*));
static int button_state __P((void *ctx, int type, long id,
void *msg));
static int button_match(struct device *, struct cfdata *, void *);
static void button_attach(struct device *, struct device *, void *);
static int button_intr(void *);
static int button_state(void *, int, long, void *);
struct cfattach button_ca = {
sizeof(struct button_softc), button_match, button_attach
};
int
button_match(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
button_match(struct device *parent, struct cfdata *match, void *aux)
{
struct hpcio_attach_args *haa = aux;
platid_mask_t mask;
if (strcmp(haa->haa_busname, HPCIO_BUSNAME))
return 0;
return (0);
if (match->cf_loc[HPCIOIFCF_PLATFORM] == 0)
return 0;
return (0);
mask = PLATID_DEREF(match->cf_loc[HPCIOIFCF_PLATFORM]);
return platid_match(&platid, &mask);
return (platid_match(&platid, &mask));
}
void
button_attach(parent, self, aux)
struct device *parent;
struct device *self;
void *aux;
button_attach(struct device *parent, struct device *self, void *aux)
{
struct hpcio_attach_args *haa = aux;
int *loc;
@ -105,7 +96,7 @@ button_attach(parent, self, aux)
sc->sc_id = loc[HPCIOIFCF_ID];
sc->sc_active = loc[HPCIOIFCF_ACTIVE];
printf(" port=%d id=%ld active=%s",
sc->sc_port, sc->sc_id, sc->sc_active ? "high" : "low");
sc->sc_port, sc->sc_id, sc->sc_active ? "high" : "low");
#if 0
#if 1 /* Windows CE default */
@ -151,37 +142,29 @@ button_attach(parent, self, aux)
else
sc->sc_intr_handle =
hpcio_intr_establish(sc->sc_hc, sc->sc_port,
mode, button_intr, sc);
sc->sc_ghook_tag = config_hook(CONFIG_HOOK_GET,
sc->sc_id,
CONFIG_HOOK_SHARE,
button_state,
sc);
mode, button_intr, sc);
sc->sc_ghook_tag = config_hook(CONFIG_HOOK_GET, sc->sc_id,
CONFIG_HOOK_SHARE, button_state, sc);
printf("\n");
}
int
button_state(ctx, type, id, msg)
void *ctx;
int type;
long id;
void *msg;
button_state(void *ctx, int type, long id, void *msg)
{
struct button_softc *sc = ctx;
if (type != CONFIG_HOOK_GET || id != sc->sc_id)
return 1;
return (1);
if (CONFIG_HOOK_VALUEP(msg))
return 1;
return (1);
*(int*)msg = (hpcio_portread(sc->sc_hc, sc->sc_port) == sc->sc_active);
return 0;
return (0);
}
int
button_intr(ctx)
void *ctx;
button_intr(void *ctx)
{
struct button_softc *sc = ctx;
int on;
@ -193,5 +176,5 @@ button_intr(ctx)
config_hook_call(CONFIG_HOOK_BUTTONEVENT, sc->sc_id, (void*)on);
return 0;
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fontconv.c,v 1.1 2001/02/22 18:37:55 uch Exp $ */
/* $NetBSD: fontconv.c,v 1.2 2001/06/04 18:59:31 uch Exp $ */
#include <stdio.h>
@ -41,7 +41,7 @@ fc_rasops(int ac, char* av[])
code = 0;
fprintf(ofp, "static u_char %s%dx%d_data[] = {\n",
fontname, width, height, code);
fontname, width, height, code);
while (1) {
int n;
int i, j, k;
@ -85,7 +85,7 @@ fc_rasops(int ac, char* av[])
fprintf(ofp, "};\n");
fprintf(ofp, "struct wsdisplay_font %s%dx%d = {\n",
fontname, width, height);
fontname, width, height);
fprintf(ofp, " \"%s\",\t\t\t/* typeface name */\n", fontname);
fprintf(ofp, " 0x%02x,\t\t\t/* firstchar */\n", code_min);
fprintf(ofp, " %d,\t\t\t/* numchars */\n", code_max - code_min + 1);
@ -96,7 +96,7 @@ fc_rasops(int ac, char* av[])
fprintf(ofp, " WSDISPLAY_FONTENC_L2R,\t/* bit order */\n");
fprintf(ofp, " WSDISPLAY_FONTENC_L2R,\t/* byte order */\n");
fprintf(ofp, " %s%dx%d_data\t\t/* data */\n",
fontname, width, height);
fontname, width, height);
fprintf(ofp, "};\n");
}
@ -128,7 +128,7 @@ fc_rcons(int ac, char* av[])
}
fprintf(ofp, "static u_int32_t %s%dx%d_%d_pix[] = {\n",
fontname, width, height, code);
fontname, width, height, code);
k = 0;
for (i = 0; i < height; i++) {
@ -144,9 +144,9 @@ fc_rcons(int ac, char* av[])
}
fprintf(ofp, "};\n");
fprintf(ofp, "static struct raster %s%dx%d_%d = {",
fontname, width, height, code);
fontname, width, height, code);
fprintf(ofp, " %d, %d, 1, 1, %s%dx%d_%d_pix, 0 };\n",
width, height, fontname, width, height, code);
width, height, fontname, width, height, code);
if (code < code_min) {
code_min = code;
}
@ -157,13 +157,13 @@ fc_rcons(int ac, char* av[])
}
fprintf(ofp, "struct raster_font %s%dx%d = {\n",
fontname, width, height);
fontname, width, height);
fprintf(ofp, " %d, %d, %d, ", width, height, ascent);
fprintf(ofp, "RASFONT_FIXEDWIDTH|RASFONT_NOVERTICALMOVEMENT,\n");
fprintf(ofp, " {\n");
for (code = code_min; code <= code_max; code++) {
fprintf(ofp, " { &%s%dx%d_%d, ",
fontname, width, height, code);
fontname, width, height, code);
fprintf(ofp, "%d, %d, %d, %d },\n", 0, -ascent, width, 0);
}
fprintf(ofp, " },\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpccmap_gen.c,v 1.2 2001/05/08 14:46:06 uch Exp $ */
/* $NetBSD: hpccmap_gen.c,v 1.3 2001/06/04 18:59:31 uch Exp $ */
/*-
* Copyright (c) 1999
@ -45,9 +45,7 @@ unsigned char compo6[6] = { 0, 51, 102, 153, 204, 255 };
unsigned char compo7[7] = { 0, 42, 85, 127, 170, 212, 255 };
void
main(ac, av)
int ac;
char *av[];
main(int ac, char *av[])
{
int i;
char *rgb = "rgb";
@ -65,10 +63,8 @@ main(ac, av)
}
void
rgb_separate_out(ctxx, idx, r, g, b)
void* ctxx;
int idx;
unsigned char r, g, b;
rgb_separate_out(void *ctxx, int idx, unsigned char r, unsigned char g,
unsigned char b)
{
int rgb = (int)ctxx;
@ -90,9 +86,7 @@ rgb_separate_out(ctxx, idx, r, g, b)
}
void
cmap_gen(func, ctx)
output_func func;
void *ctx;
cmap_gen(output_func func, void *ctx)
{
int i, r, g, b;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpcfb.c,v 1.3 2001/05/08 14:46:06 uch Exp $ */
/* $NetBSD: hpcfb.c,v 1.4 2001/06/04 18:59:31 uch Exp $ */
/*-
* Copyright (c) 1999
@ -46,7 +46,7 @@
static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1999 Shin Takemura. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) =
"$NetBSD: hpcfb.c,v 1.3 2001/05/08 14:46:06 uch Exp $";
"$NetBSD: hpcfb.c,v 1.4 2001/06/04 18:59:31 uch Exp $";
#include <sys/param.h>
#include <sys/systm.h>
@ -165,7 +165,7 @@ struct hpcfb_softc {
struct proc *sc_thread;
struct lock sc_lock;
void *sc_wantedscreen;
void (*sc_switchcb) __P((void *, int, int));
void (*sc_switchcb)(void *, int, int);
void *sc_switchcbarg;
struct callout sc_switch_callout;
};
@ -173,52 +173,49 @@ struct hpcfb_softc {
/*
* function prototypes
*/
int hpcfbmatch __P((struct device *, struct cfdata *, void *));
void hpcfbattach __P((struct device *, struct device *, void *));
int hpcfbprint __P((void *aux, const char *pnp));
int hpcfbmatch(struct device *, struct cfdata *, void *);
void hpcfbattach(struct device *, struct device *, void *);
int hpcfbprint(void *, const char *);
int hpcfb_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
paddr_t hpcfb_mmap __P((void *, off_t, int));
int hpcfb_ioctl(void *, u_long, caddr_t, int, struct proc *);
paddr_t hpcfb_mmap(void *, off_t, int);
void hpcfb_refresh_screen __P((struct hpcfb_softc *sc));
void hpcfb_doswitch __P((struct hpcfb_softc *sc));
void hpcfb_refresh_screen(struct hpcfb_softc *);
void hpcfb_doswitch(struct hpcfb_softc *);
#ifdef HPCFB_JUMP
static void hpcfb_create_thread __P((void *));
static void hpcfb_thread __P((void *));
static void hpcfb_create_thread(void *);
static void hpcfb_thread(void *);
#endif /* HPCFB_JUMP */
static int hpcfb_init __P((struct hpcfb_fbconf *fbconf,
struct hpcfb_devconfig *dc));
static int hpcfb_alloc_screen __P((void *, const struct wsscreen_descr *,
void **, int *, int *, long *));
static void hpcfb_free_screen __P((void *, void *));
static int hpcfb_show_screen __P((void *, void *, int,
void (*) (void *, int, int), void *));
static void hpcfb_pollc __P((void *, int));
static void hpcfb_power __P((int, void *));
static void hpcfb_cmap_reorder __P((struct hpcfb_fbconf *,
struct hpcfb_devconfig *));
static int hpcfb_init(struct hpcfb_fbconf *, struct hpcfb_devconfig *);
static int hpcfb_alloc_screen(void *, const struct wsscreen_descr *,
void **, int *, int *, long *);
static void hpcfb_free_screen(void *, void *);
static int hpcfb_show_screen(void *, void *, int,
void (*) (void *, int, int), void *);
static void hpcfb_pollc(void *, int);
static void hpcfb_power(int, void *);
static void hpcfb_cmap_reorder(struct hpcfb_fbconf *,
struct hpcfb_devconfig *);
static int pow __P((int, int));
static int pow(int, int);
void hpcfb_cursor __P((void *c, int on, int row, int col));
int hpcfb_mapchar __P((void *, int, unsigned int *));
void hpcfb_putchar __P((void *c, int row, int col, u_int uc, long attr));
void hpcfb_copycols __P((void *c, int row, int srccol,
int dstcol, int ncols));
void hpcfb_erasecols __P((void *c, int row, int startcol,
int ncols, long attr));
void hpcfb_redraw __P((void *c, int row, int nrows, int all));
void hpcfb_copyrows __P((void *c, int srcrow, int dstrow, int nrows));
void hpcfb_eraserows __P((void *c, int row, int nrows, long attr));
int hpcfb_alloc_attr __P((void *c, int fg, int bg, int flags, long *attr));
void hpcfb_cursor_raw __P((void *c, int on, int row, int col));
void hpcfb_cursor(void *, int, int, int);
int hpcfb_mapchar(void *, int, unsigned int *);
void hpcfb_putchar(void *, int, int, u_int, long);
void hpcfb_copycols(void *, int, int, int, int);
void hpcfb_erasecols(void *, int, int, int, long);
void hpcfb_redraw(void *, int, int, int);
void hpcfb_copyrows(void *, int, int, int);
void hpcfb_eraserows(void *, int, int, long);
int hpcfb_alloc_attr(void *, int, int, int, long *);
void hpcfb_cursor_raw(void *, int, int, int);
#ifdef HPCFB_JUMP
void hpcfb_update __P((void *));
void hpcfb_do_scroll __P((void *));
void hpcfb_check_update __P((void *));
void hpcfb_update(void *);
void hpcfb_do_scroll(void *);
void hpcfb_check_update(void *);
#endif /* HPCFB_JUMP */
struct wsdisplay_emulops hpcfb_emulops = {
@ -267,11 +264,11 @@ struct wsdisplay_accessops hpcfb_accessops = {
hpcfb_pollc
};
void hpcfb_tv_putchar __P((struct hpcfb_devconfig *, int, int, u_int, long));
void hpcfb_tv_copycols __P((struct hpcfb_devconfig *, int, int, int, int));
void hpcfb_tv_erasecols __P((struct hpcfb_devconfig *, int, int, int, long));
void hpcfb_tv_copyrows __P((struct hpcfb_devconfig *, int, int, int));
void hpcfb_tv_eraserows __P((struct hpcfb_devconfig *, int, int, long));
void hpcfb_tv_putchar(struct hpcfb_devconfig *, int, int, u_int, long);
void hpcfb_tv_copycols(struct hpcfb_devconfig *, int, int, int, int);
void hpcfb_tv_erasecols(struct hpcfb_devconfig *, int, int, int, long);
void hpcfb_tv_copyrows(struct hpcfb_devconfig *, int, int, int);
void hpcfb_tv_eraserows(struct hpcfb_devconfig *, int, int, long);
struct wsdisplay_emulops rasops_emul;
@ -294,18 +291,13 @@ pow(int x, int n)
}
int
hpcfbmatch(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
hpcfbmatch(struct device *parent, struct cfdata *match, void *aux)
{
return (1);
}
void
hpcfbattach(parent, self, aux)
struct device *parent, *self;
void *aux;
hpcfbattach(struct device *parent, struct device *self, void *aux)
{
struct hpcfb_softc *sc = (struct hpcfb_softc *)self;
struct hpcfb_attach_args *ha = aux;
@ -316,12 +308,12 @@ hpcfbattach(parent, self, aux)
if (hpcfbconsole) {
sc->screens[0] =
sc->sc_dc = &hpcfb_console_dc;
sc->sc_dc = &hpcfb_console_dc;
sc->nscreens = 1;
hpcfb_console_dc.dc_sc = sc;
} else {
sc->screens[0] =
sc->sc_dc = (struct hpcfb_devconfig *)
sc->sc_dc = (struct hpcfb_devconfig *)
malloc(sizeof(struct hpcfb_devconfig), M_DEVBUF, M_WAITOK);
sc->nscreens = 0; /* XXXX */
bzero(sc->sc_dc, sizeof(struct hpcfb_devconfig));
@ -339,30 +331,30 @@ hpcfbattach(parent, self, aux)
hpcfb_stdscreen.ncols = sc->sc_dc->dc_cols;
hpcfb_stdscreen.capabilities = sc->sc_dc->dc_rinfo.ri_caps;
printf(": hpcrasops %dx%d pixels, %d colors, %dx%d chars: multi",
sc->sc_dc->dc_rinfo.ri_width,
sc->sc_dc->dc_rinfo.ri_height,
pow(2, sc->sc_dc->dc_rinfo.ri_depth),
sc->sc_dc->dc_rinfo.ri_cols,
sc->sc_dc->dc_rinfo.ri_rows);
sc->sc_dc->dc_rinfo.ri_width,
sc->sc_dc->dc_rinfo.ri_height,
pow(2, sc->sc_dc->dc_rinfo.ri_depth),
sc->sc_dc->dc_rinfo.ri_cols,
sc->sc_dc->dc_rinfo.ri_rows);
printf("\n");
/* Set video chip dependent CLUT if any. */
if (hpcfbconsole && sc->sc_accessops->setclut) {
sc->sc_accessops->setclut(sc->sc_accessctx,
&hpcfb_console_dc.dc_rinfo);
&hpcfb_console_dc.dc_rinfo);
}
/* set font for hardware accel */
if (sc->sc_accessops->font) {
sc->sc_accessops->font(sc->sc_accessctx,
sc->sc_dc->dc_rinfo.ri_font);
sc->sc_dc->dc_rinfo.ri_font);
}
/* Add a power hook to power management */
sc->sc_powerhook = powerhook_establish(hpcfb_power, sc);
if (sc->sc_powerhook == NULL)
printf("%s: WARNING: unable to establish power hook\n",
sc->sc_dev.dv_xname);
sc->sc_dev.dv_xname);
wa.console = hpcfbconsole;
wa.scrdata = &hpcfb_screenlist;
@ -381,13 +373,12 @@ hpcfbattach(parent, self, aux)
#ifdef HPCFB_JUMP
void
hpcfb_create_thread(arg)
void *arg;
hpcfb_create_thread(void *arg)
{
struct hpcfb_softc *sc = arg;
if (kthread_create1(hpcfb_thread, sc, &sc->sc_thread,
"%s", sc->sc_dev.dv_xname) == 0)
"%s", sc->sc_dev.dv_xname) == 0)
return;
/*
@ -395,12 +386,11 @@ hpcfb_create_thread(arg)
*/
sc->sc_thread = 0;
printf("%s: unable to create thread, kernel hpcfb scroll support disabled\n",
sc->sc_dev.dv_xname);
sc->sc_dev.dv_xname);
}
void
hpcfb_thread(arg)
void *arg;
hpcfb_thread(void *arg)
{
struct hpcfb_softc *sc = arg;
@ -421,9 +411,7 @@ hpcfb_thread(arg)
/* Print function (for parent devices). */
int
hpcfbprint(aux, pnp)
void *aux;
const char *pnp;
hpcfbprint(void *aux, const char *pnp)
{
if (pnp)
printf("hpcfb at %s", pnp);
@ -432,8 +420,7 @@ hpcfbprint(aux, pnp)
}
int
hpcfb_cnattach(fbconf)
struct hpcfb_fbconf *fbconf;
hpcfb_cnattach(struct hpcfb_fbconf *fbconf)
{
struct hpcfb_fbconf __fbconf __attribute__((__unused__));
long defattr;
@ -459,16 +446,14 @@ hpcfb_cnattach(fbconf)
hpcfb_console_wsscreen.capabilities = hpcfb_console_dc.dc_rinfo.ri_caps;
hpcfb_alloc_attr(&hpcfb_console_dc, 7, 0, 0, &defattr);
wsdisplay_cnattach(&hpcfb_console_wsscreen, &hpcfb_console_dc,
0, 0, defattr);
0, 0, defattr);
hpcfbconsole = 1;
return (0);
}
int
hpcfb_init(fbconf, dc)
struct hpcfb_fbconf *fbconf;
struct hpcfb_devconfig *dc;
hpcfb_init(struct hpcfb_fbconf *fbconf, struct hpcfb_devconfig *dc)
{
struct rasops_info *ri;
vaddr_t fbaddr;
@ -517,9 +502,7 @@ hpcfb_init(fbconf, dc)
}
static void
hpcfb_cmap_reorder(fbconf, dc)
struct hpcfb_fbconf *fbconf;
struct hpcfb_devconfig *dc;
hpcfb_cmap_reorder(struct hpcfb_fbconf *fbconf, struct hpcfb_devconfig *dc)
{
struct rasops_info *ri = &dc->dc_rinfo;
int reverse = fbconf->hf_access_flags & HPCFB_ACCESS_REVERSE;
@ -567,19 +550,14 @@ hpcfb_cmap_reorder(fbconf, dc)
/* clear the screen */
bg = cmap[0];
for (i = 0;
i < fbconf->hf_height * fbconf->hf_bytes_per_line;
i += sizeof(u_int32_t)) {
i < fbconf->hf_height * fbconf->hf_bytes_per_line;
i += sizeof(u_int32_t)) {
*(u_int32_t *)(fbaddr + i) = bg;
}
}
int
hpcfb_ioctl(v, cmd, data, flag, p)
void *v;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
hpcfb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
{
struct hpcfb_softc *sc = v;
struct hpcfb_devconfig *dc = sc->sc_dc;
@ -592,7 +570,7 @@ hpcfb_ioctl(v, cmd, data, flag, p)
case WSDISPLAYIO_GTYPE:
*(u_int *)data = WSDISPLAY_TYPE_HPCFB;
return 0;
return (0);
case WSDISPLAYIO_GINFO:
wdf = (void *)data;
@ -600,7 +578,7 @@ hpcfb_ioctl(v, cmd, data, flag, p)
wdf->width = dc->dc_rinfo.ri_width;
wdf->depth = dc->dc_rinfo.ri_depth;
wdf->cmsize = 256; /* XXXX */
return 0;
return (0);
case WSDISPLAYIO_SMODE:
if (*(int *)data == WSDISPLAYIO_MODE_EMUL){
@ -623,7 +601,7 @@ hpcfb_ioctl(v, cmd, data, flag, p)
}
if (sc && sc->sc_accessops->iodone)
(*sc->sc_accessops->iodone)(sc->sc_accessctx);
return 0;
return (0);
case WSDISPLAYIO_GETCMAP:
case WSDISPLAYIO_PUTCMAP:
@ -635,14 +613,14 @@ hpcfb_ioctl(v, cmd, data, flag, p)
case HPCFBIO_SDSPCONF:
case HPCFBIO_GOP:
case HPCFBIO_SOP:
return (*sc->sc_accessops->ioctl)(sc->sc_accessctx,
cmd, data, flag, p);
return ((*sc->sc_accessops->ioctl)(sc->sc_accessctx,
cmd, data, flag, p));
default:
if (IOCGROUP(cmd) != 't')
DPRINTF(("%s(%d): hpcfb_ioctl(%lx, %lx) grp=%c num=%ld\n",
__FILE__, __LINE__,
cmd, (u_long)data, (char)IOCGROUP(cmd), cmd&0xff));
__FILE__, __LINE__,
cmd, (u_long)data, (char)IOCGROUP(cmd), cmd&0xff));
break;
}
@ -650,20 +628,15 @@ hpcfb_ioctl(v, cmd, data, flag, p)
}
paddr_t
hpcfb_mmap(v, offset, prot)
void *v;
off_t offset;
int prot;
hpcfb_mmap(void *v, off_t offset, int prot)
{
struct hpcfb_softc *sc = v;
return (*sc->sc_accessops->mmap)(sc->sc_accessctx, offset, prot);
return ((*sc->sc_accessops->mmap)(sc->sc_accessctx, offset, prot));
}
static void
hpcfb_power(why, arg)
int why;
void *arg;
hpcfb_power(int why, void *arg)
{
struct hpcfb_softc *sc = arg;
@ -695,8 +668,7 @@ hpcfb_power(why, arg)
}
void
hpcfb_refresh_screen(sc)
struct hpcfb_softc *sc;
hpcfb_refresh_screen(struct hpcfb_softc *sc)
{
struct hpcfb_devconfig *dc = sc->sc_dc;
int x, y;
@ -726,12 +698,8 @@ hpcfb_refresh_screen(sc)
}
static int
hpcfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
void *v;
const struct wsscreen_descr *type;
void **cookiep;
int *curxp, *curyp;
long *attrp;
hpcfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
int *curxp, int *curyp, long *attrp)
{
struct hpcfb_softc *sc = v;
struct hpcfb_devconfig *dc;
@ -739,16 +707,16 @@ hpcfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
DPRINTF(("%s(%d): hpcfb_alloc_screen()\n", __FILE__, __LINE__));
if (!hpcfbconsole && sc->nscreens > 0) /* XXXXX */
return ENOMEM;
return (ENOMEM);
if (sc->nscreens > HPCFB_MAX_SCREEN)
return (ENOMEM);
if (sc->screens[sc->nscreens] == NULL){
sc->screens[sc->nscreens] =
malloc(sizeof(struct hpcfb_devconfig), M_DEVBUF, M_WAITOK);
malloc(sizeof(struct hpcfb_devconfig), M_DEVBUF, M_WAITOK);
if (sc->screens[sc->nscreens] == NULL)
return ENOMEM;
return (ENOMEM);
bzero(sc->screens[sc->nscreens], sizeof(struct hpcfb_devconfig));
}
dc = sc->screens[sc->nscreens];
@ -758,7 +726,7 @@ hpcfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
dc->dc_rinfo = sc->sc_dc->dc_rinfo;
if (sc->sc_accessops->font) {
sc->sc_accessops->font(sc->sc_accessctx,
sc->sc_dc->dc_rinfo.ri_font);
sc->sc_dc->dc_rinfo.ri_font);
}
dc->dc_fbaddr = dc->dc_rinfo.ri_bits;
@ -771,15 +739,15 @@ hpcfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
dc->dc_cury = -1;
if (dc->dc_tvram == NULL){
dc->dc_tvram =
malloc(sizeof(struct hpcfb_tvrow)*dc->dc_rows,
M_DEVBUF, M_WAITOK);
malloc(sizeof(struct hpcfb_tvrow)*dc->dc_rows,
M_DEVBUF, M_WAITOK);
if (dc->dc_tvram == NULL){
free(sc->screens[sc->nscreens], M_DEVBUF);
sc->screens[sc->nscreens] = NULL;
return ENOMEM;
return (ENOMEM);
}
bzero(dc->dc_tvram,
sizeof(struct hpcfb_tvrow)*dc->dc_rows);
sizeof(struct hpcfb_tvrow)*dc->dc_rows);
}
*curxp = 0;
@ -791,9 +759,7 @@ hpcfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
}
static void
hpcfb_free_screen(v, cookie)
void *v;
void *cookie;
hpcfb_free_screen(void *v, void *cookie)
{
struct hpcfb_softc *sc = v;
@ -803,12 +769,8 @@ hpcfb_free_screen(v, cookie)
}
static int
hpcfb_show_screen(v, cookie, waitok, cb, cbarg)
void *v;
void *cookie;
int waitok;
void (*cb) __P((void *, int, int));
void *cbarg;
hpcfb_show_screen(void *v, void *cookie, int waitok,
void (*cb)(void *, int, int), void *cbarg)
{
struct hpcfb_softc *sc = v;
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
@ -820,7 +782,7 @@ hpcfb_show_screen(v, cookie, waitok, cb, cbarg)
if (dc == NULL || odc == dc) {
hpcfb_refresh_screen(sc);
return 0;
return (0);
}
sc->sc_wantedscreen = cookie;
@ -828,17 +790,16 @@ hpcfb_show_screen(v, cookie, waitok, cb, cbarg)
sc->sc_switchcbarg = cbarg;
if (cb) {
callout_reset(&sc->sc_switch_callout, 0,
(void(*)(void *))hpcfb_doswitch, sc);
return EAGAIN;
(void(*)(void *))hpcfb_doswitch, sc);
return (EAGAIN);
}
hpcfb_doswitch(sc);
return 0;
return (0);
}
void
hpcfb_doswitch(sc)
struct hpcfb_softc *sc;
hpcfb_doswitch(struct hpcfb_softc *sc)
{
struct hpcfb_devconfig *dc;
struct hpcfb_devconfig *odc;
@ -861,7 +822,7 @@ hpcfb_doswitch(sc)
if (odc->dc_curx >= 0 && odc->dc_cury >= 0)
hpcfb_cursor_raw(odc, 0, odc->dc_cury, odc->dc_curx);
/* disable cursor */
/* disable cursor */
/* disable old screen */
odc->dc_state &= ~HPCFB_DC_CURRENT;
odc->dc_rinfo.ri_bits = NULL;
@ -882,9 +843,7 @@ hpcfb_doswitch(sc)
}
static void
hpcfb_pollc(v, on)
void *v;
int on;
hpcfb_pollc(void *v, int on)
{
struct hpcfb_softc *sc = v;
@ -906,9 +865,7 @@ hpcfb_pollc(v, on)
* cursor
*/
void
hpcfb_cursor(cookie, on, row, col)
void *cookie;
int on, row, col;
hpcfb_cursor(void *cookie, int on, int row, int col)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
@ -953,7 +910,7 @@ hpcfb_cursor_raw(cookie, on, row, col)
curheight = ri->ri_font->fontheight;
curwidth = ri->ri_font->fontwidth;
(*sc->sc_accessops->cursor)(sc->sc_accessctx,
on, xoff, yoff, curwidth, curheight);
on, xoff, yoff, curwidth, curheight);
} else
rasops_emul.cursor(ri, on, row, col);
dc->dc_state &= ~HPCFB_DC_DRAWING;
@ -963,26 +920,20 @@ hpcfb_cursor_raw(cookie, on, row, col)
* mapchar
*/
int
hpcfb_mapchar(cookie, c, cp)
void *cookie;
int c;
unsigned int *cp;
hpcfb_mapchar(void *cookie, int c, unsigned int *cp)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
struct rasops_info *ri = &dc->dc_rinfo;
return rasops_emul.mapchar(ri, c, cp);
return (rasops_emul.mapchar(ri, c, cp));
}
/*
* putchar
*/
void
hpcfb_tv_putchar(dc, row, col, uc, attr)
struct hpcfb_devconfig *dc;
int row, col;
u_int uc;
long attr;
hpcfb_tv_putchar(struct hpcfb_devconfig *dc, int row, int col, u_int uc,
long attr)
{
struct hpcfb_tvrow *vscn = dc->dc_tvram;
struct hpcfb_vchar *vc = &vscn[row].col[col];
@ -1015,11 +966,7 @@ hpcfb_tv_putchar(dc, row, col, uc, attr)
}
void
hpcfb_putchar(cookie, row, col, uc, attr)
void *cookie;
int row, col;
u_int uc;
long attr;
hpcfb_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
struct hpcfb_softc *sc = dc->dc_sc;
@ -1044,7 +991,7 @@ hpcfb_putchar(cookie, row, col, uc, attr)
dc->dc_state |= HPCFB_DC_DRAWING;
if (sc && sc->sc_accessops->putchar
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
font = ri->ri_font;
yoff = row * ri->ri_font->fontheight;
xoff = col * ri->ri_font->fontwidth;
@ -1052,7 +999,7 @@ hpcfb_putchar(cookie, row, col, uc, attr)
uclr = ri->ri_devcmap[((u_int)attr >> 16) & 15];
(*sc->sc_accessops->putchar)(sc->sc_accessctx,
xoff, yoff, font, fclr, uclr, uc, attr);
xoff, yoff, font, fclr, uclr, uc, attr);
} else
rasops_emul.putchar(ri, row, col, uc, attr);
dc->dc_state &= ~HPCFB_DC_DRAWING;
@ -1065,9 +1012,8 @@ hpcfb_putchar(cookie, row, col, uc, attr)
* copycols
*/
void
hpcfb_tv_copycols(dc, row, srccol, dstcol, ncols)
struct hpcfb_devconfig *dc;
int row, srccol, dstcol, ncols;
hpcfb_tv_copycols(struct hpcfb_devconfig *dc, int row, int srccol, int dstcol,
int ncols)
{
struct hpcfb_tvrow *vscn = dc->dc_tvram;
struct hpcfb_vchar *svc = &vscn[row].col[srccol];
@ -1096,9 +1042,7 @@ hpcfb_tv_copycols(dc, row, srccol, dstcol, ncols)
}
void
hpcfb_copycols(cookie, row, srccol, dstcol, ncols)
void *cookie;
int row, srccol, dstcol, ncols;
hpcfb_copycols(void *cookie, int row, int srccol, int dstcol, int ncols)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
struct hpcfb_softc *sc = dc->dc_sc;
@ -1121,7 +1065,7 @@ hpcfb_copycols(cookie, row, srccol, dstcol, ncols)
dc->dc_state |= HPCFB_DC_DRAWING;
if (sc && sc->sc_accessops->bitblit
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
srcxoff = srccol * ri->ri_font->fontwidth;
srcyoff = row * ri->ri_font->fontheight;
dstxoff = dstcol * ri->ri_font->fontwidth;
@ -1129,7 +1073,7 @@ hpcfb_copycols(cookie, row, srccol, dstcol, ncols)
width = ncols * ri->ri_font->fontwidth;
height = ri->ri_font->fontheight;
(*sc->sc_accessops->bitblit)(sc->sc_accessctx,
srcxoff, srcyoff, dstxoff, dstyoff, height, width);
srcxoff, srcyoff, dstxoff, dstyoff, height, width);
} else
rasops_emul.copycols(ri, row, srccol, dstcol, ncols);
dc->dc_state &= ~HPCFB_DC_DRAWING;
@ -1143,10 +1087,8 @@ hpcfb_copycols(cookie, row, srccol, dstcol, ncols)
* erasecols
*/
void
hpcfb_tv_erasecols(dc, row, startcol, ncols, attr)
struct hpcfb_devconfig *dc;
int row, startcol, ncols;
long attr;
hpcfb_tv_erasecols(struct hpcfb_devconfig *dc, int row, int startcol,
int ncols, long attr)
{
struct hpcfb_tvrow *vscn = dc->dc_tvram;
@ -1171,10 +1113,7 @@ hpcfb_tv_erasecols(dc, row, startcol, ncols, attr)
}
void
hpcfb_erasecols(cookie, row, startcol, ncols, attr)
void *cookie;
int row, startcol, ncols;
long attr;
hpcfb_erasecols(void *cookie, int row, int startcol, int ncols, long attr)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
struct hpcfb_softc *sc = dc->dc_sc;
@ -1196,13 +1135,13 @@ hpcfb_erasecols(cookie, row, startcol, ncols, attr)
dc->dc_state |= HPCFB_DC_DRAWING;
if (sc && sc->sc_accessops->erase
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
xoff = startcol * ri->ri_font->fontwidth;
yoff = row * ri->ri_font->fontheight;
width = ncols * ri->ri_font->fontwidth;
height = ri->ri_font->fontheight;
(*sc->sc_accessops->erase)(sc->sc_accessctx,
xoff, yoff, height, width, attr);
xoff, yoff, height, width, attr);
} else
rasops_emul.erasecols(ri, row, startcol, ncols, attr);
dc->dc_state &= ~HPCFB_DC_DRAWING;
@ -1215,9 +1154,7 @@ hpcfb_erasecols(cookie, row, startcol, ncols, attr)
* Copy rows.
*/
void
hpcfb_tv_copyrows(dc, src, dst, num)
struct hpcfb_devconfig *dc;
int src, dst, num;
hpcfb_tv_copyrows(struct hpcfb_devconfig *dc, int src, int dst, int num)
{
struct hpcfb_tvrow *vscn = dc->dc_tvram;
struct hpcfb_tvrow *svc = &vscn[src];
@ -1332,8 +1269,7 @@ hpcfb_redraw(cookie, row, num, all)
#ifdef HPCFB_JUMP
void
hpcfb_update(v)
void *v;
hpcfb_update(void *v)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)v;
@ -1346,7 +1282,7 @@ hpcfb_update(v)
dc->dc_state &= ~(HPCFB_DC_UPDATE|HPCFB_DC_UPDATEALL);
} else if ((dc->dc_state&HPCFB_DC_UPDATE)) {
hpcfb_redraw(dc, dc->dc_min_row,
dc->dc_max_row - dc->dc_min_row, 0);
dc->dc_max_row - dc->dc_min_row, 0);
dc->dc_state &= ~HPCFB_DC_UPDATE;
} else {
hpcfb_redraw(dc, dc->dc_scroll_dst, dc->dc_scroll_num, 0);
@ -1356,8 +1292,7 @@ hpcfb_update(v)
}
void
hpcfb_do_scroll(v)
void *v;
hpcfb_do_scroll(void *v)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)v;
@ -1374,14 +1309,13 @@ hpcfb_do_scroll(v)
}
void
hpcfb_check_update(v)
void *v;
hpcfb_check_update(void *v)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)v;
if (dc->dc_sc != NULL
&& dc->dc_sc->sc_polling
&& (dc->dc_state&HPCFB_DC_SCROLLPENDING)){
&& dc->dc_sc->sc_polling
&& (dc->dc_state&HPCFB_DC_SCROLLPENDING)){
callout_stop(&dc->dc_scroll_ch);
dc->dc_state &= ~HPCFB_DC_SCRDELAY;
hpcfb_update(v);
@ -1397,9 +1331,7 @@ hpcfb_check_update(v)
#endif /* HPCFB_JUMP */
void
hpcfb_copyrows(cookie, src, dst, num)
void *cookie;
int src, dst, num;
hpcfb_copyrows(void *cookie, int src, int dst, int num)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
struct rasops_info *ri = &dc->dc_rinfo;
@ -1415,14 +1347,14 @@ hpcfb_copyrows(cookie, src, dst, num)
return;
if (sc && sc->sc_accessops->bitblit
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
dc->dc_state |= HPCFB_DC_DRAWING;
srcyoff = src * ri->ri_font->fontheight;
dstyoff = dst * ri->ri_font->fontheight;
width = dc->dc_cols * ri->ri_font->fontwidth;
height = num * ri->ri_font->fontheight;
(*sc->sc_accessops->bitblit)(sc->sc_accessctx,
0, srcyoff, 0, dstyoff, height, width);
0, srcyoff, 0, dstyoff, height, width);
dc->dc_state &= ~HPCFB_DC_DRAWING;
}
else {
@ -1447,7 +1379,7 @@ hpcfb_copyrows(cookie, src, dst, num)
if (dc->dc_state&HPCFB_DC_UPDATE) {
dc->dc_state &= ~HPCFB_DC_UPDATE;
hpcfb_redraw(cookie, dc->dc_min_row,
dc->dc_max_row - dc->dc_min_row, 0);
dc->dc_max_row - dc->dc_min_row, 0);
dc->dc_max_row = 0;
dc->dc_min_row = dc->dc_rows;
if (dc->dc_curx > 0 && dc->dc_cury > 0)
@ -1466,10 +1398,7 @@ hpcfb_copyrows(cookie, src, dst, num)
* eraserows
*/
void
hpcfb_tv_eraserows(dc, row, nrow, attr)
struct hpcfb_devconfig *dc;
int row, nrow;
long attr;
hpcfb_tv_eraserows(struct hpcfb_devconfig *dc, int row, int nrow, long attr)
{
struct hpcfb_tvrow *vscn = dc->dc_tvram;
int cols;
@ -1499,10 +1428,7 @@ hpcfb_tv_eraserows(dc, row, nrow, attr)
}
void
hpcfb_eraserows(cookie, row, nrow, attr)
void *cookie;
int row, nrow;
long attr;
hpcfb_eraserows(void *cookie, int row, int nrow, long attr)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
struct hpcfb_softc *sc = dc->dc_sc;
@ -1525,12 +1451,12 @@ hpcfb_eraserows(cookie, row, nrow, attr)
dc->dc_state |= HPCFB_DC_DRAWING;
if (sc && sc->sc_accessops->erase
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
&& (dc->dc_state&HPCFB_DC_CURRENT)) {
yoff = row * ri->ri_font->fontheight;
width = dc->dc_cols * ri->ri_font->fontwidth;
height = nrow * ri->ri_font->fontheight;
(*sc->sc_accessops->erase)(sc->sc_accessctx,
0, yoff, height, width, attr);
0, yoff, height, width, attr);
} else
rasops_emul.eraserows(ri, row, nrow, attr);
dc->dc_state &= ~HPCFB_DC_DRAWING;
@ -1543,13 +1469,10 @@ hpcfb_eraserows(cookie, row, nrow, attr)
* alloc_attr
*/
int
hpcfb_alloc_attr(cookie, fg, bg, flags, attrp)
void *cookie;
int fg, bg, flags;
long *attrp;
hpcfb_alloc_attr(void *cookie, int fg, int bg, int flags, long *attrp)
{
struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
struct rasops_info *ri = &dc->dc_rinfo;
return rasops_emul.alloc_attr(ri, fg, bg, flags, attrp);
return (rasops_emul.alloc_attr(ri, fg, bg, flags, attrp));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpcfbvar.h,v 1.1 2001/02/22 18:37:55 uch Exp $ */
/* $NetBSD: hpcfbvar.h,v 1.2 2001/06/04 18:59:31 uch Exp $ */
/*-
* Copyright (c) 1999
@ -40,16 +40,16 @@
* video access functions (must be provided by all video).
*/
struct hpcfb_accessops {
int (*ioctl) __P((void *, u_long, caddr_t, int, struct proc *));
paddr_t (*mmap) __P((void *, off_t, int));
void (*cursor) __P((void *, int, int, int, int, int));
void (*bitblit) __P((void *, int, int, int, int, int, int));
void (*erase) __P((void *, int, int, int, int, int));
void (*putchar) __P((void *, int, int, struct wsdisplay_font *,
int, int, u_int, int));
void (*setclut) __P((void *, struct rasops_info *));
void (*font) __P((void *, struct wsdisplay_font *)); /* load fonts */
void (*iodone) __P((void *)); /* wait i/o done */
int (*ioctl)(void *, u_long, caddr_t, int, struct proc *);
paddr_t (*mmap)(void *, off_t, int);
void (*cursor)(void *, int, int, int, int, int);
void (*bitblit)(void *, int, int, int, int, int, int);
void (*erase)(void *, int, int, int, int, int);
void (*putchar)(void *, int, int, struct wsdisplay_font *,
int, int, u_int, int);
void (*setclut)(void *, struct rasops_info *);
void (*font)(void *, struct wsdisplay_font *); /* load fonts */
void (*iodone)(void *); /* wait i/o done */
};
/*
@ -68,5 +68,5 @@ struct hpcfb_attach_args {
struct hpcfb_dspconf *ha_dspconflist;
};
int hpcfb_cnattach __P((struct hpcfb_fbconf *));
int hpcfbprint __P((void *aux, const char *pnp));
int hpcfb_cnattach(struct hpcfb_fbconf *);
int hpcfbprint(void *aux, const char *pnp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpcin.c,v 1.1 2001/04/30 11:42:17 takemura Exp $ */
/* $NetBSD: hpcin.c,v 1.2 2001/06/04 18:59:32 uch Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@ struct cfattach hpcin_ca = {
int
hpcin_match(struct device *parent, struct cfdata *cf, void *aux)
{
return 1;
return (1);
}
void
@ -93,8 +93,7 @@ hpcin_attach(struct device *parent, struct device *self, void *aux)
/* install interrupt handler */
sc->sc_ih = hpcio_intr_establish(sc->sc_hc, sc->sc_port,
sc->sc_intr_mode,
hpcin_intr, sc);
sc->sc_intr_mode, hpcin_intr, sc);
if (sc->sc_ih == NULL)
printf("hpcin: can't install interrupt handler\n");
}
@ -110,5 +109,5 @@ hpcin_intr(void *arg)
config_hook_call(sc->sc_type, sc->sc_id, (void *)on);
printf("done.\n");
return 0;
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpcioman.c,v 1.2 2001/05/01 00:25:17 takemura Exp $ */
/* $NetBSD: hpcioman.c,v 1.3 2001/06/04 18:59:32 uch Exp $ */
/*-
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@ -69,11 +69,11 @@ hpcioman_match(struct device *parent, struct cfdata *cf, void *aux)
platid_mask_t mask;
if (strcmp(haa->haa_busname, HPCIO_BUSNAME))
return 0;
return (0);
/* select platform */
mask = PLATID_DEREF(cf->cf_loc[HPCIOIFCF_PLATFORM]);
return platid_match(&platid, &mask);
return (platid_match(&platid, &mask));
}
void
@ -155,18 +155,21 @@ hpcioman_print(void *aux, const char *pnp)
if (!pnp) {
printf(" iochip %s, port %d, type %d, id %d",
hma->hma_hc ? hma->hma_hc->hc_name : "not found",
hma->hma_port, type, hma->hma_id);
hma->hma_hc ? hma->hma_hc->hc_name : "not found",
hma->hma_port, type, hma->hma_id);
if (type == CONFIG_HOOK_BUTTONEVENT ||
type == CONFIG_HOOK_PMEVENT ||
type == CONFIG_HOOK_EVENT) {
if (hma->hma_intr_mode & HPCIO_INTR_EDGE)
printf (", interrupt edge [%s%s]",
(hma->hma_intr_mode&HPCIO_INTR_POSEDGE) ? "p" : "",
(hma->hma_intr_mode&HPCIO_INTR_NEGEDGE) ? "n" : "");
(hma->hma_intr_mode&HPCIO_INTR_POSEDGE)
? "p" : "",
(hma->hma_intr_mode&HPCIO_INTR_NEGEDGE)
? "n" : "");
else
printf (", interrupt level %s",
(hma->hma_intr_mode&HPCIO_INTR_HIGH) ? "high" : "low");
(hma->hma_intr_mode&HPCIO_INTR_HIGH) ?
"high" : "low");
}
if (hma->hma_initvalue != -1)
printf(", initial value %d", hma->hma_initvalue);
@ -174,5 +177,5 @@ hpcioman_print(void *aux, const char *pnp)
printf(", active low");
}
return QUIET;
return (QUIET);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpciovar.h,v 1.3 2001/05/06 14:25:15 takemura Exp $ */
/* $NetBSD: hpciovar.h,v 1.4 2001/06/04 18:59:32 uch Exp $ */
/*-
* Copyright (c) 2001 TAKEMURA Shin.
@ -42,7 +42,8 @@ struct hpcio_chip {
void *hc_sc;
int (*hc_portread)(hpcio_chip_t, int);
void (*hc_portwrite)(hpcio_chip_t, int, int);
hpcio_intr_handle_t(*hc_intr_establish)(hpcio_chip_t, int, int, int (*)(void *), void*);
hpcio_intr_handle_t(*hc_intr_establish)(hpcio_chip_t, int, int,
int (*)(void *), void *);
void (*hc_intr_disestablish)(hpcio_chip_t, hpcio_intr_handle_t);
void (*hc_intr_clear)(hpcio_chip_t, hpcio_intr_handle_t);
void (*hc_register_iochip)(hpcio_chip_t, hpcio_chip_t);
@ -58,21 +59,21 @@ struct hpcio_attach_args {
};
#define HPCIO_BUSNAME "hpcioif"
#define hpcio_portread(hc, port) \
#define hpcio_portread(hc, port) \
((*(hc)->hc_portread)((hc), (port)))
#define hpcio_portwrite(hc, port, data) \
#define hpcio_portwrite(hc, port, data) \
((*(hc)->hc_portwrite)((hc), (port), (data)))
#define hpcio_intr_establish(hc, port, mode, func, arg) \
#define hpcio_intr_establish(hc, port, mode, func, arg) \
((*(hc)->hc_intr_establish)((hc),(port),(mode),(func),(arg)))
#define hpcio_intr_disestablish(hc, handle) \
#define hpcio_intr_disestablish(hc, handle) \
((*(hc)->hc_intr_disestablish)((hc), (handle)))
#define hpcio_intr_clear(hc, handle) \
#define hpcio_intr_clear(hc, handle) \
((*(hc)->hc_intr_clear)((hc), (handle)))
#define hpcio_register_iochip(hc, iochip) \
#define hpcio_register_iochip(hc, iochip) \
((*(hc)->hc_register_iochip)((hc), (iochip)))
#define hpcio_update(hc) \
#define hpcio_update(hc) \
((*(hc)->hc_update)(hc))
#define hpcio_dump(hc) \
#define hpcio_dump(hc) \
((*(hc)->hc_dump)(hc))
/* interrupt trigger options. */
@ -85,17 +86,17 @@ struct hpcio_attach_args {
#define HPCIO_INTR_POSEDGE (1<<3)
#define HPCIO_INTR_NEGEDGE (1<<4)
#define HPCIO_INTR_LEVEL_HIGH_HOLD \
#define HPCIO_INTR_LEVEL_HIGH_HOLD \
(HPCIO_INTR_LEVEL|HPCIO_INTR_HIGH|HPCIO_INTR_HOLD)
#define HPCIO_INTR_LEVEL_HIGH_THROUGH \
#define HPCIO_INTR_LEVEL_HIGH_THROUGH \
(HPCIO_INTR_LEVEL|HPCIO_INTR_HIGH|HPCIO_INTR_THROUGH)
#define HPCIO_INTR_LEVEL_LOW_HOLD \
#define HPCIO_INTR_LEVEL_LOW_HOLD \
(HPCIO_INTR_LEVEL|HPCIO_INTR_LOW|HPCIO_INTR_HOLD)
#define HPCIO_INTR_LEVEL_LOW_THROUGH \
#define HPCIO_INTR_LEVEL_LOW_THROUGH \
(HPCIO_INTR_LEVEL|HPCIO_INTR_LOW|HPCIO_INTR_THROUGH)
#define HPCIO_INTR_EDGE_HOLD \
#define HPCIO_INTR_EDGE_HOLD \
(HPCIO_INTR_EDGE|HPCIO_INTR_HOLD)
#define HPCIO_INTR_EDGE_THROUGH \
#define HPCIO_INTR_EDGE_THROUGH \
(HPCIO_INTR_EDGE|HPCIO_INTR_THROUGH)
#endif /* !_DEV_HPC_HPCIOVAR_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpckbd.c,v 1.4 2001/05/08 17:23:09 uch Exp $ */
/* $NetBSD: hpckbd.c,v 1.5 2001/06/04 18:59:32 uch Exp $ */
/*-
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@ -385,7 +385,7 @@ __hpckbd_input(void *arg, int flag, int scancode)
wskbd_rawinput(hc->hc_wskbddev, data, n);
} else
#endif
wskbd_input(hc->hc_wskbddev, type, hc->hc_keymap[scancode]);
wskbd_input(hc->hc_wskbddev, type, hc->hc_keymap[scancode]);
}
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpcout.c,v 1.1 2001/04/30 11:42:17 takemura Exp $ */
/* $NetBSD: hpcout.c,v 1.2 2001/06/04 18:59:32 uch Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@ struct cfattach hpcout_ca = {
int
hpcout_match(struct device *parent, struct cfdata *cf, void *aux)
{
return 1;
return (1);
}
void
@ -92,7 +92,7 @@ hpcout_attach(struct device *parent, struct device *self, void *aux)
hpcio_portwrite(sc->sc_hc, sc->sc_port, hma->hma_initvalue);
config_hook(sc->sc_type, sc->sc_id, CONFIG_HOOK_SHARE,
hpcout_hook, sc);
hpcout_hook, sc);
}
int
@ -105,5 +105,5 @@ hpcout_hook(void *arg, int type, long id, void *msg)
hpcio_portwrite(sc->sc_hc, sc->sc_port,
(int)msg ? sc->sc_on : sc->sc_off);
return 0;
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mra.c,v 1.1 2001/02/22 18:37:56 uch Exp $ */
/* $NetBSD: mra.c,v 1.2 2001/06/04 18:59:32 uch Exp $ */
/*
* Copyright (c) 1999 Shin Takemura All rights reserved.
@ -30,16 +30,16 @@
#include <sys/param.h>
#include <sys/systm.h>
int mra_Y_AX1_BX2_C __P((int *y, int ys, int *x1, int x1s, int *x2, int x2s,
int n, int scale, int *a, int *b, int *c));
int mra_Y_AX1_BX2_C(int *, int, int *, int, int *, int, int, int, int *,
int *, int *);
/*
* multiple regression analysis
* Y = AX1 + BX2 + C
*/
int
mra_Y_AX1_BX2_C(y, ys, x1, x1s, x2, x2s, n, scale, a, b, c)
int *y, ys, *x1, x1s, *x2, x2s, n, scale, *a, *b, *c;
mra_Y_AX1_BX2_C(int *y, int ys, int *x1, int x1s, int *x2, int x2s, int n,
int scale, int *a, int *b, int *c)
{
int i;
int64_t X1a, X2a, Ya;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pwctl.c,v 1.4 2001/05/06 14:25:15 takemura Exp $ */
/* $NetBSD: pwctl.c,v 1.5 2001/06/04 18:59:32 uch Exp $ */
/*-
* Copyright (c) 1999-2001
@ -51,7 +51,7 @@
#define PWCTLVRGIUDEBUG
#ifdef PWCTLVRGIUDEBUG
int pwctl_debug = 0;
int pwctl_debug = 1;
#define DPRINTF(arg) if (pwctl_debug) printf arg;
#else
#define DPRINTF(arg)
@ -70,44 +70,34 @@ struct pwctl_softc {
int sc_initvalue;
};
static int pwctl_match __P((struct device *, struct cfdata *,
void *));
static void pwctl_attach __P((struct device *, struct device *,
void *));
static int pwctl_hook __P((void *ctx, int type, long id,
void *msg));
static int pwctl_ghook __P((void *ctx, int type, long id,
void *msg));
int pwctl_hardpower __P((void *, int, long, void *));
static int pwctl_match(struct device *, struct cfdata *, void *);
static void pwctl_attach(struct device *, struct device *, void *);
static int pwctl_hook(void *, int, long, void *);
static int pwctl_ghook(void *, int, long, void *);
int pwctl_hardpower(void *, int, long, void *);
struct cfattach pwctl_ca = {
sizeof(struct pwctl_softc), pwctl_match, pwctl_attach
};
int
pwctl_match(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
pwctl_match(struct device *parent, struct cfdata *match, void *aux)
{
struct hpcio_attach_args *haa = aux;
platid_mask_t mask;
if (strcmp(haa->haa_busname, HPCIO_BUSNAME))
return 0;
return (0);
if (match->cf_loc[HPCIOIFCF_PLATFORM] == 0)
return 0;
return (0);
mask = PLATID_DEREF(match->cf_loc[HPCIOIFCF_PLATFORM]);
if (!platid_match(&platid, &mask))
return 0;
return 1;
return (0);
return (1);
}
void
pwctl_attach(parent, self, aux)
struct device *parent;
struct device *self;
void *aux;
pwctl_attach(struct device *parent, struct device *self, void *aux)
{
struct hpcio_attach_args *haa = aux;
int *loc;
@ -120,83 +110,71 @@ pwctl_attach(parent, self, aux)
sc->sc_on = loc[HPCIOIFCF_ACTIVE] ? 1 : 0;
sc->sc_off = loc[HPCIOIFCF_ACTIVE] ? 0 : 1;
sc->sc_initvalue = loc[HPCIOIFCF_INITVALUE];
printf(" port=%d id=%ld on=%d%s",
sc->sc_port, sc->sc_id, sc->sc_on,
sc->sc_initvalue == -1 ? "" :
sc->sc_initvalue ? " init=on" : " init=off");
sc->sc_port, sc->sc_id, sc->sc_on,
sc->sc_initvalue == -1 ? "" :
sc->sc_initvalue ? " init=on" : " init=off");
if (sc->sc_port == HPCIOIFCF_PORT_DEFAULT ||
sc->sc_id == HPCIOIFCF_ID_DEFAULT) {
printf(" (ignored)");
} else {
sc->sc_hook_tag = config_hook(CONFIG_HOOK_POWERCONTROL,
sc->sc_id, CONFIG_HOOK_SHARE,
pwctl_hook, sc);
sc->sc_id, CONFIG_HOOK_SHARE, pwctl_hook, sc);
sc->sc_ghook_tag = config_hook(CONFIG_HOOK_GET,
sc->sc_id, CONFIG_HOOK_SHARE,
pwctl_ghook, sc);
sc->sc_id, CONFIG_HOOK_SHARE, pwctl_ghook, sc);
sc->sc_hook_hardpower = config_hook(CONFIG_HOOK_PMEVENT,
CONFIG_HOOK_PMEVENT_HARDPOWER,
CONFIG_HOOK_SHARE,
pwctl_hardpower, sc);
CONFIG_HOOK_PMEVENT_HARDPOWER, CONFIG_HOOK_SHARE,
pwctl_hardpower, sc);
}
if (sc->sc_initvalue != -1)
hpcio_portwrite(sc->sc_hc, sc->sc_port,
sc->sc_initvalue ? sc->sc_on : sc->sc_off);
sc->sc_initvalue ? sc->sc_on : sc->sc_off);
printf("\n");
}
int
pwctl_hook(ctx, type, id, msg)
void *ctx;
int type;
long id;
void *msg;
pwctl_hook(void *ctx, int type, long id, void *msg)
{
struct pwctl_softc *sc = ctx;
DPRINTF(("pwctl hook: port %d %s(%d)", sc->sc_port,
msg ? "ON" : "OFF", msg ? sc->sc_on : sc->sc_off));
msg ? "ON" : "OFF", msg ? sc->sc_on : sc->sc_off));
hpcio_portwrite(sc->sc_hc, sc->sc_port,
msg ? sc->sc_on : sc->sc_off);
msg ? sc->sc_on : sc->sc_off);
return (0);
}
int
pwctl_ghook(ctx, type, id, msg)
void *ctx;
int type;
long id;
void *msg;
pwctl_ghook(void *ctx, int type, long id, void *msg)
{
struct pwctl_softc *sc = ctx;
if (CONFIG_HOOK_VALUEP(msg))
return 1;
return (1);
*(int*)msg = hpcio_portread(sc->sc_hc, sc->sc_port) == sc->sc_on;
DPRINTF(("pwctl ghook: port %d %s(%d)", sc->sc_port,
*(int*)msg? "ON" : "OFF", *(int*)msg ? sc->sc_on : sc->sc_off));
return 0;
*(int*)msg? "ON" : "OFF", *(int*)msg ? sc->sc_on : sc->sc_off));
return (0);
}
int
pwctl_hardpower(ctx, type, id, msg)
void *ctx;
int type;
long id;
void *msg;
pwctl_hardpower(void *ctx, int type, long id, void *msg)
{
struct pwctl_softc *sc = ctx;
int why =(int)msg;
#if 0
#if 1
/* XXX debug print cause hang system... Huum...*/
DPRINTF(("pwctl hardpower: port %d %s: %s(%d)\n", sc->sc_port,
why == PWR_RESUME? "resume"
: why == PWR_SUSPEND? "suspend" : "standby",
sc->sc_save == sc->sc_on ? "on": "off", sc->sc_save));
why == PWR_RESUME? "resume"
: why == PWR_SUSPEND? "suspend" : "standby",
sc->sc_save == sc->sc_on ? "on": "off", sc->sc_save));
#endif /* 0 */
switch (why) {
case PWR_STANDBY:
@ -209,5 +187,6 @@ pwctl_hardpower(ctx, type, id, msg)
hpcio_portwrite(sc->sc_hc, sc->sc_port, sc->sc_save);
break;
}
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tpcalib.c,v 1.1 2001/02/22 18:37:56 uch Exp $ */
/* $NetBSD: tpcalib.c,v 1.2 2001/06/04 18:59:32 uch Exp $ */
/*
* Copyright (c) 1999 Shin Takemura All rights reserved.
@ -43,32 +43,27 @@ int tpcalib_debug = 0;
#endif
/* mra is defined in mra.c */
int mra_Y_AX1_BX2_C __P((int *y, int ys, int *x1, int x1s, int *x2, int x2s,
int n, int scale, int *a, int *b, int *c));
extern int mra_Y_AX1_BX2_C(int *, int, int *, int, int *, int, int, int, int *,
int *, int *);
#define SCALE (1024*1024)
int
tpcalib_init(sc)
struct tpcalib_softc *sc;
tpcalib_init(struct tpcalib_softc *sc)
{
tpcalib_reset(sc);
return (0);
}
void
tpcalib_reset(sc)
struct tpcalib_softc *sc;
tpcalib_reset(struct tpcalib_softc *sc)
{
/* This indicate 'raw mode'. No translation will be done. */
sc->sc_saved.samplelen = WSMOUSE_CALIBCOORDS_RESET;
}
void
tpcalib_trans(sc, rawx, rawy, x, y)
struct tpcalib_softc *sc;
int rawx, rawy;
int *x, *y;
tpcalib_trans(struct tpcalib_softc *sc, int rawx, int rawy, int *x, int *y)
{
if (sc->sc_saved.samplelen == WSMOUSE_CALIBCOORDS_RESET) {
/* This indicate 'raw mode'. No translation will be done. */
@ -87,12 +82,8 @@ tpcalib_trans(sc, rawx, rawy, x, y)
}
int
tpcalib_ioctl(sc, cmd, data, flag, p)
struct tpcalib_softc *sc;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
tpcalib_ioctl(struct tpcalib_softc *sc, u_long cmd, caddr_t data, int flag,
struct proc *p)
{
struct wsmouse_calibcoords *d;
int s = sizeof(struct wsmouse_calibcoord);
@ -104,31 +95,31 @@ tpcalib_ioctl(sc, cmd, data, flag, p)
if (d->samplelen == WSMOUSE_CALIBCOORDS_RESET) {
tpcalib_reset(sc);
} else
if (mra_Y_AX1_BX2_C(&d->samples[0].x, s,
&d->samples[0].rawx, s,
&d->samples[0].rawy, s,
d->samplelen, SCALE,
&sc->sc_ax, &sc->sc_bx, &sc->sc_cx) ||
mra_Y_AX1_BX2_C(&d->samples[0].y, s,
&d->samples[0].rawx, s,
&d->samples[0].rawy, s,
d->samplelen, SCALE,
&sc->sc_ay, &sc->sc_by, &sc->sc_cy)) {
printf("tpcalib: MRA error");
tpcalib_reset(sc);
if (mra_Y_AX1_BX2_C(&d->samples[0].x, s,
&d->samples[0].rawx, s,
&d->samples[0].rawy, s,
d->samplelen, SCALE,
&sc->sc_ax, &sc->sc_bx, &sc->sc_cx) ||
mra_Y_AX1_BX2_C(&d->samples[0].y, s,
&d->samples[0].rawx, s,
&d->samples[0].rawy, s,
d->samplelen, SCALE,
&sc->sc_ay, &sc->sc_by, &sc->sc_cy)) {
printf("tpcalib: MRA error");
tpcalib_reset(sc);
return (-1);
} else {
sc->sc_minx = d->minx;
sc->sc_maxx = d->maxx;
sc->sc_miny = d->miny;
sc->sc_maxy = d->maxy;
sc->sc_saved = *d;
DPRINTF(("tpcalib: Ax=%d Bx=%d Cx=%d\n",
sc->sc_ax, sc->sc_bx, sc->sc_cx));
DPRINTF(("tpcalib: Ay=%d By=%d Cy=%d\n",
sc->sc_ay, sc->sc_by, sc->sc_cy));
}
return (-1);
} else {
sc->sc_minx = d->minx;
sc->sc_maxx = d->maxx;
sc->sc_miny = d->miny;
sc->sc_maxy = d->maxy;
sc->sc_saved = *d;
DPRINTF(("tpcalib: Ax=%d Bx=%d Cx=%d\n",
sc->sc_ax, sc->sc_bx, sc->sc_cx));
DPRINTF(("tpcalib: Ay=%d By=%d Cy=%d\n",
sc->sc_ay, sc->sc_by, sc->sc_cy));
}
break;
case WSMOUSEIO_GCALIBCOORDS:

View File

@ -1,4 +1,4 @@
/* $NetBSD: tpcalibvar.h,v 1.1 2001/02/22 18:37:56 uch Exp $ */
/* $NetBSD: tpcalibvar.h,v 1.2 2001/06/04 18:59:32 uch Exp $ */
/*
* Copyright (c) 1999 Shin Takemura All rights reserved.
@ -36,8 +36,8 @@ struct tpcalib_softc {
struct wsmouse_calibcoords sc_saved;
};
int tpcalib_init __P((struct tpcalib_softc *sc));
void tpcalib_reset __P((struct tpcalib_softc *sc));
void tpcalib_trans __P((struct tpcalib_softc*, int, int, int*, int*));
int tpcalib_ioctl __P((struct tpcalib_softc *, u_long, caddr_t,
int, struct proc*));
int tpcalib_init(struct tpcalib_softc *);
void tpcalib_reset(struct tpcalib_softc *);
void tpcalib_trans(struct tpcalib_softc*, int, int, int*, int*);
int tpcalib_ioctl(struct tpcalib_softc *, u_long, caddr_t, int,
struct proc *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: video_subr.c,v 1.1 2001/02/22 18:37:56 uch Exp $ */
/* $NetBSD: video_subr.c,v 1.2 2001/06/04 18:59:32 uch Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -159,7 +159,7 @@ static void dotbpp_unimpl(struct video_chip *, int, int);
int
cmap_work_alloc(u_int8_t **r, u_int8_t **g, u_int8_t **b, u_int32_t **rgb,
int cnt)
int cnt)
{
KASSERT(r && g && b && rgb && LEGAL_CLUT_INDEX(cnt - 1));
@ -197,7 +197,7 @@ rgb24_compose(u_int32_t *rgb24, u_int8_t *r, u_int8_t *g, u_int8_t *b, int cnt)
void
rgb24_decompose(u_int32_t *rgb24, u_int8_t *r, u_int8_t *g, u_int8_t *b,
int cnt)
int cnt)
{
int i;
KASSERT(rgb24 && r && g && b && LEGAL_CLUT_INDEX(cnt - 1));