Home | History | Annotate | Download | only in dev
History log of /src/sys/dev/sequencervar.h
RevisionDateAuthorComments
 1.17  22-Dec-2014  mrg various clean ups for midi and sequencer:

midi specific:
- add reference counting for midi operations, and ensure that
detach waits for other threads to complete before tearing
down the device completely.
- in detach, halt midi callouts before destroying them
- re-check sc->dying after sleeping in midiread()
- in real_writebytes(), make sure we're open and not dying
- make sure we drop the interrupt lock before calling any code
that may want to check thread locks. this is now safe due to
the above changes.

sequencer specific:
- avoid caching the midi softc in the sequencer softc. instead,
every time we want to use it, look it up again and make sure
it still exists.


this fixes various crashes i've seen in the usb midi code when
detaching the umidi while it is active.
 1.16  27-Apr-2013  christos branches: 1.16.10; 1.16.12;
allocate dynamically
 1.15  27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.14  23-Nov-2011  jmcneill branches: 1.14.8;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.13  28-Apr-2008  martin branches: 1.13.12; 1.13.34; 1.13.36;
Remove clause 3 and 4 from TNF licenses
 1.12  09-Feb-2007  ad branches: 1.12.40; 1.12.42; 1.12.44;
Merge newlock2 to head.
 1.11  30-Jun-2006  chap branches: 1.11.4;
Ankh-Morpork, we have a MIDI driver....

Merge from chap-midi branch, after
~month for review
Comments by thorpej@ drochner@ and Alexandre Ratchov

Incorporated: points by thorpej@ drochner@; preliminary support for
a stats-collecting ioctl suggested by martin@ from comments by A.R.

PR kern/32441 kern/32442 kern/32567 kern/32588 kern/32694 kern/33590
kern/33614 and one instance of kern/32651

ok martin@
 1.10  11-Dec-2005  christos branches: 1.10.4; 1.10.8; 1.10.14; 1.10.16;
merge ktrace-lwp.
 1.9  29-May-2005  christos branches: 1.9.2;
- add const
- avoid variable shadowing.
 1.8  04-Feb-2005  perry de-__P
 1.7  04-Dec-2003  keihan branches: 1.7.8; 1.7.10;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.6  23-Mar-2000  thorpej branches: 1.6.10; 1.6.28;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.5  25-Nov-1998  augustss branches: 1.5.10;
Make the copyright header conform to the NetBSD template.
 1.4  13-Aug-1998  augustss Remove some leftover fluff.
Make sure there is no outstanding timeout when the sequencer is closed.
 1.3  12-Aug-1998  augustss Handle SYSEX messages.
 1.2  08-Aug-1998  augustss Forgotten to commit this in last change.
 1.1  07-Aug-1998  augustss Add MIDI support. The MIDI devices can be accessed as ``raw'' through
the /dev/rmidiN devices, or with a sequencer interface via /dev/music.
So far the only supported MIDI device is the MPU401 port on SoundBlaster
(and only on SB on isapnp, since we do not have locators with multiple
values yet).
 1.5.10.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.28.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.28.4  04-Feb-2005  skrll Sync with HEAD.
 1.6.28.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.28.2  18-Sep-2004  skrll Sync with HEAD.
 1.6.28.1  03-Aug-2004  skrll Sync with HEAD
 1.6.10.1  21-Sep-2001  fvdl Attempt to clean up the sequencer code a bit, with only 50% success.
 1.7.10.1  12-Feb-2005  yamt sync with head.
 1.7.8.1  29-Apr-2005  kent sync with -current
 1.9.2.2  26-Feb-2007  yamt sync with head.
 1.9.2.1  30-Dec-2006  yamt sync with head.
 1.10.16.1  13-Jul-2006  gdamore Merge from HEAD.
 1.10.14.11  01-Jun-2006  chap Updating midiplay(1) to support the SYSEX CONTINUATION and ESCAPED events
that may appear in MIDI files revealed that the /dev/music API still needs
to expose the MIDIPUTC event from /dev/sequencer (to support ESCAPED); I
also noticed the sequencer was keeping some state globally that should be
per device.
 1.10.14.10  31-May-2006  chap PR kern/33614.

Rework of midiplay(1) to use sequencer facilities for tempo change (rather
than setting the sequencer for one tempo and doing all its own scaling)
exposed a hitherto concealed bug in sequencer tempo change handling.

Also took the opportunity to clarify some field names and add spl calls
in the top half to avoid concurrent access with the bottom to the timer.
 1.10.14.9  25-May-2006  chap Refactored sequencer to use the native API (now that there is one), and
updated the MIDI controller list in midiio.h.

It would be worth confirming that sequencer.c compiles on vax. It should.
 1.10.14.8  20-May-2006  chap Now for Phase Two. The patched files have been rolled forward again, with
a naive mechanical resolution of conflicts. Now to compare the diffs and
make sure the resolutions made sense. Sleep first.
 1.10.14.7  20-May-2006  chap Learned of two ugly corners in MIDI protocol that made the state machine
overly pedantic. Both have to do with the End SysEx byte, 0xf7. First, it
is allowed not only at the end of a SysEx message, but anywhere else any
status byte can appear (and in that case has no meaning). Second, it is
not even required at the end of a SysEx message - any subsequent status
byte implicitly ends the SysEx, and this is not considered an error.

I don't like these provisions because they make it even harder to detect
errors in a corrupted MIDI stream, but as MIDI gets sent increasingly over
error-correcting transports I suppose that is less of a concern. In any
case, though midi(4) will accept data (input from device or data from
write(2)) with stray or dropped End SysEx bytes, it will always ensure
that output to the device, and data for read(2), has End SysEx only and
always at the ends of SysEx messages.
 1.10.14.6  20-May-2006  chap Spotted a bug in a buffer condition. Never saw any symptom, but it's a
bug nonetheless.
 1.10.14.5  20-May-2006  chap The two choices CN_SEQ_GLOBAL and CN_SEQ_PER_EP cannot cover all devices,
some are wired arbitrarily oddly and need a CN_FIXED quirk to specify
the cable number mappings explicitly. But then as a result of those
mappings, the automatically bound mididevice unit numbers might not match
the order of the device's physical jacks or blinkenlights, so an MD_FIXED
quirk is needed to specify that order as well. It turns out the cn_base
field added earlier was neither necessary (at the time) nor sufficient
(to handle CN_FIXED), so it's gone now.

Q: How do you tell when you've got the cable number associations wrong on
a Midisport 2x4?
A: Everything works right except data-rate throttling - you'll be able to
send data to certain ports at rates far in excess of the MIDI data rate
(and lose most of it). If you never transmit that fast, you'll never
notice.

So testing for a sane data transfer rate (use dd to blast a stream of MIDI
data at the rmidi device, it'll report the rate on completion) is probably
a wise testing step when adding support for a new umidi device.
 1.10.14.4  20-May-2006  chap Patch to account explicitly for the prior inconsistency in the treatment of
cable numbers. Also contains a (functionally insignificant) change to the
declaration of endpoint buffers introduced in kern/32441, which will be
useful in a forthcoming patch. This patch should be fuzz-free on 2.0
source after the 32441 and 32442 patches.
 1.10.14.3  20-May-2006  chap Active Sense now handled for receive as well as for transmit. Following the
spec, if no Active Sense is seen on receive, no special behavior applies,
but if an Active Sense is seen then any absence of received data exceeding
300ms thereafter will be signalled as a read EOF on the rmidi device.
Receipt of any further data will clear the EOF condition, and operation
resumes as if no Active Sense has been seen.

Also moved some selnotify's out of locks so they don't deadlock against
the corresponding kevent filters.

This concludes this round of midi hacking (except for possibly improving
the safety of how pending callouts and interrupts are canceled on device
detach. Other fixes/enhancements to the midi subsystems will get their
own patches.
 1.10.14.2  20-May-2006  chap The FST now handles the equivalence between NoteOn (velocity 0) and a
NoteOff with velocity 64, both for canonicalizing (always produce NoteOff)
and compressing (produce whichever allows a current running status to be
exploited). The code from sequencer that attempted to model this behavior
and running status has been superseded and removed. Also removed the
EBADF checks I added to sequencer earlier, as they're handled in a layer
above.
 1.10.14.1  20-May-2006  chap Now for Phase One. The patches to be applied in sequence were created
and tested against 2.0 sources. To begin, let CVS roll the affected files
back to that historic state. The reverse operation will be used (and
will involve some manual merging) after the patches have been applied.
Naturally, intermediate stages on this branch will not be directly
compilable (unless merged into a 2.0 checkout).
 1.10.8.1  11-Aug-2006  yamt sync with head
 1.10.4.1  09-Sep-2006  rpaulo sync with head
 1.11.4.1  27-Jan-2007  ad Don't call selnotify() or psignal() while above IPL_VM: defer them to a
soft interrupt.
 1.12.44.1  16-May-2008  yamt sync with head.
 1.12.42.1  18-May-2008  yamt sync with head.
 1.12.40.1  02-Jun-2008  mjf Sync with HEAD.
 1.13.36.1  19-Nov-2011  jmcneill port ad-audiomp2 branch changes to 5.99.56
todo:
- port ad-audiomp2 pcppi changes
- these drivers need to be fixed:
- emuxki
- gcscaudio
- hdafg
- uaudio
- umidi
- MD audio drivers
 1.13.34.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.34.2  30-Oct-2012  yamt sync with head
 1.13.34.1  17-Apr-2012  yamt sync with head
 1.13.12.1  09-Dec-2008  ad Checkpoint work on MIDI.
 1.14.8.3  03-Dec-2017  jdolecek update from HEAD
 1.14.8.2  23-Jun-2013  tls resync from head
 1.14.8.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.16.12.1  06-Apr-2015  skrll Sync with HEAD
 1.16.10.1  11-Jan-2015  martin Pull up following revision(s) (requested by mrg in ticket #407):
sys/dev/midivar.h: revision 1.20
sys/dev/usb/umidivar.h: file removal
sys/dev/midi.c: revision 1.82
sys/dev/midi.c: revision 1.83
sys/dev/usb/FILES: revision 1.13
sys/dev/midi_if.h: revision 1.26
sys/dev/sequencer.c: revision 1.60
sys/dev/sequencer.c: revision 1.61
sys/dev/sequencer.c: revision 1.62
sys/dev/sequencer.c: revision 1.63
sys/dev/usb/umidi_quirks.c: revision 1.19
sys/dev/usb/umidi.c: revision 1.66
sys/dev/usb/umidi.c: revision 1.67
sys/dev/usb/umidi.c: revision 1.68
sys/dev/usb/umidireg.h: file removal
sys/dev/sequencervar.h: revision 1.17
fix the midi_if documentation to properly describe the locks that will
be held during various operations.
various umidi clean ups:
- move the contents of umidi{reg,var}.h into umidi.c directly as they
are not referenced by any other file.
- remove the useless include of umidi{reg,var}.h from umidi_quirks.c.
- add reference counting and wait/broadcast support to the IO paths.
- fix the error handling in midi_attach() and midi_open().
- sprinkle KASSERT() in several places.
- drop the local interrupt lock before calling into various parts of
the USB code. fixes lockdebug issues, and likely hangs.
- rename "binded" member as "bound".
with these most of the panics and problems i've seen are gone. there
is still one lockdebug panic to deal with that happens when unplugging
umidi while midiplay(1) is running.
various clean ups for midi and sequencer:
midi specific:
- add reference counting for midi operations, and ensure that
detach waits for other threads to complete before tearing
down the device completely.
- in detach, halt midi callouts before destroying them
- re-check sc->dying after sleeping in midiread()
- in real_writebytes(), make sure we're open and not dying
- make sure we drop the interrupt lock before calling any code
that may want to check thread locks. this is now safe due to
the above changes.
sequencer specific:
- avoid caching the midi softc in the sequencer softc. instead,
every time we want to use it, look it up again and make sure
it still exists.
this fixes various crashes i've seen in the usb midi code when
detaching the umidi while it is active.
use __func__ in some debug messages.
- check sc->dying after sleeping in several more places, and
convert it into EIO error where necessary.
- remove a wrong additional mutex_exit() call.
- make sure to check sc->dying under the device lock.
- fix a confusion between midi(4) unit and connected to sequencer
devices.
- minor comment/debug clean ups.
fixes problems attempting to read or write from the right midi(4)
device using the sequencer(4) device when one or more of the
non-final devices fails to open with midiseq_open().
fix !AUDIO_DEBUG build.
CID/1261465: Dereference after NULL check.
CID/1261467: Unreachable code
actually fix one of the previous: don't test for NULL after deref.

RSS XML Feed