FreeBSD kernel sound device code
hdspe-pcm.c File Reference
#include <dev/sound/pcm/sound.h>
#include <dev/sound/pci/hdspe.h>
#include <dev/sound/chip.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <mixer_if.h>
Include dependency graph for hdspe-pcm.c:

Go to the source code of this file.

Data Structures

struct  hdspe_latency
 
struct  hdspe_rate
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static int hdspe_hw_mixer (struct sc_chinfo *ch, unsigned int dst, unsigned int src, unsigned short data)
 
static int hdspechan_setgain (struct sc_chinfo *ch)
 
static int hdspemixer_init (struct snd_mixer *m)
 
static int hdspemixer_set (struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
 
 MIXER_DECLARE (hdspemixer)
 
static void hdspechan_enable (struct sc_chinfo *ch, int value)
 
static int hdspe_running (struct sc_info *sc)
 
static void hdspe_start_audio (struct sc_info *sc)
 
static void hdspe_stop_audio (struct sc_info *sc)
 
static void buffer_copy (struct sc_chinfo *ch)
 
static int clean (struct sc_chinfo *ch)
 
static void * hdspechan_init (kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
 
static int hdspechan_trigger (kobj_t obj, void *data, int go)
 
static uint32_t hdspechan_getptr (kobj_t obj, void *data)
 
static int hdspechan_free (kobj_t obj, void *data)
 
static int hdspechan_setformat (kobj_t obj, void *data, uint32_t format)
 
static uint32_t hdspechan_setspeed (kobj_t obj, void *data, uint32_t speed)
 
static uint32_t hdspechan_setblocksize (kobj_t obj, void *data, uint32_t blocksize)
 
static struct pcmchan_capshdspechan_getcaps (kobj_t obj, void *data)
 
 CHANNEL_DECLARE (hdspechan)
 
static int hdspe_pcm_probe (device_t dev)
 
static uint32_t hdspe_pcm_intr (struct sc_pcminfo *scp)
 
static int hdspe_pcm_attach (device_t dev)
 
static int hdspe_pcm_detach (device_t dev)
 
 DRIVER_MODULE (snd_hdspe_pcm, hdspe, hdspe_pcm_driver, pcm_devclass, 0, 0)
 
 MODULE_DEPEND (snd_hdspe, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_VERSION (snd_hdspe, 1)
 

Variables

static struct hdspe_latency latency_map []
 
static struct hdspe_rate rate_map []
 
static kobj_method_t hdspemixer_methods []
 
static uint32_t hdspe_rfmt []
 
static struct pcmchan_caps hdspe_rcaps = {32000, 192000, hdspe_rfmt, 0}
 
static uint32_t hdspe_pfmt []
 
static struct pcmchan_caps hdspe_pcaps = {32000, 192000, hdspe_pfmt, 0}
 
static kobj_method_t hdspechan_methods []
 
static device_method_t hdspe_pcm_methods []
 
static driver_t hdspe_pcm_driver
 

Function Documentation

◆ buffer_copy()

static void buffer_copy ( struct sc_chinfo ch)
static

◆ CHANNEL_DECLARE()

CHANNEL_DECLARE ( hdspechan  )

◆ clean()

static int clean ( struct sc_chinfo ch)
static

◆ DRIVER_MODULE()

DRIVER_MODULE ( snd_hdspe_pcm  ,
hdspe  ,
hdspe_pcm_driver  ,
pcm_devclass  ,
,
 
)

◆ hdspe_hw_mixer()

static int hdspe_hw_mixer ( struct sc_chinfo ch,
unsigned int  dst,
unsigned int  src,
unsigned short  data 
)
static

Definition at line 84 of file hdspe-pcm.c.

References sc_info::ch, data, sc_chinfo::dir, sc_info::dst, HDSPE_MIXER_BASE, hdspe_write_4, sc_chinfo::parent, PCMDIR_PLAY, sc_pcminfo::sc, and src.

Referenced by hdspechan_setgain().

Here is the caller graph for this function:

◆ hdspe_pcm_attach()

◆ hdspe_pcm_detach()

static int hdspe_pcm_detach ( device_t  dev)
static

Definition at line 748 of file hdspe-pcm.c.

References dev, and pcm_unregister().

Here is the call graph for this function:

◆ hdspe_pcm_intr()

static uint32_t hdspe_pcm_intr ( struct sc_pcminfo scp)
static

Definition at line 680 of file hdspe-pcm.c.

References sc_info::ch, sc_pcminfo::chan, sc_chinfo::channel, chn_intr(), sc_pcminfo::chnum, sc_info::lock, sc_pcminfo::sc, snd_mtxlock, and snd_mtxunlock.

Referenced by hdspe_pcm_attach().

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

◆ hdspe_pcm_probe()

static int hdspe_pcm_probe ( device_t  dev)
static

Definition at line 669 of file hdspe-pcm.c.

References dev.

◆ hdspe_running()

static int hdspe_running ( struct sc_info sc)
static

Definition at line 204 of file hdspe-pcm.c.

References sc_pcminfo::chan, sc_pcminfo::chnum, sc_info::dev, free, and sc_chinfo::run.

Referenced by hdspe_stop_audio(), hdspechan_setblocksize(), and hdspechan_setspeed().

Here is the caller graph for this function:

◆ hdspe_start_audio()

static void hdspe_start_audio ( struct sc_info sc)
static

Definition at line 240 of file hdspe-pcm.c.

References sc_info::ctrl_register, HDSPE_AUDIO_INT_ENABLE, HDSPE_CONTROL_REG, HDSPE_ENABLE, and hdspe_write_4.

Referenced by hdspechan_trigger().

Here is the caller graph for this function:

◆ hdspe_stop_audio()

static void hdspe_stop_audio ( struct sc_info sc)
static

Definition at line 248 of file hdspe-pcm.c.

References sc_info::ctrl_register, HDSPE_AUDIO_INT_ENABLE, HDSPE_CONTROL_REG, HDSPE_ENABLE, hdspe_running(), and hdspe_write_4.

Referenced by hdspechan_trigger().

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

◆ hdspechan_enable()

static void hdspechan_enable ( struct sc_chinfo ch,
int  value 
)
static

◆ hdspechan_free()

static int hdspechan_free ( kobj_t  obj,
void *  data 
)
static

◆ hdspechan_getcaps()

static struct pcmchan_caps * hdspechan_getcaps ( kobj_t  obj,
void *  data 
)
static

Definition at line 640 of file hdspe-pcm.c.

References data, sc_chinfo::dir, hdspe_pcaps, hdspe_rcaps, sc_chinfo::parent, and PCMDIR_PLAY.

◆ hdspechan_getptr()

static uint32_t hdspechan_getptr ( kobj_t  obj,
void *  data 
)
static

◆ hdspechan_init()

◆ hdspechan_setblocksize()

◆ hdspechan_setformat()

static int hdspechan_setformat ( kobj_t  obj,
void *  data,
uint32_t  format 
)
static

Definition at line 471 of file hdspe-pcm.c.

References data, sc_pcminfo::dev, format, sc_chinfo::format, and sc_chinfo::parent.

◆ hdspechan_setgain()

static int hdspechan_setgain ( struct sc_chinfo ch)
static

Definition at line 106 of file hdspe-pcm.c.

References sc_info::ch, hdspe_hw_mixer(), HDSPE_MAX_GAIN, sc_chinfo::lslot, sc_chinfo::lvol, sc_chinfo::rslot, and sc_chinfo::rvol.

Referenced by hdspechan_trigger(), and hdspemixer_set().

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

◆ hdspechan_setspeed()

static uint32_t hdspechan_setspeed ( kobj_t  obj,
void *  data,
uint32_t  speed 
)
static

◆ hdspechan_trigger()

static int hdspechan_trigger ( kobj_t  obj,
void *  data,
int  go 
)
static

◆ hdspemixer_init()

static int hdspemixer_init ( struct snd_mixer m)
static

◆ hdspemixer_set()

static int hdspemixer_set ( struct snd_mixer m,
unsigned  dev,
unsigned  left,
unsigned  right 
)
static

◆ MIXER_DECLARE()

MIXER_DECLARE ( hdspemixer  )

◆ MODULE_DEPEND()

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

◆ MODULE_VERSION()

MODULE_VERSION ( snd_hdspe  ,
 
)

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ hdspe_pcaps

struct pcmchan_caps hdspe_pcaps = {32000, 192000, hdspe_pfmt, 0}
static

Definition at line 637 of file hdspe-pcm.c.

Referenced by hdspechan_getcaps().

◆ hdspe_pcm_driver

driver_t hdspe_pcm_driver
static
Initial value:
= {
"pcm",
}
static device_method_t hdspe_pcm_methods[]
Definition: hdspe-pcm.c:761
#define PCM_SOFTC_SIZE
Definition: sound.h:96

Definition at line 768 of file hdspe-pcm.c.

◆ hdspe_pcm_methods

device_method_t hdspe_pcm_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, hdspe_pcm_probe),
DEVMETHOD(device_attach, hdspe_pcm_attach),
DEVMETHOD(device_detach, hdspe_pcm_detach),
{ 0, 0 }
}
static int hdspe_pcm_probe(device_t dev)
Definition: hdspe-pcm.c:669
static int hdspe_pcm_detach(device_t dev)
Definition: hdspe-pcm.c:748
static int hdspe_pcm_attach(device_t dev)
Definition: hdspe-pcm.c:699

Definition at line 761 of file hdspe-pcm.c.

◆ hdspe_pfmt

uint32_t hdspe_pfmt[]
static
Initial value:
= {
SND_FORMAT(AFMT_S32_LE, 1, 0),
SND_FORMAT(AFMT_S32_LE, 2, 0),
0
}
#define SND_FORMAT(f, c, e)
Definition: sound.h:238

Definition at line 631 of file hdspe-pcm.c.

◆ hdspe_rcaps

struct pcmchan_caps hdspe_rcaps = {32000, 192000, hdspe_rfmt, 0}
static

Definition at line 629 of file hdspe-pcm.c.

Referenced by hdspechan_getcaps().

◆ hdspe_rfmt

uint32_t hdspe_rfmt[]
static
Initial value:
= {
SND_FORMAT(AFMT_S32_LE, 2, 0),
0
}

Definition at line 624 of file hdspe-pcm.c.

◆ hdspechan_methods

kobj_method_t hdspechan_methods[]
static
Initial value:
= {
KOBJMETHOD(channel_init, hdspechan_init),
KOBJMETHOD(channel_free, hdspechan_free),
KOBJMETHOD(channel_setformat, hdspechan_setformat),
KOBJMETHOD(channel_setspeed, hdspechan_setspeed),
KOBJMETHOD(channel_setblocksize, hdspechan_setblocksize),
KOBJMETHOD(channel_trigger, hdspechan_trigger),
KOBJMETHOD(channel_getptr, hdspechan_getptr),
KOBJMETHOD(channel_getcaps, hdspechan_getcaps),
}
static struct pcmchan_caps * hdspechan_getcaps(kobj_t obj, void *data)
Definition: hdspe-pcm.c:640
static void * hdspechan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
Definition: hdspe-pcm.c:338
static uint32_t hdspechan_getptr(kobj_t obj, void *data)
Definition: hdspe-pcm.c:423
static uint32_t hdspechan_setblocksize(kobj_t obj, void *data, uint32_t blocksize)
Definition: hdspe-pcm.c:559
static int hdspechan_free(kobj_t obj, void *data)
Definition: hdspe-pcm.c:446
static int hdspechan_trigger(kobj_t obj, void *data, int go)
Definition: hdspe-pcm.c:379
static uint32_t hdspechan_setspeed(kobj_t obj, void *data, uint32_t speed)
Definition: hdspe-pcm.c:488
static int hdspechan_setformat(kobj_t obj, void *data, uint32_t format)
Definition: hdspe-pcm.c:471
#define KOBJMETHOD_END
Definition: midi.c:76

Definition at line 655 of file hdspe-pcm.c.

◆ hdspemixer_methods

kobj_method_t hdspemixer_methods[]
static
Initial value:
= {
KOBJMETHOD(mixer_set, hdspemixer_set),
}
static int hdspemixer_init(struct snd_mixer *m)
Definition: hdspe-pcm.c:118
static int hdspemixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
Definition: hdspe-pcm.c:146
int mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
Definition: mixer.c:725
static int mixer_set(struct snd_mixer *m, u_int dev, u_int32_t muted, u_int lev)
Definition: mixer.c:247

Definition at line 174 of file hdspe-pcm.c.

◆ latency_map

struct hdspe_latency latency_map[]
static
Initial value:
= {
{ 7, 32, 0.7 },
{ 0, 64, 1.5 },
{ 1, 128, 3 },
{ 2, 256, 6 },
{ 3, 512, 12 },
{ 4, 1024, 23 },
{ 5, 2048, 46 },
{ 6, 4096, 93 },
{ 0, 0, 0 },
}

Definition at line 51 of file hdspe-pcm.c.

Referenced by hdspechan_setblocksize().

◆ rate_map

struct hdspe_rate rate_map[]
static
Initial value:
= {
{ 32000, (HDSPE_FREQ_32000) },
{ 44100, (HDSPE_FREQ_44100) },
{ 48000, (HDSPE_FREQ_48000) },
{ 0, 0 },
}
#define HDSPE_FREQ_44100
Definition: hdspe.h:58
#define HDSPE_FREQ_48000
Definition: hdspe.h:59
#define HDSPE_FREQ_32000
Definition: hdspe.h:57
#define HDSPE_FREQ_QUAD
Definition: hdspe.h:55
#define HDSPE_FREQ_DOUBLE
Definition: hdspe.h:54

Definition at line 69 of file hdspe-pcm.c.

Referenced by hdspechan_setspeed().