FreeBSD kernel sound device code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/queue.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/conf.h>
#include <sys/selinfo.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/sx.h>
#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/poll.h>
#include <sys/sbuf.h>
#include <sys/kobj.h>
#include <sys/module.h>
#include <dev/sound/midi/midi.h>
#include "mpu_if.h"
#include <dev/sound/midi/midiq.h>
#include "synth_if.h"
Go to the source code of this file.
Data Structures | |
struct | snd_midi |
struct | synth_midi |
Macros | |
#define | KOBJMETHOD_END { NULL, NULL } |
#define | PCMMKMINOR(u, d, c) ((((c) & 0xff) << 16) | (((u) & 0x0f) << 4) | ((d) & 0x0f)) |
#define | MIDIMKMINOR(u, d, c) PCMMKMINOR(u, d, c) |
#define | MIDI_DEV_RAW 2 |
#define | MIDI_DEV_MIDICTL 12 |
#define | MIDI_NAMELEN 16 |
#define | MIDI_DEBUG(l, a) if(midi_debug>=l) a |
#define | MIDI_LENGTH(d) (midi_lengths[((d) >> 4) & 7]) |
#define | MIDI_ACK 0xfe |
#define | MIDI_IS_STATUS(d) ((d) >= 0x80) |
#define | MIDI_IS_COMMON(d) ((d) >= 0xf0) |
#define | MIDI_SYSEX_START 0xF0 |
#define | MIDI_SYSEX_END 0xF7 |
#define | MIDI_RSIZE 32 |
#define | MIDI_WSIZE 32 |
Enumerations | |
enum | midi_states { MIDI_IN_START , MIDI_IN_SYSEX , MIDI_IN_DATA } |
Functions | |
__FBSDID ("$FreeBSD$") | |
MALLOC_DEFINE (M_MIDI, "midi buffers", "Midi data allocation area") | |
DEFINE_CLASS (midisynth, midisynth_methods, 0) | |
TAILQ_HEAD (snd_midi) | |
static int | midi_destroy (struct snd_midi *, int) |
static int | midistat_prepare (struct sbuf *s) |
static int | midi_load (void) |
static int | midi_unload (void) |
SYSCTL_NODE (_hw, OID_AUTO, midi, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "Midi driver") | |
static | SYSCTL_NODE (_hw_midi, OID_AUTO, stat, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "Status device") |
SYSCTL_INT (_hw_midi, OID_AUTO, debug, CTLFLAG_RW, &midi_debug, 0, "") | |
SYSCTL_INT (_hw_midi, OID_AUTO, dumpraw, CTLFLAG_RW, &midi_dumpraw, 0, "") | |
SYSCTL_INT (_hw_midi, OID_AUTO, instroff, CTLFLAG_RW, &midi_instroff, 0, "") | |
SYSCTL_INT (_hw_midi_stat, OID_AUTO, verbose, CTLFLAG_RW, &midistat_verbose, 0, "") | |
struct snd_midi * | midi_init (kobj_class_t cls, int unit, int channel, void *cookie) |
int | midi_uninit (struct snd_midi *m) |
int | midi_in (struct snd_midi *m, MIDI_TYPE *buf, int size) |
int | midi_out (struct snd_midi *m, MIDI_TYPE *buf, int size) |
int | midi_open (struct cdev *i_dev, int flags, int mode, struct thread *td) |
int | midi_close (struct cdev *i_dev, int flags, int mode, struct thread *td) |
int | midi_read (struct cdev *i_dev, struct uio *uio, int ioflag) |
int | midi_write (struct cdev *i_dev, struct uio *uio, int ioflag) |
int | midi_ioctl (struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) |
int | midi_poll (struct cdev *i_dev, int events, struct thread *td) |
static int | midistat_open (struct cdev *i_dev, int flags, int mode, struct thread *td) |
static int | midistat_close (struct cdev *i_dev, int flags, int mode, struct thread *td) |
static int | midistat_read (struct cdev *i_dev, struct uio *uio, int flag) |
int | midisynth_open (void *n, void *arg, int flags) |
int | midisynth_close (void *n) |
int | midisynth_writeraw (void *n, uint8_t *buf, size_t len) |
static int | midisynth_killnote (void *n, uint8_t chn, uint8_t note, uint8_t vel) |
static int | midisynth_setinstr (void *n, uint8_t chn, uint16_t instr) |
static int | midisynth_startnote (void *n, uint8_t chn, uint8_t note, uint8_t vel) |
static int | midisynth_alloc (void *n, uint8_t chan, uint8_t note) |
static int | midisynth_controller (void *n, uint8_t chn, uint8_t ctrlnum, uint16_t val) |
static int | midisynth_bender (void *n, uint8_t chn, uint16_t val) |
int | seq_modevent (module_t mod, int type, void *data) |
static int | midi_modevent (module_t mod, int type, void *data) |
kobj_t | midimapper_addseq (void *arg1, int *unit, void **cookie) |
int | midimapper_open (void *arg1, void **cookie) |
int | midimapper_close (void *arg1, void *cookie) |
kobj_t | midimapper_fetch_synth (void *arg, void *cookie, int unit) |
DEV_MODULE (midi, midi_modevent, NULL) | |
MODULE_VERSION (midi, 1) | |
Variables | |
static synth_open_t | midisynth_open |
static synth_close_t | midisynth_close |
static synth_writeraw_t | midisynth_writeraw |
static synth_killnote_t | midisynth_killnote |
static synth_startnote_t | midisynth_startnote |
static synth_setinstr_t | midisynth_setinstr |
static synth_alloc_t | midisynth_alloc |
static synth_controller_t | midisynth_controller |
static synth_bender_t | midisynth_bender |
static kobj_method_t | midisynth_methods [] |
static d_open_t | midi_open |
static d_close_t | midi_close |
static d_ioctl_t | midi_ioctl |
static d_read_t | midi_read |
static d_write_t | midi_write |
static d_poll_t | midi_poll |
static struct cdevsw | midi_cdevsw |
int | midi_debug |
int | midi_dumpraw |
int | midi_instroff |
int | midistat_verbose |
#define MIDI_DEBUG | ( | l, | |
a | |||
) | if(midi_debug>=l) a |
#define MIDI_RSIZE 32 |
#define MIDI_WSIZE 32 |
#define MIDIMKMINOR | ( | u, | |
d, | |||
c | |||
) | PCMMKMINOR(u, d, c) |
enum midi_states |
__FBSDID | ( | "$FreeBSD$" | ) |
DEFINE_CLASS | ( | midisynth | , |
midisynth_methods | , | ||
0 | |||
) |
DEV_MODULE | ( | midi | , |
midi_modevent | , | ||
NULL | |||
) |
MALLOC_DEFINE | ( | M_MIDI | , |
"midi buffers" | , | ||
"Midi data allocation area" | |||
) |
int midi_close | ( | struct cdev * | i_dev, |
int | flags, | ||
int | mode, | ||
struct thread * | td | ||
) |
Definition at line 682 of file midi.c.
References snd_midi::flags, m, M_RX, M_RXEN, M_TX, M_TXEN, and MIDI_DEBUG.
|
static |
Definition at line 1361 of file midi.c.
References free, m, MIDI_DEBUG, and MIDIQ_BUF.
Referenced by midi_uninit(), and midi_unload().
Definition at line 453 of file midi.c.
References buf, data, m, M_RX, MIDI_ACK, MIDI_DEBUG, MIDI_IN_DATA, MIDI_IN_START, MIDI_IN_SYSEX, MIDI_IS_COMMON, MIDI_IS_STATUS, MIDI_LENGTH, MIDI_SYSEX_END, MIDIQ_AVAIL, MIDIQ_ENQ, MIDIQ_FULL, MIDIQ_LEN, and size.
Referenced by mpu401_intr().
struct snd_midi * midi_init | ( | kobj_class_t | cls, |
int | unit, | ||
int | channel, | ||
void * | cookie | ||
) |
Definition at line 281 of file midi.c.
References buf, channel, snd_midi::cookie, free, inqsize, m, midi_cdevsw, MIDI_DEBUG, MIDI_DEV_RAW, MIDI_TYPE, MIDIMKMINOR, MIDIQ_BUF, MIDIQ_INIT, outqsize, and snd_midi::unit.
Referenced by mpu401_init().
int midi_ioctl | ( | struct cdev * | i_dev, |
u_long | cmd, | ||
caddr_t | arg, | ||
int | mode, | ||
struct thread * | td | ||
) |
Definition at line 884 of file midi.c.
Referenced by mseq_ioctl().
|
static |
Definition at line 1387 of file midi.c.
References MIDI_DEV_MIDICTL, and MIDIMKMINOR.
Referenced by midi_modevent().
|
static |
Definition at line 1441 of file midi.c.
References data, midi_load(), midi_unload(), seq_modevent(), and type.
Referenced by sound_modevent().
int midi_open | ( | struct cdev * | i_dev, |
int | flags, | ||
int | mode, | ||
struct thread * | td | ||
) |
Definition at line 623 of file midi.c.
References snd_midi::flags, m, M_RX, M_RXEN, M_TX, MIDI_DEBUG, MIDIQ_CLEAR, and MIDIQ_SIZE.
Definition at line 583 of file midi.c.
References buf, m, M_TXEN, MIDI_DEBUG, MIDIQ_AVAIL, MIDIQ_DEQ, MIDIQ_EMPTY, MIDIQ_LEN, and size.
Referenced by mpu401_intr().
int midi_poll | ( | struct cdev * | i_dev, |
int | events, | ||
struct thread * | td | ||
) |
Definition at line 891 of file midi.c.
References m, MIDIQ_AVAIL, and MIDIQ_EMPTY.
int midi_read | ( | struct cdev * | i_dev, |
struct uio * | uio, | ||
int | ioflag | ||
) |
Definition at line 727 of file midi.c.
References buf, m, M_RX, MIDI_DEBUG, MIDI_RSIZE, MIDIQ_DEQ, MIDIQ_EMPTY, and MIDIQ_LEN.
int midi_uninit | ( | struct snd_midi * | m | ) |
Definition at line 401 of file midi.c.
References m, and midi_destroy().
Referenced by mpu401_uninit().
|
static |
Definition at line 1400 of file midi.c.
References m, MIDI_DEBUG, and midi_destroy().
Referenced by midi_modevent().
int midi_write | ( | struct cdev * | i_dev, |
struct uio * | uio, | ||
int | ioflag | ||
) |
Definition at line 805 of file midi.c.
References buf, m, M_TX, M_TXEN, MIDI_DEBUG, MIDI_WSIZE, MIDIQ_AVAIL, MIDIQ_ENQ, and MIDIQ_LEN.
kobj_t midimapper_addseq | ( | void * | arg1, |
int * | unit, | ||
void ** | cookie | ||
) |
Definition at line 1468 of file midi.c.
References snd_midi::unit.
Referenced by seq_addunit().
int midimapper_close | ( | void * | arg1, |
void * | cookie | ||
) |
Definition at line 1490 of file midi.c.
Referenced by mseq_close().
kobj_t midimapper_fetch_synth | ( | void * | arg, |
void * | cookie, | ||
int | unit | ||
) |
Definition at line 1496 of file midi.c.
References m, and snd_midi::unit.
Referenced by mseq_open().
int midimapper_open | ( | void * | arg1, |
void ** | cookie | ||
) |
Definition at line 1476 of file midi.c.
References m.
Referenced by mseq_open().
|
static |
Definition at line 955 of file midi.c.
References MIDI_DEBUG.
|
static |
Definition at line 930 of file midi.c.
References error, MIDI_DEBUG, and midistat_prepare().
|
static |
Definition at line 1000 of file midi.c.
References m, and midistat_verbose.
Referenced by midistat_open().
|
static |
Definition at line 970 of file midi.c.
References MIDI_DEBUG.
|
static |
|
static |
int midisynth_close | ( | void * | n | ) |
|
static |
|
static |
Definition at line 1268 of file midi.c.
References c, midisynth_writeraw, and n.
int midisynth_open | ( | void * | n, |
void * | arg, | ||
int | flags | ||
) |
Definition at line 1070 of file midi.c.
References m, M_RX, M_RXEN, M_TX, MIDI_DEBUG, MIDIQ_CLEAR, MIDIQ_SIZE, and n.
|
static |
Definition at line 1292 of file midi.c.
References c, midi_instroff, midisynth_writeraw, and n.
|
static |
Definition at line 1306 of file midi.c.
References c, midisynth_writeraw, and n.
int midisynth_writeraw | ( | void * | n, |
uint8_t * | buf, | ||
size_t | len | ||
) |
Definition at line 1179 of file midi.c.
References buf, len, m, M_TX, M_TXEN, MIDI_DEBUG, midi_dumpraw, MIDI_WSIZE, MIDIQ_AVAIL, MIDIQ_ENQ, MIDIQ_LEN, and n.
MODULE_VERSION | ( | midi | , |
1 | |||
) |
int seq_modevent | ( | module_t | mod, |
int | type, | ||
void * | data | ||
) |
Definition at line 695 of file sequencer.c.
References nseq, r, seq_addunit(), seq_delunit(), seqinfo_mtx, and type.
Referenced by midi_modevent().
SYSCTL_INT | ( | _hw_midi | , |
OID_AUTO | , | ||
debug | , | ||
CTLFLAG_RW | , | ||
& | midi_debug, | ||
0 | , | ||
"" | |||
) |
SYSCTL_INT | ( | _hw_midi | , |
OID_AUTO | , | ||
dumpraw | , | ||
CTLFLAG_RW | , | ||
& | midi_dumpraw, | ||
0 | , | ||
"" | |||
) |
SYSCTL_INT | ( | _hw_midi | , |
OID_AUTO | , | ||
instroff | , | ||
CTLFLAG_RW | , | ||
& | midi_instroff, | ||
0 | , | ||
"" | |||
) |
SYSCTL_INT | ( | _hw_midi_stat | , |
OID_AUTO | , | ||
verbose | , | ||
CTLFLAG_RW | , | ||
& | midistat_verbose, | ||
0 | , | ||
"" | |||
) |
SYSCTL_NODE | ( | _hw | , |
OID_AUTO | , | ||
midi | , | ||
CTLFLAG_RD| | CTLFLAG_MPSAFE, | ||
0 | , | ||
"Midi driver" | |||
) |
|
static |
|
static |
Definition at line 220 of file midi.c.
Referenced by midi_init().
int midi_dumpraw |
Definition at line 252 of file midi.c.
Referenced by midisynth_writeraw().
int midi_instroff |
Definition at line 255 of file midi.c.
Referenced by midisynth_setinstr().
int midistat_verbose |
Definition at line 258 of file midi.c.
Referenced by midistat_prepare().
|
static |
|
static |
Definition at line 137 of file midi.c.
Referenced by midisynth_bender(), midisynth_controller(), midisynth_killnote(), midisynth_setinstr(), and midisynth_startnote().