FreeBSD kernel sound device code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioccom.h>
#include <sys/filio.h>
#include <sys/lock.h>
#include <sys/sockio.h>
#include <sys/fcntl.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/uio.h>
#include <sys/syslog.h>
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/bus.h>
#include <machine/resource.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <sys/soundcard.h>
#include <sys/rman.h>
#include <sys/mman.h>
#include <sys/poll.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/kthread.h>
#include <sys/unistd.h>
#include <sys/selinfo.h>
#include <dev/sound/midi/midi.h>
#include <dev/sound/midi/midiq.h>
#include "synth_if.h"
#include <dev/sound/midi/sequencer.h>
Go to the source code of this file.
Data Structures | |
struct | seq_softc |
Macros | |
#define | TMR_TIMERBASE 13 |
#define | SND_DEV_SEQ |
#define | SND_DEV_MUSIC 8 /* /dev/music, level 2 interface */ |
#define | EV_SZ 8 |
#define | IEV_SZ 8 |
#define | LOOKUP_EXIST (0) |
#define | LOOKUP_OPEN (1) |
#define | LOOKUP_CLOSE (2) |
#define | PCMMKMINOR(u, d, c) ((((c) & 0xff) << 16) | (((u) & 0x0f) << 4) | ((d) & 0x0f)) |
#define | MIDIMKMINOR(u, d, c) PCMMKMINOR(u, d, c) |
#define | MIDIUNIT(y) ((dev2unit(y) >> 4) & 0x0f) |
#define | MIDIDEV(y) (dev2unit(y) & 0x0f) |
#define | KOBJMETHOD_END { NULL, NULL } |
#define | SEQ_RSIZE 32 |
#define | SEQ_SYNC_TIMEOUT 8 |
Functions | |
__FBSDID ("$FreeBSD$") | |
SYSCTL_NODE (_hw_midi, OID_AUTO, seq, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "Midi sequencer") | |
SYSCTL_INT (_hw_midi_seq, OID_AUTO, debug, CTLFLAG_RW, &seq_debug, 0, "") | |
DEFINE_CLASS (sequencer, seq_methods, 0) | |
static int | seq_convertold (u_char *event, u_char *out) |
static void | seq_reset (struct seq_softc *scp) |
static int | seq_sync (struct seq_softc *scp) |
static int | seq_processevent (struct seq_softc *scp, u_char *event) |
static int | seq_timing (struct seq_softc *scp, u_char *event) |
static int | seq_local (struct seq_softc *scp, u_char *event) |
static int | seq_chnvoice (struct seq_softc *scp, kobj_t md, u_char *event) |
static int | seq_chncommon (struct seq_softc *scp, kobj_t md, u_char *event) |
static int | seq_sysex (struct seq_softc *scp, kobj_t md, u_char *event) |
static int | seq_fetch_mid (struct seq_softc *scp, int unit, kobj_t *md) |
void | seq_copytoinput (struct seq_softc *scp, u_char *event, int len) |
int | seq_modevent (module_t mod, int type, void *data) |
static void | timer_start (struct seq_softc *t) |
static void | timer_stop (struct seq_softc *t) |
static void | timer_setvals (struct seq_softc *t, int tempo, int timerbase) |
static void | timer_wait (struct seq_softc *t, int ticks, int wait_abs) |
static int | timer_now (struct seq_softc *t) |
static void | timer_continue (struct seq_softc *t) |
static void | seq_eventthread (void *arg) |
static int | seq_addunit (void) |
static int | seq_delunit (int unit) |
int | mseq_open (struct cdev *i_dev, int flags, int mode, struct thread *td) |
int | mseq_close (struct cdev *i_dev, int flags, int mode, struct thread *td) |
int | mseq_read (struct cdev *i_dev, struct uio *uio, int ioflag) |
int | mseq_write (struct cdev *i_dev, struct uio *uio, int ioflag) |
int | mseq_ioctl (struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) |
int | mseq_poll (struct cdev *i_dev, int events, struct thread *td) |
char * | midi_cmdname (int cmd, midi_cmdtab *tab) |
Variables | |
static d_open_t | mseq_open |
static d_close_t | mseq_close |
static d_ioctl_t | mseq_ioctl |
static d_read_t | mseq_read |
static d_write_t | mseq_write |
static d_poll_t | mseq_poll |
static struct cdevsw | seq_cdevsw |
int | seq_debug |
midi_cmdtab | cmdtab_seqevent [] |
midi_cmdtab | cmdtab_seqioctl [] |
midi_cmdtab | cmdtab_timer [] |
midi_cmdtab | cmdtab_seqcv [] |
midi_cmdtab | cmdtab_seqccmn [] |
static kobj_method_t | seq_methods [] |
struct seq_softc * | seqs [10] |
static struct mtx | seqinfo_mtx |
static u_long | nseq = 0 |
#define EV_SZ 8 |
Definition at line 87 of file sequencer.c.
#define IEV_SZ 8 |
Definition at line 88 of file sequencer.c.
#define KOBJMETHOD_END { NULL, NULL } |
Definition at line 267 of file sequencer.c.
#define LOOKUP_CLOSE (2) |
Definition at line 93 of file sequencer.c.
#define LOOKUP_EXIST (0) |
Definition at line 91 of file sequencer.c.
#define LOOKUP_OPEN (1) |
Definition at line 92 of file sequencer.c.
#define MIDIDEV | ( | y | ) | (dev2unit(y) & 0x0f) |
Definition at line 99 of file sequencer.c.
#define MIDIMKMINOR | ( | u, | |
d, | |||
c | |||
) | PCMMKMINOR(u, d, c) |
Definition at line 97 of file sequencer.c.
#define MIDIUNIT | ( | y | ) | ((dev2unit(y) >> 4) & 0x0f) |
Definition at line 98 of file sequencer.c.
Definition at line 95 of file sequencer.c.
#define SEQ_RSIZE 32 |
#define SEQ_SYNC_TIMEOUT 8 |
Definition at line 2010 of file sequencer.c.
#define SND_DEV_MUSIC 8 /* /dev/music, level 2 interface */ |
Definition at line 84 of file sequencer.c.
#define SND_DEV_SEQ |
Definition at line 83 of file sequencer.c.
#define TMR_TIMERBASE 13 |
Definition at line 81 of file sequencer.c.
__FBSDID | ( | "$FreeBSD$" | ) |
DEFINE_CLASS | ( | sequencer | , |
seq_methods | , | ||
0 | |||
) |
char * midi_cmdname | ( | int | cmd, |
midi_cmdtab * | tab | ||
) |
Definition at line 2095 of file sequencer.c.
References _midi_cmdtab::cmd, and _midi_cmdtab::name.
Referenced by mseq_ioctl(), mseq_write(), seq_chncommon(), and seq_chnvoice().
int mseq_close | ( | struct cdev * | i_dev, |
int | flags, | ||
int | mode, | ||
struct thread * | td | ||
) |
Definition at line 824 of file sequencer.c.
References midimapper_close(), SEQ_DEBUG, seq_reset(), seq_sync(), and timer_stop().
int mseq_ioctl | ( | struct cdev * | i_dev, |
u_long | cmd, | ||
caddr_t | arg, | ||
int | mode, | ||
struct thread * | td | ||
) |
Definition at line 1127 of file sequencer.c.
References cmdtab_seqioctl, EV_SZ, LOOKUP_OPEN, midi_cmdname(), midi_ioctl(), MIDIQ_SIZE, RANGE, seq_convertold(), SEQ_DEBUG, seq_fetch_mid(), seq_processevent(), seq_reset(), seq_sync(), SND_DEV_MIDIN, timer_now(), and TMR_TIMERBASE.
int mseq_open | ( | struct cdev * | i_dev, |
int | flags, | ||
int | mode, | ||
struct thread * | td | ||
) |
Definition at line 741 of file sequencer.c.
References MIDIDEV, midimapper_fetch_synth(), midimapper_open(), MIDIQ_SIZE, SEQ_DEBUG, SND_DEV_MUSIC, timer_setvals(), timer_start(), and timer_stop().
int mseq_poll | ( | struct cdev * | i_dev, |
int | events, | ||
struct thread * | td | ||
) |
Definition at line 1431 of file sequencer.c.
References MIDIQ_AVAIL, MIDIQ_LEN, and SEQ_DEBUG.
int mseq_read | ( | struct cdev * | i_dev, |
struct uio * | uio, | ||
int | ioflag | ||
) |
Definition at line 862 of file sequencer.c.
References buf, MIDIQ_DEQ, MIDIQ_EMPTY, MIDIQ_LEN, SEQ_DEBUG, and SEQ_RSIZE.
int mseq_write | ( | struct cdev * | i_dev, |
struct uio * | uio, | ||
int | ioflag | ||
) |
Definition at line 940 of file sequencer.c.
References buf, cmdtab_seqevent, count, error, EV_SZ, LOOKUP_OPEN, midi_cmdname(), MIDIQ_AVAIL, MIDIQ_ENQ, MIDIQ_LEN, seq_convertold(), SEQ_DEBUG, and seq_processevent().
|
static |
Definition at line 521 of file sequencer.c.
References buf, EV_SZ, free, midimapper_addseq(), MIDIMKMINOR, MIDIQ_INIT, nseq, seq_cdevsw, SEQ_DEBUG, seq_eventthread(), seqinfo_mtx, seqs, SND_DEV_MUSIC, SND_DEV_SEQ, and seq_softc::th_cv.
Referenced by seq_modevent().
|
static |
Definition at line 1765 of file sequencer.c.
References cmdtab_seqccmn, key, midi_cmdname(), QUEUEFULL, and SEQ_DEBUG.
Referenced by seq_processevent().
|
static |
Definition at line 1691 of file sequencer.c.
References cmdtab_seqcv, midi_cmdname(), and SEQ_DEBUG.
Referenced by seq_processevent().
|
static |
Definition at line 1503 of file sequencer.c.
References dev, MORE, QUEUEFULL, seq_copytoinput(), and SEQ_DEBUG.
Referenced by mseq_ioctl(), and mseq_write().
void seq_copytoinput | ( | struct seq_softc * | scp, |
u_char * | event, | ||
int | len | ||
) |
Definition at line 1672 of file sequencer.c.
References len, MIDIQ_AVAIL, MIDIQ_ENQ, and SEQ_DEBUG.
Referenced by seq_convertold(), and seq_timing().
|
static |
Definition at line 629 of file sequencer.c.
References free, nseq, SEQ_DEBUG, seqinfo_mtx, seqs, and seq_softc::th_cv.
Referenced by seq_modevent().
|
static |
Definition at line 433 of file sequencer.c.
References EV_SZ, MIDIQ_AVAIL, MIDIQ_DEQ, MIDIQ_EMPTY, SEQ_DEBUG, seq_processevent(), and seq_softc::th_cv.
Referenced by seq_addunit().
|
static |
Definition at line 729 of file sequencer.c.
Referenced by mseq_ioctl(), and seq_processevent().
|
static |
Definition at line 1919 of file sequencer.c.
References SEQ_DEBUG.
Referenced by seq_processevent().
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().
|
static |
Definition at line 478 of file sequencer.c.
References m, seq_chncommon(), seq_chnvoice(), SEQ_DEBUG, seq_fetch_mid(), seq_local(), seq_sysex(), and seq_timing().
Referenced by mseq_ioctl(), mseq_write(), and seq_eventthread().
|
static |
Definition at line 1965 of file sequencer.c.
References m, MIDIQ_CLEAR, and SEQ_DEBUG.
Referenced by mseq_close(), and mseq_ioctl().
|
static |
Definition at line 2012 of file sequencer.c.
References MIDIQ_CLEAR, MIDIQ_EMPTY, MIDIQ_LEN, SEQ_DEBUG, and SEQ_SYNC_TIMEOUT.
Referenced by mseq_close(), and mseq_ioctl().
|
static |
Definition at line 1939 of file sequencer.c.
References SEQ_DEBUG.
Referenced by seq_processevent().
|
static |
Definition at line 1841 of file sequencer.c.
References param, seq_copytoinput(), SEQ_DEBUG, timer_continue(), timer_setvals(), timer_start(), timer_stop(), timer_wait(), and TMR_TIMERBASE.
Referenced by seq_processevent().
SYSCTL_INT | ( | _hw_midi_seq | , |
OID_AUTO | , | ||
debug | , | ||
CTLFLAG_RW | , | ||
& | seq_debug, | ||
0 | , | ||
"" | |||
) |
SYSCTL_NODE | ( | _hw_midi | , |
OID_AUTO | , | ||
seq | , | ||
CTLFLAG_RD| | CTLFLAG_MPSAFE, | ||
0 | , | ||
"Midi sequencer" | |||
) |
|
static |
Definition at line 320 of file sequencer.c.
Referenced by seq_timing().
|
static |
Definition at line 405 of file sequencer.c.
Referenced by mseq_ioctl().
|
static |
Definition at line 340 of file sequencer.c.
Referenced by mseq_open(), and seq_timing().
|
static |
Definition at line 313 of file sequencer.c.
Referenced by mseq_open(), and seq_timing().
|
static |
Definition at line 333 of file sequencer.c.
Referenced by mseq_close(), mseq_open(), and seq_timing().
|
static |
Definition at line 347 of file sequencer.c.
References SEQ_DEBUG.
Referenced by seq_timing().
midi_cmdtab cmdtab_seqccmn[] |
Definition at line 257 of file sequencer.c.
Referenced by seq_chncommon().
midi_cmdtab cmdtab_seqcv[] |
Definition at line 250 of file sequencer.c.
Referenced by seq_chnvoice().
midi_cmdtab cmdtab_seqevent[] |
Definition at line 168 of file sequencer.c.
Referenced by mseq_write().
midi_cmdtab cmdtab_seqioctl[] |
Definition at line 193 of file sequencer.c.
Referenced by mseq_ioctl().
midi_cmdtab cmdtab_timer[] |
Definition at line 236 of file sequencer.c.
|
static |
Definition at line 103 of file sequencer.c.
|
static |
Definition at line 104 of file sequencer.c.
|
static |
Definition at line 102 of file sequencer.c.
|
static |
Definition at line 107 of file sequencer.c.
|
static |
Definition at line 105 of file sequencer.c.
|
static |
Definition at line 106 of file sequencer.c.
|
static |
Definition at line 304 of file sequencer.c.
Referenced by seq_addunit(), seq_delunit(), and seq_modevent().
|
static |
Definition at line 109 of file sequencer.c.
Referenced by seq_addunit().
int seq_debug |
Definition at line 164 of file sequencer.c.
|
static |
Definition at line 274 of file sequencer.c.
|
static |
Definition at line 303 of file sequencer.c.
Referenced by seq_addunit(), seq_delunit(), and seq_modevent().
struct seq_softc* seqs[10] |
Definition at line 302 of file sequencer.c.
Referenced by seq_addunit(), and seq_delunit().