xref: /freebsd-src/sys/dev/sound/midi/midi.h (revision 2d6fc24673ccc97020c94094f97ee015f1db9702)
1206b17d7SAlexander Leidinger /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
448351eafSJoel Dahl  * Copyright (c) 2003 Mathew Kanner
548351eafSJoel Dahl  * All rights reserved.
6206b17d7SAlexander Leidinger  *
7206b17d7SAlexander Leidinger  * Redistribution and use in source and binary forms, with or without
848351eafSJoel Dahl  * modification, are permitted provided that the following conditions
948351eafSJoel Dahl  * are met:
1048351eafSJoel Dahl  * 1. Redistributions of source code must retain the above copyright
1148351eafSJoel Dahl  *    notice, this list of conditions and the following disclaimer.
1248351eafSJoel Dahl  * 2. Redistributions in binary form must reproduce the above copyright
1348351eafSJoel Dahl  *    notice, this list of conditions and the following disclaimer in the
1448351eafSJoel Dahl  *    documentation and/or other materials provided with the distribution.
15206b17d7SAlexander Leidinger  *
1648351eafSJoel Dahl  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1748351eafSJoel Dahl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1848351eafSJoel Dahl  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1948351eafSJoel Dahl  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2048351eafSJoel Dahl  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2148351eafSJoel Dahl  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2248351eafSJoel Dahl  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2348351eafSJoel Dahl  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24206b17d7SAlexander Leidinger  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25206b17d7SAlexander Leidinger  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26206b17d7SAlexander Leidinger  * SUCH DAMAGE.
27206b17d7SAlexander Leidinger  */
28206b17d7SAlexander Leidinger 
29206b17d7SAlexander Leidinger #ifndef MIDI_H
30206b17d7SAlexander Leidinger #define MIDI_H
31206b17d7SAlexander Leidinger 
32206b17d7SAlexander Leidinger #include <sys/types.h>
33206b17d7SAlexander Leidinger #include <sys/malloc.h>
34206b17d7SAlexander Leidinger 
35206b17d7SAlexander Leidinger MALLOC_DECLARE(M_MIDI);
36206b17d7SAlexander Leidinger 
37206b17d7SAlexander Leidinger #define M_RX		0x01
38206b17d7SAlexander Leidinger #define M_TX		0x02
39206b17d7SAlexander Leidinger #define M_RXEN		0x04
40206b17d7SAlexander Leidinger #define M_TXEN		0x08
41206b17d7SAlexander Leidinger 
42206b17d7SAlexander Leidinger struct snd_midi;
43206b17d7SAlexander Leidinger 
44*2d6fc246SChristos Margiolis void	midistat_lock(void);
45*2d6fc246SChristos Margiolis void	midistat_unlock(void);
46*2d6fc246SChristos Margiolis void	midistat_lockassert(void);
47*2d6fc246SChristos Margiolis 
488f981688SAlexander Leidinger struct snd_midi *
498f981688SAlexander Leidinger midi_init(kobj_class_t _mpu_cls, int _unit, int _channel, void *cookie);
50206b17d7SAlexander Leidinger int	midi_uninit(struct snd_midi *_m);
51526bd1d8SChristos Margiolis int	midi_out(struct snd_midi *_m, uint8_t *_buf, int _size);
52526bd1d8SChristos Margiolis int	midi_in(struct snd_midi *_m, uint8_t *_buf, int _size);
53206b17d7SAlexander Leidinger 
54206b17d7SAlexander Leidinger kobj_t	midimapper_addseq(void *arg1, int *unit, void **cookie);
55fc76e24eSChristos Margiolis int	midimapper_open_locked(void *arg1, void **cookie);
56206b17d7SAlexander Leidinger int	midimapper_open(void *arg1, void **cookie);
57206b17d7SAlexander Leidinger int	midimapper_close(void *arg1, void *cookie);
58fc76e24eSChristos Margiolis kobj_t	midimapper_fetch_synth_locked(void *arg, void *cookie, int unit);
59206b17d7SAlexander Leidinger kobj_t	midimapper_fetch_synth(void *arg, void *cookie, int unit);
60206b17d7SAlexander Leidinger 
61206b17d7SAlexander Leidinger #endif
62