31#ifdef HAVE_KERNEL_OPTION_HEADERS
38#include <isa/isavar.h>
102 return bus_space_read_1(rman_get_bustag(port),
103 rman_get_bushandle(port),
113 bus_space_write_1(rman_get_bustag(port),
114 rman_get_bushandle(port),
134 unsigned char c, served = 0;
142 printf(
"pcm: stray int (%x)\n",
c);
162 printf(
"pcm: int without reason (%x)\n",
c);
167 if (
c != 0) printf(
"pcm: int clear failed (%x)\n",
c);
179 printf(
"ad1816_wait_init failed 0x%02x.\n",
n);
233 case SOUND_MIXER_VOLUME:
238 case SOUND_MIXER_LINE1:
242 case SOUND_MIXER_SYNTH:
246 case SOUND_MIXER_PCM:
250 case SOUND_MIXER_LINE:
251 case SOUND_MIXER_LINE3:
255 case SOUND_MIXER_MIC:
259 case SOUND_MIXER_IGAIN:
267 printf(
"ad1816_mixer_set(): unknown device.\n");
285 case SOUND_MASK_LINE:
286 case SOUND_MASK_LINE3:
291 case SOUND_MASK_LINE1:
298 src = SOUND_MASK_MIC;
427 int cnt = ((ch->
blksz) >> 2) - 1;
431 (wr? 0x8000 : 0x4000));
435 printf(
"ad1816: failed to start %s DMA!\n",
445 ~(wr? 0x8000 : 0x4000));
450 printf(
"ad1816: failed to stop %s DMA!\n",
493 bus_teardown_intr(
dev, ad1816->
irq, ad1816->
ih);
494 bus_release_resource(
dev, SYS_RES_IRQ, ad1816->
irq_rid, ad1816->
irq);
498 isa_dma_release(rman_get_start(ad1816->
drq1));
499 bus_release_resource(
dev, SYS_RES_DRQ, ad1816->
drq1_rid, ad1816->
drq1);
503 isa_dma_release(rman_get_start(ad1816->
drq2));
504 bus_release_resource(
dev, SYS_RES_DRQ, ad1816->
drq2_rid, ad1816->
drq2);
518 free(ad1816, M_DEVBUF);
524 int ok = 1, pdma, rdma;
528 SYS_RES_IOPORT, &ad1816->
io_rid, RF_ACTIVE);
530 ad1816->
irq = bus_alloc_resource_any(
dev, SYS_RES_IRQ,
533 ad1816->
drq1 = bus_alloc_resource_any(
dev, SYS_RES_DRQ,
536 ad1816->
drq2 = bus_alloc_resource_any(
dev, SYS_RES_DRQ,
542 pdma = rman_get_start(ad1816->
drq1);
543 isa_dma_acquire(pdma);
544 isa_dmainit(pdma, ad1816->
bufsize);
546 rdma = rman_get_start(ad1816->
drq2);
547 isa_dma_acquire(rdma);
548 isa_dmainit(rdma, ad1816->
bufsize);
578 u_int32_t logical_id = isa_get_logicalid(
dev);
580 switch (logical_id) {
590 device_set_desc(
dev, s);
591 return BUS_PROBE_DEFAULT;
602 gone_in_dev(
dev, 14,
"ISA sound driver");
603 ad1816 = malloc(
sizeof(*ad1816), M_DEVBUF, M_WAITOK | M_ZERO);
617 if (bus_dma_tag_create(bus_get_dma_tag(
dev), 2,
619 BUS_SPACE_MAXADDR_24BIT,
626 device_printf(
dev,
"unable to create dma tag\n");
635 rman_get_start(ad1816->
io_base),
636 rman_get_start(ad1816->
irq),
637 rman_get_start(ad1816->
drq1),
static struct pcmchan_caps * ad1816chan_getcaps(kobj_t obj, void *data)
static device_method_t ad1816_methods[]
static u_int32_t ad1816_fmt[]
static int ad1816_alloc_resources(struct ad1816_info *ad1816, device_t dev)
static int ad1816_probe(device_t dev)
static u_int32_t ad1816chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
static void * ad1816chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
static int port_rd(struct resource *port, int off)
static struct pcmchan_caps ad1816_caps
static int ad1816_attach(device_t dev)
static int ad1816chan_setformat(kobj_t obj, void *data, u_int32_t format)
static int ad1816mix_init(struct snd_mixer *m)
static void ad1816_release_resources(struct ad1816_info *ad1816, device_t dev)
static int ad1816chan_trigger(kobj_t obj, void *data, int go)
static u_int32_t ad1816mix_setrecsrc(struct snd_mixer *m, u_int32_t src)
static kobj_method_t ad1816mixer_methods[]
SND_DECLARE_FILE("$FreeBSD$")
static void port_wr(struct resource *port, int off, u_int8_t data)
DRIVER_MODULE(snd_ad1816, isa, ad1816_driver, pcm_devclass, 0, 0)
static kobj_method_t ad1816chan_methods[]
static driver_t ad1816_driver
static void ad1816_write(struct ad1816_info *ad1816, unsigned int reg, unsigned short data)
static void ad1816_intr(void *arg)
static int ad1816_init(struct ad1816_info *ad1816, device_t dev)
static void io_wr(struct ad1816_info *ad1816, int reg, u_int8_t data)
static u_int32_t ad1816chan_getptr(kobj_t obj, void *data)
static u_int32_t ad1816chan_setspeed(kobj_t obj, void *data, u_int32_t speed)
static int ad1816_wait_init(struct ad1816_info *ad1816, int x)
CHANNEL_DECLARE(ad1816chan)
static int io_rd(struct ad1816_info *ad1816, int reg)
static void ad1816_lock(struct ad1816_info *ad1816)
static unsigned short ad1816_read(struct ad1816_info *ad1816, unsigned int reg)
static void ad1816_unlock(struct ad1816_info *ad1816)
MIXER_DECLARE(ad1816mixer)
static int ad1816mix_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
static int ad1816_detach(device_t dev)
MODULE_DEPEND(snd_ad1816, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
MODULE_VERSION(snd_ad1816, 1)
#define AD1816_MIXER_DEVICES
#define AD1816_REC_DEVICES
int sndbuf_alloc(struct snd_dbuf *b, bus_dma_tag_t dmatag, int dmaflags, unsigned int size)
unsigned int sndbuf_runsz(struct snd_dbuf *b)
void chn_intr(struct pcm_channel *c)
#define PCMTRIG_COMMON(x)
struct pcmchan_matrix * m
static int mixer_setrecsrc(struct snd_mixer *mixer, u_int32_t src)
int mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
static int mixer_set(struct snd_mixer *m, u_int dev, u_int32_t muted, u_int lev)
void mix_setdevs(struct snd_mixer *m, u_int32_t v)
void * mix_getdevinfo(struct snd_mixer *m)
void mix_setrecdevs(struct snd_mixer *m, u_int32_t v)
Record mask of available recording devices.
#define RANGE(var, low, high)
int sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq)
void sndbuf_dma(struct snd_dbuf *b, int go)
int sndbuf_dmaptr(struct snd_dbuf *b)
int sndbuf_dmasetdir(struct snd_dbuf *b, int dir)
void * snd_mtxcreate(const char *desc, const char *type)
void pcm_setflags(device_t dev, uint32_t val)
void * pcm_getdevinfo(device_t dev)
uint32_t pcm_getflags(device_t dev)
int pcm_setstatus(device_t dev, char *str)
void snd_mtxfree(void *m)
int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo)
int pcm_unregister(device_t dev)
int pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
int snd_setup_intr(device_t dev, struct resource *res, int flags, driver_intr_t hand, void *param, void **cookiep)
unsigned int pcm_getbuffersize(device_t dev, unsigned int minbufsz, unsigned int deflt, unsigned int maxbufsz)
#define SND_FORMAT(f, c, e)
struct ad1816_info * parent
struct pcm_channel * channel
struct resource * io_base
bus_dma_tag_t parent_dmat
struct ad1816_chinfo pch rch