1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-25 16:13:17 +00:00

My first shot at get sound to work on the emulator.

Inspired by the work Amancio Hasty has done, but implemented
somewhat differently.
This commit is contained in:
Søren Schmidt 1995-12-29 22:12:14 +00:00
parent e896b7b2a3
commit bb5889bdb5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13111
6 changed files with 254 additions and 16 deletions

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux.h,v 1.1 1995/06/25 17:32:32 sos Exp $
* $Id: linux.h,v 1.2 1995/11/22 07:43:43 bde Exp $
*/
#ifndef _I386_LINUX_LINUX_H_
@ -403,6 +403,24 @@ extern int linux_to_bsd_signal[];
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
/* Sound system defines */
#define LINUX_SNDCTL_DSP_RESET 0x5000
#define LINUX_SNDCTL_DSP_SYNC 0x5001
#define LINUX_SNDCTL_DSP_SPEED 0x5002
#define LINUX_SNDCTL_DSP_STEREO 0x5003
#define LINUX_SNDCTL_DSP_GETBLKSIZE 0x5004
#define LINUX_SNDCTL_DSP_SETBLKSIZE 0x5004
#define LINUX_SNDCTL_DSP_SETFMT 0x5005
#define LINUX_SOUND_PCM_WRITE_CHANNELS 0x5006
#define LINUX_SOUND_PCM_WRITE_FILTER 0x5007
#define LINUX_SNDCTL_DSP_POST 0x5008
#define LINUX_SNDCTL_DSP_SUBDIVIDE 0x5009
#define LINUX_SNDCTL_DSP_SETFRAGMENT 0x500A
#define LINUX_SNDCTL_DSP_GETFMTS 0x500B
#define LINUX_SNDCTL_DSP_GETOSPACE 0x500C
#define LINUX_SNDCTL_DSP_GETISPACE 0x500D
#define LINUX_SNDCTL_DSP_NONBLOCK 0x500E
#ifdef KERNEL
caddr_t ua_alloc_init __P((int len));
caddr_t ua_alloc __P((int len));

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_ioctl.c,v 1.2 1995/11/22 07:43:46 bde Exp $
* $Id: linux_ioctl.c,v 1.3 1995/12/15 03:06:52 peter Exp $
*/
#include <sys/param.h>
@ -40,6 +40,7 @@
#include <sys/termios.h>
#include <machine/console.h>
#include <machine/soundcard.h>
#include <i386/linux/linux.h>
#include <i386/linux/sysproto.h>
@ -469,7 +470,6 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args, int *retval)
default:
return EINVAL;
}
break;
case LINUX_TIOCGETD:
bsd_line = TTYDISC;
@ -490,6 +490,67 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args, int *retval)
}
return copyout(&linux_line, (caddr_t)args->arg,
sizeof(int));
case LINUX_SNDCTL_DSP_RESET:
args->cmd = SNDCTL_DSP_RESET;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SYNC:
args->cmd = SNDCTL_DSP_SYNC;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SPEED:
args->cmd = SNDCTL_DSP_SPEED;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_STEREO:
args->cmd = SNDCTL_DSP_STEREO;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_GETBLKSIZE:
/* LINUX_SNDCTL_DSP_SETBLKSIZE */
args->cmd = SNDCTL_DSP_GETBLKSIZE;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SETFMT:
args->cmd = SNDCTL_DSP_SETFMT;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SOUND_PCM_WRITE_CHANNELS:
args->cmd = SOUND_PCM_WRITE_CHANNELS;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SOUND_PCM_WRITE_FILTER:
args->cmd = SOUND_PCM_WRITE_FILTER;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_POST:
args->cmd = SNDCTL_DSP_POST;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SUBDIVIDE:
args->cmd = SNDCTL_DSP_SUBDIVIDE;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SETFRAGMENT:
args->cmd = SNDCTL_DSP_SETFRAGMENT;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_GETFMTS:
args->cmd = SNDCTL_DSP_GETFMTS;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_GETOSPACE:
args->cmd = SNDCTL_DSP_GETOSPACE;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_GETISPACE:
args->cmd = SNDCTL_DSP_GETISPACE;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_NONBLOCK:
args->cmd = SNDCTL_DSP_NONBLOCK;
return ioctl(p, (struct ioctl_args *)args, retval);
}
uprintf("LINUX: 'ioctl' fd=%d, typ=0x%x(%c), num=0x%x not implemented\n",
args->fd, (args->cmd&0xffff00)>>8,

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_ipc.c,v 1.2 1995/11/22 07:43:47 bde Exp $
* $Id: linux_ipc.c,v 1.3 1995/12/15 05:07:20 peter Exp $
*/
#include <sys/param.h>
@ -143,25 +143,65 @@ linux_semctl(struct proc *p, struct linux_ipc_args *args, int *retval)
int
linux_msgsnd(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
struct msgsnd_args /* {
int msqid;
void *msgp;
size_t msgsz;
int msgflg;
} */ bsd_args;
bsd_args.msqid = args->arg1;
bsd_args.msgp = args->ptr;
bsd_args.msgsz = args->arg2;
bsd_args.msgflg = args->arg3;
return msgsnd(p, &bsd_args, retval);
}
int
linux_msgrcv(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
struct msgrcv_args /* {
int msqid;
void *msgp;
size_t msgsz;
long msgtyp;
int msgflg;
} */ bsd_args;
bsd_args.msqid = args->arg1;
bsd_args.msgp = args->ptr;
bsd_args.msgsz = args->arg2;
bsd_args.msgtyp = 0;
bsd_args.msgflg = args->arg3;
return msgrcv(p, &bsd_args, retval);
}
int
linux_msgget(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
struct msgget_args /* {
key_t key;
int msgflg;
} */ bsd_args;
bsd_args.key = args->arg1;
bsd_args.msgflg = args->arg2;
return msgget(p, &bsd_args, retval);
}
int
linux_msgctl(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
struct msgctl_args /* {
int msqid;
int cmd;
struct msqid_ds *buf;
} */ bsd_args;
bsd_args.msqid = args->arg1;
bsd_args.cmd = args->arg2;
bsd_args.buf = (struct msqid_ds *)args->ptr;
return msgctl(p, &bsd_args, retval);
}
int

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux.h,v 1.1 1995/06/25 17:32:32 sos Exp $
* $Id: linux.h,v 1.2 1995/11/22 07:43:43 bde Exp $
*/
#ifndef _I386_LINUX_LINUX_H_
@ -403,6 +403,24 @@ extern int linux_to_bsd_signal[];
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
/* Sound system defines */
#define LINUX_SNDCTL_DSP_RESET 0x5000
#define LINUX_SNDCTL_DSP_SYNC 0x5001
#define LINUX_SNDCTL_DSP_SPEED 0x5002
#define LINUX_SNDCTL_DSP_STEREO 0x5003
#define LINUX_SNDCTL_DSP_GETBLKSIZE 0x5004
#define LINUX_SNDCTL_DSP_SETBLKSIZE 0x5004
#define LINUX_SNDCTL_DSP_SETFMT 0x5005
#define LINUX_SOUND_PCM_WRITE_CHANNELS 0x5006
#define LINUX_SOUND_PCM_WRITE_FILTER 0x5007
#define LINUX_SNDCTL_DSP_POST 0x5008
#define LINUX_SNDCTL_DSP_SUBDIVIDE 0x5009
#define LINUX_SNDCTL_DSP_SETFRAGMENT 0x500A
#define LINUX_SNDCTL_DSP_GETFMTS 0x500B
#define LINUX_SNDCTL_DSP_GETOSPACE 0x500C
#define LINUX_SNDCTL_DSP_GETISPACE 0x500D
#define LINUX_SNDCTL_DSP_NONBLOCK 0x500E
#ifdef KERNEL
caddr_t ua_alloc_init __P((int len));
caddr_t ua_alloc __P((int len));

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_ioctl.c,v 1.2 1995/11/22 07:43:46 bde Exp $
* $Id: linux_ioctl.c,v 1.3 1995/12/15 03:06:52 peter Exp $
*/
#include <sys/param.h>
@ -40,6 +40,7 @@
#include <sys/termios.h>
#include <machine/console.h>
#include <machine/soundcard.h>
#include <i386/linux/linux.h>
#include <i386/linux/sysproto.h>
@ -469,7 +470,6 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args, int *retval)
default:
return EINVAL;
}
break;
case LINUX_TIOCGETD:
bsd_line = TTYDISC;
@ -490,6 +490,67 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args, int *retval)
}
return copyout(&linux_line, (caddr_t)args->arg,
sizeof(int));
case LINUX_SNDCTL_DSP_RESET:
args->cmd = SNDCTL_DSP_RESET;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SYNC:
args->cmd = SNDCTL_DSP_SYNC;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SPEED:
args->cmd = SNDCTL_DSP_SPEED;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_STEREO:
args->cmd = SNDCTL_DSP_STEREO;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_GETBLKSIZE:
/* LINUX_SNDCTL_DSP_SETBLKSIZE */
args->cmd = SNDCTL_DSP_GETBLKSIZE;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SETFMT:
args->cmd = SNDCTL_DSP_SETFMT;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SOUND_PCM_WRITE_CHANNELS:
args->cmd = SOUND_PCM_WRITE_CHANNELS;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SOUND_PCM_WRITE_FILTER:
args->cmd = SOUND_PCM_WRITE_FILTER;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_POST:
args->cmd = SNDCTL_DSP_POST;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SUBDIVIDE:
args->cmd = SNDCTL_DSP_SUBDIVIDE;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_SETFRAGMENT:
args->cmd = SNDCTL_DSP_SETFRAGMENT;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_GETFMTS:
args->cmd = SNDCTL_DSP_GETFMTS;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_GETOSPACE:
args->cmd = SNDCTL_DSP_GETOSPACE;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_GETISPACE:
args->cmd = SNDCTL_DSP_GETISPACE;
return ioctl(p, (struct ioctl_args *)args, retval);
case LINUX_SNDCTL_DSP_NONBLOCK:
args->cmd = SNDCTL_DSP_NONBLOCK;
return ioctl(p, (struct ioctl_args *)args, retval);
}
uprintf("LINUX: 'ioctl' fd=%d, typ=0x%x(%c), num=0x%x not implemented\n",
args->fd, (args->cmd&0xffff00)>>8,

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_ipc.c,v 1.2 1995/11/22 07:43:47 bde Exp $
* $Id: linux_ipc.c,v 1.3 1995/12/15 05:07:20 peter Exp $
*/
#include <sys/param.h>
@ -143,25 +143,65 @@ linux_semctl(struct proc *p, struct linux_ipc_args *args, int *retval)
int
linux_msgsnd(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
struct msgsnd_args /* {
int msqid;
void *msgp;
size_t msgsz;
int msgflg;
} */ bsd_args;
bsd_args.msqid = args->arg1;
bsd_args.msgp = args->ptr;
bsd_args.msgsz = args->arg2;
bsd_args.msgflg = args->arg3;
return msgsnd(p, &bsd_args, retval);
}
int
linux_msgrcv(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
struct msgrcv_args /* {
int msqid;
void *msgp;
size_t msgsz;
long msgtyp;
int msgflg;
} */ bsd_args;
bsd_args.msqid = args->arg1;
bsd_args.msgp = args->ptr;
bsd_args.msgsz = args->arg2;
bsd_args.msgtyp = 0;
bsd_args.msgflg = args->arg3;
return msgrcv(p, &bsd_args, retval);
}
int
linux_msgget(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
struct msgget_args /* {
key_t key;
int msgflg;
} */ bsd_args;
bsd_args.key = args->arg1;
bsd_args.msgflg = args->arg2;
return msgget(p, &bsd_args, retval);
}
int
linux_msgctl(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
struct msgctl_args /* {
int msqid;
int cmd;
struct msqid_ds *buf;
} */ bsd_args;
bsd_args.msqid = args->arg1;
bsd_args.cmd = args->arg2;
bsd_args.buf = (struct msqid_ds *)args->ptr;
return msgctl(p, &bsd_args, retval);
}
int