Fix a serious emulation bug.
Add some missing #defines. Add a little more documentation.
This commit is contained in:
parent
87ca153bb5
commit
a1338abe8c
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: ossaudio.3,v 1.4 1997/10/26 23:50:30 augustss Exp $
|
||||
.\" $NetBSD: ossaudio.3,v 1.5 1997/10/29 00:31:01 augustss Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -50,10 +50,22 @@ library only for porting programs.
|
|||
.Sh SEE ALSO
|
||||
.Xr audio 4
|
||||
.Sh BUGS
|
||||
The emulation uses an #define for ioctl() so some obscure programs
|
||||
The emulation uses an #define for
|
||||
.Va ioctl()
|
||||
so some obscure programs
|
||||
can fail to compile.
|
||||
.Pp
|
||||
The emulation is incomplete.
|
||||
.Pp
|
||||
The emulation only covers
|
||||
.Va ioctl() ,
|
||||
there are other differences as well. E.g., on a write
|
||||
that would block in non-blocking mode Linux returns
|
||||
.Dv EINTR
|
||||
whereas
|
||||
.Nx 1.3
|
||||
returns
|
||||
.Dv EWOULDBLOCK .
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ossaudio.c,v 1.3 1997/10/26 23:50:33 augustss Exp $ */
|
||||
/* $NetBSD: ossaudio.c,v 1.4 1997/10/29 00:31:06 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -132,6 +132,7 @@ audio_ioctl(int fd, unsigned long com, void *argp)
|
|||
INTARG = tmpinfo.blocksize;
|
||||
break;
|
||||
case SNDCTL_DSP_SETFMT:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
switch (INTARG) {
|
||||
case AFMT_MU_LAW:
|
||||
tmpinfo.play.precision =
|
||||
|
@ -184,7 +185,6 @@ audio_ioctl(int fd, unsigned long com, void *argp)
|
|||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
(void) ioctl(fd, AUDIO_SETINFO, &tmpinfo);
|
||||
/* fall into ... */
|
||||
case SOUND_PCM_READ_BITS:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: soundcard.h,v 1.2 1997/10/26 23:50:36 augustss Exp $ */
|
||||
/* $NetBSD: soundcard.h,v 1.3 1997/10/29 00:31:11 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -52,6 +52,17 @@
|
|||
#define SNDCTL_DSP_STEREO _IOWR('P', 3, int)
|
||||
#define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int)
|
||||
#define SNDCTL_DSP_SETFMT _IOWR('P', 5, int)
|
||||
#define AFMT_QUERY 0x00000000
|
||||
#define AFMT_MU_LAW 0x00000001
|
||||
#define AFMT_A_LAW 0x00000002
|
||||
#define AFMT_IMA_ADPCM 0x00000004
|
||||
#define AFMT_U8 0x00000008
|
||||
#define AFMT_S16_LE 0x00000010
|
||||
#define AFMT_S16_BE 0x00000020
|
||||
#define AFMT_S8 0x00000040
|
||||
#define AFMT_U16_LE 0x00000080
|
||||
#define AFMT_U16_BE 0x00000100
|
||||
#define AFMT_MPEG 0x00000200
|
||||
#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
|
||||
#define SOUND_PCM_READ_BITS _IOR ('P', 5, int)
|
||||
#define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int)
|
||||
|
@ -89,17 +100,41 @@
|
|||
#define APF_NETWORK 1
|
||||
#define APF_CPUINTENS 2
|
||||
|
||||
#define AFMT_QUERY 0x00000000
|
||||
#define AFMT_MU_LAW 0x00000001
|
||||
#define AFMT_A_LAW 0x00000002
|
||||
#define AFMT_IMA_ADPCM 0x00000004
|
||||
#define AFMT_U8 0x00000008
|
||||
#define AFMT_S16_LE 0x00000010
|
||||
#define AFMT_S16_BE 0x00000020
|
||||
#define AFMT_S8 0x00000040
|
||||
#define AFMT_U16_LE 0x00000080
|
||||
#define AFMT_U16_BE 0x00000100
|
||||
#define AFMT_MPEG 0x00000200
|
||||
/* Need native 16 bit format which depends on byte order */
|
||||
/* XXX This isn't really a good way, but I don't want to
|
||||
* include all of endian.h because it contains a lot
|
||||
* junk symbols. [augustss]
|
||||
*/
|
||||
#define _POSIX_SOURCE /* avoid dragging in a lot of junk */
|
||||
#include <machine/endian.h>
|
||||
#if _QUAD_LOWWORD == 0
|
||||
#define AFMT_S16_NE AFMT_S16_LE
|
||||
#else
|
||||
#define AFMT_S16_NE AFMT_S16_BE
|
||||
#endif
|
||||
|
||||
|
||||
/* Aliases */
|
||||
#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT
|
||||
#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
|
||||
#define SOUND_PCM_POST SNDCTL_DSP_POST
|
||||
#define SOUND_PCM_RESET SNDCTL_DSP_RESET
|
||||
#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
|
||||
#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
|
||||
#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT
|
||||
#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS
|
||||
#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT
|
||||
#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE
|
||||
#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE
|
||||
#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK
|
||||
#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS
|
||||
#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER
|
||||
#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER
|
||||
#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO
|
||||
#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR
|
||||
#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR
|
||||
#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF
|
||||
#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF
|
||||
|
||||
/* Mixer defines */
|
||||
#define SOUND_MIXER_FIRST 0
|
||||
|
|
Loading…
Reference in New Issue