summaryrefslogtreecommitdiff
path: root/sys/arch/amiga/dev/ms.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-05-02 06:44:48 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-05-02 06:44:48 +0000
commita1ab0133973a053ec8cb7034b5f525c772d2c6d6 (patch)
tree348052b6165a33d50f05b52e0989ec9095b81452 /sys/arch/amiga/dev/ms.c
parent357d854e83a35ee1bdb134546c9f0e8b086a8833 (diff)
Sync with NetBSD 9600430. The port has gone over a major -Wall treat
Diffstat (limited to 'sys/arch/amiga/dev/ms.c')
-rw-r--r--sys/arch/amiga/dev/ms.c95
1 files changed, 60 insertions, 35 deletions
diff --git a/sys/arch/amiga/dev/ms.c b/sys/arch/amiga/dev/ms.c
index 27353a26602..39bee0431f9 100644
--- a/sys/arch/amiga/dev/ms.c
+++ b/sys/arch/amiga/dev/ms.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ms.c,v 1.7 1995/04/10 09:10:21 mycroft Exp $ */
+/* $OpenBSD: ms.c,v 1.2 1996/05/02 06:44:21 niklas Exp $ */
+/* $NetBSD: ms.c,v 1.9 1996/04/24 11:41:16 is Exp $ */
/*
* based on:
@@ -53,40 +54,76 @@
*/
#include <sys/param.h>
-#include <sys/conf.h>
+#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/tty.h>
+#include <sys/signalvar.h>
#include <amiga/dev/event_var.h>
#include <amiga/dev/vuid_event.h>
#include <amiga/amiga/custom.h>
#include <amiga/amiga/cia.h>
+#include <amiga/amiga/device.h>
-#include "mouse.h"
-#if NMOUSE > 0
+#include <sys/conf.h>
+#include <machine/conf.h>
-/* there's really no more physical ports on an amiga.. */
-#if NMOUSE > 2
-#undef NMOUSE
-#define NMOUSE 2
-#endif
+void msattach __P((struct device *, struct device *, void *));
+int msmatch __P((struct device *, void *, void *));
void msintr __P((void *));
void ms_enable __P((dev_t));
void ms_disable __P((dev_t));
+struct ms_softc {
+ struct device sc_dev;
+
+ u_char ms_horc; /* horizontal counter on last scan */
+ u_char ms_verc; /* vertical counter on last scan */
+ char ms_mb; /* mouse button state */
+ char ms_ub; /* user button state */
+ int ms_dx; /* delta-x */
+ int ms_dy; /* delta-y */
+ volatile int ms_ready; /* event queue is ready */
+ struct evvar ms_events; /* event queue state */
+};
+
+struct cfattach ms_ca = {
+ sizeof(struct ms_softc), msmatch, msattach
+};
+
+struct cfdriver ms_cd = {
+ NULL, "ms", DV_DULL, NULL, 0
+};
+
int
-mouseattach(cnt)
- int cnt;
+msmatch(pdp, match, auxp)
+ struct device *pdp;
+ void *match, *auxp;
+{
+ struct cfdata *cfp = (struct cfdata *)match;
+
+ if (matchname((char *)auxp, "ms") &&
+ cfp->cf_unit >= 0 && cfp->cf_unit <= 1) /* only two units */
+ return 1;
+
+ return 0;
+}
+
+
+void
+msattach(pdp, dp, auxp)
+ struct device *pdp, *dp;
+ void *auxp;
{
- printf("%d %s configured\n", NMOUSE, NMOUSE == 1 ? "mouse" : "mice");
- return(NMOUSE);
+ printf("\n");
}
+
/*
* Amiga mice are hooked up to one of the two "game" ports, where
@@ -95,17 +132,6 @@ mouseattach(cnt)
* devices, /dev/mouse0 and /dev/mouse1 (with a link of /dev/mouse to
* the device that represents the port of the mouse in use).
*/
-struct ms_softc {
- u_char ms_horc; /* horizontal counter on last scan */
- u_char ms_verc; /* vertical counter on last scan */
- char ms_mb; /* mouse button state */
- char ms_ub; /* user button state */
- int ms_dx; /* delta-x */
- int ms_dy; /* delta-y */
- volatile int ms_ready; /* event queue is ready */
- struct evvar ms_events; /* event queue state */
-} ms_softc[NMOUSE];
-
/*
* enable scanner, called when someone opens the device.
@@ -117,7 +143,7 @@ ms_enable(dev)
{
struct ms_softc *ms;
- ms = &ms_softc[minor(dev)];
+ ms = (struct ms_softc *)getsoftc(ms_cd, minor(dev));
/*
* use this as flag to the "interrupt" to tell it when to
* shut off (when it's reset to 0).
@@ -138,7 +164,7 @@ ms_disable(dev)
struct ms_softc *ms;
int s;
- ms = &ms_softc[minor(dev)];
+ ms = (struct ms_softc *)getsoftc(ms_cd, minor(dev));
s = splhigh ();
ms->ms_ready = 0;
/*
@@ -166,7 +192,7 @@ msintr(arg)
short dx, dy;
unit = (int)arg;
- ms = &ms_softc[unit];
+ ms = (struct ms_softc *)getsoftc(ms_cd, unit);
horc = ((u_char *) &count) + 1;
verc = (u_char *) &count;
@@ -315,12 +341,12 @@ msopen(dev, flags, mode, p)
struct proc *p;
{
struct ms_softc *ms;
- int s, error, unit;
+ int unit;
unit = minor(dev);
- ms = &ms_softc[unit];
+ ms = (struct ms_softc *)getsoftc(ms_cd, unit);
- if (unit >= NMOUSE)
+ if (ms == NULL)
return(EXDEV);
if (ms->ms_events.ev_io)
@@ -342,7 +368,7 @@ msclose(dev, flags, mode, p)
struct ms_softc *ms;
unit = minor (dev);
- ms = &ms_softc[unit];
+ ms = (struct ms_softc *)getsoftc(ms_cd, unit);
ms_disable(dev);
ev_fini(&ms->ms_events);
@@ -358,7 +384,7 @@ msread(dev, uio, flags)
{
struct ms_softc *ms;
- ms = &ms_softc[minor(dev)];
+ ms = (struct ms_softc *)getsoftc(ms_cd, minor(dev));
return(ev_read(&ms->ms_events, uio, flags));
}
@@ -374,7 +400,7 @@ msioctl(dev, cmd, data, flag, p)
int unit;
unit = minor(dev);
- ms = &ms_softc[unit];
+ ms = (struct ms_softc *)getsoftc(ms_cd, unit);
switch (cmd) {
case FIONBIO: /* we will remove this someday (soon???) */
@@ -405,7 +431,6 @@ msselect(dev, rw, p)
{
struct ms_softc *ms;
- ms = &ms_softc[minor(dev)];
+ ms = (struct ms_softc *)getsoftc(ms_cd, minor(dev));
return(ev_select(&ms->ms_events, rw, p));
}
-#endif /* NMOUSE > 0 */