aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/midi
Commit message (Collapse)AuthorAgeFilesLines
* sound: clean up empty lines in .c and .h filesMateusz Guzik2020-09-014-20/+0
| | | | Notes: svn path=/head/; revision=365085
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-262-3/+6
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Properly check for an interrupted cv_wait_sig().Mark Johnston2019-08-301-2/+2
| | | | | | | | | | | | The returned error number may be EINTR or ERESTART depending on whether or not the signal is supposed to interrupt the system call. Reported and tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351624
* Use a sleepable lock for midistat functions.Mark Johnston2019-08-201-72/+58
| | | | | | | | | | | | Otherwise the mutex needs to be dropped when copying out the midistat sbuf, leading to a race which allows one to read kernel memory beyond the end of the sbuf buffer. Reported and tested by: pho Security: CVE-2019-5612 Notes: svn path=/head/; revision=351262
* The event bytes should be unsigned char.Hans Petter Selasky2018-10-221-1/+1
| | | | | | | | | Found by: Peter Holm <peter@holm.cc> MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=339583
* Drop sequencer mutex around uiomove() and make sure we don't move more bytesHans Petter Selasky2018-10-221-2/+15
| | | | | | | | | | | than is available, else a panic might happen. Found by: Peter Holm <peter@holm.cc> MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=339582
* Fix off-by-one which can lead to panics.Hans Petter Selasky2018-10-221-1/+1
| | | | | | | | | Found by: Peter Holm <peter@holm.cc> MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=339581
* Revert r338423, reapplying r338422, which did get approval butGlen Barber2018-09-011-4/+0
| | | | | | | | | | | | communication lines got crossed. Apologies to avatar@ for the confusion. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=338424
* Revert r338422, which was did not get official approval from re@.Glen Barber2018-09-011-0/+4
| | | | | | | | Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=338423
* Adding support for CS46xx MIDI output. With this patch, users canTai-hwa Liang2018-09-011-4/+0
| | | | | | | | | | | | | | play the MIDI files through /dev/sequencer device with tools like playmidi. The audio output will go through the external MIDI device such like wavetable synthesis card. Reviewed by: matk (a long time ago), kib Approved by: re (kib) Tested with: Terratec SiXPack 5.1+ + Yamaha DB50XG MFC after: 4 weeks Notes: svn path=/head/; revision=338422
* Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni2018-01-211-3/+2
| | | | | | | | | | | | | | | | | | Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Notes: svn path=/head/; revision=328218
* dev: make some use of mallocarray(9).Pedro F. Giffuni2018-01-131-2/+3
| | | | | | | | | | | | | | Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Notes: svn path=/head/; revision=327949
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-277-0/+14
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* sound(4): Don't use-after-free in midi module unloadConrad Meyer2016-04-201-4/+4
| | | | | | | | | | | Also, use ANSI function parameter definitions (void) while here. Reported by: Coverity CID: 1006107 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298339
* Replace 0 with NULL for pointers in misc. device drivers.Pedro F. Giffuni2016-04-121-1/+1
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297862
* Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni2016-04-101-2/+2
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
* - Plugging a memory leak when malloc() failed during initialisation;Tai-hwa Liang2015-10-241-4/+8
| | | | | | | | | | - Plugging another memory leak inside the destructor. Reviewed by: matk MFC after: 3 weeks Notes: svn path=/head/; revision=289888
* Using the error return code documented in the comment.Tai-hwa Liang2015-08-181-1/+1
| | | | | | | | | | | | | Though there is no direct midi_uninit() caller amongst existing drivers at this moment, a quick experiment indicates that EBUSY gives users more precise error message once drivers start to honour this result. For example, emu_midi_detach() should check the result of mpu401_uninit() and block module unloading if there is any MIDI I/O in progress. MFC after: 2 weeks Notes: svn path=/head/; revision=286887
* Fixing typo as well as improving readability of a few comments.Tai-hwa Liang2015-08-181-6/+11
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=286886
* Rename seq_* to mseq_*, to avoid clashes with seq.h (namely, seq_read.)Adrian Chadd2015-06-261-22/+22
| | | | Notes: svn path=/head/; revision=284865
* CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than tenJung-uk Kim2015-05-221-1/+1
| | | | | | | | | | | | | years for head. However, it is continuously misused as the mpsafe argument for callout_init(9). Deprecate the flag and clean up callout_init() calls to make them more consistent. Differential Revision: https://reviews.freebsd.org/D2613 Reviewed by: jhb MFC after: 2 weeks Notes: svn path=/head/; revision=283291
* Remove check for obsolete FreeBSD versionsBaptiste Daroussin2014-11-031-9/+0
| | | | | | | | PR: 194517 Submitted by: François Tigeot <ftigeot@wolfpond.org> Notes: svn path=/head/; revision=274035
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-071-1/+1
| | | | | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Notes: svn path=/head/; revision=227309
* In order to maximize the re-usability of kernel code in user space thisKip Macy2011-09-161-2/+2
| | | | | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz) Notes: svn path=/head/; revision=225617
* Change the type of uio_resid member of struct uio from int to ssize_t.Konstantin Belousov2009-06-252-6/+6
| | | | | | | | | | | Note that this does not actually enable full-range i/o requests for 64 architectures, and is done now to update KBI only. Tested by: pho Reviewed by: jhb, bde (as part of the review of the bigger patch) Notes: svn path=/head/; revision=194990
* Remove custom KOBJMETHOD(), CHANNEL_DECLARE() and MIXER_DECLARE()Ariff Abdullah2009-06-112-22/+7
| | | | | | | | (enabled with SND_DEBUG) that was intended to provoke build failure due to inconsistencies. Notes: svn path=/head/; revision=193979
* Sound Mega-commit. Expect further cleanup until code freeze.Ariff Abdullah2009-06-074-22/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a slightly thorough explaination, please refer to [1] http://people.freebsd.org/~ariff/SOUND_4.TXT.html . Summary of changes includes: 1 Volume Per-Channel (vpc). Provides private / standalone volume control unique per-stream pcm channel without touching master volume / pcm. Applications can directly use SNDCTL_DSP_[GET|SET][PLAY|REC]VOL, or for backwards compatibility, SOUND_MIXER_PCM through the opened dsp device instead of /dev/mixer. Special "bypass" mode is enabled through /dev/mixer which will automatically detect if the adjustment is made through /dev/mixer and forward its request to this private volume controller. Changes to this volume object will not interfere with other channels. Requirements: - SNDCTL_DSP_[GET|SET][PLAY|REC]_VOL are newer ioctls (OSSv4) which require specific application modifications (preferred). - No modifications required for using bypass mode, so applications like mplayer or xmms should work out of the box. Kernel hints: - hint.pcm.%d.vpc (0 = disable vpc). Kernel sysctls: - hw.snd.vpc_mixer_bypass (default: 1). Enable or disable /dev/mixer bypass mode. - hw.snd.vpc_autoreset (default: 1). By default, closing/opening /dev/dsp will reset the volume back to 0 db gain/attenuation. Setting this to 0 will preserve its settings across device closing/opening. - hw.snd.vpc_reset (default: 0). Panic/reset button to reset all volume settings back to 0 db. - hw.snd.vpc_0db (default: 45). 0 db relative to linear mixer value. 2 High quality fixed-point Bandlimited SINC sampling rate converter, based on Julius O'Smith's Digital Audio Resampling - http://ccrma.stanford.edu/~jos/resample/. It includes a filter design script written in awk (the clumsiest joke I've ever written) - 100% 32bit fixed-point, 64bit accumulator. - Possibly among the fastest (if not fastest) of its kind. - Resampling quality is tunable, either runtime or during kernel compilation (FEEDER_RATE_PRESETS). - Quality can be further customized during kernel compilation by defining FEEDER_RATE_PRESETS in /etc/make.conf. Kernel sysctls: - hw.snd.feeder_rate_quality. 0 - Zero-order Hold (ZOH). Fastest, bad quality. 1 - Linear Interpolation (LINEAR). Slightly slower than ZOH, better quality but still does not eliminate aliasing. 2 - (and above) - Sinc Interpolation(SINC). Best quality. SINC quality always start from 2 and above. Rough quality comparisons: - http://people.freebsd.org/~ariff/z_comparison/ 3 Bit-perfect mode. Bypasses all feeder/dsp effects. Pure sound will be directly fed into the hardware. 4 Parametric (compile time) Software Equalizer (Bass/Treble mixer). Can be customized by defining FEEDER_EQ_PRESETS in /etc/make.conf. 5 Transparent/Adaptive Virtual Channel. Now you don't have to disable vchans in order to make digital format pass through. It also makes vchans more dynamic by choosing a better format/rate among all the concurrent streams, which means that dev.pcm.X.play.vchanformat/rate becomes sort of optional. 6 Exclusive Stream, with special open() mode O_EXCL. This will "mute" other concurrent vchan streams and only allow a single channel with O_EXCL set to keep producing sound. Other Changes: * most feeder_* stuffs are compilable in userland. Let's not speculate whether we should go all out for it (save that for FreeBSD 16.0-RELEASE). * kobj signature fixups, thanks to Andriy Gapon <avg@freebsd.org> * pull out channel mixing logic out of vchan.c and create its own feeder_mixer for world justice. * various refactoring here and there, for good or bad. * activation of few more OSSv4 ioctls() (see [1] above). * opt_snd.h for possible compile time configuration: (mostly for debugging purposes, don't try these at home) SND_DEBUG SND_DIAGNOSTIC SND_FEEDER_MULTIFORMAT SND_FEEDER_FULL_MULTIFORMAT SND_FEEDER_RATE_HP SND_PCM_64 SND_OLDSTEREO Manual page updates are on the way. Tested by: joel, Olivier SMEDTS <olivier at gid0 d org>, too many unsung / unnamed heroes. Notes: svn path=/head/; revision=193640
* Remove license clauses 3 and 4 as per rev. 1.65 of midi.c in NetBSD.Joel Dahl2009-05-201-7/+0
| | | | | | | Approved by: matk Notes: svn path=/head/; revision=192458
* Replace all calls to minor() with dev2unit().Ed Schouten2008-09-271-2/+2
| | | | | | | | | | | | | | | | | | After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere. This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware. Reviewed by: kib Notes: svn path=/head/; revision=183397
* Don't include <sys/tty.h> in our sound layer. It is not needed.Ed Schouten2008-08-191-1/+0
| | | | | | | | | | | | | The PCM's sound.h file only seems to include <sys/tty.h>, because channel_if seems to require selinfo. Just replace it with <sys/selinfo.h>. There's no real problem with including <sys/tty.h> here, even with MPSAFE TTY, but <sys/tty.h> is something that should be used by the TTY layer, its driver and code that integrated it with the process tree. Notes: svn path=/head/; revision=181874
* Giant is no longer required and can not be held over kproc_exit().Andrew Thompson2008-05-211-1/+0
| | | | Notes: svn path=/head/; revision=179183
* Replace callout_init(..., 1) with callout_init(..., CALLOUT_MPSAFE) forKris Kennaway2008-04-161-1/+1
| | | | | | | | | | better grep-compliance and to standardize with the rest of the kernel. Reviewed by: jhb MFC after: 1 week Notes: svn path=/head/; revision=178250
* Rename the kthread_xxx (e.g. kthread_create()) callsJulian Elischer2007-10-201-2/+2
| | | | | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls. Notes: svn path=/head/; revision=172836
* Disable seq_modevent(). The implementation is incomplete, and causingAriff Abdullah2007-04-021-0/+4
| | | | | | | memory leak during unload. Notes: svn path=/head/; revision=168253
* NULL instead of 0 in mtx_init() .Ariff Abdullah2007-03-152-5/+5
| | | | Notes: svn path=/head/; revision=167604
* semi-automatic style(9)Alexander Leidinger2007-02-2510-1310/+1359
| | | | Notes: svn path=/head/; revision=166971
* Clean up the BSD license to match the preferred license inJoel Dahl2007-01-2810-138/+160
| | | | | | | | | | | /usr/share/examples/etc/bsd-style-copyright. I've fixed a few minor wording and formatting differences. Approved by: matk, Hannu Savolainen <hannu@opensound.com> Reviewed by: imp Notes: svn path=/head/; revision=166322
* Rearrange locking order to avoid LOR (cat /dev/midistat).Ariff Abdullah2007-01-271-3/+9
| | | | | | | Reported by: rodrigc Notes: svn path=/head/; revision=166280
* Wrap debug printfs into SEQ_DEBUG() to avoid kernel messages clutterAriff Abdullah2006-10-151-19/+19
| | | | | | | during module unload. Notes: svn path=/head/; revision=163364
* SNDCTL_TMR_{START,STOP,CONTINUE} don't take an argument.Ruslan Ermilov2006-09-291-4/+8
| | | | Notes: svn path=/head/; revision=162776
* Move debug printfs under the proper macro.Nate Lawson2006-07-121-3/+3
| | | | Notes: svn path=/head/; revision=160288
* - Rename hw.snd.unit to hw.snd.default_unit to make the purpose more obvious.Alexander Leidinger2006-06-182-0/+2
| | | | | | | | | | - Enable 4 automatic vchan's by default. - Add some comments which provide ides/questions for improvement. - Prefix some temporary sysctl's with an underscore to denote that it is not an official API but a workaround until the real solution is implemented. Notes: svn path=/head/; revision=159732
* Fix build with -Wundef.Ruslan Ermilov2006-05-292-4/+4
| | | | Notes: svn path=/head/; revision=159042
* Use a more appropriate printf format for size_t.Alexander Leidinger2006-05-281-1/+1
| | | | | | | This should unbreak the tinderbox build (64bit architectures). Notes: svn path=/head/; revision=159009
* Commit the new (old) midi framework. It's based in parts on the NetBSD code,Alexander Leidinger2006-05-2710-0/+4547
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | but large parts are rewritten by matk and tanimura. This is old code, it's not maintained since 2003. We also don't have a maintainer for this! Yuriy Tsibizov took it and uses it in his emu10kx driver. Since the emu10kx driver will enter the tree "soon" (some bugs have to be fixed after Yuriy return from his holidays), I add it here already. This also contains some changes to emu10k1 and cmi, so if you're lucky, you can now make some kind of use of midi with those soundcards. To all those poor souls which don't have such a card: feel free to send patches, we don't have a maintainer for this. To those which miss a specific feature in the midi code: feel free to submit patches, we don't have a maintainer for this. Oh, did I already told that it would be nice if someone would take care of it? Maintainer with midi equipment wanted! :-) If you get LOR's, submit a PR and notify multimedia@ please. If you get panics, submit a PR with a backtrace (compile the sound system into your kernel instead of using modules in this case) and notify multimedia@ please. Written by: matk, tanimura Submitted by: "Yuriy Tsibizov" <Yuriy.Tsibizov@gfk.ru> Based upon: code from NetBSD Notes: svn path=/head/; revision=158979
* Axe the old midi drivers and framework. matk has developed a newSeigo Tanimura2004-06-0111-6051/+0
| | | | | | | module-friendly midi subsystem to be merged soon. Notes: svn path=/head/; revision=129925
* Device megapatch 5/6:Poul-Henning Kamp2004-02-211-1/+1
| | | | | | | | | | | | | | | Remove the unused second argument from udev2dev(). Convert all remaining users of makedev() to use udev2dev(). The semantic difference is that udev2dev() will only locate a pre-existing dev_t, it will not line makedev() create a new one. Apart from the tiny well controlled windown in D_PSEUDO drivers, there should no longer be any "anonymous" dev_t's in the system now, only dev_t's created with make_dev() and make_dev_alias() Notes: svn path=/head/; revision=126081
* Device megapatch 4/6:Poul-Henning Kamp2004-02-212-0/+4
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080
* - Implement selwakeuppri() which allows raising the priority of aSeigo Tanimura2003-11-091-2/+2
| | | | | | | | | | | | | | | | thread being waken up. The thread waken up can run at a priority as high as after tsleep(). - Replace selwakeup()s with selwakeuppri()s and pass appropriate priorities. - Add cv_broadcastpri() which raises the priority of the broadcast threads. Used by selwakeuppri() if collision occurs. Not objected in: -arch, -current Notes: svn path=/head/; revision=122352
* Deprecate machine/limits.h in favor of new sys/limits.h.Alexander Kabaev2003-04-291-1/+1
| | | | | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com> Notes: svn path=/head/; revision=114216