Changes to the sudio system:

- It is now possible to handle devices that want "looping" DMA,
    e.g. the SoundBlaster correctly.  The WSS and SB drivers use this.
    To do this several new methods were introduced in audio_hw_if.
  - Different silence handling (forced by previous change).
  - The audio driver can now be mmap()-ed, but due to problems in
    the VM system only for writing for now.
  - The OSS (Linux) audio emulation takes advantage of some of the
    new features.
This commit is contained in:
augustss 1997-07-27 01:16:32 +00:00
parent 3ca46d33e1
commit 9745684ebe
41 changed files with 1536 additions and 830 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lmcaudio.c,v 1.8 1997/07/15 07:46:07 augustss Exp $ */
/* $NetBSD: lmcaudio.c,v 1.9 1997/07/27 01:16:32 augustss Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
@ -613,6 +613,8 @@ struct audio_hw_if lmcaudio_hw_if = {
lmcaudio_set_in_port,
lmcaudio_get_in_port,
lmcaudio_commit_settings,
NULL,
NULL,
lmcaudio_start_output,
lmcaudio_start_input,
lmcaudio_halt_output,
@ -625,7 +627,10 @@ struct audio_hw_if lmcaudio_hw_if = {
lmcaudio_set_port,
lmcaudio_get_port,
lmcaudio_query_devinfo,
0, /* not full duplex */
0,
0,
0,
0,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcaudio.c,v 1.13 1997/05/09 22:16:28 augustss Exp $ */
/* $NetBSD: vidcaudio.c,v 1.14 1997/07/27 01:16:34 augustss Exp $ */
/*
* Copyright (c) 1995 Melvin Tang-Richardson
@ -519,6 +519,8 @@ struct audio_hw_if vidcaudio_hw_if = {
vidcaudio_set_in_port,
vidcaudio_get_in_port,
vidcaudio_commit_settings,
NULL,
NULL,
vidcaudio_start_output,
vidcaudio_start_input,
vidcaudio_halt_output,
@ -531,7 +533,10 @@ struct audio_hw_if vidcaudio_hw_if = {
vidcaudio_set_port,
vidcaudio_get_port,
vidcaudio_query_devinfo,
0, /* not full duplex */
0,
0,
0,
0,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: lmcaudio.c,v 1.8 1997/07/15 07:46:07 augustss Exp $ */
/* $NetBSD: lmcaudio.c,v 1.9 1997/07/27 01:16:32 augustss Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
@ -613,6 +613,8 @@ struct audio_hw_if lmcaudio_hw_if = {
lmcaudio_set_in_port,
lmcaudio_get_in_port,
lmcaudio_commit_settings,
NULL,
NULL,
lmcaudio_start_output,
lmcaudio_start_input,
lmcaudio_halt_output,
@ -625,7 +627,10 @@ struct audio_hw_if lmcaudio_hw_if = {
lmcaudio_set_port,
lmcaudio_get_port,
lmcaudio_query_devinfo,
0, /* not full duplex */
0,
0,
0,
0,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcaudio.c,v 1.13 1997/05/09 22:16:28 augustss Exp $ */
/* $NetBSD: vidcaudio.c,v 1.14 1997/07/27 01:16:34 augustss Exp $ */
/*
* Copyright (c) 1995 Melvin Tang-Richardson
@ -519,6 +519,8 @@ struct audio_hw_if vidcaudio_hw_if = {
vidcaudio_set_in_port,
vidcaudio_get_in_port,
vidcaudio_commit_settings,
NULL,
NULL,
vidcaudio_start_output,
vidcaudio_start_input,
vidcaudio_halt_output,
@ -531,7 +533,10 @@ struct audio_hw_if vidcaudio_hw_if = {
vidcaudio_set_port,
vidcaudio_get_port,
vidcaudio_query_devinfo,
0, /* not full duplex */
0,
0,
0,
0,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: am7930_sparc.c,v 1.22 1997/05/24 20:15:59 pk Exp $ */
/* $NetBSD: am7930_sparc.c,v 1.23 1997/07/27 01:16:37 augustss Exp $ */
/*
* Copyright (c) 1995 Rolf Grossmann
@ -240,6 +240,8 @@ struct audio_hw_if sa_hw_if = {
amd7930_set_in_port,
amd7930_get_in_port,
amd7930_commit_settings,
NULL,
NULL,
amd7930_start_output,
amd7930_start_input,
amd7930_halt_output,
@ -252,7 +254,10 @@ struct audio_hw_if sa_hw_if = {
amd7930_set_port,
amd7930_get_port,
amd7930_query_devinfo,
1,
0,
0,
0,
AUDIO_PROP_FULLDUPLEX,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: amd7930.c,v 1.22 1997/05/24 20:15:59 pk Exp $ */
/* $NetBSD: amd7930.c,v 1.23 1997/07/27 01:16:37 augustss Exp $ */
/*
* Copyright (c) 1995 Rolf Grossmann
@ -240,6 +240,8 @@ struct audio_hw_if sa_hw_if = {
amd7930_set_in_port,
amd7930_get_in_port,
amd7930_commit_settings,
NULL,
NULL,
amd7930_start_output,
amd7930_start_input,
amd7930_halt_output,
@ -252,7 +254,10 @@ struct audio_hw_if sa_hw_if = {
amd7930_set_port,
amd7930_get_port,
amd7930_query_devinfo,
1,
0,
0,
0,
AUDIO_PROP_FULLDUPLEX,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_break.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_break.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_misc.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc_notalpha.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_misc_notalpha.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldmmap.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_oldmmap.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldolduname.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_oldolduname.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldselect.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_oldselect.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_olduname.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_olduname.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_pipe.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_pipe.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_misc.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_break.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_break.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc_notalpha.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_misc_notalpha.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldmmap.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_oldmmap.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldolduname.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_oldolduname.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldselect.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_oldselect.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_olduname.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_olduname.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_pipe.c,v 1.30 1997/04/07 14:13:16 augustss Exp $ */
/* $NetBSD: linux_pipe.c,v 1.31 1997/07/27 01:16:39 augustss Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -502,6 +502,8 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma,addr) = lmap.lm_addr;
SCARG(&cma,len) = lmap.lm_len;
if (lmap.lm_prot & VM_PROT_WRITE) /* XXX */
lmap.lm_prot |= VM_PROT_READ;
SCARG(&cma,prot) = lmap.lm_prot;
SCARG(&cma,flags) = flags;
SCARG(&cma,fd) = lmap.lm_fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ossaudio.c,v 1.12 1997/07/15 07:46:09 augustss Exp $ */
/* $NetBSD: ossaudio.c,v 1.13 1997/07/27 01:16:41 augustss Exp $ */
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/systm.h>
@ -30,7 +30,10 @@ oss_ioctl_audio(p, uap, retval)
register struct filedesc *fdp;
u_long com;
struct audio_info tmpinfo;
int idat;
struct audio_offset tmpoffs;
struct oss_audio_buf_info bufinfo;
struct oss_count_info cntinfo;
int idat, idata;
int error;
int (*ioctlf) __P((struct file *, u_long, caddr_t, struct proc *));
@ -270,19 +273,85 @@ oss_ioctl_audio(p, uap, retval)
return error;
break;
case OSS_SNDCTL_DSP_GETOSPACE:
error = ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
if (error)
return error;
bufinfo.fragsize = tmpinfo.blocksize;
bufinfo.fragments = /* XXX */
bufinfo.fragstotal = tmpinfo.buffersize / bufinfo.fragsize;
bufinfo.bytes = bufinfo.fragments * bufinfo.fragsize;
error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo);
if (error)
return error;
break;
case OSS_SNDCTL_DSP_GETISPACE:
case OSS_SNDCTL_DSP_NONBLOCK:
return EINVAL; /* XXX unimplemented */
case OSS_SNDCTL_DSP_GETCAPS:
idat = 0; /* XXX full duplex info should be set */
error = ioctlf(fp, AUDIO_GETPROPS, (caddr_t)&idata, p);
if (error)
return error;
idat = OSS_DSP_CAP_TRIGGER; /* pretend we have trigger */
if (idata & AUDIO_PROP_FULLDUPLEX)
idat |= OSS_DSP_CAP_DUPLEX;
if (idata & AUDIO_PROP_MMAP)
idat |= OSS_DSP_CAP_MMAP;
error = copyout(&idat, SCARG(uap, data), sizeof idat);
if (error)
return error;
break;
#if 0
case OSS_SNDCTL_DSP_GETTRIGGER:
error = ioctlf(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
if (error)
return error;
idat = (tmpinfo.play.pause ? 0 : OSS_PCM_ENABLE_OUTPUT) |
(tmpinfo.record.pause ? 0 : OSS_PCM_ENABLE_INPUT);
error = copyout(&idat, SCARG(uap, data), sizeof idat);
if (error)
return error;
break;
case OSS_SNDCTL_DSP_SETTRIGGER:
AUDIO_INITINFO(&tmpinfo);
error = copyin(SCARG(uap, data), &idat, sizeof idat);
if (error)
return error;
tmpinfo.play.pause = (idat & OSS_PCM_ENABLE_OUTPUT) == 0;
tmpinfo.record.pause = (idat & OSS_PCM_ENABLE_INPUT) == 0;
(void) ioctlf(fp, AUDIO_SETINFO, (caddr_t)&tmpinfo, p);
error = copyout(&idat, SCARG(uap, data), sizeof idat);
if (error)
return error;
break;
#else
case OSS_SNDCTL_DSP_GETTRIGGER:
case OSS_SNDCTL_DSP_SETTRIGGER:
/* XXX Do nothing for now. */
idat = OSS_PCM_ENABLE_OUTPUT;
return copyout(&idat, SCARG(uap, data), sizeof idat);
#endif
case OSS_SNDCTL_DSP_GETIPTR:
error = ioctlf(fp, AUDIO_GETIOFFS, (caddr_t)&tmpoffs, p);
if (error)
return error;
cntinfo.bytes = tmpoffs.samples;
cntinfo.blocks = tmpoffs.deltablks;
cntinfo.ptr = tmpoffs.offset;
error = copyout(&cntinfo, SCARG(uap, data), sizeof cntinfo);
if (error)
return error;
break;
case OSS_SNDCTL_DSP_GETOPTR:
error = ioctlf(fp, AUDIO_GETOOFFS, (caddr_t)&tmpoffs, p);
if (error)
return error;
cntinfo.bytes = tmpoffs.samples;
cntinfo.blocks = tmpoffs.deltablks;
cntinfo.ptr = tmpoffs.offset;
error = copyout(&cntinfo, SCARG(uap, data), sizeof cntinfo);
if (error)
return error;
break;
case OSS_SNDCTL_DSP_MAPINBUF:
case OSS_SNDCTL_DSP_MAPOUTBUF:
case OSS_SNDCTL_DSP_SETSYNCRO:

View File

@ -1,4 +1,4 @@
/* $NetBSD: ossaudiovar.h,v 1.1 1997/04/04 15:36:02 augustss Exp $ */
/* $NetBSD: ossaudiovar.h,v 1.2 1997/07/27 01:16:42 augustss Exp $ */
struct oss_sys_ioctl_args {
syscallarg(int) fd;
syscallarg(u_long) com;
@ -16,22 +16,22 @@ struct oss_sys_ioctl_args {
#define _OSS_IOW(x,y,t) _OSS_IOCTL(OSS_IOC_IN, x, y, sizeof(t))
#define _OSS_IOWR(x,y,t) _OSS_IOCTL(OSS_IOC_INOUT, x, y, sizeof(t))
#define OSS_SNDCTL_DSP_RESET _OSS_IO('P', 0)
#define OSS_SNDCTL_DSP_SYNC _OSS_IO('P', 1)
#define OSS_SNDCTL_DSP_RESET _OSS_IO ('P', 0)
#define OSS_SNDCTL_DSP_SYNC _OSS_IO ('P', 1)
#define OSS_SNDCTL_DSP_SPEED _OSS_IOWR('P', 2, int)
#define OSS_SOUND_PCM_READ_RATE _OSS_IOR('P', 2, int)
#define OSS_SOUND_PCM_READ_RATE _OSS_IOR ('P', 2, int)
#define OSS_SNDCTL_DSP_STEREO _OSS_IOWR('P', 3, int)
#define OSS_SNDCTL_DSP_GETBLKSIZE _OSS_IOWR('P', 4, int)
#define OSS_SNDCTL_DSP_SETFMT _OSS_IOWR('P', 5, int)
#define OSS_SOUND_PCM_READ_BITS _OSS_IOR('P', 5, int)
#define OSS_SOUND_PCM_READ_BITS _OSS_IOR ('P', 5, int)
#define OSS_SNDCTL_DSP_CHANNELS _OSS_IOWR('P', 6, int)
#define OSS_SOUND_PCM_READ_CHANNELS _OSS_IOR('P', 6, int)
#define OSS_SOUND_PCM_READ_CHANNELS _OSS_IOR ('P', 6, int)
#define OSS_SOUND_PCM_WRITE_FILTER _OSS_IOWR('P', 7, int)
#define OSS_SOUND_PCM_READ_FILTER _OSS_IOR('P', 7, int)
#define OSS_SNDCTL_DSP_POST _OSS_IO('P', 8)
#define OSS_SOUND_PCM_READ_FILTER _OSS_IOR ('P', 7, int)
#define OSS_SNDCTL_DSP_POST _OSS_IO ('P', 8)
#define OSS_SNDCTL_DSP_SUBDIVIDE _OSS_IOWR('P', 9, int)
#define OSS_SNDCTL_DSP_SETFRAGMENT _OSS_IOWR('P', 10, int)
#define OSS_SNDCTL_DSP_GETFMTS _OSS_IOR('P', 11, int)
#define OSS_SNDCTL_DSP_GETFMTS _OSS_IOR ('P', 11, int)
#define OSS_SNDCTL_DSP_GETOSPACE _OSS_IOR ('P',12, struct oss_audio_buf_info)
#define OSS_SNDCTL_DSP_GETISPACE _OSS_IOR ('P',13, struct oss_audio_buf_info)
#define OSS_SNDCTL_DSP_NONBLOCK _OSS_IO ('P',14)
@ -43,10 +43,12 @@ struct oss_sys_ioctl_args {
# define OSS_DSP_CAP_COPROC 0x00000800
# define OSS_DSP_CAP_TRIGGER 0x00001000
# define OSS_DSP_CAP_MMAP 0x00002000
#define OSS_SNDCTL_DSP_GETTRIGGER _OSS_IOR ('P',16, int)
#define OSS_SNDCTL_DSP_SETTRIGGER _OSS_IOW ('P',16, int)
#define OSS_SNDCTL_DSP_GETIPTR _OSS_IOR ('P',17, struct oss_count_info)
#define OSS_SNDCTL_DSP_GETOPTR _OSS_IOR ('P',18, struct oss_count_info)
#define OSS_SNDCTL_DSP_GETTRIGGER _OSS_IOR ('P', 16, int)
#define OSS_SNDCTL_DSP_SETTRIGGER _OSS_IOW ('P', 16, int)
# define OSS_PCM_ENABLE_INPUT 0x00000001
# define OSS_PCM_ENABLE_OUTPUT 0x00000002
#define OSS_SNDCTL_DSP_GETIPTR _OSS_IOR ('P', 17, struct oss_count_info)
#define OSS_SNDCTL_DSP_GETOPTR _OSS_IOR ('P', 18, struct oss_count_info)
#define OSS_SNDCTL_DSP_MAPINBUF _OSS_IOR ('P', 19, struct oss_buffmem_desc)
#define OSS_SNDCTL_DSP_MAPOUTBUF _OSS_IOR ('P', 20, struct oss_buffmem_desc)
#define OSS_SNDCTL_DSP_SETSYNCRO _OSS_IO ('P', 21)

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio_if.h,v 1.13 1997/05/20 12:51:45 augustss Exp $ */
/* $NetBSD: audio_if.h,v 1.14 1997/07/27 01:16:46 augustss Exp $ */
/*
* Copyright (c) 1994 Havard Eidnes.
@ -89,6 +89,8 @@ struct audio_hw_if {
int (*commit_settings)__P((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,
@ -111,7 +113,12 @@ struct audio_hw_if {
int (*query_devinfo)__P((void *, mixer_devinfo_t *));
int full_duplex; /* non-null if HW is able to do full-duplex */
/* Allocate/free memory for the ring buffer. Usually malloc/free. */
void *(*alloc)__P((void *, unsigned long, int, int));
void (*free)__P((void *, void *, int));
unsigned long (*roundbuffer)__P((void *, unsigned long));
int props; /* device properties */
int audio_unit;
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: audiovar.h,v 1.10 1997/04/29 21:01:47 augustss Exp $ */
/* $NetBSD: audiovar.h,v 1.11 1997/07/27 01:16:47 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -42,52 +42,38 @@
#define AUDIO_BLK_MS 20 /* 20 ms */
#endif
#ifndef AUDIO_BACKLOG
#define AUDIO_BACKLOG 3 /* 60 ms */
#endif
/*
* Use a single page as the size of the audio ring buffers, so that
* the data won't cross a page boundary. This way the dma carried out
* in the hardware module will be efficient (i.e., at_dma() won't have
* to make a copy).
*/
#ifndef AU_RING_SIZE
#define AU_RING_SIZE NBPG
#define AU_RING_SIZE 65536
#endif
#define AU_RING_MOD(k) ((k) & (AU_RING_SIZE - 1))
#define AU_RING_EMPTY(rp) ((rp)->hp == (rp)->tp)
#define AU_RING_FULL(rp) (AU_RING_MOD((rp)->tp + 1) == (rp)->hp)
#define AU_RING_LEN(rp) (AU_RING_MOD((rp)->tp - (rp)->hp))
#define AU_RING_INIT(rp) { \
(rp)->nblk = (rp)->au_stamp = 0; \
(rp)->hp = (rp)->tp = (rp)->bp; \
}
struct audio_buffer {
u_char *hp; /* head */
u_char *tp; /* tail */
u_char *bp; /* start of buffer */
u_char *ep; /* end of buffer */
int nblk; /* number of active blocks in buffer */
int maxblk; /* max # of active blocks in buffer */
u_long au_stamp; /* number of audio samples read/written */
u_short cb_pause; /* io paused */
u_long cb_drops; /* missed samples from over/underrun */
u_long cb_pdrops; /* paused samples */
int fill; /* number of silence pad bytes */
u_char *otp; /* point where silence padding started */
#define AUMINBUF 512
#define AUMINNOBLK 3
struct audio_ringbuffer {
int bufsize; /* allocated memory */
int blksize; /* I/O block size */
int maxblks; /* no of blocks in ring */
u_char *start; /* start of buffer area */
u_char *end; /* end of buffer area */
u_char *inp; /* input pointer (to buffer) */
u_char *outp; /* output pointer (from buffer) */
int used; /* no of used bytes */
int usedlow; /* start writer when used falls below this */
int usedhigh; /* stop writer when used goes above this */
u_long stamp; /* bytes transferred */
u_long stamp_last; /* old value of bytes transferred */
u_long drops; /* missed samples from over/underrun */
u_long pdrops; /* paused samples */
char pause; /* transfer is paused */
char copying; /* data is being copied */
char needfill; /* buffer needs filling when copying is done */
char mmapped; /* device is mmap()-ed */
};
/*
* Software state, per audio device.
*/
struct audio_softc {
void *hw_hdl; /* Hardware driver handle */
void *hw_hdl; /* Hardware driver handle */
struct audio_hw_if *hw_if; /* Hardware interface */
u_char sc_open; /* single use device */
#define AUOPEN_READ 0x01
@ -103,26 +89,32 @@ struct audio_softc {
int sc_wchan;
/* Ring buffers, separate for record and play. */
struct audio_buffer rr; /* Record ring */
struct audio_buffer pr; /* Play ring */
struct audio_ringbuffer sc_rr; /* Record ring */
struct audio_ringbuffer sc_pr; /* Play ring */
u_char *sc_sil_start; /* start of silence in buffer */
int sc_sil_count; /* # of silence bytes */
u_char *auzero_block; /* a block of silence */
u_char sc_rbus; /* input dma in progress */
u_char sc_pbus; /* output dma in progress */
u_long sc_wseek; /* timestamp of last frame written */
u_long sc_rseek; /* timestamp of last frame read */
int sc_blksize; /* recv block (chunk) size in bytes */
int sc_smpl_in_blk; /* # samples in a block */
int sc_50ms; /* # of samples for 50ms? */
int sc_backlog; /* # blks of xmit backlog to generate */
int sc_lowat; /* xmit low water mark (for wakeup) */
int sc_hiwat; /* xmit high water mark (for wakeup) */
int sc_rblks; /* number of phantom record blocks */
int sc_wblks; /* number of output silence blocks */
struct audio_params sc_pparams; /* play encoding parameters */
struct audio_params sc_rparams; /* record encoding parameters */
int sc_eof; /* EOF, i.e. zero sixed write, counter */
u_long sc_wstamp;
u_long sc_playdrop;
int sc_full_duplex; /* device in full duplex mode */
#ifdef AUDIO_INTR_TIME
u_long sc_pfirstintr; /* first time we saw a xmit interrupt */
int sc_pnintr; /* number of interrupts */
u_long sc_plastintr; /* last time we saw a xmit interrupt */
long sc_pblktime; /* nominal time between interrupts */
u_long sc_rfirstintr; /* first time we saw a rec interrupt */
int sc_rnintr; /* number of interrupts */
u_long sc_rlastintr; /* last time we saw a xrec interrupt */
long sc_rblktime; /* nominal time between interrupts */
#endif
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: am7930.c,v 1.22 1997/05/24 20:15:59 pk Exp $ */
/* $NetBSD: am7930.c,v 1.23 1997/07/27 01:16:37 augustss Exp $ */
/*
* Copyright (c) 1995 Rolf Grossmann
@ -240,6 +240,8 @@ struct audio_hw_if sa_hw_if = {
amd7930_set_in_port,
amd7930_get_in_port,
amd7930_commit_settings,
NULL,
NULL,
amd7930_start_output,
amd7930_start_input,
amd7930_halt_output,
@ -252,7 +254,10 @@ struct audio_hw_if sa_hw_if = {
amd7930_set_port,
amd7930_get_port,
amd7930_query_devinfo,
1,
0,
0,
0,
AUDIO_PROP_FULLDUPLEX,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: ad1848.c,v 1.32 1997/07/15 07:46:14 augustss Exp $ */
/* $NetBSD: ad1848.c,v 1.33 1997/07/27 01:16:50 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@ -97,8 +97,7 @@
#include <dev/isa/cs4231var.h>
#ifdef AUDIO_DEBUG
extern void Dprintf __P((const char *, ...));
#define DPRINTF(x) if (ad1848debug) Dprintf x
#define DPRINTF(x) if (ad1848debug) printf x
int ad1848debug = 0;
#else
#define DPRINTF(x)
@ -265,8 +264,8 @@ ad1848_dump_regs(sc)
r = ad_read(sc, i);
printf("%02x ", r);
}
printf("\n");
}
printf("\n");
}
#endif
@ -314,7 +313,7 @@ ad1848_probe(sc)
return 0;
}
/* map the ports upto the AD1488 port */
/* Map the AD1848 ports */
if (bus_space_map(sc->sc_iot, sc->sc_iobase, AD1848_NPORT, 0, &sc->sc_ioh))
return 0;
@ -496,6 +495,8 @@ ad1848_attach(sc)
struct audio_params xparams;
sc->sc_locked = 0;
sc->sc_playrun = NOTRUNNING;
sc->sc_recrun = NOTRUNNING;
if (sc->sc_drq != -1) {
if (isa_dmamap_create(sc->sc_isa, sc->sc_drq, MAXPHYS /* XXX */,
@ -1010,7 +1011,7 @@ ad1848_set_params(addr, mode, p, q)
int error, bits, enc;
void (*swcode) __P((void *, u_char *buf, int cnt));
DPRINTF(("ad1848_set_params: %d %d %d %d\n",
DPRINTF(("ad1848_set_params: %d %d %d %ld\n",
p->encoding, p->precision, p->channels, p->sample_rate));
enc = p->encoding;
@ -1094,7 +1095,7 @@ ad1848_set_params(addr, mode, p, q)
q->channels = p->channels;
q->precision = p->precision;
DPRINTF(("ad1848_set_params succeeded\n"));
DPRINTF(("ad1848_set_params succeeded, bits=%x\n", bits));
return (0);
}
@ -1167,7 +1168,7 @@ ad1848_open(sc, dev, flags)
dev_t dev;
int flags;
{
DPRINTF(("ad1848_open: sc=0x%x\n", sc));
DPRINTF(("ad1848_open: sc=%p\n", sc));
sc->sc_intr = 0;
sc->sc_lastcc = -1;
@ -1198,12 +1199,21 @@ ad1848_close(addr)
sc->sc_intr = 0;
DPRINTF(("ad1848_close: stop DMA\n"));
if (sc->sc_playrun != NOTRUNNING) {
isa_dmaabort(sc->sc_isa, sc->sc_drq);
sc->sc_playrun = NOTRUNNING;
}
if (sc->sc_recrun != NOTRUNNING) {
isa_dmaabort(sc->sc_isa, sc->sc_recdrq);
sc->sc_recrun = NOTRUNNING;
}
ad_write(sc, SP_LOWER_BASE_COUNT, (u_char)0);
ad_write(sc, SP_UPPER_BASE_COUNT, (u_char)0);
/* Disable interrupts */
DPRINTF(("ad1848_close: disable intrs\n"));
ad_write(sc, SP_PIN_CONTROL, ad_read(sc, SP_PIN_CONTROL) & ~(INTERRUPT_ENABLE));
ad_write(sc, SP_PIN_CONTROL,
ad_read(sc, SP_PIN_CONTROL) & ~INTERRUPT_ENABLE);
DPRINTF(("ad1848_close: disable capture and playback\n"));
r = ad_read(sc, SP_INTERFACE_CONFIG);
@ -1460,6 +1470,24 @@ ad1848_cont_in_dma(addr)
return(0);
}
int
ad1848_dma_init_input(addr, buf, cc)
void *addr;
void *buf;
int cc;
{
struct ad1848_softc *sc = addr;
sc->sc_recrun = DMARUNNING;
sc->sc_dma_flags = DMAMODE_READ | DMAMODE_LOOP;
sc->sc_dma_bp = buf;
sc->sc_dma_cnt = cc;
isa_dmastart(sc->sc_isa, sc->sc_recdrq, buf, cc, NULL,
sc->sc_dma_flags, BUS_DMA_NOWAIT);
DPRINTF(("ad1848_dma_init_input: %p %d\n", buf, cc));
return 0;
}
/*
* DMA input/output are called at splaudio().
*/
@ -1481,43 +1509,73 @@ ad1848_dma_input(addr, p, cc, intr, arg)
#ifdef AUDIO_DEBUG
if (ad1848debug > 1)
Dprintf("ad1848_dma_input: cc=%d 0x%x (0x%x)\n", cc, intr, arg);
printf("ad1848_dma_input: cc=%d %p (%p)\n", cc, intr, arg);
#endif
sc->sc_locked = 1;
sc->sc_intr = intr;
sc->sc_arg = arg;
sc->sc_dma_flags = DMAMODE_READ;
sc->sc_dma_bp = p;
sc->sc_dma_cnt = cc;
isa_dmastart(sc->sc_isa, sc->sc_recdrq, p, cc, NULL,
DMAMODE_READ, BUS_DMA_NOWAIT);
if (sc->precision == 16)
cc >>= 1;
if (sc->channels == 2)
cc >>= 1;
cc--;
switch (sc->sc_recrun) {
case NOTRUNNING:
sc->sc_dma_flags = DMAMODE_READ;
sc->sc_dma_bp = p;
sc->sc_dma_cnt = cc;
isa_dmastart(sc->sc_isa, sc->sc_recdrq, p, cc, NULL,
DMAMODE_READ, BUS_DMA_NOWAIT);
goto startpcm;
case DMARUNNING:
sc->sc_recrun = PCMRUNNING;
startpcm:
if (sc->precision == 16)
cc >>= 1;
if (sc->channels == 2)
cc >>= 1;
cc--;
if (sc->sc_lastcc != cc || sc->sc_mode != AUMODE_RECORD) {
ad_write(sc, SP_LOWER_BASE_COUNT, (u_char)(cc & 0xff));
ad_write(sc, SP_UPPER_BASE_COUNT, (u_char)((cc >> 8) & 0xff));
if (sc->sc_lastcc != cc || sc->sc_mode != AUMODE_RECORD) {
ad_write(sc, SP_LOWER_BASE_COUNT, (u_char)(cc & 0xff));
ad_write(sc, SP_UPPER_BASE_COUNT, (u_char)((cc >> 8) & 0xff));
if (sc->mode == 2) {
ad_write(sc, CS_LOWER_REC_CNT, (u_char)(cc & 0xff));
ad_write(sc, CS_UPPER_REC_CNT, (u_char)((cc >> 8) & 0xff));
}
if (sc->mode == 2) {
ad_write(sc, CS_LOWER_REC_CNT, (u_char)(cc & 0xff));
ad_write(sc, CS_UPPER_REC_CNT, (u_char)((cc >> 8) & 0xff));
}
reg = ad_read(sc, SP_INTERFACE_CONFIG);
ad_write(sc, SP_INTERFACE_CONFIG, (CAPTURE_ENABLE|reg));
reg = ad_read(sc, SP_INTERFACE_CONFIG);
ad_write(sc, SP_INTERFACE_CONFIG, (CAPTURE_ENABLE|reg));
sc->sc_lastcc = cc;
sc->sc_mode = AUMODE_RECORD;
sc->sc_lastcc = cc;
sc->sc_mode = AUMODE_RECORD;
#ifdef AUDIO_DEBUG
if (ad1848debug > 1)
printf("ad1848_dma_input: started capture\n");
#endif
}
case PCMRUNNING:
break;
}
return 0;
}
int
ad1848_dma_init_output(addr, buf, cc)
void *addr;
void *buf;
int cc;
{
struct ad1848_softc *sc = addr;
sc->sc_playrun = DMARUNNING;
sc->sc_dma_flags = DMAMODE_WRITE | DMAMODE_LOOP;
sc->sc_dma_bp = buf;
sc->sc_dma_cnt = cc;
isa_dmastart(sc->sc_isa, sc->sc_drq, buf, cc, NULL,
sc->sc_dma_flags, BUS_DMA_NOWAIT);
DPRINTF(("ad1848_dma_init_output: %p %d\n", buf, cc));
return 0;
}
int
ad1848_dma_output(addr, p, cc, intr, arg)
void *addr;
@ -1535,32 +1593,43 @@ ad1848_dma_output(addr, p, cc, intr, arg)
}
#ifdef AUDIO_DEBUG
if (ad1848debug > 1)
Dprintf("ad1848_dma_output: cc=%d 0x%x (0x%x)\n", cc, intr, arg);
if (ad1848debug > 0)
printf("ad1848_dma_output: cc=%d at %p 0x%p (0x%p)\n", cc, p, intr, arg);
#endif
sc->sc_locked = 1;
sc->sc_intr = intr;
sc->sc_arg = arg;
sc->sc_dma_flags = DMAMODE_WRITE;
sc->sc_dma_bp = p;
sc->sc_dma_cnt = cc;
isa_dmastart(sc->sc_isa, sc->sc_drq, p, cc, NULL,
DMAMODE_WRITE, BUS_DMA_NOWAIT);
if (sc->precision == 16)
cc >>= 1;
if (sc->channels == 2)
cc >>= 1;
cc--;
if (sc->sc_lastcc != cc || sc->sc_mode != AUMODE_PLAY) {
ad_write(sc, SP_LOWER_BASE_COUNT, (u_char)(cc & 0xff));
ad_write(sc, SP_UPPER_BASE_COUNT, (u_char)((cc >> 8) & 0xff));
reg = ad_read(sc, SP_INTERFACE_CONFIG);
ad_write(sc, SP_INTERFACE_CONFIG, (PLAYBACK_ENABLE|reg));
sc->sc_lastcc = cc;
sc->sc_mode = AUMODE_PLAY;
switch (sc->sc_playrun) {
case NOTRUNNING:
sc->sc_dma_flags = DMAMODE_WRITE;
sc->sc_dma_bp = p;
sc->sc_dma_cnt = cc;
isa_dmastart(sc->sc_isa, sc->sc_drq, p, cc, NULL,
DMAMODE_WRITE, BUS_DMA_NOWAIT);
goto startpcm;
case DMARUNNING:
sc->sc_playrun = PCMRUNNING;
startpcm:
if (sc->precision == 16)
cc >>= 1;
if (sc->channels == 2)
cc >>= 1;
cc--;
if (sc->sc_lastcc != cc || sc->sc_mode != AUMODE_PLAY) {
ad_write(sc, SP_LOWER_BASE_COUNT, (u_char)(cc & 0xff));
ad_write(sc, SP_UPPER_BASE_COUNT, (u_char)((cc >> 8) & 0xff));
reg = ad_read(sc, SP_INTERFACE_CONFIG);
ad_write(sc, SP_INTERFACE_CONFIG, (PLAYBACK_ENABLE|reg));
sc->sc_lastcc = cc;
sc->sc_mode = AUMODE_PLAY;
}
break;
case PCMRUNNING:
break;
}
return 0;
@ -1579,7 +1648,7 @@ ad1848_intr(arg)
#ifdef AUDIO_DEBUG
if (ad1848debug > 1)
Dprintf("ad1848_intr: intr=0x%x status=%x\n", sc->sc_intr, status);
printf("ad1848_intr: intr=%p status=%x\n", sc->sc_intr, status);
#endif
sc->sc_locked = 0;
sc->sc_interrupts++;
@ -1588,7 +1657,7 @@ ad1848_intr(arg)
if (sc->sc_intr && (status & INTERRUPT_STATUS)) {
/* ACK DMA read because it may be in a bounce buffer */
/* XXX Do write to mask DMA ? */
if (sc->sc_dma_flags & DMAMODE_READ)
if ((sc->sc_dma_flags & DMAMODE_READ) && sc->sc_recrun == NOTRUNNING)
isa_dmadone(sc->sc_isa, sc->sc_recdrq);
(*sc->sc_intr)(sc->sc_arg);
retval = 1;
@ -1600,3 +1669,34 @@ ad1848_intr(arg)
return(retval);
}
void *
ad1848_malloc(addr, size, pool, flags)
void *addr;
unsigned long size;
int pool;
int flags;
{
struct ad1848_softc *sc = addr;
return isa_malloc(sc->sc_isa, 4, size, pool, flags);
}
void
ad1848_free(addr, ptr, pool)
void *addr;
void *ptr;
int pool;
{
isa_free(ptr, pool);
}
unsigned long
ad1848_round(addr, size)
void *addr;
unsigned long size;
{
if (size > MAX_ISADMA)
size = MAX_ISADMA;
return size;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ad1848var.h,v 1.15 1997/06/06 23:43:46 thorpej Exp $ */
/* $NetBSD: ad1848var.h,v 1.16 1997/07/27 01:16:52 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@ -62,6 +62,12 @@ struct ad1848_softc {
u_int sc_dma_cnt;
#endif
char sc_playrun; /* running in continuous mode */
char sc_recrun; /* running in continuous mode */
#define NOTRUNNING 0
#define DMARUNNING 1
#define PCMRUNNING 2
int sc_iobase; /* I/O port base address */
int sc_irq; /* interrupt */
int sc_drq; /* DMA */
@ -113,6 +119,8 @@ int ad1848_set_params __P((void *, int, struct audio_params *, struct audio_para
int ad1848_round_blocksize __P((void *, int));
int ad1848_dma_init_output __P((void *, void *, int));
int ad1848_dma_init_input __P((void *, void *, int));
int ad1848_dma_output __P((void *, void *, int, void (*)(void *), void*));
int ad1848_dma_input __P((void *, void *, int, void (*)(void *), void*));
@ -143,4 +151,9 @@ int ad1848_set_mic_gain __P((struct ad1848_softc *, struct ad1848_volume *));
int ad1848_get_mic_gain __P((struct ad1848_softc *, struct ad1848_volume *));
void ad1848_mute_aux1 __P((struct ad1848_softc *, int /* onoff */));
void ad1848_mute_aux2 __P((struct ad1848_softc *, int /* onoff */));
void *ad1848_malloc __P((void *, unsigned long, int, int));
void ad1848_free __P((void *, void *, int));
unsigned long ad1848_round __P((void *, unsigned long));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: gus.c,v 1.32 1997/07/15 07:46:16 augustss Exp $ */
/* $NetBSD: gus.c,v 1.33 1997/07/27 01:16:55 augustss Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -319,9 +319,8 @@ struct ics2101_volume {
#ifdef AUDIO_DEBUG
#define GUSPLAYDEBUG /*XXX*/
extern void Dprintf __P((const char *, ...));
#define DPRINTF(x) if (gusdebug) Dprintf x
#define DMAPRINTF(x) if (gusdmadebug) Dprintf x
#define DPRINTF(x) if (gusdebug) printf x
#define DMAPRINTF(x) if (gusdmadebug) printf x
int gusdebug = 0;
int gusdmadebug = 0;
#else
@ -611,6 +610,9 @@ struct audio_hw_if gus_hw_if = {
gus_commit_settings,
NULL,
NULL,
gus_dma_output,
gus_dma_input,
gus_halt_out_dma,
@ -625,7 +627,10 @@ struct audio_hw_if gus_hw_if = {
gus_mixer_set_port,
gus_mixer_get_port,
gus_mixer_query_devinfo,
1, /* full-duplex */
NULL,
NULL,
NULL,
AUDIO_PROP_FULLDUPLEX,
0,
};
@ -888,10 +893,10 @@ gusattach(parent, self, aux)
printf("%s codec/mixer, ", sc->sc_codec.chip_name);
if (sc->sc_recdrq == sc->sc_drq) {
printf("half-duplex");
gus_hw_if.full_duplex = 0;
gus_hw_if.props &= ~AUDIO_PROP_FULLDUPLEX;
} else {
printf("full-duplex, record drq %d", sc->sc_recdrq);
gus_hw_if.full_duplex = 1;
gus_hw_if.props |= AUDIO_PROP_FULLDUPLEX;
}
printf(">\n");
@ -1117,7 +1122,7 @@ gus_dma_output(addr, buf, size, intr, arg)
u_long boarddma;
int flags;
DMAPRINTF(("gus_dma_output %d @ %x\n", size, buf));
DMAPRINTF(("gus_dma_output %d @ %p\n", size, buf));
if (size != sc->sc_blocksize) {
DPRINTF(("gus_dma_output reqsize %d not sc_blocksize %d\n",
@ -1210,7 +1215,7 @@ gusclose(addr)
{
struct gus_softc *sc = addr;
DPRINTF(("gus_close: sc=0x%x\n", sc));
DPRINTF(("gus_close: sc=%p\n", sc));
/* if (sc->sc_flags & GUS_DMAOUT_ACTIVE) */ {
@ -1365,7 +1370,7 @@ gus_dmaout_dointr(sc)
/* sc->sc_dmaoutcnt - 1 because DMA controller counts from zero?. */
isa_dmadone(sc->sc_dev.dv_parent, sc->sc_drq);
sc->sc_flags &= ~GUS_DMAOUT_ACTIVE; /* pending DMA is done */
DMAPRINTF(("gus_dmaout_dointr %d @ %x\n", sc->sc_dmaoutcnt,
DMAPRINTF(("gus_dmaout_dointr %d @ %p\n", sc->sc_dmaoutcnt,
sc->sc_dmaoutaddr));
/*
@ -2519,7 +2524,7 @@ gus_get_curaddr(sc, voice)
if (sc->sc_voc[voice].voccntl & GUSMASK_DATA_SIZE16)
addr = (addr & 0xc0000) | ((addr & 0x1ffff) << 1); /* undo 16-bit change */
DPRINTF(("gus voice %d curaddr %d end_addr %d\n",
DPRINTF(("gus voice %d curaddr %ld end_addr %ld\n",
voice, addr, sc->sc_voc[voice].end_addr));
/* XXX sanity check the address? */
@ -2774,6 +2779,9 @@ gus_init_cs4231(sc)
gusmax_commit_settings,
NULL,
NULL,
gusmax_dma_output,
gusmax_dma_input,
gusmax_halt_out_dma,
@ -2788,7 +2796,10 @@ gus_init_cs4231(sc)
gusmax_mixer_set_port,
gusmax_mixer_get_port,
gusmax_mixer_query_devinfo,
1, /* full-duplex */
NULL,
NULL,
NULL,
AUDIO_PROP_FULLDUPLEX,
0,
};
sc->sc_flags |= GUS_CODEC_INSTALLED;
@ -3029,7 +3040,7 @@ gus_dmain_intr(sc)
sc->sc_inarg = 0;
sc->sc_flags &= ~GUS_DMAIN_ACTIVE;
DMAPRINTF(("calling dmain_intr callback %x(%x)\n", callback, arg));
DMAPRINTF(("calling dmain_intr callback %p(%p)\n", callback, arg));
(*callback)(arg);
return 1;
} else {
@ -3157,9 +3168,6 @@ gus_setfd(addr, flag)
void *addr;
int flag;
{
if (gus_hw_if.full_duplex == 0)
return ENOTTY;
return(0); /* nothing fancy to do. */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: isadma.c,v 1.26 1997/06/06 23:43:55 thorpej Exp $ */
/* $NetBSD: isadma.c,v 1.27 1997/07/27 01:16:57 augustss Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -55,6 +55,17 @@
#include <dev/isa/isadmavar.h>
#include <dev/isa/isadmareg.h>
/* Used by isa_malloc() */
#include <sys/malloc.h>
struct isa_mem {
struct device *isadev;
int chan;
bus_size_t size;
bus_addr_t addr;
caddr_t kva;
struct isa_mem *next;
} *isa_mem_head = 0;
/*
* High byte of DMA address is stored in this DMAPG register for
* the Nth DMA channel.
@ -571,3 +582,61 @@ isa_dmamem_mmap(isadev, chan, addr, size, off, prot, flags)
return (bus_dmamem_mmap(sc->sc_dmat, &seg, 1, off, prot, flags));
}
void *
isa_malloc(isadev, chan, size, pool, flags)
struct device *isadev;
int chan;
size_t size;
int pool;
int flags;
{
bus_addr_t addr;
caddr_t kva;
int bflags;
struct isa_mem *m;
bflags = flags & M_WAITOK ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT;
if (isa_dmamem_alloc(isadev, chan, size, &addr, bflags))
return 0;
if (isa_dmamem_map(isadev, chan, addr, size, &kva, bflags)) {
isa_dmamem_free(isadev, chan, addr, size);
return 0;
}
m = malloc(sizeof(*m), pool, flags);
if (m == 0) {
isa_dmamem_unmap(isadev, chan, kva, size);
isa_dmamem_free(isadev, chan, addr, size);
return 0;
}
m->isadev = isadev;
m->chan = chan;
m->size = size;
m->addr = addr;
m->kva = kva;
m->next = isa_mem_head;
isa_mem_head = m;
return (void *)kva;
}
void
isa_free(addr, pool)
void *addr;
int pool;
{
struct isa_mem **mp, *m;
caddr_t kva = (caddr_t)addr;
for(mp = &isa_mem_head; *mp && (*mp)->kva != kva; mp = &(*mp)->next)
;
m = *mp;
if (!m) {
printf("isa_free: freeing unallocted memory\n");
return;
}
*mp = m->next;
isa_dmamem_unmap(m->isadev, m->chan, kva, m->size);
isa_dmamem_free(m->isadev, m->chan, m->addr, m->size);
free(m, pool);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: isadmavar.h,v 1.7 1997/06/06 23:43:56 thorpej Exp $ */
/* $NetBSD: isadmavar.h,v 1.8 1997/07/27 01:17:01 augustss Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -37,6 +37,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#define MAX_ISADMA 65536
#define DMAMODE_WRITE 0
#define DMAMODE_READ 1
#define DMAMODE_LOOP 2
@ -63,3 +65,7 @@ int isa_dmamem_map __P((struct device *, int, bus_addr_t, bus_size_t,
void isa_dmamem_unmap __P((struct device *, int, caddr_t, size_t));
int isa_dmamem_mmap __P((struct device *, int, bus_addr_t, bus_size_t,
int, int, int));
void *isa_malloc __P((struct device *, int, size_t, int, int));
void isa_free __P((void *, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: pas.c,v 1.28 1997/07/25 01:42:20 augustss Exp $ */
/* $NetBSD: pas.c,v 1.29 1997/07/27 01:17:02 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -120,6 +120,8 @@ struct audio_hw_if pas_hw_if = {
sbdsp_set_in_port,
sbdsp_get_in_port,
sbdsp_commit_settings,
NULL,
NULL,
sbdsp_dma_output,
sbdsp_dma_input,
sbdsp_haltdma,
@ -132,7 +134,10 @@ struct audio_hw_if pas_hw_if = {
sbdsp_mixer_set_port,
sbdsp_mixer_get_port,
sbdsp_mixer_query_devinfo,
0, /* not full-duplex */
sb_malloc,
sb_free,
sb_round,
0,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: pss.c,v 1.28 1997/06/06 23:43:59 thorpej Exp $ */
/* $NetBSD: pss.c,v 1.29 1997/07/27 01:17:04 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@ -155,8 +155,7 @@ struct pcd_softc {
#endif
#ifdef AUDIO_DEBUG
extern void Dprintf __P((const char *, ...));
#define DPRINTF(x) if (pssdebug) Dprintf x
#define DPRINTF(x) if (pssdebug) printf x
int pssdebug = 0;
#else
#define DPRINTF(x)
@ -243,6 +242,8 @@ struct audio_hw_if pss_audio_if = {
pss_set_in_port,
pss_get_in_port,
ad1848_commit_settings,
NULL,
NULL,
ad1848_dma_output,
ad1848_dma_input,
ad1848_halt_out_dma,
@ -255,7 +256,10 @@ struct audio_hw_if pss_audio_if = {
pss_mixer_set_port,
pss_mixer_get_port,
pss_query_devinfo,
0, /* not full-duplex */
ad1848_malloc,
ad1848_free,
ad1848_round,
0,
0
};
@ -1348,7 +1352,7 @@ pssintr(arg)
sr = inw(sc->sc_iobase+PSS_STATUS);
DPRINTF(("pssintr: sc=%x st=%x\n", sc, sr));
DPRINTF(("pssintr: sc=%p st=%x\n", sc, sr));
/* Acknowledge intr */
outw(sc->sc_iobase+PSS_IRQ_ACK, 0);
@ -1384,7 +1388,7 @@ pss_getdev(addr, retp)
void *addr;
struct audio_device *retp;
{
DPRINTF(("pss_getdev: retp=0x%x\n", retp));
DPRINTF(("pss_getdev: retp=%p\n", retp));
*retp = pss_device;
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sb.c,v 1.49 1997/06/06 23:44:01 thorpej Exp $ */
/* $NetBSD: sb.c,v 1.50 1997/07/27 01:17:05 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -86,6 +86,8 @@ struct audio_hw_if sb_hw_if = {
sbdsp_set_in_port,
sbdsp_get_in_port,
sbdsp_commit_settings,
sbdsp_dma_init_output,
sbdsp_dma_init_input,
sbdsp_dma_output,
sbdsp_dma_input,
sbdsp_haltdma,
@ -98,7 +100,10 @@ struct audio_hw_if sb_hw_if = {
sbdsp_mixer_set_port,
sbdsp_mixer_get_port,
sbdsp_mixer_query_devinfo,
0, /* not full-duplex */
sb_malloc,
sb_free,
sb_round,
AUDIO_PROP_MMAP,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: sb_isa.c,v 1.7 1997/06/06 23:44:01 thorpej Exp $ */
/* $NetBSD: sb_isa.c,v 1.8 1997/07/27 01:17:06 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -102,7 +102,7 @@ sb_isa_match(parent, match, aux)
sc->sc_iobase = ia->ia_iobase;
sc->sc_irq = ia->ia_irq;
sc->sc_drq8 = ia->ia_drq;
sc->sc_drq16 = 5; /* XXX XXX */
sc->sc_drq16 = 5; /* XXX */
sc->sc_ic = ia->ia_ic;
if (!sbmatch(sc)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbdsp.c,v 1.59 1997/07/15 07:46:19 augustss Exp $ */
/* $NetBSD: sbdsp.c,v 1.60 1997/07/27 01:17:07 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -68,9 +68,10 @@
#include <dev/isa/sbreg.h>
#include <dev/isa/sbdspvar.h>
#define MAXDMA 65536 /* XXX */
#ifdef AUDIO_DEBUG
extern void Dprintf __P((const char *, ...));
#define DPRINTF(x) if (sbdspdebug) Dprintf x
#define DPRINTF(x) if (sbdspdebug) printf x
int sbdspdebug = 0;
#else
#define DPRINTF(x)
@ -367,6 +368,7 @@ sbdsp_attach(sc)
sc->in_filter = 0; /* no filters turned on, please */
}
printf(" drq16 %d", sc->sc_drq16);
printf(": dsp v%d.%02d%s\n",
SBVER_MAJOR(sc->sc_version), SBVER_MINOR(sc->sc_version),
sc->sc_model == SB_JAZZ ? ": <Jazz16>" : "");
@ -614,8 +616,8 @@ sbdsp_set_params(addr, mode, p, q)
*/
sc->sc_dmadir = SB_DMA_NONE;
DPRINTF(("set_params: model=%d, rate=%ld, prec=%d, chan=%d, enc=%d -> tc=%02x, cmd=%02x, bmode=%02x, cmdchan=%02x, swcode=%p\n",
sc->sc_model, p->sample_rate, p->precision, p->channels,
DPRINTF(("set_params: model=%d, mode=%d, rate=%ld, prec=%d, chan=%d, enc=%d -> tc=%02x, cmd=%02x, bmode=%02x, cmdchan=%02x, swcode=%p\n",
sc->sc_model, mode, p->sample_rate, p->precision, p->channels,
p->encoding, tc, m->cmd, bmode, m->cmdchan, swcode));
return 0;
@ -726,7 +728,7 @@ sbdsp_set_in_ports(sc, mask)
sbport = SBP_FROM_CD;
break;
default:
return EINVAL;
return (EINVAL);
}
sbdsp_mix_write(sc, SBP_RECORD_SOURCE,
SBP_RECORD_FROM(sbport, SBP_FILTER_OFF, SBP_IFILTER_HIGH));
@ -799,12 +801,9 @@ sbdsp_round_blocksize(addr, blk)
void *addr;
int blk;
{
if (blk > NBPG/3)
blk = NBPG/3; /* XXX allow at least 3 blocks */
/* Round to a multiple of the biggest sample size. */
blk &= -4;
if (blk > MAXDMA)
blk = MAXDMA; /* cannot DMA more than 64k */
blk &= -4; /* round to biggest sample size */
return blk;
}
@ -1023,8 +1022,8 @@ sbdsp_spkroff(sc)
}
/*
* Read the version number out of the card. Return major code
* in high byte, and minor code in low byte.
* Read the version number out of the card.
* Store version information in the softc.
*/
void
sbversion(sc)
@ -1129,6 +1128,27 @@ sbdsp16_set_rate(sc, cmd, rate)
return 0;
}
int
sbdsp_dma_init_input(addr, buf, cc)
void *addr;
void *buf;
int cc;
{
struct sbdsp_softc *sc = addr;
if (sc->sc_model == SB_1)
return 0;
sc->dmaflags = DMAMODE_READ | DMAMODE_LOOP;
sc->dmaaddr = buf;
sc->dmacnt = cc;
sc->dmachan = sc->sc_imodep->precision == 16 ? sc->sc_drq16 : sc->sc_drq8;
DPRINTF(("sbdsp: dma start loop input addr=%p cc=%d chan=%d\n",
buf, cc, sc->dmachan));
isa_dmastart(sc->sc_isa, sc->dmachan, sc->dmaaddr,
sc->dmacnt, NULL, sc->dmaflags, BUS_DMA_NOWAIT);
return 0;
}
int
sbdsp_dma_input(addr, p, cc, intr, arg)
void *addr;
@ -1144,7 +1164,7 @@ sbdsp_dma_input(addr, p, cc, intr, arg)
#ifdef AUDIO_DEBUG
if (sbdspdebug > 1)
Dprintf("sbdsp_dma_input: cc=%d 0x%x (0x%x)\n", cc, intr, arg);
printf("sbdsp_dma_input: cc=%d %p (%p)\n", cc, intr, arg);
#endif
#ifdef DIAGNOSTIC
if (sc->sc_imodep->channels == 2 && (cc & 1)) {
@ -1165,33 +1185,39 @@ sbdsp_dma_input(addr, p, cc, intr, arg)
if (ISSB16CLASS(sc)) {
if (sbdsp16_set_rate(sc, SB_DSP16_INPUTRATE,
sc->sc_irate))
sc->sc_irate)) {
DPRINTF(("sbdsp_dma_input: rate=%d set failed\n",
sc->sc_irate));
goto giveup;
}
} else {
if (sbdsp_set_timeconst(sc, sc->sc_itc))
if (sbdsp_set_timeconst(sc, sc->sc_itc)) {
DPRINTF(("sbdsp_dma_output: tc=%d set failed\n",
sc->sc_irate));
goto giveup;
}
}
sc->sc_dmadir = SB_DMA_IN;
sc->dmaflags = DMAMODE_READ;
if (loop)
sc->dmaflags |= DMAMODE_LOOP;
} else {
/* If already started; just return. */
/* If already started just return. */
if (loop)
return 0;
}
sc->dmaaddr = p;
sc->dmacnt = loop ? (NBPG/cc)*cc : cc;
sc->dmachan = sc->sc_imodep->precision == 16 ? sc->sc_drq16 : sc->sc_drq8;
if (!loop) {
sc->dmaaddr = p;
sc->dmacnt = cc;
sc->dmachan = sc->sc_imodep->precision == 16 ? sc->sc_drq16 : sc->sc_drq8;
#ifdef AUDIO_DEBUG
if (sbdspdebug > 1)
Dprintf("sbdsp_dma_input: dmastart %x %p %d %d\n",
if (sbdspdebug > 2)
printf("sbdsp_dma_input: dmastart %x %p %ld %d\n",
sc->dmaflags, sc->dmaaddr, sc->dmacnt, sc->dmachan);
#endif
isa_dmastart(sc->sc_isa, sc->dmachan, sc->dmaaddr,
sc->dmacnt, NULL, sc->dmaflags, BUS_DMA_NOWAIT);
isa_dmastart(sc->sc_isa, sc->dmachan, sc->dmaaddr,
sc->dmacnt, NULL, sc->dmaflags, BUS_DMA_NOWAIT);
}
sc->sc_intr = intr;
sc->sc_arg = arg;
@ -1200,6 +1226,11 @@ sbdsp_dma_input(addr, p, cc, intr, arg)
cc >>= 1;
--cc;
if (ISSB16CLASS(sc)) {
#ifdef AUDIO_DEBUG
if (sbdspdebug > 2)
printf("sbdsp16 input command %02x %02x %d\n",
sc->sc_imodep->cmd, sc->sc_ibmode, cc);
#endif
if (sbdsp_wdsp(sc, sc->sc_imodep->cmd) < 0 ||
sbdsp_wdsp(sc, sc->sc_ibmode) < 0 ||
sbdsp16_wait(sc) ||
@ -1214,11 +1245,11 @@ sbdsp_dma_input(addr, p, cc, intr, arg)
if (sbdsp_wdsp(sc, SB_DSP_BLOCKSIZE) < 0 ||
sbdsp_wdsp(sc, cc) < 0 ||
sbdsp_wdsp(sc, cc >> 8) < 0) {
DPRINTF(("sbdsp_dma_input: SB2 DMA start failed\n"));
DPRINTF(("sbdsp_dma_input: SB2 DMA blocksize failed\n"));
goto giveup;
}
if (sbdsp_wdsp(sc, sc->sc_imodep->cmd) < 0) {
DPRINTF(("sbdsp_dma_input: SB2 DMA restart failed\n"));
DPRINTF(("sbdsp_dma_input: SB2 DMA start failed\n"));
goto giveup;
}
} else {
@ -1241,6 +1272,27 @@ badmode:
return EIO;
}
int
sbdsp_dma_init_output(addr, buf, cc)
void *addr;
void *buf;
int cc;
{
struct sbdsp_softc *sc = addr;
if (sc->sc_model == SB_1)
return 0;
sc->dmaflags = DMAMODE_WRITE | DMAMODE_LOOP;
sc->dmaaddr = buf;
sc->dmacnt = cc;
sc->dmachan = sc->sc_omodep->precision == 16 ? sc->sc_drq16 : sc->sc_drq8;
DPRINTF(("sbdsp: dma start loop output addr=%p cc=%d chan=%d\n",
buf, cc, sc->dmachan));
isa_dmastart(sc->sc_isa, sc->dmachan, sc->dmaaddr,
sc->dmacnt, NULL, sc->dmaflags, BUS_DMA_NOWAIT);
return 0;
}
int
sbdsp_dma_output(addr, p, cc, intr, arg)
void *addr;
@ -1256,7 +1308,7 @@ sbdsp_dma_output(addr, p, cc, intr, arg)
#ifdef AUDIO_DEBUG
if (sbdspdebug > 1)
Dprintf("sbdsp_dma_output: cc=%d 0x%x (0x%x)\n", cc, intr, arg);
printf("sbdsp_dma_output: cc=%d %p (%p)\n", cc, intr, arg);
#endif
#ifdef DIAGNOSTIC
if (stereo && (cc & 1)) {
@ -1279,33 +1331,39 @@ sbdsp_dma_output(addr, p, cc, intr, arg)
if (ISSB16CLASS(sc)) {
if (sbdsp16_set_rate(sc, SB_DSP16_OUTPUTRATE,
sc->sc_orate))
sc->sc_orate)) {
DPRINTF(("sbdsp_dma_output: rate=%d set failed\n",
sc->sc_orate));
goto giveup;
}
} else {
if (sbdsp_set_timeconst(sc, sc->sc_otc))
if (sbdsp_set_timeconst(sc, sc->sc_otc)) {
DPRINTF(("sbdsp_dma_output: tc=%d set failed\n",
sc->sc_orate));
goto giveup;
}
}
sc->sc_dmadir = SB_DMA_OUT;
sc->dmaflags = DMAMODE_WRITE;
if (loop)
sc->dmaflags |= DMAMODE_LOOP;
} else {
/* Already started; just return. */
/* If already started just return. */
if (loop)
return 0;
}
sc->dmaaddr = p;
sc->dmacnt = loop ? (NBPG/cc)*cc : cc;
sc->dmachan = sc->sc_omodep->precision == 16 ? sc->sc_drq16 : sc->sc_drq8;
if (!loop) {
sc->dmaaddr = p;
sc->dmacnt = cc;
sc->dmachan = sc->sc_omodep->precision == 16 ? sc->sc_drq16 : sc->sc_drq8;
#ifdef AUDIO_DEBUG
if (sbdspdebug > 1)
Dprintf("sbdsp_dma_output: dmastart %x %p %d %d\n",
sc->dmaflags, sc->dmaaddr, sc->dmacnt, sc->dmachan);
if (sbdspdebug > 2)
printf("sbdsp: start dma out flags=%x, addr=%p, cnt=%ld, chan=%d\n",
sc->dmaflags, sc->dmaaddr, sc->dmacnt, sc->dmachan);
#endif
isa_dmastart(sc->sc_isa, sc->dmachan, sc->dmaaddr,
sc->dmacnt, NULL, sc->dmaflags, BUS_DMA_NOWAIT);
isa_dmastart(sc->sc_isa, sc->dmachan, sc->dmaaddr,
sc->dmacnt, NULL, sc->dmaflags, BUS_DMA_NOWAIT);
}
sc->sc_intr = intr;
sc->sc_arg = arg;
@ -1361,6 +1419,10 @@ badmode:
* (when mode is enabled), completion of dma transmission, or
* completion of a dma reception. The three modes are mutually
* exclusive so we know a priori which event has occurred.
*
* If there is interrupt sharing or a spurious interrupt occurs
* there is no way to distinuish this on an SB2. So if you have
* an SB2 and experience problems, buy an SB16 (it's only $25).
*/
int
sbdsp_intr(arg)
@ -1372,7 +1434,7 @@ sbdsp_intr(arg)
#ifdef AUDIO_DEBUG
if (sbdspdebug > 1)
Dprintf("sbdsp_intr: intr=0x%x\n", sc->sc_intr);
printf("sbdsp_intr: intr=%p\n", sc->sc_intr);
#endif
if (ISSB16CLASS(sc)) {
irq = sbdsp_mix_read(sc, SBP_IRQ_STATUS);
@ -1977,3 +2039,34 @@ sbdsp_mixer_query_devinfo(addr, dip)
return ENXIO;
}
void *
sb_malloc(addr, size, pool, flags)
void *addr;
unsigned long size;
int pool;
int flags;
{
struct sbdsp_softc *sc = addr;
return isa_malloc(sc->sc_isa, 4, size, pool, flags);
}
void
sb_free(addr, ptr, pool)
void *addr;
void *ptr;
int pool;
{
isa_free(ptr, pool);
}
unsigned long
sb_round(addr, size)
void *addr;
unsigned long size;
{
if (size > MAX_ISADMA)
size = MAX_ISADMA;
return size;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbdspvar.h,v 1.23 1997/06/06 23:44:04 thorpej Exp $ */
/* $NetBSD: sbdspvar.h,v 1.24 1997/07/27 01:17:08 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -174,6 +174,8 @@ int sbdsp_get_avail_out_ports __P((void *));
int sbdsp_speaker_ctl __P((void *, int));
int sbdsp_commit_settings __P((void *));
int sbdsp_dma_init_input __P((void *, void *, int));
int sbdsp_dma_init_output __P((void *, void *, int));
int sbdsp_dma_output __P((void *, void *, int, void (*)(void *), void*));
int sbdsp_dma_input __P((void *, void *, int, void (*)(void *), void*));
@ -202,4 +204,9 @@ int sbdsp_mixer_set_port __P((void *, mixer_ctrl_t *));
int sbdsp_mixer_get_port __P((void *, mixer_ctrl_t *));
int sbdsp_mixer_query_devinfo __P((void *, mixer_devinfo_t *));
void *sb_malloc __P((void *, unsigned long, int, int));
void sb_free __P((void *, void *, int));
unsigned long sb_round __P((void *, unsigned long));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: wss.c,v 1.26 1997/06/06 23:44:09 thorpej Exp $ */
/* $NetBSD: wss.c,v 1.27 1997/07/27 01:17:09 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@ -171,6 +171,8 @@ struct audio_hw_if wss_hw_if = {
wss_set_in_port,
wss_get_in_port,
ad1848_commit_settings,
ad1848_dma_init_output,
ad1848_dma_init_input,
ad1848_dma_output,
ad1848_dma_input,
ad1848_halt_out_dma,
@ -183,7 +185,10 @@ struct audio_hw_if wss_hw_if = {
wss_mixer_set_port,
wss_mixer_get_port,
wss_query_devinfo,
0, /* not full-duplex */
ad1848_malloc,
ad1848_free,
ad1848_round,
AUDIO_PROP_MMAP,
0
};
@ -224,7 +229,7 @@ wssprobe(parent, match, aux)
return 0;
}
/* map the ports upto the AD1488 port */
/* Map the ports upto the AD1848 port */
if (bus_space_map(sc->sc_iot, ia->ia_iobase, WSS_CODEC, 0, &sc->sc_ioh))
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: audioio.h,v 1.11 1997/07/15 07:46:22 augustss Exp $ */
/* $NetBSD: audioio.h,v 1.12 1997/07/27 01:17:10 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -73,7 +73,7 @@ struct audio_info {
u_int mode; /* current device mode */
#define AUMODE_PLAY 0x01
#define AUMODE_RECORD 0x02
#define AUMODE_PLAY_ALL 0x04 /* play all samples--no real-time correction */
#define AUMODE_PLAY_ALL 0x04 /* don't do real-time correction */
};
typedef struct audio_info audio_info_t;
@ -99,6 +99,12 @@ typedef struct audio_device {
char config[MAX_AUDIO_DEV_LEN];
} audio_device_t;
typedef struct audio_offset {
u_int samples; /* Total number of bytes transferred */
u_int deltablks; /* Blocks transferred since last checked */
u_int offset; /* Physical transfer offset in buffer */
} audio_offset_t;
/*
* Supported audio encodings
*/
@ -140,6 +146,11 @@ typedef struct audio_encoding {
#define AUDIO_GETFD _IOR('A', 29, int)
#define AUDIO_SETFD _IOWR('A', 30, int)
#define AUDIO_PERROR _IOR('A', 31, int)
#define AUDIO_GETIOFFS _IOR('A', 32, struct audio_offset)
#define AUDIO_GETOOFFS _IOR('A', 33, struct audio_offset)
#define AUDIO_GETPROPS _IOR('A', 34, int)
#define AUDIO_PROP_FULLDUPLEX 0x01
#define AUDIO_PROP_MMAP 0x02
/*
* Mixer device