FreeBSD kernel sound device code
|
#include <dev/sound/pcm/sound.h>
#include <dev/sound/pci/cmireg.h>
#include <dev/sound/isa/sb.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <sys/sysctl.h>
#include <dev/sound/midi/mpu401.h>
#include "mixer_if.h"
#include "mpufoi_if.h"
Go to the source code of this file.
Data Structures | |
struct | sc_chinfo |
struct | sc_info |
struct | sb16props |
Macros | |
#define | CMI8338A_PCI_ID 0x010013f6 |
#define | CMI8338B_PCI_ID 0x010113f6 |
#define | CMI8738_PCI_ID 0x011113f6 |
#define | CMI8738B_PCI_ID 0x011213f6 |
#define | CMI120_USB_ID 0x01030d8c |
#define | CMI_DEFAULT_BUFSZ 16384 |
#define | CMI_INTR_PER_BUFFER 2 |
#define | CMPCI_REG_DMA0_MAX_SAMPLES CMPCI_REG_DMA0_BYTES |
#define | CMPCI_REG_DMA0_INTR_SAMPLES CMPCI_REG_DMA0_SAMPLES |
#define | CMPCI_REG_DMA1_MAX_SAMPLES CMPCI_REG_DMA1_BYTES |
#define | CMPCI_REG_DMA1_INTR_SAMPLES CMPCI_REG_DMA1_SAMPLES |
#define | CMPCI_NON_SB16_CONTROL 0xff |
#define | DEB(x) /* x */ |
#define | DEBMIX(x) /* x */ |
#define | NUM_CMI_RATES (sizeof(cmi_rates)/sizeof(cmi_rates[0])) |
#define | MIXER_GAIN_REG_RTOL(r) (r - 1) |
Functions | |
SND_DECLARE_FILE ("$FreeBSD$") | |
static u_int32_t | cmi_rd (struct sc_info *sc, int regno, int size) |
static void | cmi_wr (struct sc_info *sc, int regno, u_int32_t data, int size) |
static void | cmi_partial_wr4 (struct sc_info *sc, int reg, int shift, u_int32_t mask, u_int32_t val) |
static void | cmi_clr4 (struct sc_info *sc, int reg, u_int32_t mask) |
static void | cmi_set4 (struct sc_info *sc, int reg, u_int32_t mask) |
static u_int32_t | cmpci_rate_to_regvalue (int rate) |
static int | cmpci_regvalue_to_rate (u_int32_t r) |
static void | cmi_dma_prog (struct sc_info *sc, struct sc_chinfo *ch, u_int32_t base) |
static void | cmi_ch0_start (struct sc_info *sc, struct sc_chinfo *ch) |
static u_int32_t | cmi_ch0_stop (struct sc_info *sc, struct sc_chinfo *ch) |
static void | cmi_ch1_start (struct sc_info *sc, struct sc_chinfo *ch) |
static u_int32_t | cmi_ch1_stop (struct sc_info *sc, struct sc_chinfo *ch) |
static void | cmi_spdif_speed (struct sc_info *sc, int speed) |
static void * | cmichan_init (kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir) |
static int | cmichan_setformat (kobj_t obj, void *data, u_int32_t format) |
static u_int32_t | cmichan_setspeed (kobj_t obj, void *data, u_int32_t speed) |
static u_int32_t | cmichan_setblocksize (kobj_t obj, void *data, u_int32_t blocksize) |
static int | cmichan_trigger (kobj_t obj, void *data, int go) |
static u_int32_t | cmichan_getptr (kobj_t obj, void *data) |
static void | cmi_intr (void *data) |
static struct pcmchan_caps * | cmichan_getcaps (kobj_t obj, void *data) |
CHANNEL_DECLARE (cmichan) | |
static void | cmimix_wr (struct sc_info *sc, u_int8_t port, u_int8_t val) |
static u_int8_t | cmimix_rd (struct sc_info *sc, u_int8_t port) |
static int | cmimix_init (struct snd_mixer *m) |
static int | cmimix_set (struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) |
static u_int32_t | cmimix_setrecsrc (struct snd_mixer *m, u_int32_t src) |
static int | cmi_initsys (struct sc_info *sc) |
MIXER_DECLARE (cmi_mixer) | |
static unsigned char | cmi_mread (struct mpu401 *arg, void *sc, int reg) |
static void | cmi_mwrite (struct mpu401 *arg, void *sc, int reg, unsigned char b) |
static int | cmi_muninit (struct mpu401 *arg, void *cookie) |
static | DEFINE_CLASS (cmi_mpu, cmi_mpu_methods, 0) |
static void | cmi_midiattach (struct sc_info *sc) |
static void | cmi_power (struct sc_info *sc, int state) |
static int | cmi_init (struct sc_info *sc) |
static void | cmi_uninit (struct sc_info *sc) |
static int | cmi_probe (device_t dev) |
static int | cmi_attach (device_t dev) |
static int | cmi_detach (device_t dev) |
static int | cmi_suspend (device_t dev) |
static int | cmi_resume (device_t dev) |
DRIVER_MODULE (snd_cmi, pci, cmi_driver, pcm_devclass, 0, 0) | |
MODULE_DEPEND (snd_cmi, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER) | |
MODULE_DEPEND (snd_cmi, midi, 1, 1, 1) | |
MODULE_VERSION (snd_cmi, 1) | |
Variables | |
static u_int32_t | cmi_fmt [] |
static struct pcmchan_caps | cmi_caps = {5512, 48000, cmi_fmt, 0} |
static int | cmi_rates [] |
static kobj_method_t | cmichan_methods [] |
struct sb16props | cmt [SOUND_MIXER_NRDEVICES] |
static kobj_method_t | cmi_mixer_methods [] |
static kobj_method_t | cmi_mpu_methods [] |
static device_method_t | cmi_methods [] |
static driver_t | cmi_driver |
#define CMPCI_REG_DMA0_INTR_SAMPLES CMPCI_REG_DMA0_SAMPLES |
#define CMPCI_REG_DMA0_MAX_SAMPLES CMPCI_REG_DMA0_BYTES |
#define CMPCI_REG_DMA1_INTR_SAMPLES CMPCI_REG_DMA1_SAMPLES |
#define CMPCI_REG_DMA1_MAX_SAMPLES CMPCI_REG_DMA1_BYTES |
CHANNEL_DECLARE | ( | cmichan | ) |
|
static |
Definition at line 932 of file cmi.c.
References sc_info::bufsz, CMI_DEFAULT_BUFSZ, cmi_init(), cmi_initsys(), cmi_intr(), cmi_midiattach(), cmi_power(), DEB, sc_info::dev, dev, free, sc_info::ih, sc_info::irq, sc_info::irqid, sc_info::lock, mixer_init(), sc_info::parent_dmat, PCIR_BAR, pcm_addchan(), pcm_getbuffersize(), PCM_KLDSTRING, pcm_register(), pcm_setstatus(), PCMDIR_PLAY, PCMDIR_REC, sc_info::reg, sc_info::regid, sc_info::sh, snd_mtxcreate(), snd_mtxfree(), snd_setup_intr(), SND_STATUSLEN, sc_info::st, and status.
Definition at line 273 of file cmi.c.
References cmi_dma_prog(), cmi_set4(), CMPCI_REG_CH0_ENABLE, CMPCI_REG_CH0_INTR_ENABLE, CMPCI_REG_DMA0_BASE, CMPCI_REG_FUNC_0, CMPCI_REG_INTR_CTRL, and sc_chinfo::dma_active.
Referenced by cmi_resume(), and cmichan_trigger().
Definition at line 285 of file cmi.c.
References cmi_clr4(), cmi_set4(), CMPCI_REG_CH0_ENABLE, CMPCI_REG_CH0_INTR_ENABLE, CMPCI_REG_CH0_RESET, CMPCI_REG_FUNC_0, CMPCI_REG_INTR_CTRL, sc_chinfo::dma_active, and r.
Referenced by cmi_suspend(), and cmichan_trigger().
Definition at line 298 of file cmi.c.
References cmi_dma_prog(), cmi_set4(), CMPCI_REG_CH1_ENABLE, CMPCI_REG_CH1_INTR_ENABLE, CMPCI_REG_DMA1_BASE, CMPCI_REG_FUNC_0, CMPCI_REG_INTR_CTRL, DEB, and sc_chinfo::dma_active.
Referenced by cmi_resume(), and cmichan_trigger().
Definition at line 310 of file cmi.c.
References cmi_clr4(), cmi_set4(), CMPCI_REG_CH1_ENABLE, CMPCI_REG_CH1_INTR_ENABLE, CMPCI_REG_CH1_RESET, CMPCI_REG_FUNC_0, CMPCI_REG_INTR_CTRL, sc_chinfo::dma_active, and r.
Referenced by cmi_suspend(), and cmichan_trigger().
|
static |
Definition at line 195 of file cmi.c.
References cmi_rd(), cmi_wr(), r, and reg.
Referenced by cmi_ch0_stop(), cmi_ch1_stop(), cmi_init(), cmi_intr(), cmi_midiattach(), cmi_power(), and cmi_uninit().
|
static |
Definition at line 1020 of file cmi.c.
References cmi_power(), cmi_uninit(), dev, free, sc_info::ih, sc_info::irq, sc_info::irqid, sc_info::lock, sc_info::mpu, mpu401_uninit(), sc_info::mpu_reg, sc_info::mpu_regid, sc_info::parent_dmat, pcm_getdevinfo(), pcm_unregister(), r, sc_info::reg, sc_info::regid, and snd_mtxfree().
Definition at line 256 of file cmi.c.
References base, sc_chinfo::bps, sc_chinfo::buffer, CMI_INTR_PER_BUFFER, cmi_wr(), sc_chinfo::phys_buf, sndbuf_getbufaddr(), and sndbuf_getsize().
Referenced by cmi_ch0_start(), cmi_ch1_start(), and cmichan_init().
|
static |
Definition at line 862 of file cmi.c.
References cmi_clr4(), cmi_set4(), CMPCI_REG_BUS_AND_DSP_RESET, CMPCI_REG_CH0_DIR, CMPCI_REG_CH0_ENABLE, CMPCI_REG_CH0_INTR_ENABLE, CMPCI_REG_CH1_DIR, CMPCI_REG_CH1_ENABLE, CMPCI_REG_CH1_INTR_ENABLE, CMPCI_REG_FUNC_0, CMPCI_REG_FUNC_1, CMPCI_REG_INTR_CTRL, CMPCI_REG_MISC, CMPCI_REG_N4SPK3D, CMPCI_REG_SPDIF1_ENABLE, and CMPCI_REG_SPDIF_LOOP.
Referenced by cmi_attach(), and cmi_resume().
|
static |
Definition at line 752 of file cmi.c.
References sc_info::dev, and sc_info::spdif_enabled.
Referenced by cmi_attach().
|
static |
Definition at line 537 of file cmi.c.
References sc_chinfo::channel, chn_intr(), cmi_clr4(), cmi_rd(), cmi_set4(), CMPCI_REG_ANY_INTR, CMPCI_REG_CH0_INTR, CMPCI_REG_CH0_INTR_ENABLE, CMPCI_REG_CH1_INTR, CMPCI_REG_CH1_INTR_ENABLE, CMPCI_REG_INTR_CTRL, CMPCI_REG_INTR_STATUS, data, sc_info::lock, sc_info::mpu, sc_info::mpu_intr, sc_info::pch, sc_info::rch, snd_mtxlock, and snd_mtxunlock.
Referenced by cmi_attach(), and cmi_midiattach().
|
static |
Definition at line 822 of file cmi.c.
References cmi_clr4(), cmi_intr(), cmi_set4(), CMPCI_REG_FUNC_1, CMPCI_REG_LEGACY_CTRL, CMPCI_REG_UART_ENABLE, CMPCI_REG_VMPUSEL_MASK, CMPCI_REG_VMPUSEL_SHIFT, sc_info::mpu, mpu401_init(), and sc_info::mpu_intr.
Referenced by cmi_attach().
|
static |
|
static |
Definition at line 800 of file cmi.c.
References sc_info::lock, sc_info::mpu, sc_info::mpu_intr, snd_mtxlock, and snd_mtxunlock.
|
static |
|
static |
Definition at line 183 of file cmi.c.
References cmi_rd(), cmi_wr(), mask, r, reg, and val.
Referenced by cmi_spdif_speed(), cmichan_setformat(), and cmichan_setspeed().
|
static |
Definition at line 848 of file cmi.c.
References cmi_clr4(), cmi_set4(), CMPCI_REG_MISC, CMPCI_REG_POWER_DOWN, and state.
Referenced by cmi_attach(), cmi_detach(), cmi_resume(), and cmi_suspend().
|
static |
Definition at line 908 of file cmi.c.
References CMI120_USB_ID, CMI8338A_PCI_ID, CMI8338B_PCI_ID, CMI8738_PCI_ID, CMI8738B_PCI_ID, and dev.
|
static |
Definition at line 151 of file cmi.c.
References DEB, regno, sc_info::sh, size, and sc_info::st.
Referenced by cmi_clr4(), cmi_intr(), cmi_partial_wr4(), cmi_set4(), cmichan_getptr(), cmichan_setspeed(), cmimix_rd(), and cmimix_set().
|
static |
Definition at line 1061 of file cmi.c.
References cmi_ch0_start(), cmi_ch1_start(), cmi_init(), cmi_power(), cmichan_setformat(), cmichan_setspeed(), dev, sc_chinfo::dma_was_active, sc_chinfo::fmt, sc_info::lock, mixer_reinit(), sc_info::pch, pcm_getdevinfo(), sc_info::rch, snd_mtxlock, snd_mtxunlock, and sc_chinfo::spd.
|
static |
Definition at line 205 of file cmi.c.
References cmi_rd(), cmi_wr(), mask, r, and reg.
Referenced by cmi_ch0_start(), cmi_ch0_stop(), cmi_ch1_start(), cmi_ch1_stop(), cmi_init(), cmi_intr(), cmi_midiattach(), and cmi_power().
|
static |
Definition at line 323 of file cmi.c.
References cmi_partial_wr4(), CMPCI_REG_FUNC_1, CMPCI_REG_LEGACY_CTRL, CMPCI_REG_MISC, CMPCI_REG_SPDIF0_ENABLE, CMPCI_REG_SPDIF_48K, CMPCI_REG_W_SPDIF_48L, CMPCI_REG_XSPDIF_ENABLE, and speed.
Referenced by cmichan_setspeed().
|
static |
Definition at line 1048 of file cmi.c.
References cmi_ch0_stop(), cmi_ch1_stop(), cmi_power(), dev, sc_chinfo::dma_was_active, sc_info::lock, sc_info::pch, pcm_getdevinfo(), sc_info::rch, snd_mtxlock, and snd_mtxunlock.
|
static |
Definition at line 890 of file cmi.c.
References cmi_clr4(), CMPCI_REG_CH0_ENABLE, CMPCI_REG_CH0_INTR_ENABLE, CMPCI_REG_CH1_ENABLE, CMPCI_REG_CH1_INTR_ENABLE, CMPCI_REG_FUNC_0, CMPCI_REG_FUNC_1, CMPCI_REG_INTR_CTRL, CMPCI_REG_TDMA_INTR_ENABLE, CMPCI_REG_UART_ENABLE, sc_info::mpu, and sc_info::mpu_intr.
Referenced by cmi_detach().
|
static |
Definition at line 167 of file cmi.c.
References data, regno, sc_info::sh, size, and sc_info::st.
Referenced by cmi_clr4(), cmi_dma_prog(), cmi_partial_wr4(), cmi_set4(), cmimix_rd(), cmimix_set(), and cmimix_wr().
|
static |
|
static |
Definition at line 516 of file cmi.c.
References sc_chinfo::bps, sc_chinfo::buffer, sc_info::ch, cmi_rd(), CMPCI_REG_DMA0_BASE, CMPCI_REG_DMA1_BASE, data, sc_chinfo::dir, sc_info::lock, sc_chinfo::parent, PCMDIR_PLAY, sc_chinfo::phys_buf, snd_mtxlock, snd_mtxunlock, and sndbuf_getsize().
|
static |
Definition at line 347 of file cmi.c.
References b, sc_chinfo::bps, sc_chinfo::buffer, sc_info::bufsz, c, sc_chinfo::channel, cmi_dma_prog(), CMPCI_REG_DMA0_BASE, CMPCI_REG_DMA1_BASE, DEB, devinfo, sc_chinfo::dir, dir, sc_chinfo::dma_active, DSP_DEFAULT_SPEED, sc_chinfo::fmt, sc_info::lock, sc_chinfo::parent, sc_info::parent_dmat, sc_info::pch, PCMDIR_PLAY, sc_info::rch, SND_FORMAT, snd_mtxlock, snd_mtxunlock, sndbuf_alloc(), and sc_chinfo::spd.
|
static |
Definition at line 466 of file cmi.c.
References blocksize, sc_chinfo::buffer, sc_info::bufsz, sc_info::ch, CMI_INTR_PER_BUFFER, data, sc_chinfo::parent, and sndbuf_resize().
|
static |
Definition at line 378 of file cmi.c.
References AFMT_CHANNEL, sc_chinfo::bps, sc_info::ch, cmi_partial_wr4(), CMPCI_REG_CH0_FORMAT_MASK, CMPCI_REG_CH0_FORMAT_SHIFT, CMPCI_REG_CH1_FORMAT_MASK, CMPCI_REG_CH1_FORMAT_SHIFT, CMPCI_REG_CHANNEL_FORMAT, CMPCI_REG_FORMAT_16BIT, CMPCI_REG_FORMAT_8BIT, CMPCI_REG_FORMAT_MONO, CMPCI_REG_FORMAT_STEREO, data, sc_chinfo::dir, sc_chinfo::fmt, format, sc_info::lock, sc_chinfo::parent, PCMDIR_PLAY, snd_mtxlock, and snd_mtxunlock.
Referenced by cmi_resume().
|
static |
Definition at line 420 of file cmi.c.
References sc_info::ch, cmi_partial_wr4(), cmi_rd(), cmi_spdif_speed(), cmpci_rate_to_regvalue(), CMPCI_REG_ADC_FS_MASK, CMPCI_REG_ADC_FS_SHIFT, CMPCI_REG_DAC_FS_MASK, CMPCI_REG_DAC_FS_SHIFT, CMPCI_REG_FUNC_1, cmpci_regvalue_to_rate(), data, DEB, sc_chinfo::dir, sc_info::lock, sc_chinfo::parent, PCMDIR_PLAY, r, snd_mtxlock, snd_mtxunlock, sc_chinfo::spd, sc_info::spdif_enabled, and speed.
Referenced by cmi_resume().
|
static |
Definition at line 481 of file cmi.c.
References sc_info::ch, cmi_ch0_start(), cmi_ch0_stop(), cmi_ch1_start(), cmi_ch1_stop(), data, sc_chinfo::dir, go, sc_info::lock, sc_chinfo::parent, PCMDIR_PLAY, PCMTRIG_ABORT, PCMTRIG_COMMON, PCMTRIG_START, PCMTRIG_STOP, snd_mtxlock, and snd_mtxunlock.
|
static |
Definition at line 651 of file cmi.c.
References cmimix_wr(), CMPCI_SB16_MIXER_ADCMIX_L, CMPCI_SB16_MIXER_ADCMIX_R, CMPCI_SB16_MIXER_OUTMIX, CMPCI_SB16_MIXER_RESET, CMPCI_SB16_SW_CD, CMPCI_SB16_SW_LINE, CMPCI_SB16_SW_MIC, cmt, m, mix_getdevinfo(), mix_setdevs(), and mix_setrecdevs().
|
static |
Definition at line 610 of file cmi.c.
References cmi_rd(), cmi_wr(), CMPCI_REG_SBADDR, and CMPCI_REG_SBDATA.
Referenced by cmimix_set().
|
static |
Definition at line 675 of file cmi.c.
References sb16props::bits, cmi_rd(), cmi_wr(), cmimix_rd(), cmimix_wr(), CMPCI_NON_SB16_CONTROL, CMPCI_REG_AUX_MIC, CMPCI_SB16_MIXER_OUTMIX, cmt, DEBMIX, dev, left, m, max, mix_getdevinfo(), MIXER_GAIN_REG_RTOL, sb16props::oselect, r, right, and stereo.
|
static |
Definition at line 723 of file cmi.c.
References cmimix_wr(), CMPCI_SB16_MIXER_ADCMIX_L, CMPCI_SB16_MIXER_ADCMIX_R, CMPCI_SB16_MIXER_SRC_R_TO_L, cmt, DEBMIX, sb16props::iselect, m, mix_getdevinfo(), src, and stereo.
|
static |
Definition at line 603 of file cmi.c.
References cmi_wr(), CMPCI_REG_SBADDR, CMPCI_REG_SBDATA, and val.
Referenced by cmimix_init(), cmimix_set(), and cmimix_setrecsrc().
|
static |
Definition at line 225 of file cmi.c.
References cmi_rates, DEB, NUM_CMI_RATES, r, and rate.
Referenced by cmichan_setspeed().
|
static |
|
static |
DRIVER_MODULE | ( | snd_cmi | , |
pci | , | ||
cmi_driver | , | ||
pcm_devclass | , | ||
0 | , | ||
0 | |||
) |
MIXER_DECLARE | ( | cmi_mixer | ) |
MODULE_DEPEND | ( | snd_cmi | , |
midi | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | snd_cmi | , |
sound | , | ||
SOUND_MINVER | , | ||
SOUND_PREFVER | , | ||
SOUND_MAXVER | |||
) |
MODULE_VERSION | ( | snd_cmi | , |
1 | |||
) |
SND_DECLARE_FILE | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 145 of file cmi.c.
Referenced by cmichan_getcaps().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 217 of file cmi.c.
Referenced by cmpci_rate_to_regvalue(), and cmpci_regvalue_to_rate().
|
static |
struct sb16props cmt[SOUND_MIXER_NRDEVICES] |
Referenced by cmimix_init(), cmimix_set(), and cmimix_setrecsrc().