summaryrefslogtreecommitdiffstats
path: root/sys/dev/midi.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Refactor klist insertion and removalvisa2020-12-251-4/+4
| | | | | | | | | | | | Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
* Abstract the head of knote lists. This allows extending the lists,visa2020-04-071-4/+4
| | | | | | for example, with locking assertions. OK mpi@, anton@
* Replace field f_isfd with field f_flags in struct filterops to allowvisa2020-02-201-3/+3
| | | | | | adding more filter properties without cluttering the struct. OK mpi@, anton@
* Use C99 designated initializers with struct filterops. In addition,visa2019-12-311-5/+11
| | | | | | make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
* midi(4): *sleep(9) -> *sleep_nsec(9)cheloha2019-12-221-7/+8
| | | | | | | | | | | | | | | | | | | | These are straightforward except for the tsleep(9) conversion. ratchov@ had a bit to say about that code: https://marc.info/?l=openbsd-tech&m=157665936017373&w=2 > The problem is that close(2) may reset the transmitter before the few > bytes of its internal buffer is sent on the wire; there's no "wait for > completion" feature in such simple hardware, so we just wait few > milliseconds. > > The transmitter buffer size is around 16 bytes, the byte rate is 3125 > bytes/second. So if we wait at least 16B / 3125B/s = 5.12ms, we're > safe. Waiting 10ms-20ms is enough and is unnoticeable. Hence, in this diff we wait a flat 20ms in that situation. ok ratchov@
* Remove SIGIO support. The audio(4) driver doesn't implement it either andkettenis2017-07-191-17/+1
| | | | | | | | | | the preferred method to access MIDI hardware is through sndiod(8) which doesn't use it. Fixes a potential issue with a stale struct proc pointer found by Ilja van Sprundel. ok deraadt@, ratchov@
* No need to include sys/malloc.h. From Michael W. Bombardieri. Thanks.ratchov2017-01-031-2/+1
|
* In midiread() and midiwrite(), add a second goto label toratchov2016-12-201-15/+12
| | | | | factor calls to mtx_leave() before returning. From Michael W. Bombardieri <mb at ii.net>. Thanks!
* Don't use an uninitialised softc pointer in midiread/midiwrite.jsg2015-05-221-3/+5
| | | | ok ratchov@
* Use device_lookup() instead of digging into midi_cd.cd_devs[] andratchov2015-05-161-92/+133
| | | | | | | | maintaining a "dying" flag which is already present in the device structure. As a side-effect, this adds the missing refcounting that mididetach() was missing. With from mpi@ and dlg@ ok mpi
* remove the sc->isopen flag, as sc->flags already hold theratchov2015-05-121-9/+9
| | | | same information.
* store byte count in a size_t and switch from uiomovei() to uiomove()ratchov2015-05-121-5/+5
|
* Remove unused code & definitions: midi_attach(), midi_unit_count(),ratchov2015-05-121-36/+8
| | | | | midi_getinfo(), midi_writebytes(). They were "used" by the sequencer interface which we removed years ago.
* Don't hold the audio mutex when calling uiomove(), as uiomove()ratchov2015-05-121-11/+12
| | | | may sleep in case of a page fault
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* First step towards making uiomove() take a size_t size argument:miod2015-02-101-3/+3
| | | | | | | - rename uiomove() to uiomovei() and update all its users. - introduce uiomove(), which is similar to uiomovei() but with a size_t. - rewrite uiomovei() as an uiomove() wrapper. ok kettenis@
* no need for lkmtedu2014-10-091-2/+1
|
* remove uneeded proc.h includesjsg2014-09-141-2/+1
| | | | ok mpi@ kspillner@
* Introduce a global interrupt-aware mutex protecting dataratchov2013-05-151-71/+53
| | | | | | | | | | | | | structures (including sound-card registers) from concurent access by syscall and interrupt code-paths. Since critical sections remain the same, calls to splraise/spllower can be safely replaced by calls to mtx_enter/mtx_leave with two exceptions: (1) mutexes are not reentrant (the inner splraise is thus removed), and (2) we're not allowed to sleep with a mutex (either msleep is used or the mutex is released before sleeping). ok and help from kettenis, a lot of work from armani
* Delete the sequencer(4) driver, since its not used any longer. Diffratchov2013-03-151-100/+1
| | | | | mostly from armani. ok miod, mpi, jsg and help from sthen
* Output interrupts are raised when the uart is ready for output, whichratchov2012-04-171-9/+9
| | | | | | obviously can occur after the transfer complete. In this case, don't print a warning (if MIDI_DEBUG defined) and don't attempt to stop the transfer twice.
* If the MIDI UART is not ready for output, don't spin at IPL_CLOCK;ratchov2012-03-301-54/+12
| | | | | | | just return and make the midi(4) driver retry later. UART buffers are large enough for this, except eap(4) which uses interrupts for output. help from and ok jsg@
* kqueue attach functions should return an errno or 0, not a plain 1. Fixnicm2011-07-021-2/+2
| | | | | | the obvious cases to return EINVAL and ENXIO. ok tedu deraadt
* while closing the device, don't sleep with the PCATCH flag, otherwiseratchov2011-01-271-3/+3
| | | | | a signal (like SIGALRM) may cause the output buffer to not be drained and causing for instance stale notes.
* fix spacingratchov2011-01-011-73/+73
|
* Don'tmiod2010-11-181-4/+1
| | | | | | | | | #include "foo.h" #if NFOO > 0 (whole file) #endif since config(8) file inclusion rules already do it for you. ok deraadt@
* remove unneeded variable. ratchov@ okfgsch2010-04-081-4/+4
|
* Every selwakeup() should have a matching KNOTE() (even if kqueue isn'tnicm2009-11-091-3/+1
| | | | | | | | | | supported it doesn't do any harm), so put the KNOTE() in selwakeup() itself and remove it from any occurences where both are used, except one for kqueue itself and one in sys_pipe.c (where the selwakeup is under a PIPE_SEL flag). Based on a diff from tedu. ok deraadt
* kqueue support for midi(4).nicm2009-11-011-4/+102
| | | | ok ratchov
* KNOTE() after selwakeup()deraadt2009-10-301-1/+3
| | | | ok ratchov
* remove prototype of non-existent midi_get_hwif()ratchov2009-08-171-2/+1
| | | | suggested by jsg@
* While detatching the device, workaround the case when a midiratchov2009-07-181-9/+8
| | | | | | entry is missing in cdevsw[], in which case vdevgone() is called with out of bounds argument. requested by dlg@
* 'tranfer' -> 'transfer' in comments.krw2006-12-211-2/+2
|
* poll errors should be POLLERR, not some random E valuetedu2006-11-011-2/+2
| | | | from alexandre ratchov. ok claudio
* Handle input interrupts in a better manner.jsg2006-04-161-13/+10
| | | | | | | It is only necessary to notify reading processes when the buffer is empty rather than on every input byte. From Alexandre Ratchov.
* Add optional flush method to MIDI hardware interface.jsg2006-04-071-12/+32
| | | | | | | Allow umidi(4) to send multiple events in a single USB transfer. This greatly improves the number of interrupts umidi is able to generate. From Alexandre Ratchov.
* the following patch fixes a bug preventing midi uarts that doderaadt2004-09-221-5/+4
| | | | | | not support interrupts on output, from writing blocks larger than MIDI_MAXWRITE bytes. tested on both kinds of devices from alex-contact@caoua.org
* re-add RCS id after last commitbrad2004-09-211-0/+2
|
* better midi stuff from alex@caoua.orgderaadt2004-06-271-635/+505
|
* Replace select backends with poll backends. selscan() and pollscan()millert2003-09-231-22/+19
| | | | | | | now call the poll backend. With this change we implement greater poll(2) functionality instead of emulating it via the select backend. Adapted from NetBSD and including some changes from FreeBSD. Tested by many, deraadt@ OK
* First round of __P removal in sysmillert2002-03-141-14/+14
|
* return ENOTTY not EINVAL in default: in *ioctl()mickey2002-01-101-2/+2
|
* fix compiling in audio-less configsmickey2001-03-231-2/+3
|
* Convert to new timeouts.art2000-06-261-2/+3
|
* Permit detach of audio devices, such as uaudio. Selected codeho2000-05-241-4/+4
| | | | from NetBSD/Lennart Augustsson. (niklas@ ok)
* Remove dependencies between midi & audio. midi now will compile onfgsch2000-01-031-3/+13
| | | | speaker only systems.
* Remove unnecessary externniklas1999-01-021-3/+1
|
* Midi & sequencer support from NetBSD, mostly by Lennart Augustssonniklas1999-01-021-0/+771