History log of /src/sys/dev/midivar.h |
Revision | | Date | Author | Comments |
1.20 |
| 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.19 |
| 05-Apr-2012 |
plunky | branches: 1.19.2; 1.19.14; 1.19.16; midi_attach() does not actually ever use the parent device pointer, so no need to store it in sc_dev. Further, remove the sc_dev field entirely since it is easily confused with the dev field, which is the 'self' device pointer. Fix the comment.
|
1.18 |
| 23-Nov-2011 |
jmcneill | branches: 1.18.2; 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.17 |
| 28-Apr-2008 |
martin | branches: 1.17.12; 1.17.34; 1.17.36; Remove clause 3 and 4 from TNF licenses
|
1.16 |
| 05-Mar-2008 |
cube | branches: 1.16.2; 1.16.4; Fix fallout from midi(4)'s softc split.
|
1.15 |
| 04-Mar-2008 |
cube | Split device_t/softc for midi(4), and other related cosmetic changes.
|
1.14 |
| 04-Jan-2008 |
ad | branches: 1.14.2; 1.14.6; Start detangling lock.h from intr.h. This is likely to cause short term breakage, but the mess of dependencies has been regularly breaking the build recently anyhow.
|
1.13 |
| 09-Feb-2007 |
ad | branches: 1.13.4; 1.13.20; 1.13.26; 1.13.32; Merge newlock2 to head.
|
1.12 |
| 30-Jun-2006 |
chap | branches: 1.12.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.11 |
| 11-Dec-2005 |
christos | branches: 1.11.4; 1.11.8; 1.11.14; 1.11.16; merge ktrace-lwp.
|
1.10 |
| 29-Oct-2004 |
yamt | branches: 1.10.12; constify audio_hw_if, midi_hw_if, and radio_hw_if.
|
1.9 |
| 04-Dec-2003 |
keihan | 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.8 |
| 13-Jan-2001 |
tshiozak | branches: 1.8.24; add detaching/deactivation code to midi driver.
|
1.7 |
| 23-Mar-2000 |
thorpej | 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.6 |
| 25-Nov-1998 |
augustss | branches: 1.6.10; Make the copyright header conform to the NetBSD template.
|
1.5 |
| 05-Oct-1998 |
augustss | Make MIDI input work again. Fix from Torsten Duwe <duwe@ns.lst.de>.
|
1.4 |
| 17-Aug-1998 |
augustss | * Redo the way the way the MIDI driver attaches to audio devices. * Improve the midisyn layer a little. * Add a driver for the Yamaha OPL[23] FM synths. The opl driver is not finished yet; it sounds pretty awful.
For some strange reason I cannot get any FM sound from my SB64 cards, but a regular SB16 works fine.
|
1.3 |
| 12-Aug-1998 |
augustss | Lower buffer size.
|
1.2 |
| 12-Aug-1998 |
augustss | Tidy up and rename some functions in the MIDI driver.
|
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.6.10.2 |
| 18-Jan-2001 |
bouyer | Sync with head (for UBC+NFS fixes, mostly).
|
1.6.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.8.24.4 |
| 02-Nov-2004 |
skrll | Sync with HEAD.
|
1.8.24.3 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.8.24.2 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.8.24.1 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.10.12.4 |
| 17-Mar-2008 |
yamt | sync with head.
|
1.10.12.3 |
| 21-Jan-2008 |
yamt | sync with head
|
1.10.12.2 |
| 26-Feb-2007 |
yamt | sync with head.
|
1.10.12.1 |
| 30-Dec-2006 |
yamt | sync with head.
|
1.11.16.1 |
| 13-Jul-2006 |
gdamore | Merge from HEAD.
|
1.11.14.18 |
| 28-Jun-2006 |
chap | Handle error counters for devices with no output capability symmetrically w.r.t. those with no input. Some preparation for a stats-returning ioctl TBD.
|
1.11.14.17 |
| 21-May-2006 |
chap | @.n.o e-mail address, and a couple of corrections to the mechanical merge, found by eyeball. Now to see how many gcc will catch....
|
1.11.14.16 |
| 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.11.14.15 |
| 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.11.14.14 |
| 20-May-2006 |
chap | Spotted a bug in a buffer condition. Never saw any symptom, but it's a bug nonetheless.
|
1.11.14.13 |
| 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.11.14.12 |
| 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.11.14.11 |
| 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.11.14.10 |
| 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.11.14.9 |
| 20-May-2006 |
chap | umidi now uses hw_if_ext and no longer has its own approximate midi state machine. This patch is relative to umidi.c and umidivar.h already patched by midiman.pat (kern/32441).
|
1.11.14.8 |
| 20-May-2006 |
chap | Added hw_if_ext for hw drivers that want their messages intact rather than byte by byte. Works with midisyn - must still integrate and test with umidi.
|
1.11.14.7 |
| 20-May-2006 |
chap | The DFA (well, technically it's really a FST - a DFA with output) is now used for transmit as well as receive; it's run at the upstream end of each pipe (the receive interrupt for receive, the write call for transmit) so that protocol errors can be detected as soon as possible, and erroneous data won't fill the buffer. Implemented a guarantee that read(2) on the raw device returns as many complete messages as will fit in the read request, so the user program does not have to parse around read boundaries (except for SysEx). Required a new buffer scheme that preserves message boundaries. (A little like reinventing STREAMS, hmm...) Implemented FIONREAD. New approach to sharing the cpu during output to interrupt- challenged devices.
umidi happens to work now even in the presence of Active Sense, as the transmit FST ensures the Active Sense doesn't appear in the midst of another message, and right now the FST is always in canonicalizing mode so there is no running status to disturb. That's half accident though, and doesn't work for midisyn (which treats any System Common message as SysEx, argh). The right solution will be to allow message-based drivers like umidi and midisyn to get their data via a message-at-a-time interface, rather than splitting the messages into bytes for lower drivers to reassemble wrong.
|
1.11.14.6 |
| 20-May-2006 |
chap | Receive dfa factored out and made usable for both receive and transmit. So far so good. Now to rewire transmit to use it.
|
1.11.14.5 |
| 20-May-2006 |
chap | Implement Active Sense on transmit. The same callout used by midi_start_output for brief delays in output is now also scheduled for 285 ms if there is nothing to transmit, and will send an Active Sense at that time if there is nothing else to go; this will keep the receiving equipment expecting our Active Sense and ensure that notes will stop sounding when it ceases (either because we close normally, or we hang, or someone trips over a cable). Sounds simple enough but involved a new locking strategy, because we used to block out user_incurred start_output whenever the device interrupt or callout was pending, but in the case of the 285ms callout we /want/ to let a user write through and cancel the callout (and avoid races, etc). Also moved the callout_init into midi_attach because midiattach was not called in all cases, and added a callout_stop in detach (though it is not yet quite up to all cases where the callout may have been fired but not yet run at the time of detach - nothing is easy.)
Surprisingly, the Active Sense works almost right over umidi: umidi's state machine isn't smart enough to pass it through a packet being built, and makes garbage instead, but a Yamaha keyboard at least is happy to accept a bit of garbage within 300 ms as a sign we're still alive. :)
Now to go do a better state machine for output. :/ It shouldn't be in umidi; it should be in midi, done once and done right; there should be no need to have slightly different replicas of the midi state machine all over the kernel ... I think there's one in sequencer too.
|
1.11.14.4 |
| 20-May-2006 |
chap | Take open modes seriously: do not write if not open for writing, or read if not open for reading, or if the midi device cannot read. In sequencer, open only the midi devices that support at least one of the open modes wanted; so, if the sequencer is opened for reading only, do not bother opening midi devices that cannot input. Do not write anything to the midi devices if opened for reading only; seq_reset previously wrote a bunch of initial settings, which could lead to long timeouts in seq_drain on close because of data in the output buffer that could not go anywhere.
TODO: sending initial settings is the less important thing for seq_reset to do; the most important is to reset the buffers so the playing stops! At present, it doesn't do that at all.
|
1.11.14.3 |
| 20-May-2006 |
chap | Fixes a bug in midi_unit_count.
Dropped byte and message counters now use evcnt.
My state machine could treat an invalid SystemCommon message or out-of- sequence EndSysex (all protocol errors anyway) as /mishandled/ protocol errors if encountered in certain states. Fixed.
|
1.11.14.2 |
| 20-May-2006 |
chap | Replaces the state machine in midi.c with a full, pedantically correct, error detecting one. Rearranges some DPRINTFN debug levels to make it easier to get the level of debug information wanted. Applies to 2.0.
|
1.11.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.11.8.1 |
| 11-Aug-2006 |
yamt | sync with head
|
1.11.4.1 |
| 09-Sep-2006 |
rpaulo | sync with head
|
1.12.4.1 |
| 27-Jan-2007 |
ad | Don't call selnotify() or psignal() while above IPL_VM: defer them to a soft interrupt.
|
1.13.32.1 |
| 08-Jan-2008 |
bouyer | Sync with HEAD
|
1.13.26.1 |
| 18-Feb-2008 |
mjf | Sync with HEAD.
|
1.13.20.2 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.13.20.1 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.13.4.1 |
| 27-Feb-2007 |
ad | Add MP locking for audio drivers.
|
1.14.6.2 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.14.6.1 |
| 03-Apr-2008 |
mjf | Sync with HEAD.
|
1.14.2.1 |
| 24-Mar-2008 |
keiichi | sync with head.
|
1.16.4.1 |
| 16-May-2008 |
yamt | sync with head.
|
1.16.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.17.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.17.34.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.17.12.1 |
| 09-Dec-2008 |
ad | Checkpoint work on MIDI.
|
1.18.2.1 |
| 05-Apr-2012 |
mrg | sync to latest -current.
|
1.19.16.1 |
| 06-Apr-2015 |
skrll | Sync with HEAD
|
1.19.14.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.
|
1.19.2.1 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|