FreeBSD kernel sound device code
hdspe-pcm.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012-2021 Ruslan Bukin <br@bsdpad.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29/*
30 * RME HDSPe driver for FreeBSD (pcm-part).
31 * Supported cards: AIO, RayDAT.
32 */
33
34#include <dev/sound/pcm/sound.h>
35#include <dev/sound/pci/hdspe.h>
36#include <dev/sound/chip.h>
37
38#include <dev/pci/pcireg.h>
39#include <dev/pci/pcivar.h>
40
41#include <mixer_if.h>
42
43SND_DECLARE_FILE("$FreeBSD$");
44
46 uint32_t n;
47 uint32_t period;
48 float ms;
49};
50
51static struct hdspe_latency latency_map[] = {
52 { 7, 32, 0.7 },
53 { 0, 64, 1.5 },
54 { 1, 128, 3 },
55 { 2, 256, 6 },
56 { 3, 512, 12 },
57 { 4, 1024, 23 },
58 { 5, 2048, 46 },
59 { 6, 4096, 93 },
60
61 { 0, 0, 0 },
62};
63
64struct hdspe_rate {
65 uint32_t speed;
66 uint32_t reg;
67};
68
69static struct hdspe_rate rate_map[] = {
70 { 32000, (HDSPE_FREQ_32000) },
71 { 44100, (HDSPE_FREQ_44100) },
72 { 48000, (HDSPE_FREQ_48000) },
76 { 128000, (HDSPE_FREQ_32000 | HDSPE_FREQ_QUAD) },
77 { 176400, (HDSPE_FREQ_44100 | HDSPE_FREQ_QUAD) },
78 { 192000, (HDSPE_FREQ_48000 | HDSPE_FREQ_QUAD) },
79
80 { 0, 0 },
81};
82
83static int
84hdspe_hw_mixer(struct sc_chinfo *ch, unsigned int dst,
85 unsigned int src, unsigned short data)
86{
87 struct sc_pcminfo *scp;
88 struct sc_info *sc;
89 int offs;
90
91 scp = ch->parent;
92 sc = scp->sc;
93
94 offs = 0;
95 if (ch->dir == PCMDIR_PLAY)
96 offs = 64;
97
99 ((offs + src + 128 * dst) * sizeof(uint32_t)),
100 data & 0xFFFF);
101
102 return (0);
103};
104
105static int
107{
108
110 ch->lvol * HDSPE_MAX_GAIN / 100);
112 ch->rvol * HDSPE_MAX_GAIN / 100);
113
114 return (0);
115}
116
117static int
119{
120 struct sc_pcminfo *scp;
121 struct sc_info *sc;
122 int mask;
123
124 scp = mix_getdevinfo(m);
125 sc = scp->sc;
126 if (sc == NULL)
127 return (-1);
128
129 mask = SOUND_MASK_PCM;
130
131 if (scp->hc->play)
132 mask |= SOUND_MASK_VOLUME;
133
134 if (scp->hc->rec)
135 mask |= SOUND_MASK_RECLEV;
136
137 snd_mtxlock(sc->lock);
140 snd_mtxunlock(sc->lock);
141
142 return (0);
143}
144
145static int
146hdspemixer_set(struct snd_mixer *m, unsigned dev,
147 unsigned left, unsigned right)
148{
149 struct sc_pcminfo *scp;
150 struct sc_chinfo *ch;
151 int i;
152
153 scp = mix_getdevinfo(m);
154
155#if 0
156 device_printf(scp->dev, "hdspemixer_set() %d %d\n",
157 left, right);
158#endif
159
160 for (i = 0; i < scp->chnum; i++) {
161 ch = &scp->chan[i];
162 if ((dev == SOUND_MIXER_VOLUME && ch->dir == PCMDIR_PLAY) ||
163 (dev == SOUND_MIXER_RECLEV && ch->dir == PCMDIR_REC)) {
164 ch->lvol = left;
165 ch->rvol = right;
166 if (ch->run)
168 }
169 }
170
171 return (0);
172}
173
174static kobj_method_t hdspemixer_methods[] = {
175 KOBJMETHOD(mixer_init, hdspemixer_init),
176 KOBJMETHOD(mixer_set, hdspemixer_set),
178};
179MIXER_DECLARE(hdspemixer);
180
181static void
183{
184 struct sc_pcminfo *scp;
185 struct sc_info *sc;
186 int reg;
187
188 scp = ch->parent;
189 sc = scp->sc;
190
191 if (ch->dir == PCMDIR_PLAY)
193 else
195
196 ch->run = value;
197
198 hdspe_write_1(sc, reg + (4 * ch->lslot), value);
199 if (AFMT_CHANNEL(ch->format) == 2)
200 hdspe_write_1(sc, reg + (4 * ch->rslot), value);
201}
202
203static int
205{
206 struct sc_pcminfo *scp;
207 struct sc_chinfo *ch;
208 device_t *devlist;
209 int devcount;
210 int i, j;
211 int err;
212
213 if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0)
214 goto bad;
215
216 for (i = 0; i < devcount; i++) {
217 scp = device_get_ivars(devlist[i]);
218 for (j = 0; j < scp->chnum; j++) {
219 ch = &scp->chan[j];
220 if (ch->run)
221 goto bad;
222 }
223 }
224
225 free(devlist, M_TEMP);
226
227 return (0);
228bad:
229
230#if 0
231 device_printf(sc->dev, "hdspe is running\n");
232#endif
233
234 free(devlist, M_TEMP);
235
236 return (1);
237}
238
239static void
241{
242
245}
246
247static void
249{
250
251 if (hdspe_running(sc) == 1)
252 return;
253
256}
257
258/* Multiplex / demultiplex: 2.0 <-> 2 x 1.0. */
259static void
261{
262 struct sc_pcminfo *scp;
263 struct sc_info *sc;
264 int ssize, dsize;
265 int src, dst;
266 int length;
267 int n;
268 int i;
269
270 scp = ch->parent;
271 sc = scp->sc;
272
273 n = AFMT_CHANNEL(ch->format); /* n channels */
274
275 length = sndbuf_getready(ch->buffer) /
276 (4 /* Bytes per sample. */ * n);
277
278 if (ch->dir == PCMDIR_PLAY) {
280 } else {
282 }
283
284 src /= 4; /* Bytes per sample. */
285 dst = src / n; /* Destination buffer n-times smaller. */
286
287 ssize = ch->size / 4;
288 dsize = ch->size / (4 * n);
289
290 /*
291 * Use two fragment buffer to avoid sound clipping.
292 */
293
294 for (i = 0; i < sc->period * 2 /* fragments */; i++) {
295 if (ch->dir == PCMDIR_PLAY) {
297 ch->data[src];
299 ch->data[src + 1];
300
301 } else {
302 ch->data[src] =
304 ch->data[src+1] =
306 }
307
308 dst+=1;
309 dst %= dsize;
310 src += n;
311 src %= ssize;
312 }
313}
314
315static int
317{
318 struct sc_pcminfo *scp;
319 struct sc_info *sc;
320 uint32_t *buf;
321
322 scp = ch->parent;
323 sc = scp->sc;
324 buf = sc->rbuf;
325
326 if (ch->dir == PCMDIR_PLAY) {
327 buf = sc->pbuf;
328 }
329
332
333 return (0);
334}
335
336/* Channel interface. */
337static void *
338hdspechan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b,
339 struct pcm_channel *c, int dir)
340{
341 struct sc_pcminfo *scp;
342 struct sc_chinfo *ch;
343 struct sc_info *sc;
344 int num;
345
346 scp = devinfo;
347 sc = scp->sc;
348
349 snd_mtxlock(sc->lock);
350 num = scp->chnum;
351
352 ch = &scp->chan[num];
353 ch->lslot = scp->hc->left;
354 ch->rslot = scp->hc->right;
355 ch->run = 0;
356 ch->lvol = 0;
357 ch->rvol = 0;
358
359 ch->size = HDSPE_CHANBUF_SIZE * 2; /* max size */
360 ch->data = malloc(ch->size, M_HDSPE, M_NOWAIT);
361
362 ch->buffer = b;
363 ch->channel = c;
364 ch->parent = scp;
365
366 ch->dir = dir;
367
368 snd_mtxunlock(sc->lock);
369
370 if (sndbuf_setup(ch->buffer, ch->data, ch->size) != 0) {
371 device_printf(scp->dev, "Can't setup sndbuf.\n");
372 return (NULL);
373 }
374
375 return (ch);
376}
377
378static int
379hdspechan_trigger(kobj_t obj, void *data, int go)
380{
381 struct sc_pcminfo *scp;
382 struct sc_chinfo *ch;
383 struct sc_info *sc;
384
385 ch = data;
386 scp = ch->parent;
387 sc = scp->sc;
388
389 snd_mtxlock(sc->lock);
390 switch (go) {
391 case PCMTRIG_START:
392#if 0
393 device_printf(scp->dev, "hdspechan_trigger(): start\n");
394#endif
398 break;
399
400 case PCMTRIG_STOP:
401 case PCMTRIG_ABORT:
402#if 0
403 device_printf(scp->dev, "hdspechan_trigger(): stop or abort\n");
404#endif
405 clean(ch);
408 break;
409
410 case PCMTRIG_EMLDMAWR:
411 case PCMTRIG_EMLDMARD:
412 if(ch->run)
414 break;
415 }
416
417 snd_mtxunlock(sc->lock);
418
419 return (0);
420}
421
422static uint32_t
423hdspechan_getptr(kobj_t obj, void *data)
424{
425 struct sc_pcminfo *scp;
426 struct sc_chinfo *ch;
427 struct sc_info *sc;
428 uint32_t ret, pos;
429
430 ch = data;
431 scp = ch->parent;
432 sc = scp->sc;
433
434 snd_mtxlock(sc->lock);
436 snd_mtxunlock(sc->lock);
437
438 pos = ret & HDSPE_BUF_POSITION_MASK;
439 if (AFMT_CHANNEL(ch->format) == 2)
440 pos *= 2; /* Hardbuf twice bigger. */
441
442 return (pos);
443}
444
445static int
446hdspechan_free(kobj_t obj, void *data)
447{
448 struct sc_pcminfo *scp;
449 struct sc_chinfo *ch;
450 struct sc_info *sc;
451
452 ch = data;
453 scp = ch->parent;
454 sc = scp->sc;
455
456#if 0
457 device_printf(scp->dev, "hdspechan_free()\n");
458#endif
459
460 snd_mtxlock(sc->lock);
461 if (ch->data != NULL) {
462 free(ch->data, M_HDSPE);
463 ch->data = NULL;
464 }
465 snd_mtxunlock(sc->lock);
466
467 return (0);
468}
469
470static int
471hdspechan_setformat(kobj_t obj, void *data, uint32_t format)
472{
473 struct sc_chinfo *ch;
474
475 ch = data;
476
477#if 0
478 struct sc_pcminfo *scp = ch->parent;
479 device_printf(scp->dev, "hdspechan_setformat(%d)\n", format);
480#endif
481
482 ch->format = format;
483
484 return (0);
485}
486
487static uint32_t
488hdspechan_setspeed(kobj_t obj, void *data, uint32_t speed)
489{
490 struct sc_pcminfo *scp;
491 struct hdspe_rate *hr;
492 struct sc_chinfo *ch;
493 struct sc_info *sc;
494 long long period;
495 int threshold;
496 int i;
497
498 ch = data;
499 scp = ch->parent;
500 sc = scp->sc;
501 hr = NULL;
502
503#if 0
504 device_printf(scp->dev, "hdspechan_setspeed(%d)\n", speed);
505#endif
506
507 if (hdspe_running(sc) == 1)
508 goto end;
509
510 /* First look for equal frequency. */
511 for (i = 0; rate_map[i].speed != 0; i++) {
512 if (rate_map[i].speed == speed)
513 hr = &rate_map[i];
514 }
515
516 /* If no match, just find nearest. */
517 if (hr == NULL) {
518 for (i = 0; rate_map[i].speed != 0; i++) {
519 hr = &rate_map[i];
520 threshold = hr->speed + ((rate_map[i + 1].speed != 0) ?
521 ((rate_map[i + 1].speed - hr->speed) >> 1) : 0);
522 if (speed < threshold)
523 break;
524 }
525 }
526
527 switch (sc->type) {
528 case RAYDAT:
529 case AIO:
531 break;
532 default:
533 /* Unsupported card. */
534 goto end;
535 }
536
537 /* Write frequency on the device. */
538 sc->ctrl_register &= ~HDSPE_FREQ_MASK;
539 sc->ctrl_register |= hr->reg;
541
542 speed = hr->speed;
543 if (speed > 96000)
544 speed /= 4;
545 else if (speed > 48000)
546 speed /= 2;
547
548 /* Set DDS value. */
549 period /= speed;
551
552 sc->speed = hr->speed;
553end:
554
555 return (sc->speed);
556}
557
558static uint32_t
559hdspechan_setblocksize(kobj_t obj, void *data, uint32_t blocksize)
560{
561 struct hdspe_latency *hl;
562 struct sc_pcminfo *scp;
563 struct sc_chinfo *ch;
564 struct sc_info *sc;
565 int threshold;
566 int i;
567
568 ch = data;
569 scp = ch->parent;
570 sc = scp->sc;
571 hl = NULL;
572
573#if 0
574 device_printf(scp->dev, "hdspechan_setblocksize(%d)\n", blocksize);
575#endif
576
577 if (hdspe_running(sc) == 1)
578 goto end;
579
584
585 blocksize /= 4 /* samples */;
586
587 /* First look for equal latency. */
588 for (i = 0; latency_map[i].period != 0; i++) {
589 if (latency_map[i].period == blocksize) {
590 hl = &latency_map[i];
591 }
592 }
593
594 /* If no match, just find nearest. */
595 if (hl == NULL) {
596 for (i = 0; latency_map[i].period != 0; i++) {
597 hl = &latency_map[i];
598 threshold = hl->period + ((latency_map[i + 1].period != 0) ?
599 ((latency_map[i + 1].period - hl->period) >> 1) : 0);
600 if (blocksize < threshold)
601 break;
602 }
603 }
604
605 snd_mtxlock(sc->lock);
606 sc->ctrl_register &= ~HDSPE_LAT_MASK;
609 sc->period = hl->period;
610 snd_mtxunlock(sc->lock);
611
612#if 0
613 device_printf(scp->dev, "New period=%d\n", sc->period);
614#endif
615
618 (sc->period * 4));
619end:
620
621 return (sndbuf_getblksz(ch->buffer));
622}
623
624static uint32_t hdspe_rfmt[] = {
625 SND_FORMAT(AFMT_S32_LE, 2, 0),
626 0
627};
628
629static struct pcmchan_caps hdspe_rcaps = {32000, 192000, hdspe_rfmt, 0};
630
631static uint32_t hdspe_pfmt[] = {
632 SND_FORMAT(AFMT_S32_LE, 1, 0),
633 SND_FORMAT(AFMT_S32_LE, 2, 0),
634 0
635};
636
637static struct pcmchan_caps hdspe_pcaps = {32000, 192000, hdspe_pfmt, 0};
638
639static struct pcmchan_caps *
640hdspechan_getcaps(kobj_t obj, void *data)
641{
642 struct sc_chinfo *ch;
643
644 ch = data;
645
646#if 0
647 struct sc_pcminfo *scl = ch->parent;
648 device_printf(scp->dev, "hdspechan_getcaps()\n");
649#endif
650
651 return ((ch->dir == PCMDIR_PLAY) ?
653}
654
655static kobj_method_t hdspechan_methods[] = {
656 KOBJMETHOD(channel_init, hdspechan_init),
657 KOBJMETHOD(channel_free, hdspechan_free),
658 KOBJMETHOD(channel_setformat, hdspechan_setformat),
659 KOBJMETHOD(channel_setspeed, hdspechan_setspeed),
660 KOBJMETHOD(channel_setblocksize, hdspechan_setblocksize),
661 KOBJMETHOD(channel_trigger, hdspechan_trigger),
662 KOBJMETHOD(channel_getptr, hdspechan_getptr),
663 KOBJMETHOD(channel_getcaps, hdspechan_getcaps),
665};
667
668static int
670{
671
672#if 0
673 device_printf(dev,"hdspe_pcm_probe()\n");
674#endif
675
676 return (0);
677}
678
679static uint32_t
681{
682 struct sc_chinfo *ch;
683 struct sc_info *sc;
684 int i;
685
686 sc = scp->sc;
687
688 for (i = 0; i < scp->chnum; i++) {
689 ch = &scp->chan[i];
690 snd_mtxunlock(sc->lock);
692 snd_mtxlock(sc->lock);
693 }
694
695 return (0);
696}
697
698static int
700{
701 char status[SND_STATUSLEN];
702 struct sc_pcminfo *scp;
703 char desc[64];
704 int i, err;
705
706 scp = device_get_ivars(dev);
707 scp->ih = &hdspe_pcm_intr;
708
709 bzero(desc, sizeof(desc));
710 snprintf(desc, sizeof(desc), "HDSPe AIO [%s]", scp->hc->descr);
711 device_set_desc_copy(dev, desc);
712
713 /*
714 * We don't register interrupt handler with snd_setup_intr
715 * in pcm device. Mark pcm device as MPSAFE manually.
716 */
718
719 err = pcm_register(dev, scp, scp->hc->play, scp->hc->rec);
720 if (err) {
721 device_printf(dev, "Can't register pcm.\n");
722 return (ENXIO);
723 }
724
725 scp->chnum = 0;
726 for (i = 0; i < scp->hc->play; i++) {
727 pcm_addchan(dev, PCMDIR_PLAY, &hdspechan_class, scp);
728 scp->chnum++;
729 }
730
731 for (i = 0; i < scp->hc->rec; i++) {
732 pcm_addchan(dev, PCMDIR_REC, &hdspechan_class, scp);
733 scp->chnum++;
734 }
735
736 snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd %s",
737 rman_get_start(scp->sc->cs),
738 rman_get_start(scp->sc->irq),
739 PCM_KLDSTRING(snd_hdspe));
741
742 mixer_init(dev, &hdspemixer_class, scp);
743
744 return (0);
745}
746
747static int
749{
750 int err;
751
752 err = pcm_unregister(dev);
753 if (err) {
754 device_printf(dev, "Can't unregister device.\n");
755 return (err);
756 }
757
758 return (0);
759}
760
761static device_method_t hdspe_pcm_methods[] = {
762 DEVMETHOD(device_probe, hdspe_pcm_probe),
763 DEVMETHOD(device_attach, hdspe_pcm_attach),
764 DEVMETHOD(device_detach, hdspe_pcm_detach),
765 { 0, 0 }
766};
767
768static driver_t hdspe_pcm_driver = {
769 "pcm",
772};
773
774DRIVER_MODULE(snd_hdspe_pcm, hdspe, hdspe_pcm_driver, pcm_devclass, 0, 0);
776MODULE_VERSION(snd_hdspe, 1);
u_int32_t data
Definition: ac97_if.m:60
void * devinfo
Definition: ac97_if.m:47
char * desc
Definition: atiixp.c:174
uint32_t format
Definition: audio_dai_if.m:39
uint32_t speed
Definition: audio_dai_if.m:86
int go
Definition: audio_dai_if.m:64
int sndbuf_setup(struct snd_dbuf *b, void *buf, unsigned int size)
Definition: buffer.c:123
unsigned int sndbuf_getblksz(struct snd_dbuf *b)
Definition: buffer.c:403
unsigned int sndbuf_getfreeptr(struct snd_dbuf *b)
Definition: buffer.c:531
unsigned int sndbuf_getready(struct snd_dbuf *b)
Definition: buffer.c:504
int sndbuf_resize(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
Definition: buffer.c:164
unsigned int sndbuf_getreadyptr(struct snd_dbuf *b)
Definition: buffer.c:513
void chn_intr(struct pcm_channel *c)
Definition: channel.c:660
#define PCMDIR_PLAY
Definition: channel.h:339
#define PCMTRIG_START
Definition: channel.h:344
#define PCMTRIG_EMLDMARD
Definition: channel.h:346
#define PCMTRIG_STOP
Definition: channel.h:347
#define PCMTRIG_EMLDMAWR
Definition: channel.h:345
#define PCMDIR_REC
Definition: channel.h:341
#define PCMTRIG_ABORT
Definition: channel.h:348
struct pcm_channel * c
Definition: channel_if.m:106
METHOD int free
Definition: channel_if.m:110
u_int32_t blocksize
Definition: channel_if.m:140
struct pcmchan_matrix * m
Definition: channel_if.m:232
struct snd_dbuf * b
Definition: channel_if.m:105
unsigned right
Definition: es137x.c:261
unsigned left
Definition: es137x.c:260
uint32_t value
Definition: hdaa.c:58
uint8_t mask
Definition: hdac.c:212
uint8_t reg
Definition: hdac.c:211
int dir
Definition: hdac_if.m:45
bus_addr_t buf
Definition: hdac_if.m:63
static void buffer_copy(struct sc_chinfo *ch)
Definition: hdspe-pcm.c:260
static int hdspe_running(struct sc_info *sc)
Definition: hdspe-pcm.c:204
static int hdspe_hw_mixer(struct sc_chinfo *ch, unsigned int dst, unsigned int src, unsigned short data)
Definition: hdspe-pcm.c:84
static struct pcmchan_caps * hdspechan_getcaps(kobj_t obj, void *data)
Definition: hdspe-pcm.c:640
static int hdspe_pcm_probe(device_t dev)
Definition: hdspe-pcm.c:669
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 int clean(struct sc_chinfo *ch)
Definition: hdspe-pcm.c:316
static int hdspemixer_init(struct snd_mixer *m)
Definition: hdspe-pcm.c:118
static device_method_t hdspe_pcm_methods[]
Definition: hdspe-pcm.c:761
static uint32_t hdspe_pfmt[]
Definition: hdspe-pcm.c:631
static uint32_t hdspechan_setblocksize(kobj_t obj, void *data, uint32_t blocksize)
Definition: hdspe-pcm.c:559
static int hdspe_pcm_detach(device_t dev)
Definition: hdspe-pcm.c:748
static int hdspechan_setgain(struct sc_chinfo *ch)
Definition: hdspe-pcm.c:106
static void hdspechan_enable(struct sc_chinfo *ch, int value)
Definition: hdspe-pcm.c:182
static struct hdspe_rate rate_map[]
Definition: hdspe-pcm.c:69
static int hdspechan_free(kobj_t obj, void *data)
Definition: hdspe-pcm.c:446
static kobj_method_t hdspemixer_methods[]
Definition: hdspe-pcm.c:174
SND_DECLARE_FILE("$FreeBSD$")
static uint32_t hdspe_pcm_intr(struct sc_pcminfo *scp)
Definition: hdspe-pcm.c:680
MODULE_DEPEND(snd_hdspe, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
static struct pcmchan_caps hdspe_rcaps
Definition: hdspe-pcm.c:629
static int hdspemixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
Definition: hdspe-pcm.c:146
static int hdspe_pcm_attach(device_t dev)
Definition: hdspe-pcm.c:699
static void hdspe_start_audio(struct sc_info *sc)
Definition: hdspe-pcm.c:240
DRIVER_MODULE(snd_hdspe_pcm, hdspe, hdspe_pcm_driver, pcm_devclass, 0, 0)
MIXER_DECLARE(hdspemixer)
static kobj_method_t hdspechan_methods[]
Definition: hdspe-pcm.c:655
static int hdspechan_trigger(kobj_t obj, void *data, int go)
Definition: hdspe-pcm.c:379
static uint32_t hdspe_rfmt[]
Definition: hdspe-pcm.c:624
static void hdspe_stop_audio(struct sc_info *sc)
Definition: hdspe-pcm.c:248
static driver_t hdspe_pcm_driver
Definition: hdspe-pcm.c:768
static struct hdspe_latency latency_map[]
Definition: hdspe-pcm.c:51
CHANNEL_DECLARE(hdspechan)
MODULE_VERSION(snd_hdspe, 1)
static struct pcmchan_caps hdspe_pcaps
Definition: hdspe-pcm.c:637
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 HDSPE_BUF_POSITION_MASK
Definition: hdspe.h:49
#define HDSPE_CONTROL_REG
Definition: hdspe.h:105
#define HDSPE_ENABLE
Definition: hdspe.h:107
#define hdspe_write_1(sc, regno, data)
Definition: hdspe.h:202
#define HDSPE_CHANBUF_SAMPLES
Definition: hdspe.h:119
#define HDSPE_LAT_BYTES_MAX
Definition: hdspe.h:73
#define HDSPE_MIXER_BASE
Definition: hdspe.h:43
#define hdspe_write_4(sc, regno, data)
Definition: hdspe.h:206
#define HDSPE_FREQ_AIO
Definition: hdspe.h:64
#define HDSPE_OUT_ENABLE_BASE
Definition: hdspe.h:41
#define HDSPE_FREQ_REG
Definition: hdspe.h:63
#define HDSPE_AUDIO_INT_ENABLE
Definition: hdspe.h:112
#define HDSPE_IN_ENABLE_BASE
Definition: hdspe.h:42
#define AIO
Definition: hdspe.h:37
#define HDSPE_STATUS_REG
Definition: hdspe.h:106
#define HDSPE_LAT_BYTES_MIN
Definition: hdspe.h:74
#define HDSPE_FREQ_44100
Definition: hdspe.h:58
#define RAYDAT
Definition: hdspe.h:38
#define HDSPE_FREQ_48000
Definition: hdspe.h:59
#define HDSPE_CHANBUF_SIZE
Definition: hdspe.h:120
#define HDSPE_MAX_GAIN
Definition: hdspe.h:44
#define HDSPE_FREQ_32000
Definition: hdspe.h:57
#define HDSPE_FREQ_QUAD
Definition: hdspe.h:55
#define hdspe_read_2(sc, regno)
Definition: hdspe.h:197
#define HDSPE_FREQ_DOUBLE
Definition: hdspe.h:54
#define hdspe_encode_latency(x)
Definition: hdspe.h:75
uint8_t n
#define KOBJMETHOD_END
Definition: midi.c:76
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
void mix_setdevs(struct snd_mixer *m, u_int32_t v)
Definition: mixer.c:489
void * mix_getdevinfo(struct snd_mixer *m)
Definition: mixer.c:645
unsigned dev
Definition: mixer_if.m:59
u_int32_t src
Definition: mixer_if.m:66
bool * status
void pcm_setflags(device_t dev, uint32_t val)
Definition: sound.c:824
uint32_t pcm_getflags(device_t dev)
Definition: sound.c:816
int pcm_setstatus(device_t dev, char *str)
Definition: sound.c:766
devclass_t pcm_devclass
Definition: sound.c:49
int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo)
Definition: sound.c:692
int pcm_unregister(device_t dev)
Definition: sound.c:1170
int pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
Definition: sound.c:1080
#define PCM_KLDSTRING(a)
Definition: sound.h:619
#define SND_FORMAT(f, c, e)
Definition: sound.h:238
#define SOUND_PREFVER
Definition: sound.h:103
#define SOUND_MAXVER
Definition: sound.h:104
#define SD_F_MPSAFE
Definition: sound.h:138
#define SD_F_SOFTPCMVOL
Definition: sound.h:134
#define snd_mtxlock(m)
Definition: sound.h:347
#define AFMT_CHANNEL(v)
Definition: sound.h:227
#define snd_mtxunlock(m)
Definition: sound.h:348
#define SOUND_MINVER
Definition: sound.h:102
#define PCM_SOFTC_SIZE
Definition: sound.h:96
#define SND_STATUSLEN
Definition: sound.h:98
char * descr
Definition: hdspe.h:126
uint32_t right
Definition: hdspe.h:125
uint32_t play
Definition: hdspe.h:127
uint32_t left
Definition: hdspe.h:124
uint32_t rec
Definition: hdspe.h:128
uint32_t n
Definition: hdspe-pcm.c:46
uint32_t period
Definition: hdspe-pcm.c:47
uint32_t speed
Definition: hdspe-pcm.c:65
uint32_t reg
Definition: hdspe-pcm.c:66
uint32_t rvol
Definition: hdspe.h:145
uint32_t rslot
Definition: hdspe.h:143
unsigned int size
Definition: envy24.c:88
int run
Definition: envy24.c:94
u_int8_t * data
Definition: envy24.c:87
struct pcm_channel * channel
Definition: als4000.c:68
u_int32_t format
Definition: als4000.c:70
uint32_t lvol
Definition: hdspe.h:144
struct sc_info * parent
Definition: als4000.c:67
uint32_t lslot
Definition: hdspe.h:142
int dir
Definition: als4000.c:73
struct snd_dbuf * buffer
Definition: als4000.c:69
u_int32_t type
Definition: cs4281.c:87
uint32_t ctrl_register
Definition: hdspe.h:170
struct mtx * lock
Definition: als4000.c:84
struct resource * cs
Definition: envy24.c:124
sample32_t * rbuf
Definition: envy24.c:164
struct resource * irq
Definition: als4000.c:81
sample32_t * pbuf
Definition: envy24.c:163
device_t dev
Definition: als4000.c:77
uint32_t period
Definition: hdspe.h:191
bus_space_tag_t dst
Definition: envy24.c:136
struct sc_chinfo ch[3]
Definition: ich.c:192
u_int32_t speed
Definition: envy24.c:171
struct hdspe_channel * hc
Definition: hdspe.h:162
uint32_t(* ih)(struct sc_pcminfo *scp)
Definition: hdspe.h:158
struct sc_info * sc
Definition: hdspe.h:161
uint32_t chnum
Definition: hdspe.h:159
device_t dev
Definition: hdspe.h:157
struct sc_chinfo chan[HDSPE_MAX_CHANS]
Definition: hdspe.h:160