FreeBSD kernel sound device code
via82c686.c File Reference
#include <dev/sound/pcm/sound.h>
#include <dev/sound/pcm/ac97.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <sys/sysctl.h>
#include <dev/sound/pci/via82c686.h>
Include dependency graph for via82c686.c:

Go to the source code of this file.

Data Structures

struct  via_dma_op
 
struct  via_chinfo
 
struct  via_info
 

Macros

#define VIA_PCI_ID   0x30581106
 
#define NSEGS   4 /* Number of segments in SGD table */
 
#define SEGS_PER_CHAN   (NSEGS/2)
 
#define TIMEOUT   50
 
#define VIA_DEFAULT_BUFSZ   0x1000
 
#define DEB(x)
 
#define VIA_DMAOP_EOL   0x80000000
 
#define VIA_DMAOP_FLAG   0x40000000
 
#define VIA_DMAOP_STOP   0x20000000
 
#define VIA_DMAOP_COUNT(x)   ((x)&0x00FFFFFF)
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static __inline u_int32_t via_rd (struct via_info *via, int regno, int size)
 
static __inline void via_wr (struct via_info *via, int regno, u_int32_t data, int size)
 
static int via_waitready_codec (struct via_info *via)
 
static int via_waitvalid_codec (struct via_info *via)
 
static int via_write_codec (kobj_t obj, void *addr, int reg, u_int32_t val)
 
static int via_read_codec (kobj_t obj, void *addr, int reg)
 
 AC97_DECLARE (via_ac97)
 
static int via_buildsgdt (struct via_chinfo *ch)
 
static void * viachan_init (kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
 
static int viachan_setformat (kobj_t obj, void *data, u_int32_t format)
 
static u_int32_t viachan_setspeed (kobj_t obj, void *data, u_int32_t speed)
 
static u_int32_t viachan_setblocksize (kobj_t obj, void *data, u_int32_t blocksize)
 
static int viachan_trigger (kobj_t obj, void *data, int go)
 
static u_int32_t viachan_getptr (kobj_t obj, void *data)
 
static struct pcmchan_capsviachan_getcaps (kobj_t obj, void *data)
 
 CHANNEL_DECLARE (viachan)
 
static void via_intr (void *p)
 
static int via_probe (device_t dev)
 
static void dma_cb (void *p, bus_dma_segment_t *bds, int a, int b)
 
static int via_attach (device_t dev)
 
static int via_detach (device_t dev)
 
 DRIVER_MODULE (snd_via82c686, pci, via_driver, pcm_devclass, 0, 0)
 
 MODULE_DEPEND (snd_via82c686, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_VERSION (snd_via82c686, 1)
 

Variables

static u_int32_t via_fmt []
 
static struct pcmchan_caps via_vracaps = {4000, 48000, via_fmt, 0}
 
static struct pcmchan_caps via_caps = {48000, 48000, via_fmt, 0}
 
static kobj_method_t via_ac97_methods []
 
static kobj_method_t viachan_methods []
 
static device_method_t via_methods []
 
static driver_t via_driver
 

Macro Definition Documentation

◆ DEB

#define DEB (   x)

Definition at line 53 of file via82c686.c.

◆ NSEGS

#define NSEGS   4 /* Number of segments in SGD table */

Definition at line 45 of file via82c686.c.

◆ SEGS_PER_CHAN

#define SEGS_PER_CHAN   (NSEGS/2)

Definition at line 47 of file via82c686.c.

◆ TIMEOUT

#define TIMEOUT   50

Definition at line 49 of file via82c686.c.

◆ VIA_DEFAULT_BUFSZ

#define VIA_DEFAULT_BUFSZ   0x1000

Definition at line 50 of file via82c686.c.

◆ VIA_DMAOP_COUNT

#define VIA_DMAOP_COUNT (   x)    ((x)&0x00FFFFFF)

Definition at line 62 of file via82c686.c.

◆ VIA_DMAOP_EOL

#define VIA_DMAOP_EOL   0x80000000

Definition at line 59 of file via82c686.c.

◆ VIA_DMAOP_FLAG

#define VIA_DMAOP_FLAG   0x40000000

Definition at line 60 of file via82c686.c.

◆ VIA_DMAOP_STOP

#define VIA_DMAOP_STOP   0x20000000

Definition at line 61 of file via82c686.c.

◆ VIA_PCI_ID

#define VIA_PCI_ID   0x30581106

Definition at line 44 of file via82c686.c.

Function Documentation

◆ AC97_DECLARE()

AC97_DECLARE ( via_ac97  )

◆ CHANNEL_DECLARE()

CHANNEL_DECLARE ( viachan  )

◆ dma_cb()

static void dma_cb ( void *  p,
bus_dma_segment_t *  bds,
int  a,
int  b 
)
static

Definition at line 467 of file via82c686.c.

References via_info::sgd_addr.

Referenced by via_attach().

Here is the caller graph for this function:

◆ DRIVER_MODULE()

DRIVER_MODULE ( snd_via82c686  ,
pci  ,
via_driver  ,
pcm_devclass  ,
,
 
)

◆ MODULE_DEPEND()

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

◆ MODULE_VERSION()

MODULE_VERSION ( snd_via82c686  ,
 
)

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

◆ via_attach()

◆ via_buildsgdt()

static int via_buildsgdt ( struct via_chinfo ch)
static

Definition at line 219 of file via82c686.c.

References via_chinfo::blksz, via_chinfo::buffer, via_dma_op::flags, via_dma_op::ptr, via_chinfo::sgd_table, sndbuf_getbufaddr(), sndbuf_getsize(), VIA_DMAOP_EOL, and VIA_DMAOP_FLAG.

Referenced by viachan_trigger().

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

◆ via_detach()

static int via_detach ( device_t  dev)
static

◆ via_intr()

static void via_intr ( void *  p)
static

Definition at line 429 of file via82c686.c.

References via_chinfo::channel, chn_intr(), via_info::lock, via_info::pch, via_info::rch, snd_mtxlock, snd_mtxunlock, VIA_PLAY_STAT, via_rd(), VIA_RECORD_STAT, VIA_RPSTAT_INTR, and via_wr().

Referenced by via_attach().

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

◆ via_probe()

static int via_probe ( device_t  dev)
static

Definition at line 457 of file via82c686.c.

References dev, and VIA_PCI_ID.

◆ via_rd()

static __inline u_int32_t via_rd ( struct via_info via,
int  regno,
int  size 
)
static

Definition at line 109 of file via82c686.c.

References regno, via_info::sh, size, and via_info::st.

Referenced by via_intr(), via_read_codec(), via_waitready_codec(), via_waitvalid_codec(), viachan_getptr(), and viachan_setformat().

Here is the caller graph for this function:

◆ via_read_codec()

static int via_read_codec ( kobj_t  obj,
void *  addr,
int  reg 
)
static

Definition at line 191 of file via82c686.c.

References addr, reg, VIA_CODEC_CTL, VIA_CODEC_INDEX, VIA_CODEC_PRIVALID, VIA_CODEC_READ, via_rd(), via_waitready_codec(), via_waitvalid_codec(), and via_wr().

Here is the call graph for this function:

◆ via_waitready_codec()

static int via_waitready_codec ( struct via_info via)
static

Definition at line 145 of file via82c686.c.

References TIMEOUT, VIA_CODEC_BUSY, VIA_CODEC_CTL, and via_rd().

Referenced by via_read_codec(), and via_write_codec().

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

◆ via_waitvalid_codec()

static int via_waitvalid_codec ( struct via_info via)
static

Definition at line 162 of file via82c686.c.

References TIMEOUT, VIA_CODEC_CTL, VIA_CODEC_PRIVALID, and via_rd().

Referenced by via_read_codec().

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

◆ via_wr()

static __inline void via_wr ( struct via_info via,
int  regno,
u_int32_t  data,
int  size 
)
static

Definition at line 125 of file via82c686.c.

References data, regno, via_info::sh, size, and via_info::st.

Referenced by via_attach(), via_intr(), via_read_codec(), via_write_codec(), viachan_setformat(), and viachan_trigger().

Here is the caller graph for this function:

◆ via_write_codec()

static int via_write_codec ( kobj_t  obj,
void *  addr,
int  reg,
u_int32_t  val 
)
static

Definition at line 179 of file via82c686.c.

References addr, reg, val, VIA_CODEC_CTL, VIA_CODEC_INDEX, VIA_CODEC_PRIVALID, via_waitready_codec(), and via_wr().

Here is the call graph for this function:

◆ viachan_getcaps()

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

◆ viachan_getptr()

static u_int32_t viachan_getptr ( kobj_t  obj,
void *  data 
)
static

◆ viachan_init()

◆ viachan_setblocksize()

static u_int32_t viachan_setblocksize ( kobj_t  obj,
void *  data,
u_int32_t  blocksize 
)
static

Definition at line 329 of file via82c686.c.

References via_chinfo::blksz, blocksize, via_chinfo::buffer, data, SEGS_PER_CHAN, and sndbuf_resize().

Here is the call graph for this function:

◆ viachan_setformat()

static int viachan_setformat ( kobj_t  obj,
void *  data,
u_int32_t  format 
)
static

◆ viachan_setspeed()

static u_int32_t viachan_setspeed ( kobj_t  obj,
void *  data,
u_int32_t  speed 
)
static

◆ viachan_trigger()

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

Variable Documentation

◆ via_ac97_methods

kobj_method_t via_ac97_methods[]
static
Initial value:
= {
KOBJMETHOD(ac97_read, via_read_codec),
KOBJMETHOD(ac97_write, via_write_codec),
}
#define KOBJMETHOD_END
Definition: midi.c:76
static int via_read_codec(kobj_t obj, void *addr, int reg)
Definition: via82c686.c:191
static int via_write_codec(kobj_t obj, void *addr, int reg, u_int32_t val)
Definition: via82c686.c:179

Definition at line 209 of file via82c686.c.

◆ via_caps

struct pcmchan_caps via_caps = {48000, 48000, via_fmt, 0}
static

Definition at line 106 of file via82c686.c.

Referenced by viachan_getcaps().

◆ via_driver

driver_t via_driver
static
Initial value:
= {
"pcm",
}
#define PCM_SOFTC_SIZE
Definition: sound.h:96
static device_method_t via_methods[]
Definition: via82c686.c:636

Definition at line 643 of file via82c686.c.

◆ via_fmt

u_int32_t via_fmt[]
static
Initial value:
= {
SND_FORMAT(AFMT_U8, 1, 0),
SND_FORMAT(AFMT_U8, 2, 0),
SND_FORMAT(AFMT_S16_LE, 1, 0),
SND_FORMAT(AFMT_S16_LE, 2, 0),
0
}
#define SND_FORMAT(f, c, e)
Definition: sound.h:238

Definition at line 98 of file via82c686.c.

◆ via_methods

device_method_t via_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, via_probe),
DEVMETHOD(device_attach, via_attach),
DEVMETHOD(device_detach, via_detach),
{ 0, 0}
}
static int via_attach(device_t dev)
Definition: via82c686.c:474
static int via_detach(device_t dev)
Definition: via82c686.c:614
static int via_probe(device_t dev)
Definition: via82c686.c:457

Definition at line 636 of file via82c686.c.

◆ via_vracaps

struct pcmchan_caps via_vracaps = {4000, 48000, via_fmt, 0}
static

Definition at line 105 of file via82c686.c.

Referenced by viachan_getcaps().

◆ viachan_methods

kobj_method_t viachan_methods[]
static
Initial value:
= {
KOBJMETHOD(channel_init, viachan_init),
KOBJMETHOD(channel_setformat, viachan_setformat),
KOBJMETHOD(channel_setspeed, viachan_setspeed),
KOBJMETHOD(channel_setblocksize, viachan_setblocksize),
KOBJMETHOD(channel_trigger, viachan_trigger),
KOBJMETHOD(channel_getptr, viachan_getptr),
KOBJMETHOD(channel_getcaps, viachan_getcaps),
}
static u_int32_t viachan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
Definition: via82c686.c:329
static void * viachan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
Definition: via82c686.c:245
static u_int32_t viachan_getptr(kobj_t obj, void *data)
Definition: via82c686.c:367
static struct pcmchan_caps * viachan_getcaps(kobj_t obj, void *data)
Definition: via82c686.c:406
static int viachan_setformat(kobj_t obj, void *data, u_int32_t format)
Definition: via82c686.c:282
static u_int32_t viachan_setspeed(kobj_t obj, void *data, u_int32_t speed)
Definition: via82c686.c:306
static int viachan_trigger(kobj_t obj, void *data, int go)
Definition: via82c686.c:340

Definition at line 414 of file via82c686.c.