FreeBSD kernel sound device code
csamidi.c File Reference
#include <sys/param.h>
#include <sys/types.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <sys/systm.h>
#include <sys/kobj.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/sound/chip.h>
#include <dev/sound/pcm/sound.h>
#include <dev/sound/midi/midi.h>
#include <dev/sound/midi/mpu401.h>
#include <dev/sound/pci/csareg.h>
#include <dev/sound/pci/csavar.h>
#include "mpufoi_if.h"
Include dependency graph for csamidi.c:

Go to the source code of this file.

Data Structures

struct  csa_midi_softc
 

Macros

#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
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static u_int32_t csamidi_readio (struct csa_midi_softc *scp, u_long offset)
 
static void csamidi_writeio (struct csa_midi_softc *scp, u_long offset, u_int32_t data)
 
static void csamidi_midi_intr (void *arg)
 
static unsigned char csamidi_mread (struct mpu401 *arg __unused, void *cookie, int reg)
 
static void csamidi_mwrite (struct mpu401 *arg __unused, void *cookie, int reg, unsigned char b)
 
static int csamidi_muninit (struct mpu401 *arg __unused, void *cookie)
 
static int midicsa_probe (device_t dev)
 
static int midicsa_attach (device_t dev)
 
static int midicsa_detach (device_t dev)
 
static DEFINE_CLASS (csamidi_mpu, csamidi_mpu_methods, 0)
 
 DRIVER_MODULE (snd_csa_midi, csa, midicsa_driver, midicsa_devclass, 0, 0)
 
 MODULE_DEPEND (snd_csa_midi, snd_csa, 1, 1, 1)
 
 MODULE_DEPEND (snd_csa_midi, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_VERSION (snd_csa_midi, 1)
 

Variables

static struct kobj_class csamidi_mpu_class
 
static devclass_t midicsa_devclass
 
static kobj_method_t csamidi_mpu_methods []
 
static device_method_t midicsa_methods []
 
static driver_t midicsa_driver
 

Macro Definition Documentation

◆ MPU_ACK

#define MPU_ACK   0xfe

Definition at line 65 of file csamidi.c.

◆ MPU_CMDPORT

#define MPU_CMDPORT   1

Definition at line 61 of file csamidi.c.

◆ MPU_DATAPORT

#define MPU_DATAPORT   0

Definition at line 60 of file csamidi.c.

◆ MPU_INPUTBUSY

#define MPU_INPUTBUSY   0x80

Definition at line 68 of file csamidi.c.

◆ MPU_OUTPUTBUSY

#define MPU_OUTPUTBUSY   0x40

Definition at line 67 of file csamidi.c.

◆ MPU_RESET

#define MPU_RESET   0xff

Definition at line 63 of file csamidi.c.

◆ MPU_STATMASK

#define MPU_STATMASK   0xc0

Definition at line 66 of file csamidi.c.

◆ MPU_STATPORT

#define MPU_STATPORT   1

Definition at line 62 of file csamidi.c.

◆ MPU_UART

#define MPU_UART   0x3f

Definition at line 64 of file csamidi.c.

Function Documentation

◆ csamidi_midi_intr()

static void csamidi_midi_intr ( void *  arg)
static

Definition at line 103 of file csamidi.c.

References csa_midi_softc::mpu, and csa_midi_softc::mpu_intr.

Referenced by midicsa_attach().

Here is the caller graph for this function:

◆ csamidi_mread()

static unsigned char csamidi_mread ( struct mpu401 *arg  __unused,
void *  cookie,
int  reg 
)
static

Definition at line 112 of file csamidi.c.

References BA0_MIDRP, BA0_MIDSR, csamidi_readio(), MIDSR_RBE, MIDSR_TBF, MPU_DATAPORT, MPU_INPUTBUSY, MPU_OUTPUTBUSY, MPU_STATPORT, and reg.

Here is the call graph for this function:

◆ csamidi_muninit()

static int csamidi_muninit ( struct mpu401 *arg  __unused,
void *  cookie 
)
static

Definition at line 175 of file csamidi.c.

References csa_midi_softc::mpu_intr, and csa_midi_softc::mtx.

◆ csamidi_mwrite()

static void csamidi_mwrite ( struct mpu401 *arg  __unused,
void *  cookie,
int  reg,
unsigned char  b 
)
static

Definition at line 139 of file csamidi.c.

References b, BA0_MIDCR, BA0_MIDWP, csamidi_readio(), csamidi_writeio(), MIDCR_MLB, MIDCR_MRST, MPU_CMDPORT, MPU_DATAPORT, MPU_RESET, MPU_UART, reg, and val.

Here is the call graph for this function:

◆ csamidi_readio()

static u_int32_t csamidi_readio ( struct csa_midi_softc scp,
u_long  offset 
)
static

Definition at line 87 of file csamidi.c.

References BA0_AC97_RESET, csa_midi_softc::io, and offset.

Referenced by csamidi_mread(), and csamidi_mwrite().

Here is the caller graph for this function:

◆ csamidi_writeio()

static void csamidi_writeio ( struct csa_midi_softc scp,
u_long  offset,
u_int32_t  data 
)
static

Definition at line 96 of file csamidi.c.

References BA0_AC97_RESET, data, csa_midi_softc::io, and offset.

Referenced by csamidi_mwrite(), and midicsa_attach().

Here is the caller graph for this function:

◆ DEFINE_CLASS()

static DEFINE_CLASS ( csamidi_mpu  ,
csamidi_mpu_methods  ,
 
)
static

◆ DRIVER_MODULE()

DRIVER_MODULE ( snd_csa_midi  ,
csa  ,
midicsa_driver  ,
midicsa_devclass  ,
,
 
)

◆ midicsa_attach()

◆ midicsa_detach()

static int midicsa_detach ( device_t  dev)
static

Definition at line 247 of file csamidi.c.

References dev, csa_midi_softc::io, csa_midi_softc::io_rid, csa_midi_softc::mpu, mpu401_uninit(), and csa_midi_softc::mtx.

Here is the call graph for this function:

◆ midicsa_probe()

static int midicsa_probe ( device_t  dev)
static

Definition at line 187 of file csamidi.c.

References dev, sndcard_func::func, and SCF_MIDI.

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( snd_csa_midi  ,
snd_csa  ,
,
,
 
)

◆ MODULE_DEPEND() [2/2]

MODULE_DEPEND ( snd_csa_midi  ,
sound  ,
SOUND_MINVER  ,
SOUND_PREFVER  ,
SOUND_MAXVER   
)

◆ MODULE_VERSION()

MODULE_VERSION ( snd_csa_midi  ,
 
)

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ csamidi_mpu_class

struct kobj_class csamidi_mpu_class
static

Definition at line 83 of file csamidi.c.

Referenced by midicsa_attach().

◆ csamidi_mpu_methods

kobj_method_t csamidi_mpu_methods[]
static
Initial value:
= {
KOBJMETHOD(mpufoi_read, csamidi_mread),
KOBJMETHOD(mpufoi_write, csamidi_mwrite),
KOBJMETHOD(mpufoi_uninit, csamidi_muninit),
}
static void csamidi_mwrite(struct mpu401 *arg __unused, void *cookie, int reg, unsigned char b)
Definition: csamidi.c:139
static int csamidi_muninit(struct mpu401 *arg __unused, void *cookie)
Definition: csamidi.c:175
static unsigned char csamidi_mread(struct mpu401 *arg __unused, void *cookie, int reg)
Definition: csamidi.c:112
#define KOBJMETHOD_END
Definition: midi.c:76

Definition at line 265 of file csamidi.c.

◆ midicsa_devclass

devclass_t midicsa_devclass
static

Definition at line 84 of file csamidi.c.

◆ midicsa_driver

driver_t midicsa_driver
static
Initial value:
= {
"midi",
sizeof(struct csa_midi_softc),
}
static device_method_t midicsa_methods[]
Definition: csamidi.c:274

Definition at line 282 of file csamidi.c.

◆ midicsa_methods

device_method_t midicsa_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, midicsa_probe),
DEVMETHOD(device_attach, midicsa_attach),
DEVMETHOD(device_detach, midicsa_detach),
DEVMETHOD_END
}
static int midicsa_detach(device_t dev)
Definition: csamidi.c:247
static int midicsa_probe(device_t dev)
Definition: csamidi.c:187
static int midicsa_attach(device_t dev)
Definition: csamidi.c:202

Definition at line 274 of file csamidi.c.