summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/i386/isa/joy.c8
-rw-r--r--sys/arch/i386/isa/pccons.c43
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_hdr.h4
-rw-r--r--sys/arch/i386/isa/pms.c38
-rw-r--r--sys/arch/i386/isa/spkr.c112
5 files changed, 114 insertions, 91 deletions
diff --git a/sys/arch/i386/isa/joy.c b/sys/arch/i386/isa/joy.c
index aaf893af18b..dc4196591b2 100644
--- a/sys/arch/i386/isa/joy.c
+++ b/sys/arch/i386/isa/joy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: joy.c,v 1.2 1996/04/01 06:39:17 scottr Exp $ */
+/* $NetBSD: joy.c,v 1.3 1996/05/05 19:46:15 christos Exp $ */
/*-
* Copyright (c) 1995 Jean-Marc Zucconi
@@ -41,6 +41,7 @@
#include <machine/pio.h>
#include <machine/cpufunc.h>
#include <machine/joystick.h>
+#include <machine/conf.h>
#include <dev/isa/isavar.h>
#include <dev/isa/isareg.h>
@@ -65,7 +66,7 @@
#define TICKS2USEC(u) (((u) * 3433) >> 12)
-#define JOYPART(d) minor(d) & 1
+#define JOYPART(d) (minor(d) & 1)
#define JOYUNIT(d) minor(d) >> 1 & 3
#ifndef JOY_TIMEOUT
@@ -102,9 +103,9 @@ joyprobe(parent, match, aux)
void *match, *aux;
{
struct isa_attach_args *ia = aux;
+#ifdef WANT_JOYSTICK_CONNECTED
int iobase = ia->ia_iobase;
-#ifdef WANT_JOYSTICK_CONNECTED
outb(iobase, 0xff);
DELAY(10000); /* 10 ms delay */
return (inb(iobase) & 0x0f) != 0x0f;
@@ -122,7 +123,6 @@ joyattach(parent, self, aux)
{
struct joy_softc *sc = (void *) self;
struct isa_attach_args *ia = aux;
- int unit = sc->sc_dev.dv_unit;
int iobase = ia->ia_iobase;
sc->port = iobase;
diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c
index 508e7c767bb..c7ea3f9c595 100644
--- a/sys/arch/i386/isa/pccons.c
+++ b/sys/arch/i386/isa/pccons.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pccons.c,v 1.13 1996/05/09 14:19:47 deraadt Exp $ */
-/* $NetBSD: pccons.c,v 1.97 1996/05/03 19:15:00 christos Exp $ */
+/* $OpenBSD: pccons.c,v 1.14 1996/05/10 12:46:20 deraadt Exp $ */
+/* $NetBSD: pccons.c,v 1.98 1996/05/05 19:48:15 christos Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
@@ -985,7 +985,7 @@ sput(cp, n)
else
vs.so_at = FG_YELLOW | BG_BLACK;
- fillw((vs.at << 8) | ' ', (caddr_t) crtat, vs.nchr - cursorat);
+ fillw((vs.at << 8) | ' ', crtat, vs.nchr - cursorat);
}
while (n--) {
@@ -1072,7 +1072,7 @@ sput(cp, n)
vs.state = VSS_EBRACE;
} else if (c == 'c') { /* Clear screen & home */
fillw((vs.at << 8) | ' ',
- (caddr_t) Crtat, vs.nchr);
+ Crtat, vs.nchr);
crtat = Crtat;
vs.col = 0;
vs.state = 0;
@@ -1163,20 +1163,18 @@ sput(cp, n)
case 0:
/* ... to end of display */
fillw((vs.at << 8) | ' ',
- (caddr_t) crtat,
+ crtat,
Crtat + vs.nchr - crtat);
break;
case 1:
/* ... to next location */
fillw((vs.at << 8) | ' ',
- (caddr_t) Crtat,
- crtat - Crtat + 1);
+ Crtat, crtat - Crtat + 1);
break;
case 2:
/* ... whole display */
fillw((vs.at << 8) | ' ',
- (caddr_t) Crtat,
- vs.nchr);
+ Crtat, vs.nchr);
break;
}
vs.state = 0;
@@ -1186,20 +1184,17 @@ sput(cp, n)
case 0:
/* ... current to EOL */
fillw((vs.at << 8) | ' ',
- (caddr_t) crtat,
- vs.ncol - vs.col);
+ crtat, vs.ncol - vs.col);
break;
case 1:
/* ... beginning to next */
fillw((vs.at << 8) | ' ',
- (caddr_t) (crtat - vs.col),
- vs.col + 1);
+ crtat - vs.col, vs.col + 1);
break;
case 2:
/* ... entire line */
fillw((vs.at << 8) | ' ',
- (caddr_t) (crtat - vs.col),
- vs.ncol);
+ crtat - vs.col, vs.ncol);
break;
}
vs.state = 0;
@@ -1237,7 +1232,7 @@ sput(cp, n)
crtAt, vs.ncol * (nrow -
cx) * CHR);
fillw((vs.at << 8) | ' ',
- (caddr_t) (crtAt + vs.ncol * (nrow - cx)),
+ crtAt + vs.ncol * (nrow - cx),
vs.ncol * cx);
vs.state = 0;
break;
@@ -1253,7 +1248,7 @@ sput(cp, n)
Crtat, vs.ncol * (vs.nrow -
cx) * CHR);
fillw((vs.at << 8) | ' ',
- (caddr_t) (Crtat + vs.ncol * (vs.nrow - cx)),
+ Crtat + vs.ncol * (vs.nrow - cx),
vs.ncol * cx);
#if 0
crtat -= vs.ncol * cx; /* XXX */
@@ -1276,8 +1271,7 @@ sput(cp, n)
vs.ncol * (nrow - cx) *
CHR);
fillw((vs.at << 8) | ' ',
- (caddr_t) crtAt,
- vs.ncol * cx);
+ crtAt, vs.ncol * cx);
vs.state = 0;
break;
}
@@ -1293,8 +1287,7 @@ sput(cp, n)
vs.ncol * (vs.nrow - cx) *
CHR);
fillw((vs.at << 8) | ' ',
- (caddr_t) Crtat,
- vs.ncol * cx);
+ Crtat, vs.ncol * cx);
#if 0
crtat += vs.ncol * cx; /* XXX */
#endif
@@ -1360,14 +1353,14 @@ sput(cp, n)
if (!kernel) {
int s = spltty();
if (lock_state & KB_SCROLL)
- tsleep((caddr_t)&lock_state,
+ tsleep(&lock_state,
PUSER, "pcputc", 0);
splx(s);
}
bcopy(Crtat + vs.ncol, Crtat,
(vs.nchr - vs.ncol) * CHR);
fillw((vs.at << 8) | ' ',
- (caddr_t) (Crtat + vs.nchr - vs.ncol),
+ Crtat + vs.nchr - vs.ncol,
vs.ncol);
crtat -= vs.ncol;
}
@@ -1578,7 +1571,7 @@ top:
shift_state |= KB_SCROLL;
lock_state ^= KB_SCROLL;
if ((lock_state & KB_SCROLL) == 0)
- wakeup((caddr_t)&lock_state);
+ wakeup(&lock_state);
async_update();
break;
}
@@ -1663,7 +1656,7 @@ top:
shift_state |= KB_SCROLL;
lock_state ^= KB_SCROLL;
if ((lock_state & KB_SCROLL) == 0)
- wakeup((caddr_t)&lock_state);
+ wakeup(&lock_state);
async_update();
break;
/*
diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
index 35ea3874ede..43a69e160f0 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_hdr.h,v 1.9 1996/05/07 12:26:29 mickey Exp $ */
+/* $OpenBSD: pcvt_hdr.h,v 1.10 1996/05/10 12:46:24 deraadt Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -1194,7 +1194,7 @@ extern u_char *saved_charsets[NVGAFONTS];
extern void bcopyb(void *from, void *to, u_int length);
#endif
-#if (!PCVT_FREEBSD || (PCVT_FREEBSD < 200)) && (PCVT_NETBSD < 110)
+#if (PCVT_FREEBSD > 0 && PCVT_FREEBSD < 200) || (PCVT_NETBSD > 0 && PCVT_NETBSD <= 110)
extern void fillw(U_short value, void *addr, u_int length);
#endif
diff --git a/sys/arch/i386/isa/pms.c b/sys/arch/i386/isa/pms.c
index e3ba04481b0..4819fc8a7ca 100644
--- a/sys/arch/i386/isa/pms.c
+++ b/sys/arch/i386/isa/pms.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pms.c,v 1.7 1996/04/21 22:17:02 deraadt Exp $ */
-/* $NetBSD: pms.c,v 1.27 1996/04/11 22:15:27 cgd Exp $ */
+/* $OpenBSD: pms.c,v 1.8 1996/05/10 12:46:22 deraadt Exp $ */
+/* $NetBSD: pms.c,v 1.28 1996/05/05 19:46:18 christos Exp $ */
/*-
* Copyright (c) 1994 Charles Hannum.
@@ -53,6 +53,7 @@
#include <machine/cpu.h>
#include <machine/pio.h>
#include <machine/mouse.h>
+#include <machine/conf.h>
#include <dev/isa/isavar.h>
@@ -115,12 +116,17 @@ struct cfdriver pms_cd = {
#define PMSUNIT(dev) (minor(dev))
-static inline void
+static __inline void pms_flush __P((void));
+static __inline void pms_dev_cmd __P((u_char));
+static __inline void pms_pit_cmd __P((u_char));
+static __inline void pms_aux_cmd __P((u_char));
+
+static __inline void
pms_flush()
{
u_char c;
- while (c = inb(PMS_STATUS) & 0x03)
+ while ((c = inb(PMS_STATUS) & 0x03) != 0)
if ((c & PMS_OBUF_FULL) == PMS_OBUF_FULL) {
/* XXX - delay is needed to prevent some keyboards from
wedging when the system boots */
@@ -129,7 +135,7 @@ pms_flush()
}
}
-static inline void
+static __inline void
pms_dev_cmd(value)
u_char value;
{
@@ -140,7 +146,7 @@ pms_dev_cmd(value)
outb(PMS_DATA, value);
}
-static inline void
+static __inline void
pms_aux_cmd(value)
u_char value;
{
@@ -149,7 +155,7 @@ pms_aux_cmd(value)
outb(PMS_CNTRL, value);
}
-static inline void
+static __inline void
pms_pit_cmd(value)
u_char value;
{
@@ -216,9 +222,11 @@ pmsattach(parent, self, aux)
}
int
-pmsopen(dev, flag)
+pmsopen(dev, flag, mode, p)
dev_t dev;
int flag;
+ int mode;
+ struct proc *p;
{
int unit = PMSUNIT(dev);
struct pms_softc *sc;
@@ -256,9 +264,11 @@ pmsopen(dev, flag)
}
int
-pmsclose(dev, flag)
+pmsclose(dev, flag, mode, p)
dev_t dev;
int flag;
+ int mode;
+ struct proc *p;
{
struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
@@ -282,7 +292,7 @@ pmsread(dev, uio, flag)
{
struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
int s;
- int error;
+ int error = 0;
size_t length;
u_char buffer[PMS_CHUNK];
@@ -295,7 +305,8 @@ pmsread(dev, uio, flag)
return EWOULDBLOCK;
}
sc->sc_state |= PMS_ASLP;
- if (error = tsleep((caddr_t)sc, PZERO | PCATCH, "pmsrea", 0)) {
+ error = tsleep((caddr_t)sc, PZERO | PCATCH, "pmsrea", 0);
+ if (error) {
sc->sc_state &= ~PMS_ASLP;
splx(s);
return error;
@@ -314,7 +325,7 @@ pmsread(dev, uio, flag)
(void) q_to_b(&sc->sc_q, buffer, length);
/* Copy the data to the user process. */
- if (error = uiomove(buffer, length, uio))
+ if ((error = uiomove(buffer, length, uio)) != 0)
break;
}
@@ -322,11 +333,12 @@ pmsread(dev, uio, flag)
}
int
-pmsioctl(dev, cmd, addr, flag)
+pmsioctl(dev, cmd, addr, flag, p)
dev_t dev;
u_long cmd;
caddr_t addr;
int flag;
+ struct proc *p;
{
struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
struct mouseinfo info;
diff --git a/sys/arch/i386/isa/spkr.c b/sys/arch/i386/isa/spkr.c
index fda1720489e..dd62539b022 100644
--- a/sys/arch/i386/isa/spkr.c
+++ b/sys/arch/i386/isa/spkr.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: spkr.c,v 1.7 1996/05/01 00:16:19 mickey Exp $ */
-/* $NetBSD: spkr.c,v 1.22 1996/03/18 01:26:12 jtk Exp $ */
+/* $OpenBSD: spkr.c,v 1.8 1996/05/10 12:46:23 deraadt Exp $ */
+/* $NetBSD: spkr.c,v 1.23 1996/05/05 19:31:25 christos Exp $ */
/*
* spkr.c -- device driver for console speaker on 80386
@@ -17,15 +17,18 @@
#endif
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/errno.h>
#include <sys/device.h>
#include <sys/buf.h>
#include <sys/uio.h>
+#include <sys/proc.h>
#include <machine/cpu.h>
#include <machine/pio.h>
#include <machine/spkr.h>
+#include <machine/conf.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
@@ -65,19 +68,28 @@ struct cfdriver spkr_cd = {
*/
#define PIT_MODE (TIMER_SEL2|TIMER_16BIT|TIMER_SQWAVE)
-
-static int endtone()
-/* turn off the speaker, ending current tone */
+static void endtone __P((void *));
+static void tone __P((u_int, u_int));
+static void endrest __P((void *));
+static void rest __P((int));
+static void playinit __P((void));
+static void playtone __P((int, int, int));
+static void playstring __P((char *, size_t));
+
+static void
+endtone(v)
+ void *v;
{
- wakeup((caddr_t)endtone);
+ wakeup(endtone);
outb(PITAUX_PORT, inb(PITAUX_PORT) & ~PIT_SPKR);
}
-static void tone(hz, ticks)
+static
+void tone(hz, ticks)
/* emit tone of frequency hz for given number of ticks */
-unsigned int hz, ticks;
+ u_int hz, ticks;
{
- unsigned int divisor = TIMER_DIV(hz);
+ u_int divisor = TIMER_DIV(hz);
int sps;
#ifdef DEBUG
@@ -99,19 +111,22 @@ unsigned int hz, ticks;
* This is so other processes can execute while the tone is being
* emitted.
*/
- timeout((caddr_t)endtone, (caddr_t)NULL, ticks);
- sleep((caddr_t)endtone, PZERO - 1);
+ timeout(endtone, NULL, ticks);
+ sleep(endtone, PZERO - 1);
}
-static int endrest()
+static void
+endrest(v)
/* end a rest */
+ void *v;
{
- wakeup((caddr_t)endrest);
+ wakeup(endrest);
}
-static void rest(ticks)
+static void
+rest(ticks)
/* rest for given number of ticks */
-int ticks;
+ int ticks;
{
/*
* Set timeout to endrest function, then give up the timeslice.
@@ -121,8 +136,8 @@ int ticks;
#ifdef DEBUG
printf("rest: %d\n", ticks);
#endif /* DEBUG */
- timeout((caddr_t)endrest, (caddr_t)NULL, ticks);
- sleep((caddr_t)endrest, PZERO - 1);
+ timeout(endrest, NULL, ticks);
+ sleep(endrest, PZERO - 1);
}
/**************** PLAY STRING INTERPRETER BEGINS HERE **********************
@@ -187,7 +202,8 @@ static int pitchtab[] =
/* 6 */ 4186, 4435, 4698, 4978, 5274, 5588, 5920, 6272, 6644, 7040, 7459, 7902,
};
-static void playinit()
+static void
+playinit()
{
octave = DFLT_OCTAVE;
whole = (hz * SECS_PER_MIN * WHOLE_NOTE) / DFLT_TEMPO;
@@ -197,9 +213,10 @@ static void playinit()
octprefix = TRUE; /* act as though there was an initial O(n) */
}
-static void playtone(pitch, value, sustain)
+static void
+playtone(pitch, value, sustain)
/* play tone of proper duration for current rhythm signature */
-int pitch, value, sustain;
+ int pitch, value, sustain;
{
register int sound, silence, snum = 1, sdenom = 1;
@@ -229,19 +246,11 @@ int pitch, value, sustain;
}
}
-static int abs(n)
-int n;
-{
- if (n < 0)
- return(-n);
- else
- return(n);
-}
-
-static void playstring(cp, slen)
+static void
+playstring(cp, slen)
/* interpret and play an item from a notation string */
-char *cp;
-size_t slen;
+ char *cp;
+ size_t slen;
{
int pitch, lastpitch = OCTAVE_NOTES * DFLT_OCTAVE;
@@ -419,12 +428,12 @@ size_t slen;
static int spkr_active; /* exclusion flag */
static struct buf *spkr_inbuf; /* incoming buf */
-int spkrprobe (parent, match, aux)
+int
+spkrprobe (parent, match, aux)
struct device *parent;
void *match;
void *aux;
{
- register struct isa_attach_args *ia = aux;
struct cfdata *cf = match;
extern struct cfattach pc_ca, vt_ca;
/*
@@ -467,8 +476,12 @@ spkrattach(parent, self, aux)
spkr_attached = 1;
}
-int spkropen(dev)
-dev_t dev;
+int
+spkropen(dev, flags, mode, p)
+ dev_t dev;
+ int flags;
+ int mode;
+ struct proc *p;
{
#ifdef DEBUG
printf("spkropen: entering with dev = %x\n", dev);
@@ -487,9 +500,11 @@ dev_t dev;
return(0);
}
-int spkrwrite(dev, uio)
-dev_t dev;
-struct uio *uio;
+int
+spkrwrite(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
{
register unsigned n;
char *cp;
@@ -512,8 +527,11 @@ struct uio *uio;
}
}
-int spkrclose(dev)
-dev_t dev;
+int spkrclose(dev, flags, mode, p)
+ dev_t dev;
+ int flags;
+ int mode;
+ struct proc *p;
{
#ifdef DEBUG
printf("spkrclose: entering with dev = %x\n", dev);
@@ -523,7 +541,7 @@ dev_t dev;
return(ENXIO);
else
{
- endtone();
+ endtone(NULL);
brelse(spkr_inbuf);
spkr_active = 0;
}
@@ -531,11 +549,11 @@ dev_t dev;
}
int spkrioctl(dev, cmd, data, flag, p)
-dev_t dev;
-u_long cmd;
-caddr_t data;
-int flag;
-struct proc *p;
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
{
#ifdef DEBUG
printf("spkrioctl: entering with dev = %x, cmd = %lx\n", dev, cmd);