rename the autoconfiguration related symbols to opms* to avoid namespace

collisions with an mi wscons-capable pms driver
This commit is contained in:
drochner 1999-01-23 15:07:10 +00:00
parent 6ad1646ffb
commit 4120bf17c4

View File

@ -1,4 +1,4 @@
/* $NetBSD: pms.c,v 1.41 1998/08/20 19:55:06 veego Exp $ */
/* $NetBSD: pms.c,v 1.42 1999/01/23 15:07:10 drochner Exp $ */
/*-
* Copyright (c) 1994, 1997 Charles M. Hannum.
@ -31,8 +31,8 @@
* may result in dropped characters and/or corrupted mouse events.
*/
#include "pms.h"
#if (NPMS_HACK + NPMS_PCKBC) > 1
#include "opms.h"
#if (NOPMS_HACK + NOPMS_PCKBC) > 1
#error Only one PS/2 style mouse may be configured into your system.
#endif
@ -50,19 +50,19 @@
#include <sys/device.h>
#include <sys/poll.h>
#if (NPMS_HACK > 0)
#if (NOPMS_HACK > 0)
#include <machine/cpu.h>
#include <machine/intr.h>
#include <machine/pio.h>
#endif
#if (NPMS_PCKBC > 0)
#if (NOPMS_PCKBC > 0)
#include <machine/bus.h>
#include <dev/isa/pckbcvar.h>
#endif
#include <machine/mouse.h>
#include <machine/conf.h>
#if (NPMS_HACK > 0)
#if (NOPMS_HACK > 0)
#include <dev/isa/isavar.h>
@ -82,7 +82,7 @@
#define PMS_AUX_DISABLE 0xa7 /* disable auxiliary port */
#define PMS_AUX_TEST 0xa9 /* test auxiliary port */
#endif /* NPMS_HACK > 0 */
#endif /* NOPMS_HACK > 0 */
/* mouse commands */
#define PMS_SET_SCALE11 0xe6 /* set scaling 1:1 */
@ -98,12 +98,12 @@
#define PMS_CHUNK 128 /* chunk size for read */
#define PMS_BSIZE 1020 /* buffer size */
struct pms_softc { /* driver status information */
struct opms_softc { /* driver status information */
struct device sc_dev;
#if (NPMS_HACK > 0)
#if (NOPMS_HACK > 0)
void *sc_ih;
#endif
#if (NPMS_PCKBC > 0)
#if (NOPMS_PCKBC > 0)
pckbc_tag_t sc_kbctag;
pckbc_slot_t sc_kbcslot;
#endif
@ -117,31 +117,31 @@ struct pms_softc { /* driver status information */
int sc_x, sc_y; /* accumulated motion in the X,Y axis */
};
#if (NPMS_HACK > 0)
int pms_hack_probe __P((struct device *, struct cfdata *, void *));
void pms_hack_attach __P((struct device *, struct device *, void *));
int pmsintr __P((void *));
#if (NOPMS_HACK > 0)
int opms_hack_probe __P((struct device *, struct cfdata *, void *));
void opms_hack_attach __P((struct device *, struct device *, void *));
int opmsintr __P((void *));
struct cfattach pms_hack_ca = {
sizeof(struct pms_softc), pms_hack_probe, pms_hack_attach,
struct cfattach opms_hack_ca = {
sizeof(struct opms_softc), opms_hack_probe, opms_hack_attach,
};
#endif
#if (NPMS_PCKBC > 0)
int pms_pckbc_probe __P((struct device *, struct cfdata *, void *));
void pms_pckbc_attach __P((struct device *, struct device *, void *));
#if (NOPMS_PCKBC > 0)
int opms_pckbc_probe __P((struct device *, struct cfdata *, void *));
void opms_pckbc_attach __P((struct device *, struct device *, void *));
struct cfattach pms_pckbc_ca = {
sizeof(struct pms_softc), pms_pckbc_probe, pms_pckbc_attach,
struct cfattach opms_pckbc_ca = {
sizeof(struct opms_softc), opms_pckbc_probe, opms_pckbc_attach,
};
#endif
void pmsinput __P((void *, int));
void opmsinput __P((void *, int));
extern struct cfdriver pms_cd;
extern struct cfdriver opms_cd;
#define PMSUNIT(dev) (minor(dev))
#if (NPMS_HACK > 0)
#if (NOPMS_HACK > 0)
static __inline int pms_wait_output __P((void));
static __inline int pms_wait_input __P((void));
@ -244,7 +244,7 @@ pms_pit_cmd(value)
* provides the parent's io port and our irq.
*/
int
pms_hack_probe(parent, cf, aux)
opms_hack_probe(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
@ -284,11 +284,11 @@ pms_hack_probe(parent, cf, aux)
}
void
pms_hack_attach(parent, self, aux)
opms_hack_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct pms_softc *sc = (void *)self;
struct opms_softc *sc = (void *)self;
int irq = self->dv_cfdata->cf_loc[PCKBCPORTCF_IRQ];
isa_chipset_tag_t ic = aux; /* XXX */
@ -298,14 +298,14 @@ pms_hack_attach(parent, self, aux)
sc->sc_state = 0;
sc->sc_ih = isa_intr_establish(ic, irq, IST_EDGE, IPL_TTY,
pmsintr, sc);
opmsintr, sc);
}
#endif /* NPMS_HACK > 0 */
#endif /* NOPMS_HACK > 0 */
#if (NPMS_PCKBC > 0)
#if (NOPMS_PCKBC > 0)
int
pms_pckbc_probe(parent, match, aux)
opms_pckbc_probe(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
@ -324,18 +324,18 @@ pms_pckbc_probe(parent, match, aux)
cmd[0] = PMS_RESET;
res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 2, resp, 1);
if (res) {
printf("pmsprobe: command error\n");
printf("opmsprobe: command error\n");
return(0);
}
if (resp[0] != 0xaa) {
printf("pmsprobe: reset error\n");
printf("opmsprobe: reset error\n");
return(0);
}
/* get type number (0 = mouse) */
if (resp[1] != 0) {
#ifdef DIAGNOSTIC
printf("pmsprobe: type 0x%x\n", resp[1]);
printf("opmsprobe: type 0x%x\n", resp[1]);
#endif
return(0);
}
@ -344,11 +344,11 @@ pms_pckbc_probe(parent, match, aux)
}
void
pms_pckbc_attach(parent, self, aux)
opms_pckbc_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct pms_softc *sc = (void *)self;
struct opms_softc *sc = (void *)self;
struct pckbc_attach_args *pa = aux;
u_char cmd[1];
int res;
@ -362,13 +362,13 @@ pms_pckbc_attach(parent, self, aux)
sc->sc_state = 0;
pckbc_set_inputhandler(sc->sc_kbctag, sc->sc_kbcslot,
pmsinput, sc);
opmsinput, sc);
/* no interrupts until enabled */
cmd[0] = PMS_DEV_DISABLE;
res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 0, 0, 0);
if (res)
printf("pmsattach: disable error\n");
printf("opmsattach: disable error\n");
pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 0);
}
#endif
@ -381,15 +381,15 @@ pmsopen(dev, flag, mode, p)
struct proc *p;
{
int unit = PMSUNIT(dev);
struct pms_softc *sc;
#if (NPMS_PCKBC > 0)
struct opms_softc *sc;
#if (NOPMS_PCKBC > 0)
u_char cmd[1];
int res;
#endif
if (unit >= pms_cd.cd_ndevs)
if (unit >= opms_cd.cd_ndevs)
return ENXIO;
sc = pms_cd.cd_devs[unit];
sc = opms_cd.cd_devs[unit];
if (!sc)
return ENXIO;
@ -404,21 +404,21 @@ pmsopen(dev, flag, mode, p)
sc->sc_x = sc->sc_y = 0;
/* Enable interrupts. */
#if (NPMS_HACK > 0)
#if (NOPMS_HACK > 0)
pms_aux_cmd(PMS_AUX_ENABLE);
pms_pit_cmd(PMS_INT_ENABLE);
pms_dev_cmd(PMS_DEV_ENABLE);
if (pms_wait_input())
pms_flush_input();
#endif
#if (NPMS_PCKBC > 0)
#if (NOPMS_PCKBC > 0)
pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 1);
cmd[0] = PMS_DEV_ENABLE;
res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
cmd, 1, 0, 1, 0);
if (res) {
printf("pms_enable: command error\n");
printf("opms_enable: command error\n");
return (res);
}
#endif
@ -442,26 +442,26 @@ pmsclose(dev, flag, mode, p)
int mode;
struct proc *p;
{
struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
#if (NPMS_PCKBC > 0)
struct opms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
#if (NOPMS_PCKBC > 0)
u_char cmd[1];
int res;
#endif
/* Disable interrupts. */
#if (NPMS_HACK > 0)
#if (NOPMS_HACK > 0)
pms_dev_cmd(PMS_DEV_DISABLE);
if (pms_wait_input())
pms_flush_input();
pms_pit_cmd(PMS_INT_DISABLE);
pms_aux_cmd(PMS_AUX_DISABLE);
#endif
#if (NPMS_PCKBC > 0)
#if (NOPMS_PCKBC > 0)
cmd[0] = PMS_DEV_DISABLE;
res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
cmd, 1, 0, 1, 0);
if (res)
printf("pms_disable: command error\n");
printf("opms_disable: command error\n");
pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 0);
#endif
@ -479,7 +479,7 @@ pmsread(dev, uio, flag)
struct uio *uio;
int flag;
{
struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
struct opms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
int s;
int error = 0;
size_t length;
@ -529,7 +529,7 @@ pmsioctl(dev, cmd, addr, flag, p)
int flag;
struct proc *p;
{
struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
struct opms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
struct mouseinfo info;
int s;
int error;
@ -580,11 +580,11 @@ pmsioctl(dev, cmd, addr, flag, p)
#define PS2MBUTMASK 0x04
void
pmsinput(arg, data)
opmsinput(arg, data)
void *arg;
int data;
{
struct pms_softc *sc = arg;
struct opms_softc *sc = arg;
static int state = 0;
static u_char buttons;
u_char changed;
@ -644,12 +644,12 @@ pmsinput(arg, data)
}
}
#if (NPMS_HACK > 0)
#if (NOPMS_HACK > 0)
int
pmsintr(arg)
opmsintr(arg)
void *arg;
{
struct pms_softc *sc = arg;
struct opms_softc *sc = arg;
int data;
if ((sc->sc_state & PMS_OPEN) == 0) {
@ -659,7 +659,7 @@ pmsintr(arg)
}
data = inb(PMS_DATA);
pmsinput(arg, data);
opmsinput(arg, data);
return (-1);
}
#endif
@ -670,7 +670,7 @@ pmspoll(dev, events, p)
int events;
struct proc *p;
{
struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
struct opms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
int revents = 0;
int s = spltty();