FreeBSD kernel sound device code
csapcm.c File Reference
Include dependency graph for csapcm.c:

Go to the source code of this file.

Data Structures

struct  csa_chinfo
 
struct  csa_info
 

Macros

#define CS461x_BUFFSIZE   (4 * 1024)
 
#define GOF_PER_SEC   200
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static int csa_init (struct csa_info *)
 
static void csa_intr (void *)
 
static void csa_setplaysamplerate (csa_res *resp, u_long ulInRate)
 
static void csa_setcapturesamplerate (csa_res *resp, u_long ulOutRate)
 
static void csa_startplaydma (struct csa_info *csa)
 
static void csa_startcapturedma (struct csa_info *csa)
 
static void csa_stopplaydma (struct csa_info *csa)
 
static void csa_stopcapturedma (struct csa_info *csa)
 
static int csa_startdsp (csa_res *resp)
 
static int csa_stopdsp (csa_res *resp)
 
static int csa_allocres (struct csa_info *scp, device_t dev)
 
static void csa_releaseres (struct csa_info *scp, device_t dev)
 
static void csa_ac97_suspend (struct csa_info *csa)
 
static void csa_ac97_resume (struct csa_info *csa)
 
static int csa_active (struct csa_info *csa, int run)
 
static int csa_rdcd (kobj_t obj, void *devinfo, int regno)
 
static int csa_wrcd (kobj_t obj, void *devinfo, int regno, u_int32_t data)
 
 AC97_DECLARE (csa_ac97)
 
static int csa_setupchan (struct csa_chinfo *ch)
 
static void * csachan_init (kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
 
static int csachan_setformat (kobj_t obj, void *data, u_int32_t format)
 
static u_int32_t csachan_setspeed (kobj_t obj, void *data, u_int32_t speed)
 
static u_int32_t csachan_setblocksize (kobj_t obj, void *data, u_int32_t blocksize)
 
static int csachan_trigger (kobj_t obj, void *data, int go)
 
static u_int32_t csachan_getptr (kobj_t obj, void *data)
 
static struct pcmchan_capscsachan_getcaps (kobj_t obj, void *data)
 
 CHANNEL_DECLARE (csachan)
 
static int pcmcsa_probe (device_t dev)
 
static int pcmcsa_attach (device_t dev)
 
static int pcmcsa_detach (device_t dev)
 
static int pcmcsa_suspend (device_t dev)
 
static int pcmcsa_resume (device_t dev)
 
 DRIVER_MODULE (snd_csapcm, csa, pcmcsa_driver, pcm_devclass, 0, 0)
 
 MODULE_DEPEND (snd_csapcm, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_DEPEND (snd_csapcm, snd_csa, 1, 1, 1)
 
 MODULE_VERSION (snd_csapcm, 1)
 

Variables

static u_int32_t csa_playfmt []
 
static struct pcmchan_caps csa_playcaps = {8000, 48000, csa_playfmt, 0}
 
static u_int32_t csa_recfmt []
 
static struct pcmchan_caps csa_reccaps = {11025, 48000, csa_recfmt, 0}
 
static kobj_method_t csa_ac97_methods []
 
static kobj_method_t csachan_methods []
 
static device_method_t pcmcsa_methods []
 
static driver_t pcmcsa_driver
 

Macro Definition Documentation

◆ CS461x_BUFFSIZE

#define CS461x_BUFFSIZE   (4 * 1024)

Definition at line 49 of file csapcm.c.

◆ GOF_PER_SEC

#define GOF_PER_SEC   200

Definition at line 51 of file csapcm.c.

Function Documentation

◆ AC97_DECLARE()

AC97_DECLARE ( csa_ac97  )

◆ CHANNEL_DECLARE()

CHANNEL_DECLARE ( csachan  )

◆ csa_ac97_resume()

static void csa_ac97_resume ( struct csa_info csa)
static

Definition at line 910 of file csapcm.c.

References csa_info::ac97, csa_info::ac97_general_purpose, csa_info::ac97_powerdown, BA0_AC97_GENERAL_PURPOSE, BA0_AC97_POWERDOWN, BA0_AC97_RESET, count, CS461x_AC97_HIGHESTREGTORESTORE, CS461x_AC97_NUMBER_RESTORE_REGS, csa_writecodec(), and csa_info::res.

Referenced by pcmcsa_resume().

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

◆ csa_ac97_suspend()

◆ csa_active()

static int csa_active ( struct csa_info csa,
int  run 
)
static

Definition at line 124 of file csapcm.c.

References csa_info::active, csa_card::active, and csa_info::card.

Referenced by csa_rdcd(), csa_wrcd(), csachan_trigger(), pcmcsa_attach(), pcmcsa_resume(), and pcmcsa_suspend().

Here is the caller graph for this function:

◆ csa_allocres()

static int csa_allocres ( struct csa_info scp,
device_t  dev 
)
static

Definition at line 689 of file csapcm.c.

References CS461x_BUFFSIZE, dev, csa_info::parent_dmat, csa_info::res, and resp.

Referenced by pcmcsa_attach().

Here is the caller graph for this function:

◆ csa_init()

static int csa_init ( struct csa_info csa)
static

Definition at line 659 of file csapcm.c.

References BA0_EGPIODR, BA0_EGPIOPTR, csa_readio(), csa_setcapturesamplerate(), csa_setplaysamplerate(), csa_startdsp(), csa_stopcapturedma(), csa_stopplaydma(), csa_writeio(), EGPIODR_GPOE0, EGPIODR_GPOE2, EGPIOPTR_GPPT0, EGPIOPTR_GPPT2, csa_info::pfie, csa_info::res, and resp.

Referenced by pcmcsa_attach().

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

◆ csa_intr()

static void csa_intr ( void *  p)
static

Definition at line 642 of file csapcm.c.

References csa_info::binfo, csa_chinfo::channel, chn_intr(), csa_bridgeinfo::hisr, HISR_VC0, HISR_VC1, and csa_info::rch.

Referenced by pcmcsa_attach().

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

◆ csa_rdcd()

static int csa_rdcd ( kobj_t  obj,
void *  devinfo,
int  regno 
)
static

Definition at line 143 of file csapcm.c.

References BA0_AC97_RESET, csa_active(), csa_readcodec(), data, devinfo, regno, and csa_info::res.

Here is the call graph for this function:

◆ csa_releaseres()

static void csa_releaseres ( struct csa_info scp,
device_t  dev 
)
static

Definition at line 728 of file csapcm.c.

References dev, free, csa_info::ih, csa_info::parent_dmat, csa_info::res, and resp.

Referenced by pcmcsa_attach(), and pcmcsa_detach().

Here is the caller graph for this function:

◆ csa_setcapturesamplerate()

static void csa_setcapturesamplerate ( csa_res resp,
u_long  ulOutRate 
)
static

Definition at line 222 of file csapcm.c.

References BA1_CCI, BA1_CCST, BA1_CD, BA1_CFG1, BA1_CFG2, BA1_CPI, BA1_CSPB, BA1_CSRC, BA1_VARIDEC_BUF_1, csa_writemem(), GOF_PER_SEC, and resp.

Referenced by csa_init(), and csa_setupchan().

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

◆ csa_setplaysamplerate()

static void csa_setplaysamplerate ( csa_res resp,
u_long  ulInRate 
)
static

Definition at line 176 of file csapcm.c.

References BA1_PPI, BA1_PSRC, csa_writemem(), GOF_PER_SEC, and resp.

Referenced by csa_init(), and csa_setupchan().

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

◆ csa_setupchan()

static int csa_setupchan ( struct csa_chinfo ch)
static

◆ csa_startcapturedma()

static void csa_startcapturedma ( struct csa_info csa)
static

Definition at line 352 of file csapcm.c.

References BA1_CCTL, BA1_CVOL, csa_info::cctl, csa_readmem(), csa_writemem(), csa_chinfo::dma, csa_info::rch, csa_info::res, and resp.

Referenced by csachan_trigger(), and pcmcsa_resume().

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

◆ csa_startdsp()

static int csa_startdsp ( csa_res resp)
static

Definition at line 422 of file csapcm.c.

References BA1_FRMT, BA1_SPCR, csa_readmem(), csa_writemem(), resp, SPCR_DRQEN, SPCR_RUN, and SPCR_RUNFR.

Referenced by csa_init(), and pcmcsa_resume().

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

◆ csa_startplaydma()

static void csa_startplaydma ( struct csa_info csa)
static

Definition at line 336 of file csapcm.c.

References BA1_PCTL, BA1_PVOL, csa_readmem(), csa_writemem(), csa_info::pctl, csa_info::res, and resp.

Referenced by csachan_trigger(), and pcmcsa_resume().

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

◆ csa_stopcapturedma()

static void csa_stopcapturedma ( struct csa_info csa)
static

Definition at line 395 of file csapcm.c.

References BA0_SERBSP, BA1_CCTL, BA1_CVOL, csa_info::cctl, csa_clearserialfifos(), csa_readmem(), csa_writeio(), csa_writemem(), csa_chinfo::dma, csa_info::rch, csa_info::res, and resp.

Referenced by csa_init(), csachan_trigger(), pcmcsa_resume(), and pcmcsa_suspend().

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

◆ csa_stopdsp()

static int csa_stopdsp ( csa_res resp)
static

Definition at line 469 of file csapcm.c.

References BA1_SPCR, csa_writemem(), and resp.

Referenced by pcmcsa_suspend().

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

◆ csa_stopplaydma()

static void csa_stopplaydma ( struct csa_info csa)
static

Definition at line 368 of file csapcm.c.

References BA0_SERBSP, BA1_PCTL, BA1_PVOL, csa_clearserialfifos(), csa_readmem(), csa_writeio(), csa_writemem(), csa_chinfo::dma, csa_info::pctl, csa_info::rch, csa_info::res, and resp.

Referenced by csa_init(), csachan_trigger(), pcmcsa_resume(), and pcmcsa_suspend().

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

◆ csa_wrcd()

static int csa_wrcd ( kobj_t  obj,
void *  devinfo,
int  regno,
u_int32_t  data 
)
static

Definition at line 157 of file csapcm.c.

References BA0_AC97_RESET, csa_active(), csa_writecodec(), data, devinfo, regno, and csa_info::res.

Here is the call graph for this function:

◆ csachan_getcaps()

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

Definition at line 621 of file csapcm.c.

References csa_playcaps, csa_reccaps, data, csa_chinfo::dir, and PCMDIR_PLAY.

◆ csachan_getptr()

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

Definition at line 598 of file csapcm.c.

References BA1_CBA, BA1_PBA, csa_chinfo::buffer, csa_readmem(), data, csa_chinfo::dir, csa_chinfo::fmt, csa_chinfo::parent, PCMDIR_PLAY, csa_info::res, resp, and sndbuf_getbufaddr().

Here is the call graph for this function:

◆ csachan_init()

static void * csachan_init ( kobj_t  obj,
void *  devinfo,
struct snd_dbuf b,
struct pcm_channel c,
int  dir 
)
static

Definition at line 533 of file csapcm.c.

References b, csa_chinfo::buffer, c, csa_chinfo::channel, CS461x_BUFFSIZE, devinfo, csa_chinfo::dir, dir, csa_chinfo::parent, csa_info::parent_dmat, PCMDIR_PLAY, csa_info::rch, and sndbuf_alloc().

Here is the call graph for this function:

◆ csachan_setblocksize()

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

Definition at line 566 of file csapcm.c.

References CS461x_BUFFSIZE.

◆ csachan_setformat()

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

Definition at line 548 of file csapcm.c.

References data, csa_chinfo::fmt, and format.

◆ csachan_setspeed()

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

Definition at line 557 of file csapcm.c.

References data, csa_chinfo::spd, and speed.

◆ csachan_trigger()

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

◆ DRIVER_MODULE()

DRIVER_MODULE ( snd_csapcm  ,
csa  ,
pcmcsa_driver  ,
pcm_devclass  ,
,
 
)

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( snd_csapcm  ,
snd_csa  ,
,
,
 
)

◆ MODULE_DEPEND() [2/2]

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

◆ MODULE_VERSION()

MODULE_VERSION ( snd_csapcm  ,
 
)

◆ pcmcsa_attach()

◆ pcmcsa_detach()

static int pcmcsa_detach ( device_t  dev)
static

Definition at line 852 of file csapcm.c.

References csa_releaseres(), dev, pcm_getdevinfo(), pcm_unregister(), and r.

Here is the call graph for this function:

◆ pcmcsa_probe()

static int pcmcsa_probe ( device_t  dev)
static

Definition at line 758 of file csapcm.c.

References dev, sndcard_func::func, and SCF_PCM.

◆ pcmcsa_resume()

◆ pcmcsa_suspend()

static int pcmcsa_suspend ( device_t  dev)
static

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ csa_ac97_methods

kobj_method_t csa_ac97_methods[]
static
Initial value:
= {
KOBJMETHOD(ac97_read, csa_rdcd),
KOBJMETHOD(ac97_write, csa_wrcd),
}
static int csa_rdcd(kobj_t obj, void *devinfo, int regno)
Definition: csapcm.c:143
static int csa_wrcd(kobj_t obj, void *devinfo, int regno, u_int32_t data)
Definition: csapcm.c:157
#define KOBJMETHOD_END
Definition: midi.c:76

Definition at line 168 of file csapcm.c.

◆ csa_playcaps

struct pcmchan_caps csa_playcaps = {8000, 48000, csa_playfmt, 0}
static

Definition at line 112 of file csapcm.c.

Referenced by csachan_getcaps().

◆ csa_playfmt

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

Definition at line 101 of file csapcm.c.

◆ csa_reccaps

struct pcmchan_caps csa_reccaps = {11025, 48000, csa_recfmt, 0}
static

Definition at line 119 of file csapcm.c.

Referenced by csachan_getcaps().

◆ csa_recfmt

u_int32_t csa_recfmt[]
static
Initial value:
= {
SND_FORMAT(AFMT_S16_LE, 1, 0),
SND_FORMAT(AFMT_S16_LE, 2, 0),
0
}

Definition at line 114 of file csapcm.c.

◆ csachan_methods

kobj_method_t csachan_methods[]
static
Initial value:
= {
KOBJMETHOD(channel_init, csachan_init),
KOBJMETHOD(channel_setformat, csachan_setformat),
KOBJMETHOD(channel_setspeed, csachan_setspeed),
KOBJMETHOD(channel_setblocksize, csachan_setblocksize),
KOBJMETHOD(channel_trigger, csachan_trigger),
KOBJMETHOD(channel_getptr, csachan_getptr),
KOBJMETHOD(channel_getcaps, csachan_getcaps),
}
static struct pcmchan_caps * csachan_getcaps(kobj_t obj, void *data)
Definition: csapcm.c:621
static u_int32_t csachan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
Definition: csapcm.c:566
static void * csachan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
Definition: csapcm.c:533
static u_int32_t csachan_setspeed(kobj_t obj, void *data, u_int32_t speed)
Definition: csapcm.c:557
static int csachan_trigger(kobj_t obj, void *data, int go)
Definition: csapcm.c:572
static int csachan_setformat(kobj_t obj, void *data, u_int32_t format)
Definition: csapcm.c:548
static u_int32_t csachan_getptr(kobj_t obj, void *data)
Definition: csapcm.c:598

Definition at line 627 of file csapcm.c.

◆ pcmcsa_driver

driver_t pcmcsa_driver
static
Initial value:
= {
"pcm",
}
static device_method_t pcmcsa_methods[]
Definition: csapcm.c:1023
#define PCM_SOFTC_SIZE
Definition: sound.h:96

Definition at line 1034 of file csapcm.c.

◆ pcmcsa_methods

device_method_t pcmcsa_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe , pcmcsa_probe ),
DEVMETHOD(device_attach, pcmcsa_attach),
DEVMETHOD(device_detach, pcmcsa_detach),
DEVMETHOD(device_suspend, pcmcsa_suspend),
DEVMETHOD(device_resume, pcmcsa_resume),
{ 0, 0 },
}
static int pcmcsa_detach(device_t dev)
Definition: csapcm.c:852
static int pcmcsa_resume(device_t dev)
Definition: csapcm.c:988
static int pcmcsa_attach(device_t dev)
Definition: csapcm.c:776
static int pcmcsa_probe(device_t dev)
Definition: csapcm.c:758
static int pcmcsa_suspend(device_t dev)
Definition: csapcm.c:943

Definition at line 1023 of file csapcm.c.