FreeBSD kernel sound device code
mpu401.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/kobj.h>
#include <sys/malloc.h>
#include <sys/bus.h>
#include <dev/sound/midi/mpu401.h>
#include <dev/sound/midi/midi.h>
#include "mpu_if.h"
#include "mpufoi_if.h"
Include dependency graph for mpu401.c:

Go to the source code of this file.

Data Structures

struct  mpu401
 

Macros

#define KOBJMETHOD_END   { NULL, NULL }
 
#define MPU_DATAPORT   0
 
#define MPU_CMDPORT   1
 
#define MPU_STATPORT   1
 
#define MPU_RESET   0xff
 
#define MPU_UART   0x3f
 
#define MPU_ACK   0xfe
 
#define MPU_STATMASK   0xc0
 
#define MPU_OUTPUTBUSY   0x40
 
#define MPU_INPUTBUSY   0x80
 
#define MPU_TRYDATA   50
 
#define MPU_DELAY   2500
 
#define CMD(m, d)   MPUFOI_WRITE(m, m->cookie, MPU_CMDPORT,d)
 
#define STATUS(m)   MPUFOI_READ(m, m->cookie, MPU_STATPORT)
 
#define READ(m)   MPUFOI_READ(m, m->cookie, MPU_DATAPORT)
 
#define WRITE(m, d)   MPUFOI_WRITE(m, m->cookie, MPU_DATAPORT,d)
 
#define MPU_INTR_BUF   16
 
#define RXRDY(m)   ( (STATUS(m) & MPU_INPUTBUSY) == 0)
 
#define TXRDY(m)   ( (STATUS(m) & MPU_OUTPUTBUSY) == 0)
 
#define D(x, l)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void mpu401_timeout (void *m)
 
static int mpu401_minit (struct snd_midi *, void *)
 
static int mpu401_muninit (struct snd_midi *, void *)
 
static int mpu401_minqsize (struct snd_midi *, void *)
 
static int mpu401_moutqsize (struct snd_midi *, void *)
 
static void mpu401_mcallback (struct snd_midi *, void *, int)
 
static void mpu401_mcallbackp (struct snd_midi *, void *, int)
 
static const char * mpu401_mdescr (struct snd_midi *, void *, int)
 
static const char * mpu401_mprovider (struct snd_midi *, void *)
 
 DEFINE_CLASS (mpu401, mpu401_methods, 0)
 
static int mpu401_intr (struct mpu401 *m)
 
struct mpu401mpu401_init (kobj_class_t cls, void *cookie, driver_intr_t softintr, mpu401_intr_t **cb)
 
int mpu401_uninit (struct mpu401 *m)
 

Variables

static mpu401_intr_t mpu401_intr
 
static kobj_method_t mpu401_methods []
 

Macro Definition Documentation

◆ CMD

#define CMD (   m,
 
)    MPUFOI_WRITE(m, m->cookie, MPU_CMDPORT,d)

Definition at line 71 of file mpu401.c.

◆ D

#define D (   x,
 
)

◆ KOBJMETHOD_END

#define KOBJMETHOD_END   { NULL, NULL }

Definition at line 56 of file mpu401.c.

◆ MPU_ACK

#define MPU_ACK   0xfe

Definition at line 64 of file mpu401.c.

◆ MPU_CMDPORT

#define MPU_CMDPORT   1

Definition at line 60 of file mpu401.c.

◆ MPU_DATAPORT

#define MPU_DATAPORT   0

Definition at line 59 of file mpu401.c.

◆ MPU_DELAY

#define MPU_DELAY   2500

Definition at line 69 of file mpu401.c.

◆ MPU_INPUTBUSY

#define MPU_INPUTBUSY   0x80

Definition at line 67 of file mpu401.c.

◆ MPU_INTR_BUF

#define MPU_INTR_BUF   16

◆ MPU_OUTPUTBUSY

#define MPU_OUTPUTBUSY   0x40

Definition at line 66 of file mpu401.c.

◆ MPU_RESET

#define MPU_RESET   0xff

Definition at line 62 of file mpu401.c.

◆ MPU_STATMASK

#define MPU_STATMASK   0xc0

Definition at line 65 of file mpu401.c.

◆ MPU_STATPORT

#define MPU_STATPORT   1

Definition at line 61 of file mpu401.c.

◆ MPU_TRYDATA

#define MPU_TRYDATA   50

Definition at line 68 of file mpu401.c.

◆ MPU_UART

#define MPU_UART   0x3f

Definition at line 63 of file mpu401.c.

◆ READ

#define READ (   m)    MPUFOI_READ(m, m->cookie, MPU_DATAPORT)

Definition at line 73 of file mpu401.c.

◆ RXRDY

#define RXRDY (   m)    ( (STATUS(m) & MPU_INPUTBUSY) == 0)

◆ STATUS

#define STATUS (   m)    MPUFOI_READ(m, m->cookie, MPU_STATPORT)

Definition at line 72 of file mpu401.c.

◆ TXRDY

#define TXRDY (   m)    ( (STATUS(m) & MPU_OUTPUTBUSY) == 0)

◆ WRITE

#define WRITE (   m,
 
)    MPUFOI_WRITE(m, m->cookie, MPU_DATAPORT,d)

Definition at line 74 of file mpu401.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DEFINE_CLASS()

DEFINE_CLASS ( mpu401  ,
mpu401_methods  ,
 
)

◆ mpu401_init()

struct mpu401 * mpu401_init ( kobj_class_t  cls,
void *  cookie,
driver_intr_t  softintr,
mpu401_intr_t **  cb 
)

Definition at line 177 of file mpu401.c.

References mpu401::cookie, free, m, midi_init(), and mpu401_intr.

Referenced by cmi_midiattach(), emu_midi_attach(), emu_midiattach(), and midicsa_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mpu401_intr()

static int mpu401_intr ( struct mpu401 m)
static

Definition at line 121 of file mpu401.c.

References b, D, m, M_TXEN, midi_in(), midi_out(), MIDI_TYPE, mpu401_timeout(), MPU_INPUTBUSY, MPU_INTR_BUF, MPU_OUTPUTBUSY, READ, STATUS, and WRITE.

Here is the call graph for this function:

◆ mpu401_mcallback()

static void mpu401_mcallback ( struct snd_midi sm,
void *  arg,
int  flags 
)
static

Definition at line 265 of file mpu401.c.

References mpu401::flags, m, M_RX, M_RXEN, M_TX, M_TXEN, and mpu401_timeout().

Referenced by mpu401_mcallbackp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mpu401_mcallbackp()

static void mpu401_mcallbackp ( struct snd_midi sm,
void *  arg,
int  flags 
)
static

Definition at line 282 of file mpu401.c.

References mpu401::flags, and mpu401_mcallback().

Here is the call graph for this function:

◆ mpu401_mdescr()

static const char * mpu401_mdescr ( struct snd_midi sm,
void *  arg,
int  verbosity 
)
static

Definition at line 289 of file mpu401.c.

◆ mpu401_minit()

static int mpu401_minit ( struct snd_midi sm,
void *  arg 
)
static

Definition at line 221 of file mpu401.c.

References CMD, m, MPU_ACK, MPU_RESET, MPU_UART, READ, and RXRDY.

◆ mpu401_minqsize()

int mpu401_minqsize ( struct snd_midi sm,
void *  arg 
)
static

Definition at line 253 of file mpu401.c.

◆ mpu401_moutqsize()

int mpu401_moutqsize ( struct snd_midi sm,
void *  arg 
)
static

Definition at line 259 of file mpu401.c.

◆ mpu401_mprovider()

static const char * mpu401_mprovider ( struct snd_midi m,
void *  arg 
)
static

Definition at line 296 of file mpu401.c.

◆ mpu401_muninit()

int mpu401_muninit ( struct snd_midi sm,
void *  arg 
)
static

Definition at line 245 of file mpu401.c.

References m.

◆ mpu401_timeout()

void mpu401_timeout ( void *  m)
static

Definition at line 112 of file mpu401.c.

References m.

Referenced by mpu401_intr(), and mpu401_mcallback().

Here is the caller graph for this function:

◆ mpu401_uninit()

int mpu401_uninit ( struct mpu401 m)

Definition at line 208 of file mpu401.c.

References CMD, free, m, midi_uninit(), and MPU_RESET.

Referenced by cmi_detach(), emu_midi_detach(), emu_uninit(), and midicsa_detach().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ mpu401_intr

mpu401_intr_t mpu401_intr
static

Definition at line 86 of file mpu401.c.

Referenced by mpu401_init().

◆ mpu401_methods

kobj_method_t mpu401_methods[]
static
Initial value:
= {
KOBJMETHOD(mpu_init, mpu401_minit),
KOBJMETHOD(mpu_uninit, mpu401_muninit),
KOBJMETHOD(mpu_inqsize, mpu401_minqsize),
KOBJMETHOD(mpu_outqsize, mpu401_moutqsize),
KOBJMETHOD(mpu_callback, mpu401_mcallback),
KOBJMETHOD(mpu_callbackp, mpu401_mcallbackp),
KOBJMETHOD(mpu_descr, mpu401_mdescr),
KOBJMETHOD(mpu_provider, mpu401_mprovider),
}
static int mpu401_moutqsize(struct snd_midi *, void *)
Definition: mpu401.c:259
static int mpu401_minqsize(struct snd_midi *, void *)
Definition: mpu401.c:253
static int mpu401_minit(struct snd_midi *, void *)
Definition: mpu401.c:221
static void mpu401_mcallbackp(struct snd_midi *, void *, int)
Definition: mpu401.c:282
#define KOBJMETHOD_END
Definition: mpu401.c:56
static const char * mpu401_mdescr(struct snd_midi *, void *, int)
Definition: mpu401.c:289
static void mpu401_mcallback(struct snd_midi *, void *, int)
Definition: mpu401.c:265
static int mpu401_muninit(struct snd_midi *, void *)
Definition: mpu401.c:245
static const char * mpu401_mprovider(struct snd_midi *, void *)
Definition: mpu401.c:296

Definition at line 97 of file mpu401.c.