Sort out the inclusion of wscons source files: the files are only

compiled if the corresponding devices are configured.
(Files calling wscons functions have to check whether these are present.)
This commit is contained in:
drochner 1999-05-14 16:01:11 +00:00
parent 0c3738a17b
commit 10584c9e73
3 changed files with 55 additions and 104 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.wscons,v 1.13 1999/04/01 11:50:02 drochner Exp $
# $NetBSD: files.wscons,v 1.14 1999/05/14 16:01:11 drochner Exp $
#
# "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@ -31,38 +31,20 @@ attach wskbd at wskbddev
device wsmouse
attach wsmouse at wsmousedev
file dev/wscons/wscons_glue.c
wsdisplaydev | wsemuldisplaydev | wskbddev
file dev/wscons/wsdisplay.c
wsdisplay | wsdisplaydev | wsemuldisplaydev | wskbddev
needs-flag
file dev/wscons/wsdisplay_compat_usl.c
(wsdisplay | wsdisplaydev | wsemuldisplaydev | wskbddev) &
wsdisplay_compat_usl
file dev/wscons/wsemulconf.c
wsdisplaydev | wsemuldisplaydev | wskbddev
file dev/wscons/wsemul_dumb.c
(wsdisplaydev | wsemuldisplaydev | wskbddev) & !wsemul_no_dumb
file dev/wscons/wsemul_sun.c
(wsdisplaydev | wsemuldisplaydev | wskbddev) & wsemul_sun
file dev/wscons/wsemul_vt100.c
(wsdisplaydev | wsemuldisplaydev | wskbddev) & wsemul_vt100
file dev/wscons/wsemul_vt100_subr.c
(wsdisplaydev | wsemuldisplaydev | wskbddev) & wsemul_vt100
file dev/wscons/wsemul_vt100_chars.c
(wsdisplaydev | wsemuldisplaydev | wskbddev) & wsemul_vt100
file dev/wscons/wsemul_vt100_keys.c
(wsdisplaydev | wsemuldisplaydev | wskbddev) & wsemul_vt100
file dev/wscons/wsevent.c
wskbddev | wsmousedev
file dev/wscons/wskbd.c
wskbd | wsdisplaydev | wsemuldisplaydev | wskbddev
needs-flag
file dev/wscons/wskbdutil.c
wskbd | wsdisplaydev | wsemuldisplaydev | wskbddev
needs-flag
file dev/wscons/wsmouse.c
wsmouse | wsmousedev needs-flag
file dev/wscons/wscons_glue.c wsdisplay & wskbd
file dev/wscons/wsdisplay.c wsdisplay needs-flag
file dev/wscons/wsdisplay_compat_usl.c wsdisplay & wsdisplay_compat_usl
file dev/wscons/wsemulconf.c wsdisplay
file dev/wscons/wsemul_dumb.c wsdisplay & !wsemul_no_dumb
file dev/wscons/wsemul_sun.c wsdisplay & wsemul_sun
file dev/wscons/wsemul_vt100.c wsdisplay & wsemul_vt100
file dev/wscons/wsemul_vt100_subr.c wsdisplay & wsemul_vt100
file dev/wscons/wsemul_vt100_chars.c wsdisplay & wsemul_vt100
file dev/wscons/wsemul_vt100_keys.c wsdisplay & wsemul_vt100
file dev/wscons/wsevent.c wskbd | wsmouse
file dev/wscons/wskbd.c wskbd needs-flag
file dev/wscons/wskbdutil.c wskbd needs-flag
file dev/wscons/wsmouse.c wsmouse needs-flag
# rcons bit-depth options
defopt opt_rcons.h RCONS_2BPP RCONS_16BPP

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.22 1999/03/23 15:56:56 drochner Exp $ */
/* $NetBSD: wsdisplay.c,v 1.23 1999/05/14 16:01:11 drochner Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -33,7 +33,7 @@
static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) =
"$NetBSD: wsdisplay.c,v 1.22 1999/03/23 15:56:56 drochner Exp $";
"$NetBSD: wsdisplay.c,v 1.23 1999/05/14 16:01:11 drochner Exp $";
#include <sys/param.h>
#include <sys/conf.h>
@ -60,8 +60,6 @@ static const char _rcsid[] __attribute__ ((unused)) =
#include "opt_wsdisplay_compat.h"
#include "wsdisplay.h"
struct wsscreen_internal {
const struct wsdisplay_emulops *emulops;
void *emulcookie;
@ -130,9 +128,7 @@ struct wsdisplay_softc {
#endif
};
#if NWSDISPLAY > 0
extern struct cfdriver wsdisplay_cd;
#endif /* NWSDISPLAY > 0 */
/* Autoconfiguration definitions. */
static int wsdisplay_emul_match __P((struct device *, struct cfdata *,
@ -159,10 +155,8 @@ struct cfattach wsdisplay_noemul_ca = {
/* Exported tty- and cdevsw-related functions. */
cdev_decl(wsdisplay);
#if NWSDISPLAY > 0
static void wsdisplaystart __P((struct tty *));
static int wsdisplayparam __P((struct tty *, struct termios *));
#endif /* NWSDISPLAY > 0 */
/* Internal macros, functions, and variables. */
@ -648,7 +642,6 @@ wsdisplayopen(dev, flag, mode, p)
int flag, mode;
struct proc *p;
{
#if NWSDISPLAY > 0
struct wsdisplay_softc *sc;
struct tty *tp;
int unit, newopen, error;
@ -704,9 +697,6 @@ wsdisplayopen(dev, flag, mode, p)
scr->scr_flags |= SCR_OPEN;
return (0);
#else
return (ENXIO);
#endif /* NWSDISPLAY > 0 */
}
int
@ -715,7 +705,6 @@ wsdisplayclose(dev, flag, mode, p)
int flag, mode;
struct proc *p;
{
#if NWSDISPLAY > 0
struct wsdisplay_softc *sc;
struct tty *tp;
int unit;
@ -767,9 +756,6 @@ wsdisplayclose(dev, flag, mode, p)
scr->scr_flags &= ~SCR_OPEN;
return (0);
#else
return (ENXIO);
#endif /* NWSDISPLAY > 0 */
}
int
@ -778,7 +764,6 @@ wsdisplayread(dev, uio, flag)
struct uio *uio;
int flag;
{
#if NWSDISPLAY > 0
struct wsdisplay_softc *sc;
struct tty *tp;
int unit;
@ -797,9 +782,6 @@ wsdisplayread(dev, uio, flag)
tp = scr->scr_tty;
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
#else
return (ENXIO);
#endif /* NWSDISPLAY > 0 */
}
int
@ -808,7 +790,6 @@ wsdisplaywrite(dev, uio, flag)
struct uio *uio;
int flag;
{
#if NWSDISPLAY > 0
struct wsdisplay_softc *sc;
struct tty *tp;
int unit;
@ -827,16 +808,12 @@ wsdisplaywrite(dev, uio, flag)
tp = scr->scr_tty;
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
#else
return (ENXIO);
#endif /* NWSDISPLAY > 0 */
}
struct tty *
wsdisplaytty(dev)
dev_t dev;
{
#if NWSDISPLAY > 0
struct wsdisplay_softc *sc;
int unit;
struct wsscreen *scr;
@ -850,9 +827,6 @@ wsdisplaytty(dev)
scr = sc->sc_scr[WSDISPLAYSCREEN(dev)];
return (scr->scr_tty);
#else
return (NULL);
#endif /* NWSDISPLAY > 0 */
}
int
@ -863,7 +837,6 @@ wsdisplayioctl(dev, cmd, data, flag, p)
int flag;
struct proc *p;
{
#if NWSDISPLAY > 0
struct wsdisplay_softc *sc;
struct tty *tp;
int unit, error;
@ -901,9 +874,6 @@ wsdisplayioctl(dev, cmd, data, flag, p)
error = wsdisplay_internal_ioctl(sc, scr, cmd, data, flag, p);
return (error != -1 ? error : ENOTTY);
#else
return (ENXIO);
#endif /* NWSDISPLAY > 0 */
}
int
@ -1059,7 +1029,6 @@ wsdisplaymmap(dev, offset, prot)
int offset; /* XXX */
int prot;
{
#if NWSDISPLAY > 0
struct wsdisplay_softc *sc = wsdisplay_cd.cd_devs[WSDISPLAYUNIT(dev)];
struct wsscreen *scr;
@ -1073,9 +1042,6 @@ wsdisplaymmap(dev, offset, prot)
/* pass mmap to display */
return ((*sc->sc_accessops->mmap)(sc->sc_accesscookie, offset, prot));
#else
return (-1);
#endif /* NWSDISPLAY > 0 */
}
int
@ -1084,7 +1050,6 @@ wsdisplaypoll(dev, events, p)
int events;
struct proc *p;
{
#if NWSDISPLAY > 0
struct wsdisplay_softc *sc = wsdisplay_cd.cd_devs[WSDISPLAYUNIT(dev)];
struct wsscreen *scr;
@ -1097,12 +1062,8 @@ wsdisplaypoll(dev, events, p)
return (ttpoll(dev, events, p));
else
return (0);
#else
return (0);
#endif /* NWSDISPLAY > 0 */
}
#if NWSDISPLAY > 0
void
wsdisplaystart(tp)
register struct tty *tp;
@ -1173,7 +1134,6 @@ wsdisplaystart(tp)
}
splx(s);
}
#endif /* NWSDISPLAY > 0 */
void
wsdisplaystop(tp, flag)
@ -1189,7 +1149,6 @@ wsdisplaystop(tp, flag)
splx(s);
}
#if NWSDISPLAY > 0
/* Set line parameters. */
int
wsdisplayparam(tp, t)
@ -1202,7 +1161,6 @@ wsdisplayparam(tp, t)
tp->t_cflag = t->c_cflag;
return 0;
}
#endif /* NWSDISPLAY > 0 */
/*
* Callbacks for the emulation code.

View File

@ -1,4 +1,4 @@
/* $NetBSD: wskbd.c,v 1.20 1999/03/27 11:22:23 drochner Exp $ */
/* $NetBSD: wskbd.c,v 1.21 1999/05/14 16:01:12 drochner Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -36,7 +36,7 @@
static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) =
"$NetBSD: wskbd.c,v 1.20 1999/03/27 11:22:23 drochner Exp $";
"$NetBSD: wskbd.c,v 1.21 1999/05/14 16:01:12 drochner Exp $";
/*
* Copyright (c) 1992, 1993
@ -112,7 +112,7 @@ static const char _rcsid[] __attribute__ ((unused)) =
#include "opt_wsdisplay_compat.h"
#include "wskbd.h"
#include "wsdisplay.h"
struct wskbd_internal {
const struct wskbd_mapdata *t_keymap;
@ -141,7 +141,9 @@ struct wskbd_softc {
struct wseventvar sc_events; /* event queue state */
int sc_isconsole;
#if NWSDISPLAY > 0
struct device *sc_displaydv;
#endif
struct wskbd_bell_data sc_bell_data;
struct wskbd_keyrepeat_data sc_keyrepeat_data;
@ -185,16 +187,15 @@ static inline void update_leds __P((struct wskbd_internal *));
static inline void update_modifier __P((struct wskbd_internal *, u_int, int, int));
static int internal_command __P((struct wskbd_softc *, u_int *, keysym_t));
static keysym_t wskbd_translate __P((struct wskbd_internal *, u_int, int));
#if NWSDISPLAY > 0
static void wskbd_holdscreen __P((struct wskbd_softc *, int));
#endif
struct cfattach wskbd_ca = {
sizeof (struct wskbd_softc), wskbd_match, wskbd_attach,
};
#if NWSKBD > 0
extern struct cfdriver wskbd_cd;
#endif
#ifndef WSKBD_DEFAULT_BELL_PITCH
#define WSKBD_DEFAULT_BELL_PITCH 1500 /* 1500Hz */
@ -227,7 +228,10 @@ struct wskbd_keyrepeat_data wskbd_default_keyrepeat_data = {
};
cdev_decl(wskbd);
#if NWSDISPLAY > 0
static void wskbd_repeat __P((void *v));
#endif
static int wskbd_console_initted;
static struct wskbd_softc *wskbd_console_device;
@ -319,7 +323,9 @@ wskbd_attach(parent, self, aux)
wskbd_console_device = sc;
}
sc->sc_isconsole = ap->console;
#if NWSDISPLAY > 0
sc->sc_displaydv = NULL;
#endif
/* set default bell and key repeat data */
sc->sc_bell_data = wskbd_default_bell_data;
@ -340,11 +346,14 @@ wskbd_cnattach(consops, conscookie, mapdata)
wskbd_console_data.t_consops = consops;
wskbd_console_data.t_consaccesscookie = conscookie;
#if NWSDISPLAY > 0
wsdisplay_set_cons_kbd(wskbd_cngetc, wskbd_cnpollc);
#endif
wskbd_console_initted = 1;
}
#if NWSDISPLAY > 0
static void
wskbd_repeat(v)
void *v;
@ -366,6 +375,7 @@ wskbd_repeat(v)
(hz * sc->sc_keyrepeat_data.delN) / 1000);
splx(s);
}
#endif
void
wskbd_input(dev, type, value)
@ -376,9 +386,12 @@ wskbd_input(dev, type, value)
struct wskbd_softc *sc = (struct wskbd_softc *)dev;
struct wscons_event *ev;
struct timeval xxxtime;
#if NWSDISPLAY > 0
keysym_t ks;
#endif
int put;
#if NWSDISPLAY > 0
if (sc->sc_repeating) {
sc->sc_repeating = 0;
untimeout(wskbd_repeat, sc);
@ -402,6 +415,7 @@ wskbd_input(dev, type, value)
}
return;
}
#endif
/*
* Keyboard is generating events. Turn this keystroke into an
@ -436,15 +450,18 @@ wskbd_rawinput(dev, buf, len)
char *buf;
int len;
{
#if NWSDISPLAY > 0
struct wskbd_softc *sc = (struct wskbd_softc *)dev;
int i;
for (i = 0; i < len; i++)
wsdisplay_kbdinput(sc->sc_displaydv, buf[i]);
/* this is KS_GROUP_Ascii */
}
#endif
}
#endif /* WSDISPLAY_COMPAT_RAWKBD */
#if NWSDISPLAY > 0
static void
wskbd_holdscreen(sc, hold)
struct wskbd_softc *sc;
@ -466,6 +483,7 @@ wskbd_holdscreen(sc, hold)
}
}
}
#endif
int
wskbd_enable(dev, on)
@ -476,7 +494,11 @@ wskbd_enable(dev, on)
int res;
/* XXX reference count? */
if (!on && (!sc->sc_translating || sc->sc_displaydv))
if (!on && (!sc->sc_translating
#if NWSDISPLAY > 0
|| sc->sc_displaydv
#endif
))
return (EBUSY);
res = (*sc->sc_accessops->enable)(sc->sc_accesscookie, on);
@ -489,7 +511,6 @@ wskbdopen(dev, flags, mode, p)
int flags, mode;
struct proc *p;
{
#if NWSKBD > 0
struct wskbd_softc *sc;
int unit;
@ -508,11 +529,7 @@ wskbdopen(dev, flags, mode, p)
sc->sc_ready = 1; /* start accepting events */
wskbd_enable((struct device *)sc, 1);
return (0);
#else
return (ENXIO);
#endif /* NWSKBD > 0 */
}
int
@ -521,7 +538,6 @@ wskbdclose(dev, flags, mode, p)
int flags, mode;
struct proc *p;
{
#if NWSKBD > 0
struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)];
sc->sc_ready = 0; /* stop accepting events */
@ -531,7 +547,6 @@ wskbdclose(dev, flags, mode, p)
sc->sc_events.io = NULL;
wskbd_enable((struct device *)sc, 0);
#endif /* NWSKBD > 0 */
return (0);
}
@ -541,13 +556,9 @@ wskbdread(dev, uio, flags)
struct uio *uio;
int flags;
{
#if NWSKBD > 0
struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)];
return (wsevent_read(&sc->sc_events, uio, flags));
#else
return (ENXIO);
#endif /* NWSKBD > 0 */
}
int
@ -558,7 +569,6 @@ wskbdioctl(dev, cmd, data, flag, p)
int flag;
struct proc *p;
{
#if NWSKBD > 0
struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)];
int error;
@ -585,9 +595,6 @@ wskbdioctl(dev, cmd, data, flag, p)
*/
error = wskbd_displayioctl((struct device *)sc, cmd, data, flag, p);
return (error != -1 ? error : ENOTTY);
#else
return (ENXIO);
#endif /* NWSKBD > 0 */
}
/*
@ -774,13 +781,9 @@ wskbdpoll(dev, events, p)
int events;
struct proc *p;
{
#if NWSKBD > 0
struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)];
return (wsevent_poll(&sc->sc_events, events, p));
#else
return (0);
#endif /* NWSKBD > 0 */
}
int
@ -793,6 +796,8 @@ wskbd_is_console(dv)
return (sc->sc_isconsole);
}
#if NWSDISPLAY > 0
struct device *
wskbd_display(dv)
struct device *dv;
@ -813,6 +818,8 @@ wskbd_set_display(dv, displaydv)
sc->sc_displaydv = displaydv;
}
#endif /* NWSDISPLAY > 0 */
/*
* Console interface.
*/
@ -934,6 +941,7 @@ internal_command(sc, type, ksym)
return (1);
#endif
#if NWSDISPLAY > 0
case KS_Cmd_Screen0:
case KS_Cmd_Screen1:
case KS_Cmd_Screen2:
@ -952,6 +960,7 @@ internal_command(sc, type, ksym)
case KS_Cmd_ResetClose:
wsdisplay_reset(sc->sc_displaydv, WSDISPLAY_RESETCLOSE);
return (1);
#endif
}
return (0);
}
@ -1037,12 +1046,14 @@ wskbd_translate(id, type, value)
update_modifier(id, type, 1, MOD_NUMLOCK);
break;
#if NWSDISPLAY > 0
case KS_Hold_Screen:
if (sc != NULL) {
update_modifier(id, type, 1, MOD_HOLDSCREEN);
wskbd_holdscreen(sc, id->t_modifiers & MOD_HOLDSCREEN);
}
break;
#endif
}
/* If this is a key release or we are in command mode, we are done */