This commit is contained in:
augustss 2001-10-02 23:31:54 +00:00
parent f51c550f74
commit 9cf205c410
6 changed files with 220 additions and 442 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: auconv.c,v 1.3 1999/11/01 18:12:19 augustss Exp $ */
/* $NetBSD: auconv.c,v 1.4 2001/10/02 23:31:55 augustss Exp $ */
/*
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -39,10 +39,7 @@
#include <dev/auconv.h>
void
change_sign8(v, p, cc)
void *v;
u_char *p;
int cc;
change_sign8(void *v, u_char *p, int cc)
{
while (--cc >= 0) {
*p ^= 0x80;
@ -51,10 +48,7 @@ change_sign8(v, p, cc)
}
void
change_sign16_le(v, p, cc)
void *v;
u_char *p;
int cc;
change_sign16_le(void *v, u_char *p, int cc)
{
while ((cc -= 2) >= 0) {
p[1] ^= 0x80;
@ -63,10 +57,7 @@ change_sign16_le(v, p, cc)
}
void
change_sign16_be(v, p, cc)
void *v;
u_char *p;
int cc;
change_sign16_be(void *v, u_char *p, int cc)
{
while ((cc -= 2) >= 0) {
p[0] ^= 0x80;
@ -75,10 +66,7 @@ change_sign16_be(v, p, cc)
}
void
swap_bytes(v, p, cc)
void *v;
u_char *p;
int cc;
swap_bytes(void *v, u_char *p, int cc)
{
u_char t;
@ -91,10 +79,7 @@ swap_bytes(v, p, cc)
}
void
swap_bytes_change_sign16_le(v, p, cc)
void *v;
u_char *p;
int cc;
swap_bytes_change_sign16_le(void *v, u_char *p, int cc)
{
u_char t;
@ -107,10 +92,7 @@ swap_bytes_change_sign16_le(v, p, cc)
}
void
swap_bytes_change_sign16_be(v, p, cc)
void *v;
u_char *p;
int cc;
swap_bytes_change_sign16_be(void *v, u_char *p, int cc)
{
u_char t;
@ -123,28 +105,19 @@ swap_bytes_change_sign16_be(v, p, cc)
}
void
change_sign16_swap_bytes_le(v, p, cc)
void *v;
u_char *p;
int cc;
change_sign16_swap_bytes_le(void *v, u_char *p, int cc)
{
swap_bytes_change_sign16_be(v, p, cc);
}
void
change_sign16_swap_bytes_be(v, p, cc)
void *v;
u_char *p;
int cc;
change_sign16_swap_bytes_be(void *v, u_char *p, int cc)
{
swap_bytes_change_sign16_le(v, p, cc);
}
void
linear8_to_linear16_le(v, p, cc)
void *v;
u_char *p;
int cc;
linear8_to_linear16_le(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -158,10 +131,7 @@ linear8_to_linear16_le(v, p, cc)
}
void
linear8_to_linear16_be(v, p, cc)
void *v;
u_char *p;
int cc;
linear8_to_linear16_be(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -175,10 +145,7 @@ linear8_to_linear16_be(v, p, cc)
}
void
linear16_to_linear8_le(v, p, cc)
void *v;
u_char *p;
int cc;
linear16_to_linear8_le(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -189,10 +156,7 @@ linear16_to_linear8_le(v, p, cc)
}
void
linear16_to_linear8_be(v, p, cc)
void *v;
u_char *p;
int cc;
linear16_to_linear8_be(void *v, u_char *p, int cc)
{
u_char *q = p;

View File

@ -1,4 +1,4 @@
/* $NetBSD: auconv.h,v 1.5 1999/11/01 18:12:19 augustss Exp $ */
/* $NetBSD: auconv.h,v 1.6 2001/10/02 23:31:55 augustss Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -37,17 +37,17 @@
*/
/* Convert between signed and unsigned. */
extern void change_sign8 __P((void *, u_char *, int));
extern void change_sign16_le __P((void *, u_char *, int));
extern void change_sign16_be __P((void *, u_char *, int));
extern void change_sign8(void *, u_char *, int);
extern void change_sign16_le(void *, u_char *, int);
extern void change_sign16_be(void *, u_char *, int);
/* Convert between little and big endian. */
extern void swap_bytes __P((void *, u_char *, int));
extern void swap_bytes_change_sign16_le __P((void *, u_char *, int));
extern void swap_bytes_change_sign16_be __P((void *, u_char *, int));
extern void change_sign16_swap_bytes_le __P((void *, u_char *, int));
extern void change_sign16_swap_bytes_be __P((void *, u_char *, int));
extern void swap_bytes(void *, u_char *, int);
extern void swap_bytes_change_sign16_le(void *, u_char *, int);
extern void swap_bytes_change_sign16_be(void *, u_char *, int);
extern void change_sign16_swap_bytes_le(void *, u_char *, int);
extern void change_sign16_swap_bytes_be(void *, u_char *, int);
/* Byte expansion/contraction */
extern void linear8_to_linear16_le __P((void *, u_char *, int));
extern void linear8_to_linear16_be __P((void *, u_char *, int));
extern void linear16_to_linear8_le __P((void *, u_char *, int));
extern void linear16_to_linear8_be __P((void *, u_char *, int));
extern void linear8_to_linear16_le(void *, u_char *, int);
extern void linear8_to_linear16_be(void *, u_char *, int);
extern void linear16_to_linear8_le(void *, u_char *, int);
extern void linear16_to_linear8_be(void *, u_char *, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio.c,v 1.139 2001/09/16 16:34:36 wiz Exp $ */
/* $NetBSD: audio.c,v 1.140 2001/10/02 23:31:54 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -97,54 +97,54 @@ int audiodebug = 0;
int audio_blk_ms = AUDIO_BLK_MS;
int audiosetinfo __P((struct audio_softc *, struct audio_info *));
int audiogetinfo __P((struct audio_softc *, struct audio_info *));
int audiosetinfo(struct audio_softc *, struct audio_info *);
int audiogetinfo(struct audio_softc *, struct audio_info *);
int audio_open __P((dev_t, struct audio_softc *, int, int, struct proc *));
int audio_close __P((struct audio_softc *, int, int, struct proc *));
int audio_read __P((struct audio_softc *, struct uio *, int));
int audio_write __P((struct audio_softc *, struct uio *, int));
int audio_ioctl __P((struct audio_softc *, u_long, caddr_t, int, struct proc *));
int audio_poll __P((struct audio_softc *, int, struct proc *));
paddr_t audio_mmap __P((struct audio_softc *, off_t, int));
int audio_open(dev_t, struct audio_softc *, int, int, struct proc *);
int audio_close(struct audio_softc *, int, int, struct proc *);
int audio_read(struct audio_softc *, struct uio *, int);
int audio_write(struct audio_softc *, struct uio *, int);
int audio_ioctl(struct audio_softc *, u_long, caddr_t, int, struct proc *);
int audio_poll(struct audio_softc *, int, struct proc *);
paddr_t audio_mmap(struct audio_softc *, off_t, int);
int mixer_open __P((dev_t, struct audio_softc *, int, int, struct proc *));
int mixer_close __P((struct audio_softc *, int, int, struct proc *));
int mixer_ioctl __P((struct audio_softc *, u_long, caddr_t, int, struct proc *));
static void mixer_remove __P((struct audio_softc *, struct proc *p));
static void mixer_signal __P((struct audio_softc *));
int mixer_open(dev_t, struct audio_softc *, int, int, struct proc *);
int mixer_close(struct audio_softc *, int, int, struct proc *);
int mixer_ioctl(struct audio_softc *, u_long, caddr_t, int, struct proc *);
static void mixer_remove(struct audio_softc *, struct proc *p);
static void mixer_signal(struct audio_softc *);
void audio_init_record __P((struct audio_softc *));
void audio_init_play __P((struct audio_softc *));
int audiostartr __P((struct audio_softc *));
int audiostartp __P((struct audio_softc *));
void audio_rint __P((void *));
void audio_pint __P((void *));
int audio_check_params __P((struct audio_params *));
void audio_init_record(struct audio_softc *);
void audio_init_play(struct audio_softc *);
int audiostartr(struct audio_softc *);
int audiostartp(struct audio_softc *);
void audio_rint(void *);
void audio_pint(void *);
int audio_check_params(struct audio_params *);
void audio_calc_blksize __P((struct audio_softc *, int));
void audio_fill_silence __P((struct audio_params *, u_char *, int));
int audio_silence_copyout __P((struct audio_softc *, int, struct uio *));
void audio_calc_blksize(struct audio_softc *, int);
void audio_fill_silence(struct audio_params *, u_char *, int);
int audio_silence_copyout(struct audio_softc *, int, struct uio *);
void audio_init_ringbuffer __P((struct audio_ringbuffer *));
int audio_initbufs __P((struct audio_softc *));
void audio_calcwater __P((struct audio_softc *));
static __inline int audio_sleep_timo __P((int *, char *, int));
static __inline int audio_sleep __P((int *, char *));
static __inline void audio_wakeup __P((int *));
int audio_drain __P((struct audio_softc *));
void audio_clear __P((struct audio_softc *));
void audio_init_ringbuffer(struct audio_ringbuffer *);
int audio_initbufs(struct audio_softc *);
void audio_calcwater(struct audio_softc *);
static __inline int audio_sleep_timo(int *, char *, int);
static __inline int audio_sleep(int *, char *);
static __inline void audio_wakeup(int *);
int audio_drain(struct audio_softc *);
void audio_clear(struct audio_softc *);
static __inline void audio_pint_silence
__P((struct audio_softc *, struct audio_ringbuffer *, u_char *, int));
(struct audio_softc *, struct audio_ringbuffer *, u_char *, int);
int audio_alloc_ring
__P((struct audio_softc *, struct audio_ringbuffer *, int, size_t));
void audio_free_ring __P((struct audio_softc *, struct audio_ringbuffer *));
(struct audio_softc *, struct audio_ringbuffer *, int, size_t);
void audio_free_ring(struct audio_softc *, struct audio_ringbuffer *);
int audioprobe __P((struct device *, struct cfdata *, void *));
void audioattach __P((struct device *, struct device *, void *));
int audiodetach __P((struct device *, int));
int audioactivate __P((struct device *, enum devact));
int audioprobe(struct device *, struct cfdata *, void *);
void audioattach(struct device *, struct device *, void *);
int audiodetach(struct device *, int);
int audioactivate(struct device *, enum devact);
struct portname {
char *name;
@ -162,21 +162,21 @@ static struct portname otable[] = {
{ AudioNline, AUDIO_LINE_OUT },
{ 0 }
};
void au_check_ports __P((struct audio_softc *, struct au_mixer_ports *,
void au_check_ports(struct audio_softc *, struct au_mixer_ports *,
mixer_devinfo_t *, int, char *, char *,
struct portname *));
int au_set_gain __P((struct audio_softc *, struct au_mixer_ports *,
int, int));
void au_get_gain __P((struct audio_softc *, struct au_mixer_ports *,
u_int *, u_char *));
int au_set_port __P((struct audio_softc *, struct au_mixer_ports *,
u_int));
int au_get_port __P((struct audio_softc *, struct au_mixer_ports *));
int au_get_lr_value __P((struct audio_softc *, mixer_ctrl_t *,
int *, int *r));
int au_set_lr_value __P((struct audio_softc *, mixer_ctrl_t *,
int, int));
int au_portof __P((struct audio_softc *, char *));
struct portname *);
int au_set_gain(struct audio_softc *, struct au_mixer_ports *,
int, int);
void au_get_gain(struct audio_softc *, struct au_mixer_ports *,
u_int *, u_char *);
int au_set_port(struct audio_softc *, struct au_mixer_ports *,
u_int);
int au_get_port(struct audio_softc *, struct au_mixer_ports *);
int au_get_lr_value(struct audio_softc *, mixer_ctrl_t *,
int *, int *r);
int au_set_lr_value(struct audio_softc *, mixer_ctrl_t *,
int, int);
int au_portof(struct audio_softc *, char *);
/* The default audio mode: 8 kHz mono ulaw */
@ -191,10 +191,7 @@ struct cfattach audio_ca = {
extern struct cfdriver audio_cd;
int
audioprobe(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
audioprobe(struct device *parent, struct cfdata *match, void *aux)
{
struct audio_attach_args *sa = aux;
@ -204,9 +201,7 @@ audioprobe(parent, match, aux)
}
void
audioattach(parent, self, aux)
struct device *parent, *self;
void *aux;
audioattach(struct device *parent, struct device *self, void *aux)
{
struct audio_softc *sc = (void *)self;
struct audio_attach_args *sa = aux;
@ -330,9 +325,7 @@ audioattach(parent, self, aux)
}
int
audioactivate(self, act)
struct device *self;
enum devact act;
audioactivate(struct device *self, enum devact act)
{
struct audio_softc *sc = (struct audio_softc *)self;
@ -349,9 +342,7 @@ audioactivate(self, act)
}
int
audiodetach(self, flags)
struct device *self;
int flags;
audiodetach(struct device *self, int flags)
{
struct audio_softc *sc = (struct audio_softc *)self;
int maj, mn;
@ -391,9 +382,7 @@ audiodetach(self, flags)
}
int
au_portof(sc, name)
struct audio_softc *sc;
char *name;
au_portof(struct audio_softc *sc, char *name)
{
mixer_devinfo_t mi;
@ -406,14 +395,9 @@ au_portof(sc, name)
}
void
au_check_ports(sc, ports, mi, cls, name, mname, tbl)
struct audio_softc *sc;
struct au_mixer_ports *ports;
mixer_devinfo_t *mi;
int cls;
char *name;
char *mname;
struct portname *tbl;
au_check_ports(struct audio_softc *sc, struct au_mixer_ports *ports,
mixer_devinfo_t *mi, int cls, char *name, char *mname,
struct portname *tbl)
{
int i, j;
@ -462,10 +446,7 @@ au_check_ports(sc, ports, mi, cls, name, mname, tbl)
* probed/attached to the hardware driver.
*/
struct device *
audio_attach_mi(ahwp, hdlp, dev)
struct audio_hw_if *ahwp;
void *hdlp;
struct device *dev;
audio_attach_mi(struct audio_hw_if *ahwp, void *hdlp, struct device *dev)
{
struct audio_attach_args arg;
@ -482,12 +463,11 @@ audio_attach_mi(ahwp, hdlp, dev)
}
#ifdef AUDIO_DEBUG
void audio_printsc __P((struct audio_softc *));
void audio_print_params __P((char *, struct audio_params *));
void audio_printsc(struct audio_softc *);
void audio_print_params(char *, struct audio_params *);
void
audio_printsc(sc)
struct audio_softc *sc;
audio_printsc(struct audio_softc *sc)
{
printf("hwhandle %p hw_if %p ", sc->hw_hdl, sc->hw_if);
printf("open 0x%x mode 0x%x\n", sc->sc_open, sc->sc_mode);
@ -500,9 +480,7 @@ audio_printsc(sc)
}
void
audio_print_params(s, p)
char *s;
struct audio_params *p;
audio_print_params(char *s, struct audio_params *p)
{
printf("audio: %s sr=%ld, enc=%d, chan=%d, prec=%d\n", s,
p->sample_rate, p->encoding, p->channels, p->precision);
@ -510,11 +488,8 @@ audio_print_params(s, p)
#endif
int
audio_alloc_ring(sc, r, direction, bufsize)
struct audio_softc *sc;
struct audio_ringbuffer *r;
int direction;
size_t bufsize;
audio_alloc_ring(struct audio_softc *sc, struct audio_ringbuffer *r,
int direction, size_t bufsize)
{
struct audio_hw_if *hw = sc->hw_if;
void *hdl = sc->hw_hdl;
@ -537,9 +512,7 @@ audio_alloc_ring(sc, r, direction, bufsize)
}
void
audio_free_ring(sc, r)
struct audio_softc *sc;
struct audio_ringbuffer *r;
audio_free_ring(struct audio_softc *sc, struct audio_ringbuffer *r)
{
if (sc->hw_if->freem)
@ -550,10 +523,7 @@ audio_free_ring(sc, r)
}
int
audioopen(dev, flags, ifmt, p)
dev_t dev;
int flags, ifmt;
struct proc *p;
audioopen(dev_t dev, int flags, int ifmt, struct proc *p)
{
struct audio_softc *sc;
int error;
@ -587,10 +557,7 @@ audioopen(dev, flags, ifmt, p)
}
int
audioclose(dev, flags, ifmt, p)
dev_t dev;
int flags, ifmt;
struct proc *p;
audioclose(dev_t dev, int flags, int ifmt, struct proc *p)
{
int unit = AUDIOUNIT(dev);
struct audio_softc *sc = audio_cd.cd_devs[unit];
@ -615,10 +582,7 @@ audioclose(dev, flags, ifmt, p)
}
int
audioread(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
int ioflag;
audioread(dev_t dev, struct uio *uio, int ioflag)
{
struct audio_softc *sc;
int error;
@ -650,10 +614,7 @@ audioread(dev, uio, ioflag)
}
int
audiowrite(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
int ioflag;
audiowrite(dev_t dev, struct uio *uio, int ioflag)
{
struct audio_softc *sc;
int error;
@ -685,12 +646,7 @@ audiowrite(dev, uio, ioflag)
}
int
audioioctl(dev, cmd, addr, flag, p)
dev_t dev;
u_long cmd;
caddr_t addr;
int flag;
struct proc *p;
audioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
{
int unit = AUDIOUNIT(dev);
struct audio_softc *sc = audio_cd.cd_devs[unit];
@ -719,10 +675,7 @@ audioioctl(dev, cmd, addr, flag, p)
}
int
audiopoll(dev, events, p)
dev_t dev;
int events;
struct proc *p;
audiopoll(dev_t dev, int events, struct proc *p)
{
int unit = AUDIOUNIT(dev);
struct audio_softc *sc = audio_cd.cd_devs[unit];
@ -751,10 +704,7 @@ audiopoll(dev, events, p)
}
paddr_t
audiommap(dev, off, prot)
dev_t dev;
off_t off;
int prot;
audiommap(dev_t dev, off_t off, int prot)
{
int unit = AUDIOUNIT(dev);
struct audio_softc *sc = audio_cd.cd_devs[unit];
@ -786,8 +736,7 @@ audiommap(dev, off, prot)
* Audio driver
*/
void
audio_init_ringbuffer(rp)
struct audio_ringbuffer *rp;
audio_init_ringbuffer(struct audio_ringbuffer *rp)
{
int nblks;
int blksize = rp->blksize;
@ -815,8 +764,7 @@ audio_init_ringbuffer(rp)
}
int
audio_initbufs(sc)
struct audio_softc *sc;
audio_initbufs(struct audio_softc *sc)
{
struct audio_hw_if *hw = sc->hw_if;
int error;
@ -864,8 +812,7 @@ audio_initbufs(sc)
}
void
audio_calcwater(sc)
struct audio_softc *sc;
audio_calcwater(struct audio_softc *sc)
{
sc->sc_pr.usedhigh = sc->sc_pr.end - sc->sc_pr.start;
sc->sc_pr.usedlow = sc->sc_pr.usedhigh * 3 / 4; /* set low at 75% */
@ -877,10 +824,7 @@ audio_calcwater(sc)
}
static __inline int
audio_sleep_timo(chan, label, timo)
int *chan;
char *label;
int timo;
audio_sleep_timo(int *chan, char *label, int timo)
{
int st;
@ -900,17 +844,14 @@ audio_sleep_timo(chan, label, timo)
}
static __inline int
audio_sleep(chan, label)
int *chan;
char *label;
audio_sleep(int *chan, char *label)
{
return audio_sleep_timo(chan, label, 0);
}
/* call at splaudio() */
static __inline void
audio_wakeup(chan)
int *chan;
audio_wakeup(int *chan)
{
DPRINTFN(3, ("audio_wakeup: chan=%p, *chan=%d\n", chan, *chan));
if (*chan) {
@ -920,11 +861,8 @@ audio_wakeup(chan)
}
int
audio_open(dev, sc, flags, ifmt, p)
dev_t dev;
struct audio_softc *sc;
int flags, ifmt;
struct proc *p;
audio_open(dev_t dev, struct audio_softc *sc, int flags, int ifmt,
struct proc *p)
{
int error;
int mode;
@ -1025,8 +963,7 @@ bad:
* Must be called from task context.
*/
void
audio_init_record(sc)
struct audio_softc *sc;
audio_init_record(struct audio_softc *sc)
{
int s = splaudio();
@ -1040,8 +977,7 @@ audio_init_record(sc)
* Must be called from task context.
*/
void
audio_init_play(sc)
struct audio_softc *sc;
audio_init_play(struct audio_softc *sc)
{
int s = splaudio();
@ -1052,8 +988,7 @@ audio_init_play(sc)
}
int
audio_drain(sc)
struct audio_softc *sc;
audio_drain(struct audio_softc *sc)
{
int error, drops;
struct audio_ringbuffer *cb = &sc->sc_pr;
@ -1119,10 +1054,7 @@ audio_drain(sc)
*/
/* ARGSUSED */
int
audio_close(sc, flags, ifmt, p)
struct audio_softc *sc;
int flags, ifmt;
struct proc *p;
audio_close(struct audio_softc *sc, int flags, int ifmt, struct proc *p)
{
struct audio_hw_if *hw = sc->hw_if;
int s;
@ -1177,10 +1109,7 @@ audio_close(sc, flags, ifmt, p)
}
int
audio_read(sc, uio, ioflag)
struct audio_softc *sc;
struct uio *uio;
int ioflag;
audio_read(struct audio_softc *sc, struct uio *uio, int ioflag)
{
struct audio_ringbuffer *cb = &sc->sc_rr;
u_char *outp;
@ -1297,8 +1226,7 @@ audio_read(sc, uio, ioflag)
}
void
audio_clear(sc)
struct audio_softc *sc;
audio_clear(struct audio_softc *sc)
{
int s = splaudio();
@ -1316,9 +1244,7 @@ audio_clear(sc)
}
void
audio_calc_blksize(sc, mode)
struct audio_softc *sc;
int mode;
audio_calc_blksize(struct audio_softc *sc, int mode)
{
struct audio_hw_if *hw = sc->hw_if;
struct audio_params *parm;
@ -1355,10 +1281,7 @@ audio_calc_blksize(sc, mode)
}
void
audio_fill_silence(params, p, n)
struct audio_params *params;
u_char *p;
int n;
audio_fill_silence(struct audio_params *params, u_char *p, int n)
{
u_char auzero0, auzero1 = 0; /* initialize to please gcc */
int nfill = 1;
@ -1419,10 +1342,7 @@ audio_fill_silence(params, p, n)
}
int
audio_silence_copyout(sc, n, uio)
struct audio_softc *sc;
int n;
struct uio *uio;
audio_silence_copyout(struct audio_softc *sc, int n, struct uio *uio)
{
int error;
int k;
@ -1440,10 +1360,7 @@ audio_silence_copyout(sc, n, uio)
}
int
audio_write(sc, uio, ioflag)
struct audio_softc *sc;
struct uio *uio;
int ioflag;
audio_write(struct audio_softc *sc, struct uio *uio, int ioflag)
{
struct audio_ringbuffer *cb = &sc->sc_pr;
u_char *inp, *einp;
@ -1602,12 +1519,8 @@ audio_write(sc, uio, ioflag)
}
int
audio_ioctl(sc, cmd, addr, flag, p)
struct audio_softc *sc;
u_long cmd;
caddr_t addr;
int flag;
struct proc *p;
audio_ioctl(struct audio_softc *sc, u_long cmd, caddr_t addr, int flag,
struct proc *p)
{
struct audio_hw_if *hw = sc->hw_if;
struct audio_offset *ao;
@ -1767,10 +1680,7 @@ audio_ioctl(sc, cmd, addr, flag, p)
}
int
audio_poll(sc, events, p)
struct audio_softc *sc;
int events;
struct proc *p;
audio_poll(struct audio_softc *sc, int events, struct proc *p)
{
int revents = 0;
int s = splaudio();
@ -1801,10 +1711,7 @@ audio_poll(sc, events, p)
}
paddr_t
audio_mmap(sc, off, prot)
struct audio_softc *sc;
off_t off;
int prot;
audio_mmap(struct audio_softc *sc, off_t off, int prot)
{
struct audio_hw_if *hw = sc->hw_if;
struct audio_ringbuffer *cb;
@ -1861,8 +1768,7 @@ audio_mmap(sc, off, prot)
}
int
audiostartr(sc)
struct audio_softc *sc;
audiostartr(struct audio_softc *sc)
{
int error;
@ -1886,8 +1792,7 @@ audiostartr(sc)
}
int
audiostartp(sc)
struct audio_softc *sc;
audiostartp(struct audio_softc *sc)
{
int error;
@ -1928,11 +1833,8 @@ audiostartp(sc)
* at splaudio, but there is no softaudio level to do it at yet.
*/
static __inline void
audio_pint_silence(sc, cb, inp, cc)
struct audio_softc *sc;
struct audio_ringbuffer *cb;
u_char *inp;
int cc;
audio_pint_silence(struct audio_softc *sc, struct audio_ringbuffer *cb,
u_char *inp, int cc)
{
u_char *s, *e, *p, *q;
@ -1974,8 +1876,7 @@ audio_pint_silence(sc, cb, inp, cc)
* Do a wakeup if necessary.
*/
void
audio_pint(v)
void *v;
audio_pint(void *v)
{
struct audio_softc *sc = v;
struct audio_hw_if *hw = sc->hw_if;
@ -2104,8 +2005,7 @@ audio_pint(v)
* Do a wakeup if necessary.
*/
void
audio_rint(v)
void *v;
audio_rint(void *v)
{
struct audio_softc *sc = v;
struct audio_hw_if *hw = sc->hw_if;
@ -2195,8 +2095,7 @@ audio_rint(v)
}
int
audio_check_params(p)
struct audio_params *p;
audio_check_params(struct audio_params *p)
{
if (p->encoding == AUDIO_ENCODING_PCM16) {
if (p->precision == 8)
@ -2260,10 +2159,7 @@ audio_check_params(p)
}
int
au_set_lr_value(sc, ct, l, r)
struct audio_softc *sc;
mixer_ctrl_t *ct;
int l, r;
au_set_lr_value(struct audio_softc *sc, mixer_ctrl_t *ct, int l, int r)
{
ct->type = AUDIO_MIXER_VALUE;
ct->un.value.num_channels = 2;
@ -2277,11 +2173,8 @@ au_set_lr_value(sc, ct, l, r)
}
int
au_set_gain(sc, ports, gain, balance)
struct audio_softc *sc;
struct au_mixer_ports *ports;
int gain;
int balance;
au_set_gain(struct audio_softc *sc, struct au_mixer_ports *ports,
int gain, int balance)
{
mixer_ctrl_t ct;
int i, error;
@ -2350,10 +2243,7 @@ au_set_gain(sc, ports, gain, balance)
}
int
au_get_lr_value(sc, ct, l, r)
struct audio_softc *sc;
mixer_ctrl_t *ct;
int *l, *r;
au_get_lr_value(struct audio_softc *sc, mixer_ctrl_t *ct, int *l, int *r)
{
int error;
@ -2372,11 +2262,8 @@ au_get_lr_value(sc, ct, l, r)
}
void
au_get_gain(sc, ports, pgain, pbalance)
struct audio_softc *sc;
struct au_mixer_ports *ports;
u_int *pgain;
u_char *pbalance;
au_get_gain(struct audio_softc *sc, struct au_mixer_ports *ports,
u_int *pgain, u_char *pbalance)
{
mixer_ctrl_t ct;
int i, l, r, n;
@ -2448,10 +2335,7 @@ bad:
}
int
au_set_port(sc, ports, port)
struct audio_softc *sc;
struct au_mixer_ports *ports;
u_int port;
au_set_port(struct audio_softc *sc, struct au_mixer_ports *ports, u_int port)
{
mixer_ctrl_t ct;
int i, error;
@ -2490,9 +2374,7 @@ au_set_port(sc, ports, port)
}
int
au_get_port(sc, ports)
struct audio_softc *sc;
struct au_mixer_ports *ports;
au_get_port(struct audio_softc *sc, struct au_mixer_ports *ports)
{
mixer_ctrl_t ct;
int i, aumask;
@ -2517,9 +2399,7 @@ au_get_port(sc, ports)
}
int
audiosetinfo(sc, ai)
struct audio_softc *sc;
struct audio_info *ai;
audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
{
struct audio_prinfo *r = &ai->record, *p = &ai->play;
int cleared;
@ -2824,9 +2704,7 @@ audiosetinfo(sc, ai)
}
int
audiogetinfo(sc, ai)
struct audio_softc *sc;
struct audio_info *ai;
audiogetinfo(struct audio_softc *sc, struct audio_info *ai)
{
struct audio_prinfo *r = &ai->record, *p = &ai->play;
struct audio_hw_if *hw = sc->hw_if;
@ -2904,11 +2782,8 @@ audiogetinfo(sc, ai)
* Mixer driver
*/
int
mixer_open(dev, sc, flags, ifmt, p)
dev_t dev;
struct audio_softc *sc;
int flags, ifmt;
struct proc *p;
mixer_open(dev_t dev, struct audio_softc *sc, int flags, int ifmt,
struct proc *p)
{
if (!sc->hw_if)
return (ENXIO);
@ -2922,9 +2797,7 @@ mixer_open(dev, sc, flags, ifmt, p)
* Remove a process from those to be signalled on mixer activity.
*/
static void
mixer_remove(sc, p)
struct audio_softc *sc;
struct proc *p;
mixer_remove(struct audio_softc *sc, struct proc *p)
{
struct mixer_asyncs **pm, *m;
@ -2939,11 +2812,10 @@ mixer_remove(sc, p)
}
/*
* Signal all processes waitinf for the mixer.
* Signal all processes waiting for the mixer.
*/
static void
mixer_signal(sc)
struct audio_softc *sc;
mixer_signal(struct audio_softc *sc)
{
struct mixer_asyncs *m;
@ -2956,10 +2828,7 @@ mixer_signal(sc)
*/
/* ARGSUSED */
int
mixer_close(sc, flags, ifmt, p)
struct audio_softc *sc;
int flags, ifmt;
struct proc *p;
mixer_close(struct audio_softc *sc, int flags, int ifmt, struct proc *p)
{
DPRINTF(("mixer_close: sc %p\n", sc));
@ -2969,12 +2838,8 @@ mixer_close(sc, flags, ifmt, p)
}
int
mixer_ioctl(sc, cmd, addr, flag, p)
struct audio_softc *sc;
u_long cmd;
caddr_t addr;
int flag;
struct proc *p;
mixer_ioctl(struct audio_softc *sc, u_long cmd, caddr_t addr, int flag,
struct proc *p)
{
struct audio_hw_if *hw = sc->hw_if;
int error = EINVAL;
@ -3043,9 +2908,7 @@ mixer_ioctl(sc, cmd, addr, flag, p)
#if NAUDIO > 0 || (NMIDI > 0 || NMIDIBUS > 0)
int
audioprint(aux, pnp)
void *aux;
const char *pnp;
audioprint(void *aux, const char *pnp)
{
struct audio_attach_args *arg = aux;
const char *type;

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio_if.h,v 1.35 2000/06/26 04:56:17 simonb Exp $ */
/* $NetBSD: audio_if.h,v 1.36 2001/10/02 23:31:55 augustss Exp $ */
/*
* Copyright (c) 1994 Havard Eidnes.
@ -49,7 +49,7 @@ struct audio_params {
u_int precision; /* bits/sample */
u_int channels; /* mono(1), stereo(2) */
/* Software en/decode functions, set if SW coding required by HW */
void (*sw_code)__P((void *, u_char *, int));
void (*sw_code)(void *, u_char *, int);
int factor; /* coding space change */
};
@ -57,13 +57,13 @@ struct audio_params {
extern struct audio_params audio_default;
struct audio_hw_if {
int (*open)__P((void *, int)); /* open hardware */
void (*close)__P((void *)); /* close hardware */
int (*drain)__P((void *)); /* Optional: drain buffers */
int (*open)(void *, int); /* open hardware */
void (*close)(void *); /* close hardware */
int (*drain)(void *); /* Optional: drain buffers */
/* Encoding. */
/* XXX should we have separate in/out? */
int (*query_encoding)__P((void *, struct audio_encoding *));
int (*query_encoding)(void *, struct audio_encoding *);
/* Set the audio encoding parameters (record and play).
* Return 0 on success, or an error code if the
@ -71,11 +71,11 @@ struct audio_hw_if {
* The values in the params struct may be changed (e.g. rounding
* to the nearest sample rate.)
*/
int (*set_params)__P((void *, int, int, struct audio_params *,
struct audio_params *));
int (*set_params)(void *, int, int, struct audio_params *,
struct audio_params *);
/* Hardware may have some say in the blocksize to choose */
int (*round_blocksize)__P((void *, int));
int (*round_blocksize)(void *, int);
/*
* Changing settings may require taking device out of "data mode",
@ -85,43 +85,43 @@ struct audio_hw_if {
* this function which indicates completion of settings
* adjustment.
*/
int (*commit_settings)__P((void *));
int (*commit_settings)(void *);
/* Start input/output routines. These usually control DMA. */
int (*init_output)__P((void *, void *, int));
int (*init_input)__P((void *, void *, int));
int (*start_output)__P((void *, void *, int,
void (*)(void *), void *));
int (*start_input)__P((void *, void *, int,
void (*)(void *), void *));
int (*halt_output)__P((void *));
int (*halt_input)__P((void *));
int (*init_output)(void *, void *, int);
int (*init_input)(void *, void *, int);
int (*start_output)(void *, void *, int,
void (*)(void *), void *);
int (*start_input)(void *, void *, int,
void (*)(void *), void *);
int (*halt_output)(void *);
int (*halt_input)(void *);
int (*speaker_ctl)__P((void *, int));
int (*speaker_ctl)(void *, int);
#define SPKR_ON 1
#define SPKR_OFF 0
int (*getdev)__P((void *, struct audio_device *));
int (*setfd)__P((void *, int));
int (*getdev)(void *, struct audio_device *);
int (*setfd)(void *, int);
/* Mixer (in/out ports) */
int (*set_port)__P((void *, mixer_ctrl_t *));
int (*get_port)__P((void *, mixer_ctrl_t *));
int (*set_port)(void *, mixer_ctrl_t *);
int (*get_port)(void *, mixer_ctrl_t *);
int (*query_devinfo)__P((void *, mixer_devinfo_t *));
int (*query_devinfo)(void *, mixer_devinfo_t *);
/* Allocate/free memory for the ring buffer. Usually malloc/free. */
void *(*allocm)__P((void *, int, size_t, int, int));
void (*freem)__P((void *, void *, int));
size_t (*round_buffersize)__P((void *, int, size_t));
paddr_t (*mappage)__P((void *, void *, off_t, int));
void *(*allocm)(void *, int, size_t, int, int);
void (*freem)(void *, void *, int);
size_t (*round_buffersize)(void *, int, size_t);
paddr_t (*mappage)(void *, void *, off_t, int);
int (*get_props)__P((void *)); /* device properties */
int (*get_props)(void *); /* device properties */
int (*trigger_output)__P((void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *));
int (*trigger_input)__P((void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *));
int (*trigger_output)(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
int (*trigger_input)(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
};
struct audio_attach_args {
@ -135,9 +135,8 @@ struct audio_attach_args {
#define AUDIODEV_TYPE_MPU 3
/* Attach the MI driver(s) to the MD driver. */
struct device *audio_attach_mi __P((struct audio_hw_if *, void *,
struct device *));
int audioprint __P((void *, const char *));
struct device *audio_attach_mi(struct audio_hw_if *, void *, struct device *);
int audioprint(void *, const char *);
/* Device identity flags */
#define SOUND_DEVICE 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: mulaw.c,v 1.15 2001/01/18 20:28:20 jdolecek Exp $ */
/* $NetBSD: mulaw.c,v 1.16 2001/10/02 23:31:55 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -248,10 +248,7 @@ static const u_char lintoalaw[256] = {
};
void
mulaw_to_ulinear8(v, p, cc)
void *v;
u_char *p;
int cc;
mulaw_to_ulinear8(void *v, u_char *p, int cc)
{
/* Use the 16 bit table for 8 bits too. */
while (--cc >= 0) {
@ -261,10 +258,7 @@ mulaw_to_ulinear8(v, p, cc)
}
void
mulaw_to_slinear8(v, p, cc)
void *v;
u_char *p;
int cc;
mulaw_to_slinear8(void *v, u_char *p, int cc)
{
/* Use the 16 bit table for 8 bits too. */
while (--cc >= 0) {
@ -274,10 +268,7 @@ mulaw_to_slinear8(v, p, cc)
}
void
mulaw_to_ulinear16_le(v, p, cc)
void *v;
u_char *p;
int cc;
mulaw_to_ulinear16_le(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -292,10 +283,7 @@ mulaw_to_ulinear16_le(v, p, cc)
}
void
mulaw_to_ulinear16_be(v, p, cc)
void *v;
u_char *p;
int cc;
mulaw_to_ulinear16_be(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -310,10 +298,7 @@ mulaw_to_ulinear16_be(v, p, cc)
}
void
mulaw_to_slinear16_le(v, p, cc)
void *v;
u_char *p;
int cc;
mulaw_to_slinear16_le(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -328,10 +313,7 @@ mulaw_to_slinear16_le(v, p, cc)
}
void
mulaw_to_slinear16_be(v, p, cc)
void *v;
u_char *p;
int cc;
mulaw_to_slinear16_be(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -346,10 +328,7 @@ mulaw_to_slinear16_be(v, p, cc)
}
void
ulinear8_to_mulaw(v, p, cc)
void *v;
u_char *p;
int cc;
ulinear8_to_mulaw(void *v, u_char *p, int cc)
{
while (--cc >= 0) {
*p = lintomulaw[*p];
@ -358,10 +337,7 @@ ulinear8_to_mulaw(v, p, cc)
}
void
slinear8_to_mulaw(v, p, cc)
void *v;
u_char *p;
int cc;
slinear8_to_mulaw(void *v, u_char *p, int cc)
{
while (--cc >= 0) {
*p = lintomulaw[*p ^ 0x80];
@ -370,10 +346,7 @@ slinear8_to_mulaw(v, p, cc)
}
void
alaw_to_ulinear8(v, p, cc)
void *v;
u_char *p;
int cc;
alaw_to_ulinear8(void *v, u_char *p, int cc)
{
/* Use the 16 bit table for 8 bits too. */
while (--cc >= 0) {
@ -383,10 +356,7 @@ alaw_to_ulinear8(v, p, cc)
}
void
alaw_to_slinear8(v, p, cc)
void *v;
u_char *p;
int cc;
alaw_to_slinear8(void *v, u_char *p, int cc)
{
/* Use the 16 bit table for 8 bits too. */
while (--cc >= 0) {
@ -396,10 +366,7 @@ alaw_to_slinear8(v, p, cc)
}
void
alaw_to_ulinear16_le(v, p, cc)
void *v;
u_char *p;
int cc;
alaw_to_ulinear16_le(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -414,10 +381,7 @@ alaw_to_ulinear16_le(v, p, cc)
}
void
alaw_to_ulinear16_be(v, p, cc)
void *v;
u_char *p;
int cc;
alaw_to_ulinear16_be(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -432,10 +396,7 @@ alaw_to_ulinear16_be(v, p, cc)
}
void
alaw_to_slinear16_le(v, p, cc)
void *v;
u_char *p;
int cc;
alaw_to_slinear16_le(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -450,10 +411,7 @@ alaw_to_slinear16_le(v, p, cc)
}
void
alaw_to_slinear16_be(v, p, cc)
void *v;
u_char *p;
int cc;
alaw_to_slinear16_be(void *v, u_char *p, int cc)
{
u_char *q = p;
@ -468,10 +426,7 @@ alaw_to_slinear16_be(v, p, cc)
}
void
ulinear8_to_alaw(v, p, cc)
void *v;
u_char *p;
int cc;
ulinear8_to_alaw(void *v, u_char *p, int cc)
{
while (--cc >= 0) {
*p = lintoalaw[*p];
@ -480,10 +435,7 @@ ulinear8_to_alaw(v, p, cc)
}
void
slinear8_to_alaw(v, p, cc)
void *v;
u_char *p;
int cc;
slinear8_to_alaw(void *v, u_char *p, int cc)
{
while (--cc >= 0) {
*p = lintoalaw[*p ^ 0x80];

View File

@ -1,4 +1,4 @@
/* $NetBSD: mulaw.h,v 1.11 1999/11/01 18:12:19 augustss Exp $ */
/* $NetBSD: mulaw.h,v 1.12 2001/10/02 23:31:55 augustss Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -37,26 +37,26 @@
*/
/* Convert 8-bit mu-law to 16 bit unsigned linear. */
extern void mulaw_to_ulinear16_le __P((void *, u_char *buf, int cnt));
extern void mulaw_to_ulinear16_be __P((void *, u_char *buf, int cnt));
extern void mulaw_to_ulinear16_le(void *, u_char *buf, int cnt);
extern void mulaw_to_ulinear16_be(void *, u_char *buf, int cnt);
/* Convert 8-bit mu-law to 16 bit signed linear. */
extern void mulaw_to_slinear16_le __P((void *, u_char *buf, int cnt));
extern void mulaw_to_slinear16_be __P((void *, u_char *buf, int cnt));
extern void mulaw_to_slinear16_le(void *, u_char *buf, int cnt);
extern void mulaw_to_slinear16_be(void *, u_char *buf, int cnt);
/* Convert 8-bit mu-law to/from 8 bit unsigned linear. */
extern void mulaw_to_ulinear8 __P((void *, u_char *buf, int cnt));
extern void ulinear8_to_mulaw __P((void *, u_char *buf, int cnt));
extern void mulaw_to_ulinear8(void *, u_char *buf, int cnt);
extern void ulinear8_to_mulaw(void *, u_char *buf, int cnt);
/* Convert 8-bit mu-law to/from 8 bit signed linear. */
extern void mulaw_to_slinear8 __P((void *, u_char *buf, int cnt));
extern void slinear8_to_mulaw __P((void *, u_char *buf, int cnt));
extern void mulaw_to_slinear8(void *, u_char *buf, int cnt);
extern void slinear8_to_mulaw(void *, u_char *buf, int cnt);
/* Convert 8-bit a-law to 16 bit unsigned linear. */
extern void alaw_to_ulinear16_le __P((void *, u_char *buf, int cnt));
extern void alaw_to_ulinear16_be __P((void *, u_char *buf, int cnt));
extern void alaw_to_ulinear16_le(void *, u_char *buf, int cnt);
extern void alaw_to_ulinear16_be(void *, u_char *buf, int cnt);
/* Convert 8-bit a-law to 16 bit signed linear. */
extern void alaw_to_slinear16_le __P((void *, u_char *buf, int cnt));
extern void alaw_to_slinear16_be __P((void *, u_char *buf, int cnt));
extern void alaw_to_slinear16_le(void *, u_char *buf, int cnt);
extern void alaw_to_slinear16_be(void *, u_char *buf, int cnt);
/* Convert 8-bit a-law to/from 8 bit unsigned linear. */
extern void alaw_to_ulinear8 __P((void *, u_char *buf, int cnt));
extern void ulinear8_to_alaw __P((void *, u_char *buf, int cnt));
extern void alaw_to_ulinear8(void *, u_char *buf, int cnt);
extern void ulinear8_to_alaw(void *, u_char *buf, int cnt);
/* Convert 8-bit a-law to/from 8 bit signed linear. */
extern void alaw_to_slinear8 __P((void *, u_char *buf, int cnt));
extern void slinear8_to_alaw __P((void *, u_char *buf, int cnt));
extern void alaw_to_slinear8(void *, u_char *buf, int cnt);
extern void slinear8_to_alaw(void *, u_char *buf, int cnt);