-/* $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
#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>
#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
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;
{
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;
-/* $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.
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--) {
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;
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;
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;
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;
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 */
vs.ncol * (nrow - cx) *
CHR);
fillw((vs.at << 8) | ' ',
- (caddr_t) crtAt,
- vs.ncol * cx);
+ crtAt, vs.ncol * cx);
vs.state = 0;
break;
}
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
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;
}
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;
}
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;
/*
-/* $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.
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
-/* $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.
#include <machine/cpu.h>
#include <machine/pio.h>
#include <machine/mouse.h>
+#include <machine/conf.h>
#include <dev/isa/isavar.h>
#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 */
}
}
-static inline void
+static __inline void
pms_dev_cmd(value)
u_char value;
{
outb(PMS_DATA, value);
}
-static inline void
+static __inline void
pms_aux_cmd(value)
u_char value;
{
outb(PMS_CNTRL, value);
}
-static inline void
+static __inline void
pms_pit_cmd(value)
u_char value;
{
}
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;
}
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)];
{
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];
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;
(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;
}
}
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;
-/* $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
#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>
*/
#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
* 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.
#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 **********************
/* 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;
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;
}
}
-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;
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;
/*
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);
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;
}
}
-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);
return(ENXIO);
else
{
- endtone();
+ endtone(NULL);
brelse(spkr_inbuf);
spkr_active = 0;
}
}
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);