FreeBSD kernel sound device code
ad1816.c File Reference
#include <dev/sound/pcm/sound.h>
#include <dev/sound/isa/ad1816.h>
#include <isa/isavar.h>
#include "mixer_if.h"
Include dependency graph for ad1816.c:

Go to the source code of this file.

Data Structures

struct  ad1816_chinfo
 
struct  ad1816_info
 

Macros

#define AD1816_MUTE   31 /* value for mute */
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static void ad1816_lock (struct ad1816_info *ad1816)
 
static void ad1816_unlock (struct ad1816_info *ad1816)
 
static int port_rd (struct resource *port, int off)
 
static void port_wr (struct resource *port, int off, u_int8_t data)
 
static int io_rd (struct ad1816_info *ad1816, int reg)
 
static void io_wr (struct ad1816_info *ad1816, int reg, u_int8_t data)
 
static void ad1816_intr (void *arg)
 
static int ad1816_wait_init (struct ad1816_info *ad1816, int x)
 
static unsigned short ad1816_read (struct ad1816_info *ad1816, unsigned int reg)
 
static void ad1816_write (struct ad1816_info *ad1816, unsigned int reg, unsigned short data)
 
static int ad1816mix_init (struct snd_mixer *m)
 
static int ad1816mix_set (struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
 
static u_int32_t ad1816mix_setrecsrc (struct snd_mixer *m, u_int32_t src)
 
 MIXER_DECLARE (ad1816mixer)
 
static void * ad1816chan_init (kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
 
static int ad1816chan_setformat (kobj_t obj, void *data, u_int32_t format)
 
static u_int32_t ad1816chan_setspeed (kobj_t obj, void *data, u_int32_t speed)
 
static u_int32_t ad1816chan_setblocksize (kobj_t obj, void *data, u_int32_t blocksize)
 
static int ad1816chan_trigger (kobj_t obj, void *data, int go)
 
static u_int32_t ad1816chan_getptr (kobj_t obj, void *data)
 
static struct pcmchan_capsad1816chan_getcaps (kobj_t obj, void *data)
 
 CHANNEL_DECLARE (ad1816chan)
 
static void ad1816_release_resources (struct ad1816_info *ad1816, device_t dev)
 
static int ad1816_alloc_resources (struct ad1816_info *ad1816, device_t dev)
 
static int ad1816_init (struct ad1816_info *ad1816, device_t dev)
 
static int ad1816_probe (device_t dev)
 
static int ad1816_attach (device_t dev)
 
static int ad1816_detach (device_t dev)
 
 DRIVER_MODULE (snd_ad1816, isa, ad1816_driver, pcm_devclass, 0, 0)
 
 DRIVER_MODULE (snd_ad1816, acpi, ad1816_driver, pcm_devclass, 0, 0)
 
 MODULE_DEPEND (snd_ad1816, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_VERSION (snd_ad1816, 1)
 

Variables

static u_int32_t ad1816_fmt []
 
static struct pcmchan_caps ad1816_caps = {4000, 55200, ad1816_fmt, 0}
 
static kobj_method_t ad1816mixer_methods []
 
static kobj_method_t ad1816chan_methods []
 
static device_method_t ad1816_methods []
 
static driver_t ad1816_driver
 

Macro Definition Documentation

◆ AD1816_MUTE

#define AD1816_MUTE   31 /* value for mute */

Definition at line 84 of file ad1816.c.

Function Documentation

◆ ad1816_alloc_resources()

static int ad1816_alloc_resources ( struct ad1816_info ad1816,
device_t  dev 
)
static

Definition at line 522 of file ad1816.c.

References ad1816_info::bufsize, dev, ad1816_info::drq1, ad1816_info::drq1_rid, ad1816_info::drq2, ad1816_info::drq2_rid, ad1816_info::io_base, ad1816_info::io_rid, ad1816_info::irq, ad1816_info::irq_rid, pcm_getflags(), pcm_setflags(), and SD_F_SIMPLEX.

Referenced by ad1816_attach().

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

◆ ad1816_attach()

◆ ad1816_detach()

static int ad1816_detach ( device_t  dev)
static

Definition at line 656 of file ad1816.c.

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

Here is the call graph for this function:

◆ ad1816_init()

static int ad1816_init ( struct ad1816_info ad1816,
device_t  dev 
)
static

Definition at line 559 of file ad1816.c.

References ad1816_write().

Referenced by ad1816_attach().

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

◆ ad1816_intr()

static void ad1816_intr ( void *  arg)
static

Definition at line 131 of file ad1816.c.

References AD1816_INT, AD1816_INTRCI, AD1816_INTRPI, ad1816_lock(), ad1816_unlock(), ad1816_chinfo::buffer, c, ad1816_chinfo::channel, chn_intr(), io_rd(), io_wr(), ad1816_info::rch, and sndbuf_runsz().

Referenced by ad1816_attach().

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

◆ ad1816_lock()

static void ad1816_lock ( struct ad1816_info ad1816)
static

Definition at line 87 of file ad1816.c.

References ad1816_info::lock, and snd_mtxlock.

Referenced by ad1816_intr(), ad1816chan_setformat(), ad1816chan_setspeed(), ad1816chan_trigger(), ad1816mix_set(), and ad1816mix_setrecsrc().

Here is the caller graph for this function:

◆ ad1816_probe()

static int ad1816_probe ( device_t  dev)
static

Definition at line 575 of file ad1816.c.

References dev.

◆ ad1816_read()

static unsigned short ad1816_read ( struct ad1816_info ad1816,
unsigned int  reg 
)
static

Definition at line 184 of file ad1816.c.

References AD1816_ALE, AD1816_ALEMASK, AD1816_HIGH, AD1816_LOW, ad1816_wait_init(), io_rd(), io_wr(), and reg.

Referenced by ad1816chan_trigger(), ad1816mix_set(), and ad1816mix_setrecsrc().

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

◆ ad1816_release_resources()

static void ad1816_release_resources ( struct ad1816_info ad1816,
device_t  dev 
)
static

Definition at line 489 of file ad1816.c.

References dev, ad1816_info::drq1, ad1816_info::drq1_rid, ad1816_info::drq2, ad1816_info::drq2_rid, free, ad1816_info::ih, ad1816_info::io_base, ad1816_info::io_rid, ad1816_info::irq, ad1816_info::irq_rid, ad1816_info::lock, ad1816_info::parent_dmat, and snd_mtxfree().

Referenced by ad1816_attach(), and ad1816_detach().

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

◆ ad1816_unlock()

static void ad1816_unlock ( struct ad1816_info ad1816)
static

Definition at line 93 of file ad1816.c.

References ad1816_info::lock, and snd_mtxunlock.

Referenced by ad1816_intr(), ad1816chan_setformat(), ad1816chan_setspeed(), ad1816chan_trigger(), ad1816mix_set(), and ad1816mix_setrecsrc().

Here is the caller graph for this function:

◆ ad1816_wait_init()

static int ad1816_wait_init ( struct ad1816_info ad1816,
int  x 
)
static

Definition at line 172 of file ad1816.c.

References AD1816_ALE, AD1816_BUSY, io_rd(), and n.

Referenced by ad1816_read(), and ad1816_write().

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

◆ ad1816_write()

static void ad1816_write ( struct ad1816_info ad1816,
unsigned int  reg,
unsigned short  data 
)
static

Definition at line 197 of file ad1816.c.

References AD1816_ALE, AD1816_ALEMASK, AD1816_HIGH, AD1816_LOW, ad1816_wait_init(), data, io_wr(), and reg.

Referenced by ad1816_init(), ad1816chan_setformat(), ad1816chan_setspeed(), ad1816chan_trigger(), ad1816mix_set(), and ad1816mix_setrecsrc().

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

◆ ad1816chan_getcaps()

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

Definition at line 469 of file ad1816.c.

References ad1816_caps.

◆ ad1816chan_getptr()

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

Definition at line 462 of file ad1816.c.

References ad1816_chinfo::buffer, data, and sndbuf_dmaptr().

Here is the call graph for this function:

◆ ad1816chan_init()

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

◆ ad1816chan_setblocksize()

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

Definition at line 401 of file ad1816.c.

References ad1816_chinfo::blksz, blocksize, and data.

◆ ad1816chan_setformat()

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

◆ ad1816chan_setspeed()

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

Definition at line 388 of file ad1816.c.

References ad1816_lock(), ad1816_unlock(), ad1816_write(), data, ad1816_chinfo::dir, ad1816_chinfo::parent, PCMDIR_PLAY, RANGE, and speed.

Here is the call graph for this function:

◆ ad1816chan_trigger()

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

◆ ad1816mix_init()

static int ad1816mix_init ( struct snd_mixer m)
static

Definition at line 208 of file ad1816.c.

References AD1816_MIXER_DEVICES, AD1816_REC_DEVICES, m, mix_setdevs(), and mix_setrecdevs().

Here is the call graph for this function:

◆ ad1816mix_set()

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

Definition at line 216 of file ad1816.c.

References ad1816_lock(), AD1816_MUTE, ad1816_read(), ad1816_unlock(), ad1816_write(), dev, left, m, mix_getdevinfo(), reg, and right.

Here is the call graph for this function:

◆ ad1816mix_setrecsrc()

static u_int32_t ad1816mix_setrecsrc ( struct snd_mixer m,
u_int32_t  src 
)
static

Definition at line 279 of file ad1816.c.

References ad1816_lock(), ad1816_read(), ad1816_unlock(), ad1816_write(), dev, m, mix_getdevinfo(), and src.

Here is the call graph for this function:

◆ CHANNEL_DECLARE()

CHANNEL_DECLARE ( ad1816chan  )

◆ DRIVER_MODULE() [1/2]

DRIVER_MODULE ( snd_ad1816  ,
acpi  ,
ad1816_driver  ,
pcm_devclass  ,
,
 
)

◆ DRIVER_MODULE() [2/2]

DRIVER_MODULE ( snd_ad1816  ,
isa  ,
ad1816_driver  ,
pcm_devclass  ,
,
 
)

◆ io_rd()

static int io_rd ( struct ad1816_info ad1816,
int  reg 
)
static

Definition at line 119 of file ad1816.c.

References ad1816_info::io_base, port_rd(), and reg.

Referenced by ad1816_intr(), ad1816_read(), ad1816_wait_init(), and ad1816chan_trigger().

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

◆ io_wr()

static void io_wr ( struct ad1816_info ad1816,
int  reg,
u_int8_t  data 
)
static

Definition at line 125 of file ad1816.c.

References data, ad1816_info::io_base, port_wr(), and reg.

Referenced by ad1816_intr(), ad1816_read(), ad1816_write(), ad1816chan_setformat(), and ad1816chan_trigger().

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

◆ MIXER_DECLARE()

MIXER_DECLARE ( ad1816mixer  )

◆ MODULE_DEPEND()

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

◆ MODULE_VERSION()

MODULE_VERSION ( snd_ad1816  ,
 
)

◆ port_rd()

static int port_rd ( struct resource *  port,
int  off 
)
static

Definition at line 99 of file ad1816.c.

Referenced by io_rd().

Here is the caller graph for this function:

◆ port_wr()

static void port_wr ( struct resource *  port,
int  off,
u_int8_t  data 
)
static

Definition at line 110 of file ad1816.c.

References data.

Referenced by io_wr().

Here is the caller graph for this function:

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ ad1816_caps

struct pcmchan_caps ad1816_caps = {4000, 55200, ad1816_fmt, 0}
static

Definition at line 82 of file ad1816.c.

Referenced by ad1816chan_getcaps().

◆ ad1816_driver

driver_t ad1816_driver
static
Initial value:
= {
"pcm",
}
static device_method_t ad1816_methods[]
Definition: ad1816.c:670
#define PCM_SOFTC_SIZE
Definition: sound.h:96

Definition at line 678 of file ad1816.c.

◆ ad1816_fmt

u_int32_t ad1816_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),
SND_FORMAT(AFMT_MU_LAW, 1, 0),
SND_FORMAT(AFMT_MU_LAW, 2, 0),
SND_FORMAT(AFMT_A_LAW, 1, 0),
SND_FORMAT(AFMT_A_LAW, 2, 0),
0
}
#define SND_FORMAT(f, c, e)
Definition: sound.h:238

Definition at line 70 of file ad1816.c.

◆ ad1816_methods

device_method_t ad1816_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, ad1816_probe),
DEVMETHOD(device_attach, ad1816_attach),
DEVMETHOD(device_detach, ad1816_detach),
{ 0, 0 }
}
static int ad1816_probe(device_t dev)
Definition: ad1816.c:575
static int ad1816_attach(device_t dev)
Definition: ad1816.c:597
static int ad1816_detach(device_t dev)
Definition: ad1816.c:656

Definition at line 670 of file ad1816.c.

◆ ad1816chan_methods

kobj_method_t ad1816chan_methods[]
static
Initial value:
= {
KOBJMETHOD(channel_init, ad1816chan_init),
KOBJMETHOD(channel_setformat, ad1816chan_setformat),
KOBJMETHOD(channel_setspeed, ad1816chan_setspeed),
KOBJMETHOD(channel_setblocksize, ad1816chan_setblocksize),
KOBJMETHOD(channel_trigger, ad1816chan_trigger),
KOBJMETHOD(channel_getptr, ad1816chan_getptr),
KOBJMETHOD(channel_getcaps, ad1816chan_getcaps),
}
static struct pcmchan_caps * ad1816chan_getcaps(kobj_t obj, void *data)
Definition: ad1816.c:469
static u_int32_t ad1816chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
Definition: ad1816.c:401
static void * ad1816chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
Definition: ad1816.c:319
static int ad1816chan_setformat(kobj_t obj, void *data, u_int32_t format)
Definition: ad1816.c:340
static int ad1816chan_trigger(kobj_t obj, void *data, int go)
Definition: ad1816.c:410
static u_int32_t ad1816chan_getptr(kobj_t obj, void *data)
Definition: ad1816.c:462
static u_int32_t ad1816chan_setspeed(kobj_t obj, void *data, u_int32_t speed)
Definition: ad1816.c:388
#define KOBJMETHOD_END
Definition: midi.c:76

Definition at line 474 of file ad1816.c.

◆ ad1816mixer_methods

kobj_method_t ad1816mixer_methods[]
static
Initial value:
= {
KOBJMETHOD(mixer_init, ad1816mix_init),
KOBJMETHOD(mixer_set, ad1816mix_set),
}
static int ad1816mix_init(struct snd_mixer *m)
Definition: ad1816.c:208
static u_int32_t ad1816mix_setrecsrc(struct snd_mixer *m, u_int32_t src)
Definition: ad1816.c:279
static int ad1816mix_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
Definition: ad1816.c:216
static int mixer_setrecsrc(struct snd_mixer *mixer, u_int32_t src)
Definition: mixer.c:373
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 308 of file ad1816.c.