From 58acdd095c1ac25ac70f9992f1aca1b76d8acc9c Mon Sep 17 00:00:00 2001 From: sos Date: Fri, 29 Dec 1995 22:12:14 +0000 Subject: [PATCH] My first shot at get sound to work on the emulator. Inspired by the work Amancio Hasty has done, but implemented somewhat differently. --- sys/alpha/linux/linux.h | 20 ++++++++++- sys/compat/linux/linux_ioctl.c | 65 ++++++++++++++++++++++++++++++++-- sys/compat/linux/linux_ipc.c | 50 +++++++++++++++++++++++--- sys/i386/linux/linux.h | 20 ++++++++++- sys/i386/linux/linux_ioctl.c | 65 ++++++++++++++++++++++++++++++++-- sys/i386/linux/linux_ipc.c | 50 +++++++++++++++++++++++--- 6 files changed, 254 insertions(+), 16 deletions(-) diff --git a/sys/alpha/linux/linux.h b/sys/alpha/linux/linux.h index 9cc1fedc731c..22bc387e6031 100644 --- a/sys/alpha/linux/linux.h +++ b/sys/alpha/linux/linux.h @@ -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)); diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index ebdc850c9e31..60730718e93b 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -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 @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -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, diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c index 8327b20eb2af..4973c8d36225 100644 --- a/sys/compat/linux/linux_ipc.c +++ b/sys/compat/linux/linux_ipc.c @@ -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 @@ -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 diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 9cc1fedc731c..22bc387e6031 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -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)); diff --git a/sys/i386/linux/linux_ioctl.c b/sys/i386/linux/linux_ioctl.c index ebdc850c9e31..60730718e93b 100644 --- a/sys/i386/linux/linux_ioctl.c +++ b/sys/i386/linux/linux_ioctl.c @@ -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 @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -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, diff --git a/sys/i386/linux/linux_ipc.c b/sys/i386/linux/linux_ipc.c index 8327b20eb2af..4973c8d36225 100644 --- a/sys/i386/linux/linux_ipc.c +++ b/sys/i386/linux/linux_ipc.c @@ -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 @@ -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