diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2013-03-15 09:10:53 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2013-03-15 09:10:53 +0000 |
commit | 49aac2bac6f6269f9e44cf55dc4de415e2a24efc (patch) | |
tree | 85a487a578e55d597c61aea9298132b9ed5c669a | |
parent | 34d0cca60db6731f475f499a11e845c965fd5519 (diff) |
Delete the sequencer(4) driver, since its not used any longer. Diff
mostly from armani.
ok miod, mpi, jsg and help from sthen
31 files changed, 35 insertions, 1891 deletions
diff --git a/etc/MAKEDEV.common b/etc/MAKEDEV.common index b0459b00070..b4f4e9c1e19 100644 --- a/etc/MAKEDEV.common +++ b/etc/MAKEDEV.common @@ -1,4 +1,4 @@ -vers(a, {-$OpenBSD: MAKEDEV.common,v 1.61 2013/01/30 01:59:20 yasuoka Exp $-})dnl +vers(a, {-$OpenBSD: MAKEDEV.common,v 1.62 2013/03/15 09:10:52 ratchov Exp $-})dnl dnl dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org> dnl @@ -155,7 +155,6 @@ target(all, uk, 0)dnl twrget(all, vi, video, 0, 1)dnl twrget(all, speak, speaker)dnl target(all, asc, 0)dnl -target(all, music, 0)dnl target(all, radio, 0)dnl target(all, tuner, 0)dnl target(all, rmidi, 0, 1, 2, 3, 4, 5, 6, 7)dnl @@ -447,11 +446,6 @@ __devitem(asc, asc*, ASC Audio device)dnl _mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl __devitem(bio, bio, {-ioctl tunnel pseudo-device-})dnl _mkdev(bio, bio, {-M bio c major_bio_c 0 600-})dnl -__devitem(music, music*, MIDI sequencer,music)dnl -_mkdev(music, music*, {-M music$U c major_music_c $U - M sequencer$U c major_music_c Add($U, 128) - MKlist[${#MKlist[*]}]=";[ -e music ] || ln -s music$U music" - MKlist[${#MKlist[*]}]=";[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl __devitem(radio, radio*, FM tuner devices)dnl _mkdev(radio, radio*, {-M radio$U c major_radio_c $U MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio"-})dnl diff --git a/etc/etc.alpha/MAKEDEV.md b/etc/etc.alpha/MAKEDEV.md index e625cf8e847..afb44557ba8 100644 --- a/etc/etc.alpha/MAKEDEV.md +++ b/etc/etc.alpha/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,alpha)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.55 2012/08/23 06:15:28 deraadt Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.56 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org> @@ -72,7 +72,6 @@ _DEV(fdesc, 10) _DEV(hotplug, 56) _DEV(iop, 54) _DEV(lkm, 16) -_DEV(music, 42) _DEV(pci, 52) _DEV(pf, 35) _DEV(pppx, 64) diff --git a/etc/etc.amd64/MAKEDEV.md b/etc/etc.amd64/MAKEDEV.md index 7b454c4ee78..06f13232b2b 100644 --- a/etc/etc.amd64/MAKEDEV.md +++ b/etc/etc.amd64/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,amd64)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.48 2012/08/23 06:15:28 deraadt Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.49 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org> @@ -83,7 +83,6 @@ _DEV(hotplug, 82) _DEV(iop, 75) dnl _DEV(joy, 26) _DEV(lkm, 28) -_DEV(music, 53) _DEV(nvram, 85) _DEV(pci, 72) _DEV(pctr, 46) diff --git a/etc/etc.armish/MAKEDEV.md b/etc/etc.armish/MAKEDEV.md index 49ff43b8642..afb52225108 100644 --- a/etc/etc.armish/MAKEDEV.md +++ b/etc/etc.armish/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,armish)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.25 2012/08/23 06:15:28 deraadt Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.26 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org> @@ -77,7 +77,6 @@ _DEV(fdesc, 7) _DEV(hotplug, 37) _DEV(iop, 73) _DEV(lkm, 35) -_DEV(music, 58) _DEV(pci, 88) _DEV(pf, 46) _DEV(pppx, 103) diff --git a/etc/etc.beagle/MAKEDEV.md b/etc/etc.beagle/MAKEDEV.md index e85836e6721..2b3c122d3b9 100644 --- a/etc/etc.beagle/MAKEDEV.md +++ b/etc/etc.beagle/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,beagle)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.3 2012/08/23 06:15:28 deraadt Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.4 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org> @@ -77,7 +77,6 @@ _DEV(fdesc, 7) _DEV(hotplug, 37) _DEV(iop, 73) _DEV(lkm, 35) -_DEV(music, 58) _DEV(pci, 88) _DEV(pf, 46) _DEV(pppx, 103) diff --git a/etc/etc.i386/MAKEDEV.md b/etc/etc.i386/MAKEDEV.md index ccb4ed2135c..a027cbc05a1 100644 --- a/etc/etc.i386/MAKEDEV.md +++ b/etc/etc.i386/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,i386)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.63 2012/08/23 06:15:28 deraadt Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.64 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org> @@ -86,7 +86,6 @@ _DEV(hotplug, 82) _DEV(iop, 75) _DEV(joy, 26) _DEV(lkm, 28) -_DEV(music, 53) _DEV(nvram, 84) _DEV(pci, 72) _DEV(pctr, 46) diff --git a/etc/etc.landisk/MAKEDEV.md b/etc/etc.landisk/MAKEDEV.md index 9377c2eb668..ee43f6ea43e 100644 --- a/etc/etc.landisk/MAKEDEV.md +++ b/etc/etc.landisk/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,landisk)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.27 2012/08/23 06:15:28 deraadt Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.28 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org> @@ -81,7 +81,6 @@ _DEV(fdesc, 7) _DEV(hotplug, 37) dnl _DEV(iop, 73) _DEV(lkm, 35) -_DEV(music, 58) _DEV(pci, 88) _DEV(pf, 46) _DEV(pppx,102) diff --git a/etc/etc.macppc/MAKEDEV.md b/etc/etc.macppc/MAKEDEV.md index 387f79875fb..f5fce6db760 100644 --- a/etc/etc.macppc/MAKEDEV.md +++ b/etc/etc.macppc/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,macppc)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.52 2012/12/04 10:44:20 mpi Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.53 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org> @@ -98,7 +98,6 @@ _DEV(pppx, 85) _DEV(radio, 76) _DEV(rnd, 40) _DEV(rmidi, 52) -_DEV(music, 53) _DEV(systrace, 50) _DEV(tun, 23) _DEV(tuner, 75) diff --git a/etc/etc.palm/MAKEDEV.md b/etc/etc.palm/MAKEDEV.md index 18e6d658c04..1b46ff1c042 100644 --- a/etc/etc.palm/MAKEDEV.md +++ b/etc/etc.palm/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,palm)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.12 2012/08/23 06:15:28 deraadt Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.13 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org> @@ -76,7 +76,6 @@ _DEV(diskmap, 102) _DEV(fdesc, 7) _DEV(hotplug, 37) _DEV(lkm, 35) -_DEV(music, 58) _DEV(pf, 46) _DEV(pppx, 103) _DEV(radio, 97) diff --git a/etc/etc.zaurus/MAKEDEV.md b/etc/etc.zaurus/MAKEDEV.md index ab72aa2f071..eb5c6d3ad51 100644 --- a/etc/etc.zaurus/MAKEDEV.md +++ b/etc/etc.zaurus/MAKEDEV.md @@ -1,6 +1,6 @@ define(MACHINE,zaurus)dnl vers(__file__, - {-$OpenBSD: MAKEDEV.md,v 1.31 2012/08/23 06:15:28 deraadt Exp $-}, + {-$OpenBSD: MAKEDEV.md,v 1.32 2013/03/15 09:10:52 ratchov Exp $-}, etc.MACHINE)dnl dnl dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org> @@ -76,7 +76,6 @@ _DEV(diskmap, 102) _DEV(fdesc, 7) _DEV(hotplug, 37) _DEV(lkm, 35) -_DEV(music, 58) _DEV(pf, 46) _DEV(pppx, 103) _DEV(radio, 97) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 3c99efa6bd4..0da50795132 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.544 2013/03/14 11:18:37 mpi Exp $ +# $OpenBSD: Makefile,v 1.545 2013/03/15 09:10:52 ratchov Exp $ MAN= aac.4 ac97.4 acphy.4 \ acpi.4 acpiac.4 acpiasus.4 acpibat.4 acpibtn.4 acpicpu.4 acpidock.4 \ @@ -50,7 +50,7 @@ MAN= aac.4 ac97.4 acphy.4 \ rtfps.4 rtii.4 rtw.4 safe.4 safte.4 san.4 sbt.4 sbus.4 schsio.4 \ scsi.4 sd.4 \ sdmmc.4 sdhc.4 se.4 ses.4 \ - sequencer.4 sf.4 sf2r.4 sfr.4 sili.4 siop.4 sis.4 sk.4 sl.4 sli.4 \ + sf.4 sf2r.4 sfr.4 sili.4 siop.4 sis.4 sk.4 sl.4 sli.4 \ sm.4 smsc.4 softraid.4 spdmem.4 sdtemp.4 speaker.4 sppp.4 sqphy.4 \ st.4 ste.4 stge.4 sti.4 \ stp.4 sv.4 sym.4 systrace.4 tcic.4 tcp.4 termios.4 tht.4 ti.4 tl.4 \ @@ -88,7 +88,6 @@ MLINKS+=pty.4 ptm.4 MLINKS+=random.4 arandom.4 MLINKS+=random.4 srandom.4 random.4 urandom.4 MLINKS+=scsi.4 scsibus.4 -MLINKS+=sequencer.4 music.4 MLINKS+=sk.4 skc.4 msk.4 mskc.4 MLINKS+=speaker.4 spkr.4 MLINKS+=tht.4 thtc.4 diff --git a/share/man/man4/sequencer.4 b/share/man/man4/sequencer.4 deleted file mode 100644 index f3dc805ab8d..00000000000 --- a/share/man/man4/sequencer.4 +++ /dev/null @@ -1,85 +0,0 @@ -.\" $OpenBSD: sequencer.4,v 1.6 2008/06/26 05:42:07 ray Exp $ -.\" $NetBSD: midi.4,v 1.4 1998/08/22 14:45:35 augustss Exp $ -.\" -.\" Copyright (c) 1997 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd $Mdocdate: June 26 2008 $ -.Dt SEQUENCER 4 -.Os -.Sh NAME -.Nm sequencer -.Nd OSS-compatible MIDI sequencer device -.Sh SYNOPSIS -.Cd "pseudo-device sequencer" Op Ar count -.Pp -.Fd #include <sys/types.h> -.Fd #include <sys/midiio.h> -.Sh DESCRIPTION -The -.Nm -device provides an event-oriented interface simultaneously -to all MIDI ports. -Events sent to or received from this device not only contain the -actual MIDI events, but also timing information. -The kernel will make sure that data is sent to the physical -device at the indicated time. -The -.Nm -device uses the -.Xr midi 4 -devices internally and they are unavailable when used by the -.Nm -device. -.Pp -The API for the -.Nm -device is binary compatible with the OSS sequencer -interface. -.Sh FILES -.Bl -tag -width /dev/sequencer -compact -.It Pa /dev/music -new -.Nm -device using 8-byte events -.It Pa /dev/sequencer -old -.Nm -device using 4-byte events -.El -.Sh SEE ALSO -.Xr midiplay 1 , -.Xr ioctl 2 , -.Xr ossaudio 3 , -.Xr midi 4 -.Sh HISTORY -The -.Nm -driver first appeared in -.Ox 2.5 . -.Sh AUTHORS -The -.Nm -driver was written by -.An Lennart Augustsson . diff --git a/sys/arch/alpha/alpha/conf.c b/sys/arch/alpha/alpha/conf.c index b974d93ed4d..f98728018b6 100644 --- a/sys/arch/alpha/alpha/conf.c +++ b/sys/arch/alpha/alpha/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.69 2012/08/23 06:12:49 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.70 2013/03/15 09:10:52 ratchov Exp $ */ /* $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $ */ /*- @@ -97,8 +97,6 @@ cdev_decl(com); #include "wsmux.h" #include "midi.h" cdev_decl(midi); -#include "sequencer.h" -cdev_decl(music); #include "spkr.h" cdev_decl(spkr); @@ -177,7 +175,7 @@ struct cdevsw cdevsw[] = cdev_ksyms_init(NKSYMS,ksyms), /* 39: Kernel symbols device */ cdev_spkr_init(NSPKR,spkr), /* 40: PC speaker */ cdev_midi_init(NMIDI,midi), /* 41: MIDI I/O */ - cdev_midi_init(NSEQUENCER,sequencer), /* 42: sequencer I/O */ + cdev_notdef(), /* 42 was: sequencer I/O */ cdev_notdef(), /* 43 was: RAIDframe disk driver */ cdev_video_init(NVIDEO,video), /* 44: generic video I/O */ cdev_usb_init(NUSB,usb), /* 45: USB controller */ diff --git a/sys/arch/alpha/conf/GENERIC b/sys/arch/alpha/conf/GENERIC index b9b8dc165cd..e974cf315d5 100644 --- a/sys/arch/alpha/conf/GENERIC +++ b/sys/arch/alpha/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.229 2013/03/09 02:10:47 deraadt Exp $ +# $OpenBSD: GENERIC,v 1.230 2013/03/15 09:10:52 ratchov Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -437,6 +437,5 @@ owtemp* at onewire? # Temperature owctr* at onewire? # Counter device pseudo-device crypto 1 -pseudo-device sequencer 1 pseudo-device hotplug 1 # devices hot plugging pseudo-device wsmux 2 # mouse & keyboard multiplexor diff --git a/sys/arch/amd64/amd64/conf.c b/sys/arch/amd64/amd64/conf.c index d0589694f72..0dd539bac1a 100644 --- a/sys/arch/amd64/amd64/conf.c +++ b/sys/arch/amd64/amd64/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.39 2013/03/02 11:08:38 kettenis Exp $ */ +/* $OpenBSD: conf.c,v 1.40 2013/03/15 09:10:52 ratchov Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -141,8 +141,6 @@ cdev_decl(cy); #include "audio.h" #include "video.h" #include "midi.h" -#include "sequencer.h" -cdev_decl(music); #include "acpi.h" #include "bthub.h" #include "pctr.h" @@ -242,7 +240,7 @@ struct cdevsw cdevsw[] = cdev_ksyms_init(NKSYMS,ksyms), /* 50: Kernel symbols device */ cdev_notdef(), /* 51 */ cdev_midi_init(NMIDI,midi), /* 52: MIDI I/O */ - cdev_midi_init(NSEQUENCER,sequencer), /* 53: sequencer I/O */ + cdev_notdef(), /* 53 was: sequencer I/O */ cdev_notdef(), /* 54 was: RAIDframe disk driver */ cdev_notdef(), /* 55: */ /* The following slots are reserved for isdn4bsd. */ diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index ca0a4b2633c..f37a8a5ed6c 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.337 2013/01/20 10:26:27 brad Exp $ +# $OpenBSD: GENERIC,v 1.338 2013/03/15 09:10:52 ratchov Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -599,7 +599,6 @@ owctr* at onewire? # Counter device pseudo-device pctr 1 pseudo-device nvram 1 -pseudo-device sequencer 1 pseudo-device hotplug 1 # devices hot plugging pseudo-device mtrr 1 # Memory range attributes control diff --git a/sys/arch/arm/arm/conf.c b/sys/arch/arm/arm/conf.c index 93708675ef2..98e24c7c3d2 100644 --- a/sys/arch/arm/arm/conf.c +++ b/sys/arch/arm/arm/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.33 2012/08/23 06:12:49 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.34 2013/03/15 09:10:52 ratchov Exp $ */ /* $NetBSD: conf.c,v 1.10 2002/04/19 01:04:38 wiz Exp $ */ /* @@ -117,7 +117,6 @@ cdev_decl(pci); #include "audio.h" #include "video.h" #include "midi.h" -#include "sequencer.h" /* * USB devices @@ -340,7 +339,7 @@ struct cdevsw cdevsw[] = { cdev_lkm_dummy(), /* 55: Reserved for bypass device */ cdev_notdef(), /* 56: reserved */ cdev_midi_init(NMIDI,midi), /* 57: MIDI I/O */ - cdev_midi_init(NSEQUENCER,sequencer), /* 58: sequencer I/O */ + cdev_notdef(), /* 58 was: sequencer I/O */ cdev_notdef(), /* 59: reserved */ cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 60: frame buffers, etc.*/ cdev_mouse_init(NWSKBD,wskbd), /* 61: keyboards */ diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index 190677ec1c7..8cd8ca28ffd 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.743 2013/01/12 13:02:22 sf Exp $ +# $OpenBSD: GENERIC,v 1.744 2013/03/15 09:10:52 ratchov Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -790,7 +790,6 @@ owctr* at onewire? # Counter device pseudo-device pctr 1 pseudo-device mtrr 1 # Memory range attributes control pseudo-device nvram 1 -pseudo-device sequencer 1 pseudo-device hotplug 1 # devices hot plugging # mouse & keyboard multiplexor pseudo-devices diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index 9e2ee7f5c8d..c8b3d77fd2e 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.141 2012/08/23 06:12:49 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.142 2013/03/15 09:10:52 ratchov Exp $ */ /* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */ /* @@ -142,8 +142,6 @@ cdev_decl(cy); #include "audio.h" #include "video.h" #include "midi.h" -#include "sequencer.h" -cdev_decl(music); #include "joy.h" #include "bthub.h" #include "pctr.h" @@ -246,7 +244,7 @@ struct cdevsw cdevsw[] = cdev_ksyms_init(NKSYMS,ksyms), /* 50: Kernel symbols device */ cdev_notdef(), /* 51 */ cdev_midi_init(NMIDI,midi), /* 52: MIDI I/O */ - cdev_midi_init(NSEQUENCER,sequencer), /* 53: sequencer I/O */ + cdev_notdef(), /* 53 was: sequencer I/O */ cdev_notdef(), /* 54 was: RAIDframe disk driver */ cdev_notdef(), /* 55: */ /* The following slots are reserved for isdn4bsd. */ diff --git a/sys/arch/landisk/landisk/conf.c b/sys/arch/landisk/landisk/conf.c index 23db126a590..8b698828706 100644 --- a/sys/arch/landisk/landisk/conf.c +++ b/sys/arch/landisk/landisk/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.23 2012/08/23 06:12:49 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.24 2013/03/15 09:10:52 ratchov Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -107,7 +107,6 @@ cdev_decl(pci); #include "audio.h" #include "video.h" #include "midi.h" -#include "sequencer.h" /* * USB devices @@ -316,7 +315,7 @@ struct cdevsw cdevsw[] = { cdev_lkm_dummy(), /* 55: Reserved for bypass device */ cdev_notdef(), /* 56: reserved */ cdev_midi_init(NMIDI,midi), /* 57: MIDI I/O */ - cdev_midi_init(NSEQUENCER,sequencer), /* 58: sequencer I/O */ + cdev_notdef(), /* 58 was: sequencer I/O */ cdev_notdef(), /* 59: reserved */ cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 60: frame buffers, etc.*/ cdev_mouse_init(NWSKBD,wskbd), /* 61: keyboards */ diff --git a/sys/arch/macppc/conf/GENERIC b/sys/arch/macppc/conf/GENERIC index 605802f7a3c..186f8bee098 100644 --- a/sys/arch/macppc/conf/GENERIC +++ b/sys/arch/macppc/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.216 2012/12/04 10:58:05 mpi Exp $g +# $OpenBSD: GENERIC,v 1.217 2013/03/15 09:10:52 ratchov Exp $g # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -395,4 +395,3 @@ owctr* at onewire? # Counter device pseudo-device hotplug 1 # devices hot plugging pseudo-device wsmux 2 # mouse & keyboard multiplexor -pseudo-device sequencer 1 diff --git a/sys/arch/macppc/macppc/conf.c b/sys/arch/macppc/macppc/conf.c index 369b9f31cbe..ffe0191c580 100644 --- a/sys/arch/macppc/macppc/conf.c +++ b/sys/arch/macppc/macppc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.50 2012/12/04 10:42:04 mpi Exp $ */ +/* $OpenBSD: conf.c,v 1.51 2013/03/15 09:10:52 ratchov Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -129,7 +129,6 @@ cdev_decl(pci); #include "audio.h" #include "video.h" #include "midi.h" -#include "sequencer.h" #include "pf.h" @@ -197,7 +196,7 @@ struct cdevsw cdevsw[] = { cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */ cdev_notdef(), /* 51 */ cdev_midi_init(NMIDI,midi), /* 52: MIDI I/O */ - cdev_midi_init(NSEQUENCER,sequencer), /* 53: sequencer I/O */ + cdev_notdef(), /* 53 was: sequencer I/O */ cdev_notdef(), /* 54 was: RAIDframe disk driver */ cdev_notdef(), /* 55 */ /* The following slots are reserved for isdn4bsd. */ diff --git a/sys/conf/files b/sys/conf/files index 010c2ec0673..f3c2ec2602c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.541 2013/03/14 11:18:37 mpi Exp $ +# $OpenBSD: files,v 1.542 2013/03/15 09:10:52 ratchov Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -537,7 +537,6 @@ pseudo-device mpe: ifnet, ether pseudo-device vether: ifnet, ether pseudo-device pppx: ifnet -pseudo-device sequencer pseudo-device systrace pseudo-device ksyms @@ -616,7 +615,6 @@ file dev/ic/tc921x.c tc921x file dev/ic/pt2254a.c pt2254a file dev/midi.c midi | midibus needs-flag file dev/mulaw.c mulaw -file dev/sequencer.c sequencer needs-flag file dev/systrace.c systrace needs-flag file dev/vnd.c vnd needs-flag file dev/rnd.c diff --git a/sys/ddb/db_structinfo.c b/sys/ddb/db_structinfo.c index e32d484a367..e0f9b06199c 100644 --- a/sys/ddb/db_structinfo.c +++ b/sys/ddb/db_structinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_structinfo.c,v 1.5 2012/12/05 23:20:15 deraadt Exp $ */ +/* $OpenBSD: db_structinfo.c,v 1.6 2013/03/15 09:10:52 ratchov Exp $ */ /* public domain */ /* * This file is intended to be compiled with debug information, @@ -105,7 +105,6 @@ #include <sys/cdio.h> #include <sys/chio.h> #include <sys/dkio.h> -#include <sys/midiio.h> #include <sys/filio.h> #include <sys/mtio.h> #include <sys/pciio.h> diff --git a/sys/dev/midi.c b/sys/dev/midi.c index db3913acfec..453524f68b4 100644 --- a/sys/dev/midi.c +++ b/sys/dev/midi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midi.c,v 1.28 2012/04/17 07:58:47 ratchov Exp $ */ +/* $OpenBSD: midi.c,v 1.29 2013/03/15 09:10:52 ratchov Exp $ */ /* * Copyright (c) 2003, 2004 Alexandre Ratchov @@ -16,16 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* - * TODO - * - put the sequencer stuff in sequencer.c and sequencervar.h - * there is no reason to have it here. The sequencer - * driver need only to open the midi hw_if thus it does not - * need this driver - */ - -#include "sequencer.h" - #include <sys/param.h> #include <sys/fcntl.h> #include <sys/systm.h> @@ -67,13 +57,6 @@ void midi_out_do(struct midi_softc *); void midi_attach(struct midi_softc *, struct device *); -#if NSEQUENCER > 0 -int midi_unit_count(void); -void midi_toevent(struct midi_softc *, int); -int midi_writebytes(int, u_char *, int); -void midiseq_in(struct midi_dev *, u_char *, int); -#endif - struct cfattach midi_ca = { sizeof(struct midi_softc), midiprobe, midiattach, mididetach }; @@ -107,12 +90,6 @@ midi_iintr(void *addr, int data) if (sc->isdying || !sc->isopen || !(sc->flags & FREAD)) return; -#if NSEQUENCER > 0 - if (sc->seqopen) { - midi_toevent(sc, data); - return; - } -#endif if (MIDIBUF_ISFULL(mb)) return; /* discard data */ @@ -482,11 +459,6 @@ midiopen(dev_t dev, int flags, int mode, struct proc *p) if (err) return err; sc->isopen = 1; -#if NSEQUENCER > 0 - sc->seq_md = 0; - sc->seqopen = 0; - sc->evstatus = 0xff; -#endif return 0; } @@ -644,74 +616,3 @@ midi_unit_count(void) return midi_cd.cd_ndevs; } - -#if NSEQUENCER > 0 -#define MIDI_EVLEN(status) (midi_evlen[((status) >> 4) & 7]) -unsigned midi_evlen[] = { 2, 2, 2, 2, 1, 1, 2 }; - -void -midi_toevent(struct midi_softc *sc, int data) -{ - unsigned char mesg[3]; - - if (data >= 0xf8) { /* is it a realtime message ? */ - switch(data) { - case 0xf8: /* midi timer tic */ - case 0xfa: /* midi timer start */ - case 0xfb: /* midi timer continue (after stop) */ - case 0xfc: /* midi timer stop */ - mesg[0] = data; - midiseq_in(sc->seq_md, mesg, 1); - break; - default: - break; - } - } else if (data >= 0x80) { /* is it a common or voice message ? */ - sc->evstatus = data; - sc->evindex = 0; - } else { /* else it is a data byte */ - /* strip common messages and bogus data */ - if (sc->evstatus >= 0xf0 || sc->evstatus < 0x80) - return; - - sc->evdata[sc->evindex++] = data; - if (sc->evindex == MIDI_EVLEN(sc->evstatus)) { - sc->evindex = 0; - mesg[0] = sc->evstatus; - mesg[1] = sc->evdata[0]; - mesg[2] = sc->evdata[1]; - midiseq_in(sc->seq_md, mesg, 1 + MIDI_EVLEN(sc->evstatus)); - } - } -} - - -int -midi_writebytes(int unit, unsigned char *mesg, int mesglen) -{ - struct midi_softc *sc = midi_cd.cd_devs[unit]; - struct midi_buffer *mb = &sc->outbuf; - unsigned count; - int s; - - s = splaudio(); - if (mesglen > MIDIBUF_AVAIL(mb)) { - splx(s); - return EWOULDBLOCK; - } - - while (mesglen > 0) { - count = MIDIBUF_SIZE - MIDIBUF_END(mb); - if (count > MIDIBUF_AVAIL(mb)) count = MIDIBUF_AVAIL(mb); - if (count > mesglen) count = mesglen; - bcopy(mesg, mb->data + MIDIBUF_END(mb), count); - mb->used += count; - mesg += count; - mesglen -= count; - midi_out_start(sc); - } - splx(s); - return 0; -} - -#endif /* NSEQUENCER > 0 */ diff --git a/sys/dev/midivar.h b/sys/dev/midivar.h index e2987e5c3f7..bbdad7b1622 100644 --- a/sys/dev/midivar.h +++ b/sys/dev/midivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: midivar.h,v 1.6 2012/03/30 08:18:19 ratchov Exp $ */ +/* $OpenBSD: midivar.h,v 1.7 2013/03/15 09:10:52 ratchov Exp $ */ /* * Copyright (c) 2003, 2004 Alexandre Ratchov @@ -30,12 +30,6 @@ #define MIDI_UNIT(a) ((a) & 0xff) #define MIDI_DEV2SC(a) (midi_cd.cd_devs[MIDI_UNIT(a)]) -#include "sequencer.h" - -#if NSEQUENCER > 0 -struct midi_dev; /* defined in sequencervar.h */ -#endif - /* * simple ring buffer */ @@ -91,13 +85,6 @@ struct midi_softc { struct timeout timeo; struct midi_buffer inbuf; struct midi_buffer outbuf; -#if NSEQUENCER > 0 - int seqopen; - struct midi_dev *seq_md; /* structure that links us with the seq. */ - int evindex; - unsigned char evstatus; - unsigned char evdata[2]; -#endif /* NSEQUENCER > 0 */ }; #endif /* _SYS_DEV_MIDIVAR_H_ */ diff --git a/sys/dev/sequencer.c b/sys/dev/sequencer.c deleted file mode 100644 index c50750cf05e..00000000000 --- a/sys/dev/sequencer.c +++ /dev/null @@ -1,1282 +0,0 @@ -/* $OpenBSD: sequencer.c,v 1.22 2011/07/02 22:20:07 nicm Exp $ */ -/* $NetBSD: sequencer.c,v 1.13 1998/11/25 22:17:07 augustss Exp $ */ - -/* - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Lennart Augustsson (augustss@netbsd.org). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/ioctl.h> -#include <sys/fcntl.h> -#include <sys/vnode.h> -#include <sys/selinfo.h> -#include <sys/poll.h> -#include <sys/malloc.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/syslog.h> -#include <sys/kernel.h> -#include <sys/signalvar.h> -#include <sys/conf.h> -#include <sys/audioio.h> -#include <sys/midiio.h> -#include <sys/device.h> - -#include <dev/midi_if.h> -#include <dev/midivar.h> -#include <dev/sequencervar.h> - -#ifndef splaudio -#define splaudio() splbio() /* XXX found in audio_if.h normally */ -#endif - -#define ADDTIMEVAL(a, b) ( \ - (a)->tv_sec += (b)->tv_sec, \ - (a)->tv_usec += (b)->tv_usec, \ - (a)->tv_usec >= 1000000 ? ((a)->tv_sec++, (a)->tv_usec -= 1000000) : 0\ - ) - -#define SUBTIMEVAL(a, b) ( \ - (a)->tv_sec -= (b)->tv_sec, \ - (a)->tv_usec -= (b)->tv_usec, \ - (a)->tv_usec < 0 ? ((a)->tv_sec--, (a)->tv_usec += 1000000) : 0\ - ) - -#ifdef AUDIO_DEBUG -#define DPRINTF(x) if (sequencerdebug) printf x -#define DPRINTFN(n,x) if (sequencerdebug >= (n)) printf x -int sequencerdebug = 0; -#else -#define DPRINTF(x) -#define DPRINTFN(n,x) -#endif - -#define SEQ_CMD(b) ((b)->arr[0]) - -#define SEQ_EDEV(b) ((b)->arr[1]) -#define SEQ_ECMD(b) ((b)->arr[2]) -#define SEQ_ECHAN(b) ((b)->arr[3]) -#define SEQ_ENOTE(b) ((b)->arr[4]) -#define SEQ_EPARM(b) ((b)->arr[5]) - -#define SEQ_EP1(b) ((b)->arr[4]) -#define SEQ_EP2(b) ((b)->arr[5]) - -#define SEQ_XCMD(b) ((b)->arr[1]) -#define SEQ_XDEV(b) ((b)->arr[2]) -#define SEQ_XCHAN(b) ((b)->arr[3]) -#define SEQ_XNOTE(b) ((b)->arr[4]) -#define SEQ_XVEL(b) ((b)->arr[5]) - -#define SEQ_TCMD(b) ((b)->arr[1]) -#define SEQ_TPARM(b) ((b)->arr[4]) - -#define SEQ_NOTE_MAX 128 -#define SEQ_NOTE_XXX 255 -#define SEQ_VEL_OFF 0 - -#define RECALC_TICK(t) ((t)->tick = 60 * 1000000L / ((t)->tempo * (t)->timebase)) - -struct sequencer_softc seqdevs[NSEQUENCER]; - -void sequencerattach(int); -void seq_reset(struct sequencer_softc *); -int seq_do_command(struct sequencer_softc *, seq_event_rec *); -int seq_do_extcommand(struct sequencer_softc *, seq_event_rec *); -int seq_do_chnvoice(struct sequencer_softc *, seq_event_rec *); -int seq_do_chncommon(struct sequencer_softc *, seq_event_rec *); -int seq_do_timing(struct sequencer_softc *, seq_event_rec *); -int seq_do_local(struct sequencer_softc *, seq_event_rec *); -int seq_do_sysex(struct sequencer_softc *, seq_event_rec *); -int seq_do_fullsize(struct sequencer_softc *, seq_event_rec *, - struct uio *); -int seq_timer(struct sequencer_softc *, int, int, seq_event_rec *); -static int seq_input_event(struct sequencer_softc *, seq_event_rec *); -int seq_drain(struct sequencer_softc *); -void seq_startoutput(struct sequencer_softc *); -void seq_timeout(void *); -int seq_to_new(seq_event_rec *, struct uio *); -static int seq_sleep_timo(int *, char *, int); -static int seq_sleep(int *, char *); -static void seq_wakeup(int *); - -struct midi_softc; -int midiseq_out(struct midi_dev *, u_char *, u_int, int); -struct midi_dev *midiseq_open(int, int); -void midiseq_close(struct midi_dev *); -void midiseq_reset(struct midi_dev *); -int midiseq_noteon(struct midi_dev *, int, int, int); -int midiseq_noteoff(struct midi_dev *, int, int, int); -int midiseq_keypressure(struct midi_dev *, int, int, int); -int midiseq_pgmchange(struct midi_dev *, int, int); -int midiseq_chnpressure(struct midi_dev *, int, int); -int midiseq_ctlchange(struct midi_dev *, int, int, int); -int midiseq_pitchbend(struct midi_dev *, int, int); -int midiseq_loadpatch(struct midi_dev *, struct sysex_info *, - struct uio *); -int midiseq_putc(struct midi_dev *, int); -void midiseq_in(struct midi_dev *, u_char *, int); - -void -sequencerattach(int n) -{ -} - -int -sequenceropen(dev_t dev, int flags, int ifmt, struct proc *p) -{ - int unit = SEQUENCERUNIT(dev); - struct sequencer_softc *sc; - struct midi_dev *md; - int nmidi; - - DPRINTF(("sequenceropen\n")); - - if (unit >= NSEQUENCER) - return (ENXIO); - sc = &seqdevs[unit]; - if (sc->isopen) - return (EBUSY); - if (SEQ_IS_OLD(dev)) - sc->mode = SEQ_OLD; - else - sc->mode = SEQ_NEW; - sc->isopen++; - sc->flags = flags & (FREAD|FWRITE); - sc->rchan = 0; - sc->wchan = 0; - sc->pbus = 0; - sc->async = 0; - sc->input_stamp = ~0; - - sc->nmidi = 0; - nmidi = midi_unit_count(); - - sc->devs = malloc(nmidi * sizeof(struct midi_dev *), - M_DEVBUF, M_WAITOK); - for (unit = 0; unit < nmidi; unit++) { - md = midiseq_open(unit, flags); - if (md) { - sc->devs[sc->nmidi++] = md; - md->seq = sc; - } - } - - sc->timer.timebase = 100; - sc->timer.tempo = 60; - sc->doingsysex = 0; - RECALC_TICK(&sc->timer); - sc->timer.last = 0; - microtime(&sc->timer.start); - - SEQ_QINIT(&sc->inq); - SEQ_QINIT(&sc->outq); - sc->lowat = SEQ_MAXQ / 2; - timeout_set(&sc->timo, seq_timeout, sc); - - seq_reset(sc); - - DPRINTF(("sequenceropen: mode=%d, nmidi=%d\n", sc->mode, sc->nmidi)); - return (0); -} - -static int -seq_sleep_timo(int *chan, char *label, int timo) -{ - int st; - - if (!label) - label = "seq"; - - DPRINTFN(5, ("seq_sleep_timo: %p %s %d\n", chan, label, timo)); - *chan = 1; - st = tsleep(chan, PWAIT | PCATCH, label, timo); - *chan = 0; -#ifdef MIDI_DEBUG - if (st != 0) - printf("seq_sleep: %d\n", st); -#endif - return (st); -} - -static int -seq_sleep(int *chan, char *label) -{ - return (seq_sleep_timo(chan, label, 0)); -} - -static void -seq_wakeup(int *chan) -{ - if (*chan) { - DPRINTFN(5, ("seq_wakeup: %p\n", chan)); - wakeup(chan); - *chan = 0; - } -} - -int -seq_drain(struct sequencer_softc *sc) -{ - int error; - - DPRINTFN(3, ("seq_drain: %p, len=%d\n", sc, SEQ_QLEN(&sc->outq))); - seq_startoutput(sc); - error = 0; - while(!SEQ_QEMPTY(&sc->outq) && !error) - error = seq_sleep_timo(&sc->wchan, "seq_dr", 60*hz); - return (error); -} - -void -seq_timeout(void *addr) -{ - struct sequencer_softc *sc = addr; - DPRINTFN(4, ("seq_timeout: %p\n", sc)); - sc->timeout = 0; - seq_startoutput(sc); - if (SEQ_QLEN(&sc->outq) < sc->lowat) { - seq_wakeup(&sc->wchan); - selwakeup(&sc->wsel); - if (sc->async) - psignal(sc->async, SIGIO); - } - -} - -void -seq_startoutput(struct sequencer_softc *sc) -{ - struct sequencer_queue *q = &sc->outq; - seq_event_rec cmd; - - if (sc->timeout) - return; - DPRINTFN(4, ("seq_startoutput: %p, len=%d\n", sc, SEQ_QLEN(q))); - while(!SEQ_QEMPTY(q) && !sc->timeout) { - SEQ_QGET(q, cmd); - seq_do_command(sc, &cmd); - } -} - -int -sequencerclose(dev_t dev, int flags, int ifmt, struct proc *p) -{ - struct sequencer_softc *sc = &seqdevs[SEQUENCERUNIT(dev)]; - int n, s; - - DPRINTF(("sequencerclose: %p\n", sc)); - - seq_drain(sc); - s = splaudio(); - if (sc->timeout) { - timeout_del(&sc->timo); - sc->timeout = 0; - } - splx(s); - - for (n = 0; n < sc->nmidi; n++) - midiseq_close(sc->devs[n]); - free(sc->devs, M_DEVBUF); - sc->isopen = 0; - return (0); -} - -static int -seq_input_event(struct sequencer_softc *sc, seq_event_rec *cmd) -{ - struct sequencer_queue *q = &sc->inq; - - DPRINTFN(2, ("seq_input_event: %02x %02x %02x %02x %02x %02x %02x %02x\n", - cmd->arr[0], cmd->arr[1], cmd->arr[2], cmd->arr[3], - cmd->arr[4], cmd->arr[5], cmd->arr[6], cmd->arr[7])); - if (SEQ_QFULL(q)) - return (ENOMEM); - SEQ_QPUT(q, *cmd); - seq_wakeup(&sc->rchan); - selwakeup(&sc->rsel); - if (sc->async) - psignal(sc->async, SIGIO); - return (0); -} - -void -seq_event_intr(void *addr, seq_event_rec *iev) -{ - struct sequencer_softc *sc = addr; - union { - u_int32_t l; - u_int8_t b[4]; - } u; - u_long t; - struct timeval now; - seq_event_rec ev; - - microtime(&now); - SUBTIMEVAL(&now, &sc->timer.start); - t = now.tv_sec * 1000000 + now.tv_usec; - t /= sc->timer.tick; - if (t != sc->input_stamp) { - ev.arr[0] = SEQ_TIMING; - ev.arr[1] = TMR_WAIT_ABS; - ev.arr[2] = 0; - ev.arr[3] = 0; - u.l = t; - ev.arr[4] = u.b[0]; - ev.arr[5] = u.b[1]; - ev.arr[6] = u.b[2]; - ev.arr[7] = u.b[3]; - seq_input_event(sc, &ev); - sc->input_stamp = t; - } - seq_input_event(sc, iev); -} - -int -sequencerread(dev_t dev, struct uio *uio, int ioflag) -{ - struct sequencer_softc *sc = &seqdevs[SEQUENCERUNIT(dev)]; - struct sequencer_queue *q = &sc->inq; - seq_event_rec ev; - int error, s; - - DPRINTFN(20, ("sequencerread: %p, count=%d, ioflag=%x\n", - sc, uio->uio_resid, ioflag)); - - if (sc->mode == SEQ_OLD) { - DPRINTF(("sequencerread: old read\n")); - return (EINVAL); /* XXX unimplemented */ - } - - error = 0; - while (SEQ_QEMPTY(q)) { - if (ioflag & IO_NDELAY) - return (EWOULDBLOCK); - else { - error = seq_sleep(&sc->rchan, "seq rd"); - if (error) - return (error); - } - } - s = splaudio(); - while (uio->uio_resid >= sizeof ev && !error && !SEQ_QEMPTY(q)) { - SEQ_QGET(q, ev); - error = uiomove((caddr_t)&ev, sizeof ev, uio); - } - splx(s); - return (error); -} - -int -sequencerwrite(dev_t dev, struct uio *uio, int ioflag) -{ - struct sequencer_softc *sc = &seqdevs[SEQUENCERUNIT(dev)]; - struct sequencer_queue *q = &sc->outq; - int error; - seq_event_rec cmdbuf; - int size; - - DPRINTFN(2, ("sequencerwrite: %p, count=%d\n", sc, uio->uio_resid)); - - error = 0; - size = sc->mode == SEQ_NEW ? sizeof cmdbuf : SEQOLD_CMDSIZE; - while (uio->uio_resid >= size) { - error = uiomove((caddr_t)&cmdbuf, size, uio); - if (error) - break; - if (sc->mode == SEQ_OLD) - if (seq_to_new(&cmdbuf, uio)) - continue; - if (SEQ_CMD(&cmdbuf) == SEQ_FULLSIZE) { - /* We do it like OSS does, asynchronously */ - error = seq_do_fullsize(sc, &cmdbuf, uio); - if (error) - break; - continue; - } - while (SEQ_QFULL(q)) { - seq_startoutput(sc); - if (SEQ_QFULL(q)) { - if (ioflag & IO_NDELAY) - return (EWOULDBLOCK); - error = seq_sleep(&sc->wchan, "seq_wr"); - if (error) - return (error); - } - } - SEQ_QPUT(q, cmdbuf); - } - seq_startoutput(sc); - -#ifdef SEQUENCER_DEBUG - if (error) - DPRINTFN(2, ("sequencerwrite: error=%d\n", error)); -#endif - return (error); -} - -int -sequencerioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) -{ - struct sequencer_softc *sc = &seqdevs[SEQUENCERUNIT(dev)]; - struct synth_info *si; - struct midi_dev *md; - int devno; - int error; - int t; - - DPRINTFN(2, ("sequencerioctl: %p cmd=0x%08lx\n", sc, cmd)); - - error = 0; - switch (cmd) { - case FIONBIO: - /* All handled in the upper FS layer. */ - break; - - case FIOASYNC: - if (*(int *)addr) { - if (sc->async) - return (EBUSY); - sc->async = p; - DPRINTF(("sequencer_ioctl: FIOASYNC %p\n", p)); - } else - sc->async = 0; - break; - - case SEQUENCER_RESET: - seq_reset(sc); - break; - - case SEQUENCER_PANIC: - seq_reset(sc); - /* Do more? OSS doesn't */ - break; - - case SEQUENCER_SYNC: - if (sc->flags == FREAD) - return (0); - seq_drain(sc); - error = 0; - break; - - case SEQUENCER_INFO: - si = (struct synth_info*)addr; - devno = si->device; - if (devno < 0 || devno >= sc->nmidi) - return (EINVAL); - md = sc->devs[devno]; - strncpy(si->name, md->name, sizeof si->name); - si->synth_type = SYNTH_TYPE_MIDI; - si->synth_subtype = md->subtype; - si->nr_voices = md->nr_voices; - si->instr_bank_size = md->instr_bank_size; - si->capabilities = md->capabilities; - break; - - case SEQUENCER_NRSYNTHS: - *(int *)addr = sc->nmidi; - break; - - case SEQUENCER_NRMIDIS: - *(int *)addr = sc->nmidi; - break; - - case SEQUENCER_OUTOFBAND: - DPRINTFN(3, ("sequencer_ioctl: OOB=%02x %02x %02x %02x %02x %02x %02x %02x\n", - *(u_char *)addr, *(u_char *)(addr+1), - *(u_char *)(addr+2), *(u_char *)(addr+3), - *(u_char *)(addr+4), *(u_char *)(addr+5), - *(u_char *)(addr+6), *(u_char *)(addr+7))); - error = seq_do_command(sc, (seq_event_rec *)addr); - break; - - case SEQUENCER_TMR_TIMEBASE: - t = *(int *)addr; - if (t < 1) - t = 1; - if (t > 1000) - t = 1000; - sc->timer.timebase = t; - *(int *)addr = t; - RECALC_TICK(&sc->timer); - break; - - case SEQUENCER_TMR_START: - error = seq_timer(sc, TMR_START, 0, 0); - break; - - case SEQUENCER_TMR_STOP: - error = seq_timer(sc, TMR_STOP, 0, 0); - break; - - case SEQUENCER_TMR_CONTINUE: - error = seq_timer(sc, TMR_CONTINUE, 0, 0); - break; - - case SEQUENCER_TMR_TEMPO: - t = *(int *)addr; - if (t < 8) - t = 8; - if (t > 250) - t = 250; - sc->timer.tempo = t; - *(int *)addr = t; - RECALC_TICK(&sc->timer); - break; - - case SEQUENCER_TMR_SOURCE: - *(int *)addr = SEQUENCER_TMR_INTERNAL; - break; - - case SEQUENCER_TMR_METRONOME: - /* noop */ - break; - - case SEQUENCER_THRESHOLD: - t = SEQ_MAXQ - *(int *)addr / sizeof (seq_event_rec); - if (t < 1) - t = 1; - if (t > SEQ_MAXQ) - t = SEQ_MAXQ; - sc->lowat = t; - break; - - case SEQUENCER_CTRLRATE: - *(int *)addr = (sc->timer.tempo*sc->timer.timebase + 30) / 60; - break; - - case SEQUENCER_GETTIME: - { - struct timeval now; - u_long t; - microtime(&now); - SUBTIMEVAL(&now, &sc->timer.start); - t = now.tv_sec * 1000000 + now.tv_usec; - t /= sc->timer.tick; - *(int *)addr = t; - break; - } - - default: - DPRINTF(("sequencer_ioctl: unimpl %08lx\n", cmd)); - error = ENOTTY; - break; - } - return (error); -} - -int -sequencerpoll(dev_t dev, int events, struct proc *p) -{ - struct sequencer_softc *sc = &seqdevs[SEQUENCERUNIT(dev)]; - int revents = 0; - - DPRINTF(("sequencerpoll: %p rw=0x%x\n", sc, events)); - - if (events & (POLLIN | POLLRDNORM)) { - if (!SEQ_QEMPTY(&sc->inq)) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) { - if (SEQ_QLEN(&sc->outq) < sc->lowat) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->rsel); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &sc->wsel); - } - return (revents); -} - -int -sequencerkqfilter(dev_t dev, struct knote *kn) -{ - return (ENXIO); -} - -void -seq_reset(struct sequencer_softc *sc) -{ - int i, chn; - struct midi_dev *md; - - for (i = 0; i < sc->nmidi; i++) { - md = sc->devs[i]; - midiseq_reset(md); - for (chn = 0; chn < MAXCHAN; chn++) { - midiseq_ctlchange(md, chn, MIDI_CTRL_ALLOFF, 0); - midiseq_ctlchange(md, chn, MIDI_CTRL_RESET, 0); - midiseq_pitchbend(md, chn, MIDI_BEND_NEUTRAL); - } - } -} - -int -seq_do_command(struct sequencer_softc *sc, seq_event_rec *b) -{ - int dev; - - DPRINTFN(4, ("seq_do_command: %p cmd=0x%02x\n", sc, SEQ_CMD(b))); - - switch(SEQ_CMD(b)) { - case SEQ_LOCAL: - return (seq_do_local(sc, b)); - case SEQ_TIMING: - return (seq_do_timing(sc, b)); - case SEQ_CHN_VOICE: - return (seq_do_chnvoice(sc, b)); - case SEQ_CHN_COMMON: - return (seq_do_chncommon(sc, b)); - case SEQ_SYSEX: - return (seq_do_sysex(sc, b)); - /* COMPAT */ - case SEQOLD_MIDIPUTC: - dev = b->arr[2]; - if (dev < 0 || dev >= sc->nmidi) - return (ENXIO); - return (midiseq_putc(sc->devs[dev], b->arr[1])); - default: - DPRINTF(("seq_do_command: unimpl command %02x\n", - SEQ_CMD(b))); - return (EINVAL); - } -} - -int -seq_do_chnvoice(struct sequencer_softc *sc, seq_event_rec *b) -{ - int cmd, dev, chan, note, parm, voice; - int error; - struct midi_dev *md; - - dev = SEQ_EDEV(b); - if (dev < 0 || dev >= sc->nmidi) - return (ENXIO); - md = sc->devs[dev]; - cmd = SEQ_ECMD(b); - chan = SEQ_ECHAN(b); - note = SEQ_ENOTE(b); - parm = SEQ_EPARM(b); - DPRINTFN(2,("seq_do_chnvoice: cmd=%02x dev=%d chan=%d note=%d parm=%d\n", - cmd, dev, chan, note, parm)); - voice = chan; - if (cmd == MIDI_NOTEON && parm == 0) { - cmd = MIDI_NOTEOFF; - parm = MIDI_HALF_VEL; - } - switch(cmd) { - case MIDI_NOTEON: - DPRINTFN(5, ("seq_do_chnvoice: noteon %p %d %d %d\n", - md, voice, note, parm)); - error = midiseq_noteon(md, voice, note, parm); - break; - case MIDI_NOTEOFF: - error = midiseq_noteoff(md, voice, note, parm); - break; - case MIDI_KEY_PRESSURE: - error = midiseq_keypressure(md, voice, note, parm); - break; - default: - DPRINTF(("seq_do_chnvoice: unimpl command %02x\n", cmd)); - error = EINVAL; - break; - } - return (error); -} - -int -seq_do_chncommon(struct sequencer_softc *sc, seq_event_rec *b) -{ - int cmd, dev, chan, p1, w14; - int error; - struct midi_dev *md; - union { - int16_t s; - u_int8_t b[2]; - } u; - - dev = SEQ_EDEV(b); - if (dev < 0 || dev >= sc->nmidi) - return (ENXIO); - md = sc->devs[dev]; - cmd = SEQ_ECMD(b); - chan = SEQ_ECHAN(b); - p1 = SEQ_EP1(b); - u.b[0] = b->arr[6]; - u.b[1] = b->arr[7]; - w14 = u.s; - DPRINTFN(2,("seq_do_chncommon: %02x\n", cmd)); - - error = 0; - switch(cmd) { - case MIDI_PGM_CHANGE: - error = midiseq_pgmchange(md, chan, p1); - break; - case MIDI_CTL_CHANGE: - if (chan > 15 || p1 > 127) - return (0); /* EINVAL */ - error = midiseq_ctlchange(md, chan, p1, w14); - break; - case MIDI_PITCH_BEND: - error = midiseq_pitchbend(md, chan, w14); - break; - case MIDI_CHN_PRESSURE: - error = midiseq_chnpressure(md, chan, p1); - break; - default: - DPRINTF(("seq_do_chncommon: unimpl command %02x\n", cmd)); - error = EINVAL; - break; - } - return (error); -} - -int -seq_do_timing(struct sequencer_softc *sc, seq_event_rec *b) -{ - union { - int32_t i; - u_int8_t b[4]; - } u; - - u.b[0] = b->arr[4]; - u.b[1] = b->arr[5]; - u.b[2] = b->arr[6]; - u.b[3] = b->arr[7]; - return (seq_timer(sc, SEQ_TCMD(b), u.i, b)); -} - -int -seq_do_local(struct sequencer_softc *sc, seq_event_rec *b) -{ - return (EINVAL); -} - -int -seq_do_sysex(struct sequencer_softc *sc, seq_event_rec *b) -{ - int dev, i; - struct midi_dev *md; - u_int8_t c, *buf = &b->arr[2]; - - dev = SEQ_EDEV(b); - if (dev < 0 || dev >= sc->nmidi) - return (ENXIO); - DPRINTF(("seq_do_sysex: dev=%d\n", dev)); - md = sc->devs[dev]; - - if (!sc->doingsysex) { - c = MIDI_SYSEX_START; - midiseq_out(md, &c, 1, 0); - sc->doingsysex = 1; - } - - for (i = 0; i < 6 && buf[i] != 0xff; i++) - ; - midiseq_out(md, buf, i, 0); - if (i < 6 || (i > 0 && buf[i-1] == MIDI_SYSEX_END)) - sc->doingsysex = 0; - return (0); -} - -int -seq_timer(struct sequencer_softc *sc, int cmd, int parm, seq_event_rec *b) -{ - struct syn_timer *t = &sc->timer; - struct timeval when; - int ticks; - int error; - long long usec; - - DPRINTFN(2,("seq_timer: %02x %d\n", cmd, parm)); - - error = 0; - switch(cmd) { - case TMR_WAIT_REL: - parm += t->last; - /* FALLTHROUGH */ - case TMR_WAIT_ABS: - t->last = parm; - usec = (long long)parm * (long long)t->tick; /* convert to usec */ - when.tv_sec = usec / 1000000; - when.tv_usec = usec % 1000000; - DPRINTFN(4, ("seq_timer: parm=%d, sleep when=%ld.%06ld", parm, - when.tv_sec, when.tv_usec)); - ADDTIMEVAL(&when, &t->start); /* abstime for end */ - ticks = hzto(&when); - DPRINTFN(4, (" when+start=%ld.%06ld, ticks=%d\n", - when.tv_sec, when.tv_usec, ticks)); - if (ticks > 0) { -#ifdef DIAGNOSTIC - if (ticks > 20 * hz) { - /* Waiting more than 20s */ - printf("seq_timer: funny ticks=%d, usec=%lld, parm=%d, tick=%ld\n", - ticks, usec, parm, t->tick); - } -#endif - sc->timeout = 1; - timeout_add(&sc->timo, ticks); - } -#ifdef SEQUENCER_DEBUG - else if (ticks < 0) - DPRINTF(("seq_timer: ticks = %d\n", ticks)); -#endif - break; - case TMR_START: - microtime(&t->start); - t->running = 1; - break; - case TMR_STOP: - microtime(&t->stop); - t->running = 0; - break; - case TMR_CONTINUE: - microtime(&when); - SUBTIMEVAL(&when, &t->stop); - ADDTIMEVAL(&t->start, &when); - t->running = 1; - break; - case TMR_TEMPO: - /* parm is ticks per minute / timebase */ - if (parm < 8) - parm = 8; - if (parm > 360) - parm = 360; - t->tempo = parm; - RECALC_TICK(t); - break; - case TMR_ECHO: - error = seq_input_event(sc, b); - break; - case TMR_RESET: - t->last = 0; - microtime(&t->start); - break; - default: - DPRINTF(("seq_timer: unknown %02x\n", cmd)); - error = EINVAL; - break; - } - return (error); -} - -int -seq_do_fullsize(struct sequencer_softc *sc, seq_event_rec *b, struct uio *uio) -{ - struct sysex_info sysex; - u_int dev; - -#ifdef DIAGNOSTIC - if (sizeof(seq_event_rec) != SEQ_SYSEX_HDRSIZE) { - printf("seq_do_fullsize: sysex size ??\n"); - return (EINVAL); - } -#endif - memcpy(&sysex, b, sizeof sysex); - dev = sysex.device_no; - DPRINTFN(2, ("seq_do_fullsize: fmt=%04x, dev=%d, len=%d\n", - sysex.key, dev, sysex.len)); - return (midiseq_loadpatch(sc->devs[dev], &sysex, uio)); -} - -/* Convert an old sequencer event to a new one. */ -int -seq_to_new(seq_event_rec *ev, struct uio *uio) -{ - int cmd, chan, note, parm; - u_int32_t delay; - int error; - - cmd = SEQ_CMD(ev); - chan = ev->arr[1]; - note = ev->arr[2]; - parm = ev->arr[3]; - DPRINTFN(3, ("seq_to_new: 0x%02x %d %d %d\n", cmd, chan, note, parm)); - - if (cmd >= 0x80) { - /* Fill the event record */ - if (uio->uio_resid >= sizeof *ev - SEQOLD_CMDSIZE) { - error = uiomove(&ev->arr[SEQOLD_CMDSIZE], - sizeof *ev - SEQOLD_CMDSIZE, uio); - if (error) - return (error); - } else - return (EINVAL); - } - - switch(cmd) { - case SEQOLD_NOTEOFF: - note = 255; - SEQ_ECMD(ev) = MIDI_NOTEOFF; - goto onoff; - case SEQOLD_NOTEON: - SEQ_ECMD(ev) = MIDI_NOTEON; - onoff: - SEQ_CMD(ev) = SEQ_CHN_VOICE; - SEQ_EDEV(ev) = 0; - SEQ_ECHAN(ev) = chan; - SEQ_ENOTE(ev) = note; - SEQ_EPARM(ev) = parm; - break; - case SEQOLD_WAIT: - delay = *(u_int32_t *)ev->arr >> 8; - SEQ_CMD(ev) = SEQ_TIMING; - SEQ_TCMD(ev) = TMR_WAIT_REL; - *(u_int32_t *)&ev->arr[4] = delay; - break; - case SEQOLD_SYNCTIMER: - SEQ_CMD(ev) = SEQ_TIMING; - SEQ_TCMD(ev) = TMR_RESET; - break; - case SEQOLD_PGMCHANGE: - SEQ_ECMD(ev) = MIDI_PGM_CHANGE; - SEQ_CMD(ev) = SEQ_CHN_COMMON; - SEQ_EDEV(ev) = 0; - SEQ_ECHAN(ev) = chan; - SEQ_EP1(ev) = note; - break; - case SEQOLD_MIDIPUTC: - break; /* interpret in normal mode */ - case SEQOLD_ECHO: - case SEQOLD_PRIVATE: - case SEQOLD_EXTENDED: - default: - DPRINTF(("seq_to_new: not impl 0x%02x\n", cmd)); - return (EINVAL); - /* In case new events show up */ - case SEQ_TIMING: - case SEQ_CHN_VOICE: - case SEQ_CHN_COMMON: - case SEQ_FULLSIZE: - break; - } - return (0); -} - -/**********************************************/ - -void -midiseq_in(struct midi_dev *md, u_char *msg, int len) -{ - int unit = md->unit; - seq_event_rec ev; - int status, chan; - - DPRINTFN(2, ("midiseq_in: %p %02x %02x %02x\n", - md, msg[0], msg[1], msg[2])); - - status = MIDI_GET_STATUS(msg[0]); - chan = MIDI_GET_CHAN(msg[0]); - switch (status) { - case MIDI_NOTEON: - if (msg[2] == 0) { - status = MIDI_NOTEOFF; - msg[2] = MIDI_HALF_VEL; - } - /* FALLTHROUGH */ - case MIDI_NOTEOFF: - case MIDI_KEY_PRESSURE: - SEQ_MK_CHN_VOICE(&ev, unit, status, chan, msg[1], msg[2]); - break; - case MIDI_CTL_CHANGE: - SEQ_MK_CHN_COMMON(&ev, unit, status, chan, msg[1], 0, msg[2]); - break; - case MIDI_PGM_CHANGE: - case MIDI_CHN_PRESSURE: - SEQ_MK_CHN_COMMON(&ev, unit, status, chan, msg[1], 0, 0); - break; - case MIDI_PITCH_BEND: - SEQ_MK_CHN_COMMON(&ev, unit, status, chan, 0, 0, - (msg[1] & 0x7f) | ((msg[2] & 0x7f) << 7)); - break; - default: - return; - } - seq_event_intr(md->seq, &ev); -} - -struct midi_dev * -midiseq_open(int unit, int flags) -{ - extern struct cfdriver midi_cd; - int error; - struct midi_dev *md; - struct midi_softc *sc; - struct midi_info mi; - - DPRINTFN(2, ("midiseq_open: %d %d\n", unit, flags)); - error = midiopen(makedev(0, unit), flags, 0, 0); - if (error) - return (0); - sc = midi_cd.cd_devs[unit]; - sc->seqopen = 1; - md = malloc(sizeof *md, M_DEVBUF, M_WAITOK | M_ZERO); - sc->seq_md = md; - md->msc = sc; - midi_getinfo(makedev(0, unit), &mi); - md->unit = unit; - md->name = mi.name; - md->subtype = 0; - md->nr_voices = 128; /* XXX */ - md->instr_bank_size = 128; /* XXX */ - if (mi.props & MIDI_PROP_CAN_INPUT) - md->capabilities |= SYNTH_CAP_INPUT; - return (md); -} - -void -midiseq_close(struct midi_dev *md) -{ - DPRINTFN(2, ("midiseq_close: %d\n", md->unit)); - midiclose(makedev(0, md->unit), 0, 0, 0); - free(md, M_DEVBUF); -} - -void -midiseq_reset(struct midi_dev *md) -{ - /* XXX send GM reset? */ - DPRINTFN(3, ("midiseq_reset: %d\n", md->unit)); -} - -int -midiseq_out(struct midi_dev *md, u_char *buf, u_int cc, int chk) -{ - DPRINTFN(5, ("midiseq_out: m=%p, unit=%d, buf[0]=0x%02x, cc=%d\n", - md->msc, md->unit, buf[0], cc)); - - /* The MIDI "status" byte does not have to be repeated. */ - if (chk && md->last_cmd == buf[0]) - buf++, cc--; - else - md->last_cmd = buf[0]; - return (midi_writebytes(md->unit, buf, cc)); -} - -int -midiseq_noteon(struct midi_dev *md, int chan, int note, int vel) -{ - u_char buf[3]; - - DPRINTFN(6, ("midiseq_noteon 0x%02x %d %d\n", - MIDI_NOTEON | chan, note, vel)); - if (chan < 0 || chan > 15 || - note < 0 || note > 127) - return (EINVAL); - if (vel < 0) vel = 0; - if (vel > 127) vel = 127; - buf[0] = MIDI_NOTEON | chan; - buf[1] = note; - buf[2] = vel; - return (midiseq_out(md, buf, 3, 1)); -} - -int -midiseq_noteoff(struct midi_dev *md, int chan, int note, int vel) -{ - u_char buf[3]; - - if (chan < 0 || chan > 15 || - note < 0 || note > 127) - return (EINVAL); - if (vel < 0) vel = 0; - if (vel > 127) vel = 127; - buf[0] = MIDI_NOTEOFF | chan; - buf[1] = note; - buf[2] = vel; - return (midiseq_out(md, buf, 3, 1)); -} - -int -midiseq_keypressure(struct midi_dev *md, int chan, int note, int vel) -{ - u_char buf[3]; - - if (chan < 0 || chan > 15 || - note < 0 || note > 127) - return (EINVAL); - if (vel < 0) vel = 0; - if (vel > 127) vel = 127; - buf[0] = MIDI_KEY_PRESSURE | chan; - buf[1] = note; - buf[2] = vel; - return (midiseq_out(md, buf, 3, 1)); -} - -int -midiseq_pgmchange(struct midi_dev *md, int chan, int parm) -{ - u_char buf[2]; - - if (chan < 0 || chan > 15 || - parm < 0 || parm > 127) - return (EINVAL); - buf[0] = MIDI_PGM_CHANGE | chan; - buf[1] = parm; - return (midiseq_out(md, buf, 2, 1)); -} - -int -midiseq_chnpressure(struct midi_dev *md, int chan, int parm) -{ - u_char buf[2]; - - if (chan < 0 || chan > 15 || - parm < 0 || parm > 127) - return (EINVAL); - buf[0] = MIDI_CHN_PRESSURE | chan; - buf[1] = parm; - return (midiseq_out(md, buf, 2, 1)); -} - -int -midiseq_ctlchange(struct midi_dev *md, int chan, int parm, int w14) -{ - u_char buf[3]; - - if (chan < 0 || chan > 15 || - parm < 0 || parm > 127) - return (EINVAL); - buf[0] = MIDI_CTL_CHANGE | chan; - buf[1] = parm; - buf[2] = w14 & 0x7f; - return (midiseq_out(md, buf, 3, 1)); -} - -int -midiseq_pitchbend(struct midi_dev *md, int chan, int parm) -{ - u_char buf[3]; - - if (chan < 0 || chan > 15) - return (EINVAL); - buf[0] = MIDI_PITCH_BEND | chan; - buf[1] = parm & 0x7f; - buf[2] = (parm >> 7) & 0x7f; - return (midiseq_out(md, buf, 3, 1)); -} - -int -midiseq_loadpatch(struct midi_dev *md, struct sysex_info *sysex, struct uio *uio) -{ - u_char c, buf[128]; - int i, cc, error; - - if (sysex->key != SEQ_SYSEX_PATCH) { - DPRINTF(("midiseq_loadpatch: bad patch key 0x%04x\n", - sysex->key)); - return (EINVAL); - } - if (uio->uio_resid < sysex->len) - /* adjust length, should be an error */ - sysex->len = uio->uio_resid; - - DPRINTFN(2, ("midiseq_loadpatch: len=%d\n", sysex->len)); - if (sysex->len == 0) - return (EINVAL); - error = uiomove(&c, 1, uio); - if (error) - return error; - if (c != MIDI_SYSEX_START) /* must start like this */ - return (EINVAL); - error = midiseq_out(md, &c, 1, 0); - if (error) - return (error); - --sysex->len; - while (sysex->len > 0) { - cc = sysex->len; - if (cc > sizeof buf) - cc = sizeof buf; - error = uiomove(buf, cc, uio); - if (error) - break; - for(i = 0; i < cc && !MIDI_IS_STATUS(buf[i]); i++) - ; - error = midiseq_out(md, buf, i, 0); - if (error) - break; - sysex->len -= i; - if (i != cc) - break; - } - /* Any leftover data in uio is rubbish; - * the SYSEX should be one write ending in SYSEX_END. - */ - uio->uio_resid = 0; - c = MIDI_SYSEX_END; - return (midiseq_out(md, &c, 1, 0)); -} - -int -midiseq_putc(struct midi_dev *md, int data) -{ - u_char c = data; - DPRINTFN(4,("midiseq_putc: 0x%02x\n", data)); - return (midiseq_out(md, &c, 1, 0)); -} - -#include "midi.h" -#if NMIDI == 0 -/* - * If someone has a sequencer, but no midi devices there will - * be unresolved references, so we provide little stubs. - */ - -int -midi_unit_count(void) -{ - return (0); -} - -int -midiopen(dev_t dev, int flags, int ifmt, struct proc *p) -{ - return (ENXIO); -} - -struct cfdriver midi_cd; - -void -midi_getinfo(dev_t dev, struct midi_info *mi) -{ -} - -int -midiclose(dev_t dev, int flags, int ifmt, struct proc *p) -{ - return (ENXIO); -} - -int -midi_writebytes(int unit, u_char *buf, int cc) -{ - return (ENXIO); -} -#endif /* NMIDI == 0 */ diff --git a/sys/dev/sequencervar.h b/sys/dev/sequencervar.h deleted file mode 100644 index cfa0231021a..00000000000 --- a/sys/dev/sequencervar.h +++ /dev/null @@ -1,105 +0,0 @@ -/* $OpenBSD: sequencervar.h,v 1.4 2008/06/26 05:42:14 ray Exp $ */ -/* $NetBSD: sequencervar.h,v 1.5 1998/11/25 22:17:07 augustss Exp $ */ - -/* - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Lennart Augustsson (augustss@netbsd.org). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -struct midi_softc; - -struct syn_timer { - struct timeval start, stop; - int tempo, timebase; - u_long last; - u_long tick; - int running; -}; - -#define SEQ_MAXQ 256 -struct sequencer_queue { - seq_event_rec buf[SEQ_MAXQ]; - u_int in; /* input index in buf */ - u_int out; /* output index in buf */ - u_int count; /* filled slots in buf */ -}; -#define SEQ_QINIT(q) ((q)->in = (q)->out = (q)->count = 0) -#define SEQ_QEMPTY(q) ((q)->count == 0) -#define SEQ_QFULL(q) ((q)->count >= SEQ_MAXQ) -#define SEQ_QPUT(q, e) ((q)->buf[(q)->in++] = (e), (q)->in %= SEQ_MAXQ, (q)->count++) -#define SEQ_QGET(q, e) ((e) = (q)->buf[(q)->out++], (q)->out %= SEQ_MAXQ, (q)->count--) -#define SEQ_QLEN(q) ((q)->count) - -struct sequencer_softc; - -#define MAXCHAN 16 -struct midi_dev { - char *name; - int subtype; - int capabilities; - int nr_voices; - int instr_bank_size; - int unit; - u_char last_cmd; - struct sequencer_softc *seq; - struct midi_softc *msc; -}; - -struct sequencer_softc { - struct device dev; - struct device *sc_dev; /* Hardware device struct */ - int isopen; /* Open indicator */ - int flags; /* Open flags */ - int mode; -#define SEQ_OLD 0 -#define SEQ_NEW 1 - int rchan, wchan; - int pbus; - struct selinfo wsel; /* write selector */ - struct selinfo rsel; /* read selector */ - struct proc *async; /* process who wants audio SIGIO */ - struct timeout timo; /* timeout handle */ - - char doingsysex; /* doing a SEQ_SYSEX */ - - int nmidi; /* number of MIDI devices */ - struct midi_dev **devs; - struct syn_timer timer; - - struct sequencer_queue outq; /* output event queue */ - u_int lowat; /* output queue low water mark */ - char timeout; /* timeout has been set */ - - struct sequencer_queue inq; /* input event queue */ - u_long input_stamp; -}; - -void seq_event_intr(void *, seq_event_rec *); - -#define SEQUENCERUNIT(d) ((d) & 0x7f) -#define SEQ_IS_OLD(d) ((d) & 0x80) - diff --git a/sys/sys/midiio.h b/sys/sys/midiio.h deleted file mode 100644 index 647a090fc59..00000000000 --- a/sys/sys/midiio.h +++ /dev/null @@ -1,238 +0,0 @@ -/* $OpenBSD: midiio.h,v 1.5 2012/12/05 23:20:24 deraadt Exp $ */ -/* $NetBSD: midiio.h,v 1.7 1998/11/25 22:17:07 augustss Exp $ */ - -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Lennart Augustsson (augustss@netbsd.org). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SYS_MIDIIO_H_ -#define _SYS_MIDIIO_H_ - -/* - * The API defined here is compatible with the OSS MIDI API except - * for naming. - */ - -#include <machine/endian.h> /* for _QUAD_LOWWORD */ - -/* - * ioctl() commands for /dev/midi## - */ -typedef struct { - unsigned char cmd; - char nr_args, nr_returns; - unsigned char data[30]; -} mpu_command_rec; - -#define MIDI_PRETIME _IOWR('m', 0, int) -#define MIDI_MPUMODE _IOWR('m', 1, int) -#define MIDI_MPUCMD _IOWR('m', 2, mpu_command_rec) - - -/* The MPU401 command acknowledge and active sense command */ -#define MIDI_ACK 0xfe - - -/* Sequencer */ -#define SEQUENCER_RESET _IO ('Q', 0) -#define SEQUENCER_SYNC _IO ('Q', 1) -#define SEQUENCER_INFO _IOWR('Q', 2, struct synth_info) -#define SEQUENCER_CTRLRATE _IOWR('Q', 3, int) -#define SEQUENCER_GETOUTCOUNT _IOR ('Q', 4, int) -#define SEQUENCER_GETINCOUNT _IOR ('Q', 5, int) -/*#define SEQUENCER_PERCMODE _IOW ('Q', 6, int)*/ -/*#define SEQUENCER_TESTMIDI _IOW ('Q', 8, int)*/ -#define SEQUENCER_RESETSAMPLES _IOW ('Q', 9, int) -#define SEQUENCER_NRSYNTHS _IOR ('Q',10, int) -#define SEQUENCER_NRMIDIS _IOR ('Q',11, int) -/*#define SEQUENCER_MIDI_INFO _IOWR('Q',12, struct midi_info)*/ -#define SEQUENCER_THRESHOLD _IOW ('Q',13, int) -#define SEQUENCER_MEMAVL _IOWR('Q',14, int) -/*#define SEQUENCER_FM_4OP_ENABLE _IOW ('Q',15, int)*/ -#define SEQUENCER_PANIC _IO ('Q',17) -#define SEQUENCER_OUTOFBAND _IOW ('Q',18, struct seq_event_rec) -#define SEQUENCER_GETTIME _IOR ('Q',19, int) -/*#define SEQUENCER_ID _IOWR('Q',20, struct synth_info)*/ -/*#define SEQUENCER_CONTROL _IOWR('Q',21, struct synth_control)*/ -/*#define SEQUENCER_REMOVESAMPLE _IOWR('Q',22, struct remove_sample)*/ - -#if 0 -typedef struct synth_control { - int devno; /* Synthesizer # */ - char data[4000]; /* Device specific command/data record */ -} synth_control; - -typedef struct remove_sample { - int devno; /* Synthesizer # */ - int bankno; /* MIDI bank # (0=General MIDI) */ - int instrno; /* MIDI instrument number */ -} remove_sample; -#endif - -#define CMDSIZE 8 -typedef struct seq_event_rec { - u_char arr[CMDSIZE]; -} seq_event_rec; - -struct synth_info { - char name[30]; - int device; - int synth_type; -#define SYNTH_TYPE_FM 0 -#define SYNTH_TYPE_SAMPLE 1 -#define SYNTH_TYPE_MIDI 2 - - int synth_subtype; -#define SYNTH_SUB_FM_TYPE_ADLIB 0x00 -#define SYNTH_SUB_FM_TYPE_OPL3 0x01 -#define SYNTH_SUB_MIDI_TYPE_MPU401 0x401 - -#define SYNTH_SUB_SAMPLE_TYPE_BASIC 0x10 -#define SYNTH_SUB_SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC - - int nr_voices; - int instr_bank_size; - u_int capabilities; -#define SYNTH_CAP_OPL3 0x00000002 -#define SYNTH_CAP_INPUT 0x00000004 -}; - -/* Sequencer timer */ -#define SEQUENCER_TMR_TIMEBASE _IOWR('T', 1, int) -#define SEQUENCER_TMR_START _IO ('T', 2) -#define SEQUENCER_TMR_STOP _IO ('T', 3) -#define SEQUENCER_TMR_CONTINUE _IO ('T', 4) -#define SEQUENCER_TMR_TEMPO _IOWR('T', 5, int) -#define SEQUENCER_TMR_SOURCE _IOWR('T', 6, int) -# define SEQUENCER_TMR_INTERNAL 0x00000001 -#if 0 -# define SEQUENCER_TMR_EXTERNAL 0x00000002 -# define SEQUENCER_TMR_MODE_MIDI 0x00000010 -# define SEQUENCER_TMR_MODE_FSK 0x00000020 -# define SEQUENCER_TMR_MODE_CLS 0x00000040 -# define SEQUENCER_TMR_MODE_SMPTE 0x00000080 -#endif -#define SEQUENCER_TMR_METRONOME _IOW ('T', 7, int) -#define SEQUENCER_TMR_SELECT _IOW ('T', 8, int) - - -#define MIDI_CTRL_ALLOFF 123 -#define MIDI_CTRL_RESET 121 -#define MIDI_BEND_NEUTRAL (1<<13) - -#define MIDI_NOTEOFF 0x80 -#define MIDI_NOTEON 0x90 -#define MIDI_KEY_PRESSURE 0xA0 -#define MIDI_CTL_CHANGE 0xB0 -#define MIDI_PGM_CHANGE 0xC0 -#define MIDI_CHN_PRESSURE 0xD0 -#define MIDI_PITCH_BEND 0xE0 -#define MIDI_SYSTEM_PREFIX 0xF0 - -#define MIDI_IS_STATUS(d) ((d) >= 0x80) -#define MIDI_IS_COMMON(d) ((d) >= 0xf0) - -#define MIDI_SYSEX_START 0xF0 -#define MIDI_SYSEX_END 0xF7 - -#define MIDI_GET_STATUS(d) ((d) & 0xf0) -#define MIDI_GET_CHAN(d) ((d) & 0x0f) - -#define MIDI_HALF_VEL 64 - -#define SEQ_LOCAL 0x80 -#define SEQ_TIMING 0x81 -#define SEQ_CHN_COMMON 0x92 -#define SEQ_CHN_VOICE 0x93 -#define SEQ_SYSEX 0x94 -#define SEQ_FULLSIZE 0xfd - -#define SEQ_MK_CHN_VOICE(e, unit, cmd, chan, key, vel) (\ - (e)->arr[0] = SEQ_CHN_VOICE, (e)->arr[1] = (unit), (e)->arr[2] = (cmd),\ - (e)->arr[3] = (chan), (e)->arr[4] = (key), (e)->arr[5] = (vel),\ - (e)->arr[6] = 0, (e)->arr[7] = 0) -#define SEQ_MK_CHN_COMMON(e, unit, cmd, chan, p1, p2, w14) (\ - (e)->arr[0] = SEQ_CHN_COMMON, (e)->arr[1] = (unit), (e)->arr[2] = (cmd),\ - (e)->arr[3] = (chan), (e)->arr[4] = (p1), (e)->arr[5] = (p2),\ - *(short *)&(e)->arr[6] = (w14)) - -#if _QUAD_LOWWORD == 1 -/* big endian */ -#define SEQ_PATCHKEY(id) (0xfd00|id) -#else -/* little endian */ -#define SEQ_PATCHKEY(id) ((id<<8)|0xfd) -#endif -struct sysex_info { - u_int16_t key; /* Use SYSEX_PATCH or MAUI_PATCH here */ -#define SEQ_SYSEX_PATCH SEQ_PATCHKEY(0x05) -#define SEQ_MAUI_PATCH SEQ_PATCHKEY(0x06) - int16_t device_no; /* Synthesizer number */ - int32_t len; /* Size of the sysex data in bytes */ - u_char data[1]; /* Sysex data starts here */ -}; -#define SEQ_SYSEX_HDRSIZE ((u_long)((struct sysex_info *)0)->data) - -typedef unsigned char sbi_instr_data[32]; -struct sbi_instrument { - u_int16_t key; /* FM_PATCH or OPL3_PATCH */ -#define SBI_FM_PATCH SEQ_PATCHKEY(0x01) -#define SBI_OPL3_PATCH SEQ_PATCHKEY(0x03) - int16_t device; - int32_t channel; - sbi_instr_data operators; -}; - -#define TMR_RESET 0 -#define TMR_WAIT_REL 1 /* Time relative to the prev time */ -#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ -#define TMR_STOP 3 -#define TMR_START 4 -#define TMR_CONTINUE 5 -#define TMR_TEMPO 6 -#define TMR_ECHO 8 -#define TMR_CLOCK 9 /* MIDI clock */ -#define TMR_SPP 10 /* Song position pointer */ -#define TMR_TIMESIG 11 /* Time signature */ - -/* Old sequencer definitions */ -#define SEQOLD_CMDSIZE 4 - -#define SEQOLD_NOTEOFF 0 -#define SEQOLD_NOTEON 1 -#define SEQOLD_WAIT TMR_WAIT_ABS -#define SEQOLD_PGMCHANGE 3 -#define SEQOLD_SYNCTIMER TMR_START -#define SEQOLD_MIDIPUTC 5 -#define SEQOLD_ECHO TMR_ECHO -#define SEQOLD_AFTERTOUCH 9 -#define SEQOLD_CONTROLLER 10 -#define SEQOLD_PRIVATE 0xfe -#define SEQOLD_EXTENDED 0xff - -#endif /* !_SYS_MIDIIO_H_ */ diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile index d3efeb6ab4e..f96b14c93b5 100644 --- a/usr.bin/kdump/Makefile +++ b/usr.bin/kdump/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.21 2011/10/06 20:49:28 deraadt Exp $ +# $OpenBSD: Makefile,v 1.22 2013/03/15 09:10:52 ratchov Exp $ LDSTATIC=${STATIC} PROG= kdump @@ -31,7 +31,6 @@ ioctl.c: ${.CURDIR}/Makefile ${.CURDIR}/mkioctls /usr/include/sys/dkio.h \ /usr/include/sys/filio.h \ /usr/include/sys/gpio.h \ - /usr/include/sys/midiio.h \ /usr/include/sys/mtio.h \ /usr/include/sys/pciio.h \ /usr/include/sys/radioio.h \ diff --git a/usr.bin/kdump/mkioctls b/usr.bin/kdump/mkioctls index 3a859103810..0a53184b105 100644 --- a/usr.bin/kdump/mkioctls +++ b/usr.bin/kdump/mkioctls @@ -1,5 +1,5 @@ #!/bin/sh - -# $OpenBSD: mkioctls,v 1.27 2011/10/06 21:16:01 deraadt Exp $ +# $OpenBSD: mkioctls,v 1.28 2013/03/15 09:10:52 ratchov Exp $ # # Copyright (c) 1994 @@ -67,7 +67,6 @@ BEGIN { print "#include <sys/dkio.h>" print "#include <sys/filio.h>" print "#include <sys/gpio.h>" - print "#include <sys/midiio.h>" print "#include <sys/mtio.h>" print "#include <sys/pciio.h>" print "#include <sys/radioio.h>" @@ -89,7 +88,7 @@ BEGIN { print "" } -/^#[ ]*define[ ]*(AGPIOC_|ATAIO|AUDIO_|BIOC|CDIO|CIOC|CHIO|DIOC|MIDI_|GPIO|SEQUENCER_|TIO|FIO|MTIOC|SIO|OSIO|SESIOC_|SIOC|PCIOC|PPPIOC|PPPOE|RIOC|RND|STRIOC|SCIOC|OSCIOC|TUN|VNDIOC|WSKBD|WSMOUSE|WSDISPLAY|WSMUX)[A-Z_0-9]*[ ]*_IO/ { +/^#[ ]*define[ ]*(AGPIOC_|ATAIO|AUDIO_|BIOC|CDIO|CIOC|CHIO|DIOC|GPIO|TIO|FIO|MTIOC|SIO|OSIO|SESIOC_|SIOC|PCIOC|PPPIOC|PPPOE|RIOC|RND|STRIOC|SCIOC|OSCIOC|TUN|VNDIOC|WSKBD|WSMOUSE|WSDISPLAY|WSMUX)[A-Z_0-9]*[ ]*_IO/ { # find where the name starts for (i = 1; i <= NF; i++) |