FreeBSD kernel sound device code
t4dwave.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org>
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, WHETHERIN 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 THEPOSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#ifdef HAVE_KERNEL_OPTION_HEADERS
30#include "opt_snd.h"
31#endif
32
33#include <dev/sound/pcm/sound.h>
34#include <dev/sound/pcm/ac97.h>
36
37#include <dev/pci/pcireg.h>
38#include <dev/pci/pcivar.h>
39
40SND_DECLARE_FILE("$FreeBSD$");
41
42/* -------------------------------------------------------------------- */
43
44#define TDX_PCI_ID 0x20001023
45#define TNX_PCI_ID 0x20011023
46#define ALI_PCI_ID 0x545110b9
47#define SPA_PCI_ID 0x70181039
48
49#define TR_DEFAULT_BUFSZ 0x1000
50/* For ALi M5451 the DMA transfer size appears to be fixed to 64k. */
51#define ALI_BUFSZ 0x10000
52#define TR_BUFALGN 0x8
53#define TR_TIMEOUT_CDC 0xffff
54#define TR_MAXHWCH 64
55#define ALI_MAXHWCH 32
56#define TR_MAXPLAYCH 4
57#define ALI_MAXPLAYCH 1
58/*
59 * Though, it's not clearly documented in the 4DWAVE datasheet, the
60 * DX and NX chips can't handle DMA addresses located above 1GB as the
61 * LBA (loop begin address) register which holds the DMA base address
62 * is 32-bit, but the two MSBs are used for other purposes.
63 */
64#define TR_MAXADDR ((1U << 30) - 1)
65#define ALI_MAXADDR ((1U << 31) - 1)
66
67struct tr_info;
68
69/* channel registers */
70struct tr_chinfo {
71 u_int32_t cso, alpha, fms, fmc, ec;
72 u_int32_t lba;
73 u_int32_t eso, delta;
74 u_int32_t rvol, cvol;
75 u_int32_t gvsel, pan, vol, ctrl;
76 u_int32_t active:1, was_active:1;
80 struct tr_info *parent;
81};
82
83struct tr_rchinfo {
84 u_int32_t delta;
85 u_int32_t active:1, was_active:1;
88 struct tr_info *parent;
89};
90
91/* device private data */
92struct tr_info {
93 u_int32_t type;
94 u_int32_t rev;
95
96 bus_space_tag_t st;
97 bus_space_handle_t sh;
98 bus_dma_tag_t parent_dmat;
99
100 struct resource *reg, *irq;
102 void *ih;
103
104 struct mtx *lock;
105
106 u_int32_t hwchns;
107 u_int32_t playchns;
108 unsigned int bufsz;
109
112};
113
114/* -------------------------------------------------------------------- */
115
116static u_int32_t tr_recfmt[] = {
117 SND_FORMAT(AFMT_U8, 1, 0),
118 SND_FORMAT(AFMT_U8, 2, 0),
119 SND_FORMAT(AFMT_S8, 1, 0),
120 SND_FORMAT(AFMT_S8, 2, 0),
121 SND_FORMAT(AFMT_S16_LE, 1, 0),
122 SND_FORMAT(AFMT_S16_LE, 2, 0),
123 SND_FORMAT(AFMT_U16_LE, 1, 0),
124 SND_FORMAT(AFMT_U16_LE, 2, 0),
125 0
126};
127static struct pcmchan_caps tr_reccaps = {4000, 48000, tr_recfmt, 0};
128
129static u_int32_t tr_playfmt[] = {
130 SND_FORMAT(AFMT_U8, 1, 0),
131 SND_FORMAT(AFMT_U8, 2, 0),
132 SND_FORMAT(AFMT_S8, 1, 0),
133 SND_FORMAT(AFMT_S8, 2, 0),
134 SND_FORMAT(AFMT_S16_LE, 1, 0),
135 SND_FORMAT(AFMT_S16_LE, 2, 0),
136 SND_FORMAT(AFMT_U16_LE, 1, 0),
137 SND_FORMAT(AFMT_U16_LE, 2, 0),
138 0
139};
140static struct pcmchan_caps tr_playcaps = {4000, 48000, tr_playfmt, 0};
141
142/* -------------------------------------------------------------------- */
143
144/* Hardware */
145
146static u_int32_t
147tr_rd(struct tr_info *tr, int regno, int size)
148{
149 switch(size) {
150 case 1:
151 return bus_space_read_1(tr->st, tr->sh, regno);
152 case 2:
153 return bus_space_read_2(tr->st, tr->sh, regno);
154 case 4:
155 return bus_space_read_4(tr->st, tr->sh, regno);
156 default:
157 return 0xffffffff;
158 }
159}
160
161static void
162tr_wr(struct tr_info *tr, int regno, u_int32_t data, int size)
163{
164 switch(size) {
165 case 1:
166 bus_space_write_1(tr->st, tr->sh, regno, data);
167 break;
168 case 2:
169 bus_space_write_2(tr->st, tr->sh, regno, data);
170 break;
171 case 4:
172 bus_space_write_4(tr->st, tr->sh, regno, data);
173 break;
174 }
175}
176
177/* -------------------------------------------------------------------- */
178/* ac97 codec */
179
180static int
181tr_rdcd(kobj_t obj, void *devinfo, int regno)
182{
183 struct tr_info *tr = (struct tr_info *)devinfo;
184 int i, j, treg, trw;
185
186 switch (tr->type) {
187 case SPA_PCI_ID:
188 treg=SPA_REG_CODECRD;
189 trw=SPA_CDC_RWSTAT;
190 break;
191 case ALI_PCI_ID:
192 if (tr->rev > 0x01)
193 treg=TDX_REG_CODECWR;
194 else
195 treg=TDX_REG_CODECRD;
196 trw=TDX_CDC_RWSTAT;
197 break;
198 case TDX_PCI_ID:
199 treg=TDX_REG_CODECRD;
200 trw=TDX_CDC_RWSTAT;
201 break;
202 case TNX_PCI_ID:
203 treg=(regno & 0x100)? TNX_REG_CODEC2RD : TNX_REG_CODEC1RD;
204 trw=TNX_CDC_RWSTAT;
205 break;
206 default:
207 printf("!!! tr_rdcd defaulted !!!\n");
208 return -1;
209 }
210
211 i = j = 0;
212
213 regno &= 0x7f;
214 snd_mtxlock(tr->lock);
215 if (tr->type == ALI_PCI_ID) {
216 u_int32_t chk1, chk2;
217 j = trw;
218 for (i = TR_TIMEOUT_CDC; (i > 0) && (j & trw); i--)
219 j = tr_rd(tr, treg, 4);
220 if (i > 0) {
221 chk1 = tr_rd(tr, 0xc8, 4);
222 chk2 = tr_rd(tr, 0xc8, 4);
223 for (i = TR_TIMEOUT_CDC; (i > 0) && (chk1 == chk2);
224 i--)
225 chk2 = tr_rd(tr, 0xc8, 4);
226 }
227 }
228 if (tr->type != ALI_PCI_ID || i > 0) {
229 tr_wr(tr, treg, regno | trw, 4);
230 j=trw;
231 for (i=TR_TIMEOUT_CDC; (i > 0) && (j & trw); i--)
232 j=tr_rd(tr, treg, 4);
233 }
234 snd_mtxunlock(tr->lock);
235 if (i == 0) printf("codec timeout during read of register %x\n", regno);
236 return (j >> TR_CDC_DATA) & 0xffff;
237}
238
239static int
240tr_wrcd(kobj_t obj, void *devinfo, int regno, u_int32_t data)
241{
242 struct tr_info *tr = (struct tr_info *)devinfo;
243 int i, j, treg, trw;
244
245 switch (tr->type) {
246 case SPA_PCI_ID:
247 treg=SPA_REG_CODECWR;
248 trw=SPA_CDC_RWSTAT;
249 break;
250 case ALI_PCI_ID:
251 case TDX_PCI_ID:
252 treg=TDX_REG_CODECWR;
253 trw=TDX_CDC_RWSTAT;
254 break;
255 case TNX_PCI_ID:
256 treg=TNX_REG_CODECWR;
257 trw=TNX_CDC_RWSTAT | ((regno & 0x100)? TNX_CDC_SEC : 0);
258 break;
259 default:
260 printf("!!! tr_wrcd defaulted !!!");
261 return -1;
262 }
263
264 i = 0;
265
266 regno &= 0x7f;
267#if 0
268 printf("tr_wrcd: reg %x was %x", regno, tr_rdcd(devinfo, regno));
269#endif
270 j=trw;
271 snd_mtxlock(tr->lock);
272 if (tr->type == ALI_PCI_ID) {
273 j = trw;
274 for (i = TR_TIMEOUT_CDC; (i > 0) && (j & trw); i--)
275 j = tr_rd(tr, treg, 4);
276 if (i > 0) {
277 u_int32_t chk1, chk2;
278 chk1 = tr_rd(tr, 0xc8, 4);
279 chk2 = tr_rd(tr, 0xc8, 4);
280 for (i = TR_TIMEOUT_CDC; (i > 0) && (chk1 == chk2);
281 i--)
282 chk2 = tr_rd(tr, 0xc8, 4);
283 }
284 }
285 if (tr->type != ALI_PCI_ID || i > 0) {
286 for (i=TR_TIMEOUT_CDC; (i>0) && (j & trw); i--)
287 j=tr_rd(tr, treg, 4);
288 if (tr->type == ALI_PCI_ID && tr->rev > 0x01)
289 trw |= 0x0100;
290 tr_wr(tr, treg, (data << TR_CDC_DATA) | regno | trw, 4);
291 }
292#if 0
293 printf(" - wrote %x, now %x\n", data, tr_rdcd(devinfo, regno));
294#endif
295 snd_mtxunlock(tr->lock);
296 if (i==0) printf("codec timeout writing %x, data %x\n", regno, data);
297 return (i > 0)? 0 : -1;
298}
299
300static kobj_method_t tr_ac97_methods[] = {
301 KOBJMETHOD(ac97_read, tr_rdcd),
302 KOBJMETHOD(ac97_write, tr_wrcd),
304};
306
307/* -------------------------------------------------------------------- */
308/* playback channel interrupts */
309
310#if 0
311static u_int32_t
312tr_testint(struct tr_chinfo *ch)
313{
314 struct tr_info *tr = ch->parent;
315 int bank, chan;
316
317 bank = (ch->index & 0x20) ? 1 : 0;
318 chan = ch->index & 0x1f;
319 return tr_rd(tr, bank? TR_REG_ADDRINTB : TR_REG_ADDRINTA, 4) & (1 << chan);
320}
321#endif
322
323static void
325{
326 struct tr_info *tr = ch->parent;
327 int bank, chan;
328
329 bank = (ch->index & 0x20) ? 1 : 0;
330 chan = ch->index & 0x1f;
331 tr_wr(tr, bank? TR_REG_ADDRINTB : TR_REG_ADDRINTA, 1 << chan, 4);
332}
333
334static void
335tr_enaint(struct tr_chinfo *ch, int enable)
336{
337 struct tr_info *tr = ch->parent;
338 u_int32_t i, reg;
339 int bank, chan;
340
341 snd_mtxlock(tr->lock);
342 bank = (ch->index & 0x20) ? 1 : 0;
343 chan = ch->index & 0x1f;
345
346 i = tr_rd(tr, reg, 4);
347 i &= ~(1 << chan);
348 i |= (enable? 1 : 0) << chan;
349
350 tr_clrint(ch);
351 tr_wr(tr, reg, i, 4);
352 snd_mtxunlock(tr->lock);
353}
354
355/* playback channels */
356
357static void
359{
360 struct tr_info *tr = ch->parent;
361 int i;
362
363 i = tr_rd(tr, TR_REG_CIR, 4);
364 i &= ~TR_CIR_MASK;
365 i |= ch->index & 0x3f;
366 tr_wr(tr, TR_REG_CIR, i, 4);
367}
368
369static void
371{
372 struct tr_info *tr = ch->parent;
373 int bank, chan;
374
375 bank = (ch->index & 0x20) ? 1 : 0;
376 chan = ch->index & 0x1f;
377 tr_wr(tr, bank? TR_REG_STARTB : TR_REG_STARTA, 1 << chan, 4);
378}
379
380static void
382{
383 struct tr_info *tr = ch->parent;
384 int bank, chan;
385
386 bank = (ch->index & 0x20) ? 1 : 0;
387 chan = ch->index & 0x1f;
388 tr_wr(tr, bank? TR_REG_STOPB : TR_REG_STOPA, 1 << chan, 4);
389}
390
391static void
393{
394 struct tr_info *tr = ch->parent;
395 u_int32_t cr[TR_CHN_REGS], i;
396
397 ch->gvsel &= 0x00000001;
398 ch->fmc &= 0x00000003;
399 ch->fms &= 0x0000000f;
400 ch->ctrl &= 0x0000000f;
401 ch->pan &= 0x0000007f;
402 ch->rvol &= 0x0000007f;
403 ch->cvol &= 0x0000007f;
404 ch->vol &= 0x000000ff;
405 ch->ec &= 0x00000fff;
406 ch->alpha &= 0x00000fff;
407 ch->delta &= 0x0000ffff;
408 if (tr->type == ALI_PCI_ID)
409 ch->lba &= ALI_MAXADDR;
410 else
411 ch->lba &= TR_MAXADDR;
412
413 cr[1]=ch->lba;
414 cr[3]=(ch->fmc<<14) | (ch->rvol<<7) | (ch->cvol);
415 cr[4]=(ch->gvsel<<31) | (ch->pan<<24) | (ch->vol<<16) | (ch->ctrl<<12) | (ch->ec);
416
417 switch (tr->type) {
418 case SPA_PCI_ID:
419 case ALI_PCI_ID:
420 case TDX_PCI_ID:
421 ch->cso &= 0x0000ffff;
422 ch->eso &= 0x0000ffff;
423 cr[0]=(ch->cso<<16) | (ch->alpha<<4) | (ch->fms);
424 cr[2]=(ch->eso<<16) | (ch->delta);
425 break;
426 case TNX_PCI_ID:
427 ch->cso &= 0x00ffffff;
428 ch->eso &= 0x00ffffff;
429 cr[0]=((ch->delta & 0xff)<<24) | (ch->cso);
430 cr[2]=((ch->delta>>8)<<24) | (ch->eso);
431 cr[3]|=(ch->alpha<<20) | (ch->fms<<16) | (ch->fmc<<14);
432 break;
433 }
434 snd_mtxlock(tr->lock);
435 tr_selch(ch);
436 for (i=0; i<TR_CHN_REGS; i++)
437 tr_wr(tr, TR_REG_CHNBASE+(i<<2), cr[i], 4);
438 snd_mtxunlock(tr->lock);
439}
440
441static void
443{
444 struct tr_info *tr = ch->parent;
445 u_int32_t cr[5], i;
446
447 snd_mtxlock(tr->lock);
448 tr_selch(ch);
449 for (i=0; i<5; i++)
450 cr[i]=tr_rd(tr, TR_REG_CHNBASE+(i<<2), 4);
451 snd_mtxunlock(tr->lock);
452
453 if (tr->type == ALI_PCI_ID)
454 ch->lba=(cr[1] & ALI_MAXADDR);
455 else
456 ch->lba=(cr[1] & TR_MAXADDR);
457 ch->fmc= (cr[3] & 0x0000c000) >> 14;
458 ch->rvol= (cr[3] & 0x00003f80) >> 7;
459 ch->cvol= (cr[3] & 0x0000007f);
460 ch->gvsel= (cr[4] & 0x80000000) >> 31;
461 ch->pan= (cr[4] & 0x7f000000) >> 24;
462 ch->vol= (cr[4] & 0x00ff0000) >> 16;
463 ch->ctrl= (cr[4] & 0x0000f000) >> 12;
464 ch->ec= (cr[4] & 0x00000fff);
465 switch(tr->type) {
466 case SPA_PCI_ID:
467 case ALI_PCI_ID:
468 case TDX_PCI_ID:
469 ch->cso= (cr[0] & 0xffff0000) >> 16;
470 ch->alpha= (cr[0] & 0x0000fff0) >> 4;
471 ch->fms= (cr[0] & 0x0000000f);
472 ch->eso= (cr[2] & 0xffff0000) >> 16;
473 ch->delta= (cr[2] & 0x0000ffff);
474 break;
475 case TNX_PCI_ID:
476 ch->cso= (cr[0] & 0x00ffffff);
477 ch->eso= (cr[2] & 0x00ffffff);
478 ch->delta= ((cr[2] & 0xff000000) >> 16) | ((cr[0] & 0xff000000) >> 24);
479 ch->alpha= (cr[3] & 0xfff00000) >> 20;
480 ch->fms= (cr[3] & 0x000f0000) >> 16;
481 break;
482 }
483}
484
485static u_int32_t
487{
488 u_int32_t bits;
489
490 bits = 0;
491 bits |= (fmt & AFMT_SIGNED)? 0x2 : 0;
492 bits |= (AFMT_CHANNEL(fmt) > 1)? 0x4 : 0;
493 bits |= (fmt & AFMT_16BIT)? 0x8 : 0;
494
495 return bits;
496}
497
498/* -------------------------------------------------------------------- */
499/* channel interface */
500
501static void *
502trpchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
503{
504 struct tr_info *tr = devinfo;
505 struct tr_chinfo *ch;
506
507 KASSERT(dir == PCMDIR_PLAY, ("trpchan_init: bad direction"));
508 ch = &tr->chinfo[tr->playchns];
509 ch->index = tr->playchns++;
510 ch->buffer = b;
511 ch->parent = tr;
512 ch->channel = c;
513 if (sndbuf_alloc(ch->buffer, tr->parent_dmat, 0, tr->bufsz) != 0)
514 return NULL;
515
516 return ch;
517}
518
519static int
520trpchan_setformat(kobj_t obj, void *data, u_int32_t format)
521{
522 struct tr_chinfo *ch = data;
523
524 ch->ctrl = tr_fmttobits(format) | 0x01;
525
526 return 0;
527}
528
529static u_int32_t
530trpchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
531{
532 struct tr_chinfo *ch = data;
533
534 ch->delta = (speed << 12) / 48000;
535 return (ch->delta * 48000) >> 12;
536}
537
538static u_int32_t
539trpchan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
540{
541 struct tr_chinfo *ch = data;
542
544 return blocksize;
545}
546
547static int
548trpchan_trigger(kobj_t obj, void *data, int go)
549{
550 struct tr_chinfo *ch = data;
551
552 if (!PCMTRIG_COMMON(go))
553 return 0;
554
555 if (go == PCMTRIG_START) {
556 ch->fmc = 3;
557 ch->fms = 0;
558 ch->ec = 0;
559 ch->alpha = 0;
560 ch->lba = sndbuf_getbufaddr(ch->buffer);
561 ch->cso = 0;
562 ch->eso = (sndbuf_getsize(ch->buffer) / sndbuf_getalign(ch->buffer)) - 1;
563 ch->rvol = ch->cvol = 0x7f;
564 ch->gvsel = 0;
565 ch->pan = 0;
566 ch->vol = 0;
567 ch->bufhalf = 0;
568 tr_wrch(ch);
569 tr_enaint(ch, 1);
570 tr_startch(ch);
571 ch->active = 1;
572 } else {
573 tr_stopch(ch);
574 ch->active = 0;
575 }
576
577 return 0;
578}
579
580static u_int32_t
581trpchan_getptr(kobj_t obj, void *data)
582{
583 struct tr_chinfo *ch = data;
584
585 tr_rdch(ch);
586 return ch->cso * sndbuf_getalign(ch->buffer);
587}
588
589static struct pcmchan_caps *
590trpchan_getcaps(kobj_t obj, void *data)
591{
592 return &tr_playcaps;
593}
594
595static kobj_method_t trpchan_methods[] = {
596 KOBJMETHOD(channel_init, trpchan_init),
597 KOBJMETHOD(channel_setformat, trpchan_setformat),
598 KOBJMETHOD(channel_setspeed, trpchan_setspeed),
599 KOBJMETHOD(channel_setblocksize, trpchan_setblocksize),
600 KOBJMETHOD(channel_trigger, trpchan_trigger),
601 KOBJMETHOD(channel_getptr, trpchan_getptr),
602 KOBJMETHOD(channel_getcaps, trpchan_getcaps),
604};
606
607/* -------------------------------------------------------------------- */
608/* rec channel interface */
609
610static void *
611trrchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
612{
613 struct tr_info *tr = devinfo;
614 struct tr_rchinfo *ch;
615
616 KASSERT(dir == PCMDIR_REC, ("trrchan_init: bad direction"));
617 ch = &tr->recchinfo;
618 ch->buffer = b;
619 ch->parent = tr;
620 ch->channel = c;
621 if (sndbuf_alloc(ch->buffer, tr->parent_dmat, 0, tr->bufsz) != 0)
622 return NULL;
623
624 return ch;
625}
626
627static int
628trrchan_setformat(kobj_t obj, void *data, u_int32_t format)
629{
630 struct tr_rchinfo *ch = data;
631 struct tr_info *tr = ch->parent;
632 u_int32_t i, bits;
633
634 bits = tr_fmttobits(format);
635 /* set # of samples between interrupts */
636 i = (sndbuf_runsz(ch->buffer) >> ((bits & 0x08)? 1 : 0)) - 1;
637 tr_wr(tr, TR_REG_SBBL, i | (i << 16), 4);
638 /* set sample format */
639 i = 0x18 | (bits << 4);
640 tr_wr(tr, TR_REG_SBCTRL, i, 1);
641
642 return 0;
643}
644
645static u_int32_t
646trrchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
647{
648 struct tr_rchinfo *ch = data;
649 struct tr_info *tr = ch->parent;
650
651 /* setup speed */
652 ch->delta = (48000 << 12) / speed;
653 tr_wr(tr, TR_REG_SBDELTA, ch->delta, 2);
654
655 /* return closest possible speed */
656 return (48000 << 12) / ch->delta;
657}
658
659static u_int32_t
660trrchan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
661{
662 struct tr_rchinfo *ch = data;
663
665
666 return blocksize;
667}
668
669static int
670trrchan_trigger(kobj_t obj, void *data, int go)
671{
672 struct tr_rchinfo *ch = data;
673 struct tr_info *tr = ch->parent;
674 u_int32_t i;
675
676 if (!PCMTRIG_COMMON(go))
677 return 0;
678
679 if (go == PCMTRIG_START) {
680 /* set up dma mode regs */
681 tr_wr(tr, TR_REG_DMAR15, 0, 1);
682 i = tr_rd(tr, TR_REG_DMAR11, 1) & 0x03;
683 tr_wr(tr, TR_REG_DMAR11, i | 0x54, 1);
684 /* set up base address */
686 /* set up buffer size */
687 i = tr_rd(tr, TR_REG_DMAR4, 4) & ~0x00ffffff;
688 tr_wr(tr, TR_REG_DMAR4, i | (sndbuf_runsz(ch->buffer) - 1), 4);
689 /* start */
690 tr_wr(tr, TR_REG_SBCTRL, tr_rd(tr, TR_REG_SBCTRL, 1) | 1, 1);
691 ch->active = 1;
692 } else {
693 tr_wr(tr, TR_REG_SBCTRL, tr_rd(tr, TR_REG_SBCTRL, 1) & ~7, 1);
694 ch->active = 0;
695 }
696
697 /* return 0 if ok */
698 return 0;
699}
700
701static u_int32_t
702trrchan_getptr(kobj_t obj, void *data)
703{
704 struct tr_rchinfo *ch = data;
705 struct tr_info *tr = ch->parent;
706
707 /* return current byte offset of channel */
708 return tr_rd(tr, TR_REG_DMAR0, 4) - sndbuf_getbufaddr(ch->buffer);
709}
710
711static struct pcmchan_caps *
712trrchan_getcaps(kobj_t obj, void *data)
713{
714 return &tr_reccaps;
715}
716
717static kobj_method_t trrchan_methods[] = {
718 KOBJMETHOD(channel_init, trrchan_init),
719 KOBJMETHOD(channel_setformat, trrchan_setformat),
720 KOBJMETHOD(channel_setspeed, trrchan_setspeed),
721 KOBJMETHOD(channel_setblocksize, trrchan_setblocksize),
722 KOBJMETHOD(channel_trigger, trrchan_trigger),
723 KOBJMETHOD(channel_getptr, trrchan_getptr),
724 KOBJMETHOD(channel_getcaps, trrchan_getcaps),
726};
728
729/* -------------------------------------------------------------------- */
730/* The interrupt handler */
731
732static void
733tr_intr(void *p)
734{
735 struct tr_info *tr = (struct tr_info *)p;
736 struct tr_chinfo *ch;
737 u_int32_t active, mask, bufhalf, chnum, intsrc;
738 int tmp;
739
740 intsrc = tr_rd(tr, TR_REG_MISCINT, 4);
741 if (intsrc & TR_INT_ADDR) {
742 chnum = 0;
743 while (chnum < tr->hwchns) {
744 mask = 0x00000001;
745 active = tr_rd(tr, (chnum < 32)? TR_REG_ADDRINTA : TR_REG_ADDRINTB, 4);
746 bufhalf = tr_rd(tr, (chnum < 32)? TR_REG_CSPF_A : TR_REG_CSPF_B, 4);
747 if (active) {
748 do {
749 if (active & mask) {
750 tmp = (bufhalf & mask)? 1 : 0;
751 if (chnum < tr->playchns) {
752 ch = &tr->chinfo[chnum];
753 /* printf("%d @ %d, ", chnum, trpchan_getptr(NULL, ch)); */
754 if (ch->bufhalf != tmp) {
755 chn_intr(ch->channel);
756 ch->bufhalf = tmp;
757 }
758 }
759 }
760 chnum++;
761 mask <<= 1;
762 } while (chnum & 31);
763 } else
764 chnum += 32;
765
766 tr_wr(tr, (chnum <= 32)? TR_REG_ADDRINTA : TR_REG_ADDRINTB, active, 4);
767 }
768 }
769 if (intsrc & TR_INT_SB) {
771 tr_rd(tr, TR_REG_SBR9, 1);
772 tr_rd(tr, TR_REG_SBR10, 1);
773 }
774}
775
776/* -------------------------------------------------------------------- */
777
778/*
779 * Probe and attach the card
780 */
781
782static int
783tr_init(struct tr_info *tr)
784{
785 switch (tr->type) {
786 case SPA_PCI_ID:
787 tr_wr(tr, SPA_REG_GPIO, 0, 4);
789 break;
790 case TDX_PCI_ID:
792 break;
793 case TNX_PCI_ID:
795 break;
796 }
797
799 return 0;
800}
801
802static int
804{
805 switch (pci_get_devid(dev)) {
806 case SPA_PCI_ID:
807 device_set_desc(dev, "SiS 7018");
808 return BUS_PROBE_DEFAULT;
809 case ALI_PCI_ID:
810 device_set_desc(dev, "Acer Labs M5451");
811 return BUS_PROBE_DEFAULT;
812 case TDX_PCI_ID:
813 device_set_desc(dev, "Trident 4DWave DX");
814 return BUS_PROBE_DEFAULT;
815 case TNX_PCI_ID:
816 device_set_desc(dev, "Trident 4DWave NX");
817 return BUS_PROBE_DEFAULT;
818 }
819
820 return ENXIO;
821}
822
823static int
825{
826 struct tr_info *tr;
827 struct ac97_info *codec = NULL;
828 bus_addr_t lowaddr;
829 int i, dacn;
830 char status[SND_STATUSLEN];
831
832 tr = malloc(sizeof(*tr), M_DEVBUF, M_WAITOK | M_ZERO);
833 tr->type = pci_get_devid(dev);
834 tr->rev = pci_get_revid(dev);
835 tr->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_t4dwave softc");
836
837 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
838 "dac", &i) == 0) {
839 if (i < 1)
840 dacn = 1;
841 else if (i > TR_MAXPLAYCH)
842 dacn = TR_MAXPLAYCH;
843 else
844 dacn = i;
845 } else {
846 switch (tr->type) {
847 case ALI_PCI_ID:
848 dacn = ALI_MAXPLAYCH;
849 break;
850 default:
851 dacn = TR_MAXPLAYCH;
852 break;
853 }
854 }
855
856 pci_enable_busmaster(dev);
857
858 tr->regid = PCIR_BAR(0);
859 tr->regtype = SYS_RES_IOPORT;
860 tr->reg = bus_alloc_resource_any(dev, tr->regtype, &tr->regid,
861 RF_ACTIVE);
862 if (tr->reg) {
863 tr->st = rman_get_bustag(tr->reg);
864 tr->sh = rman_get_bushandle(tr->reg);
865 } else {
866 device_printf(dev, "unable to map register space\n");
867 goto bad;
868 }
869
870 if (tr_init(tr) == -1) {
871 device_printf(dev, "unable to initialize the card\n");
872 goto bad;
873 }
874 tr->playchns = 0;
875
876 codec = AC97_CREATE(dev, tr, tr_ac97);
877 if (codec == NULL) goto bad;
878 if (mixer_init(dev, ac97_getmixerclass(), codec) == -1) goto bad;
879
880 tr->irqid = 0;
881 tr->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &tr->irqid,
882 RF_ACTIVE | RF_SHAREABLE);
883 if (!tr->irq || snd_setup_intr(dev, tr->irq, 0, tr_intr, tr, &tr->ih)) {
884 device_printf(dev, "unable to map interrupt\n");
885 goto bad;
886 }
887
888 if (tr->type == ALI_PCI_ID) {
889 /*
890 * The M5451 generates 31 bit of DMA and in order to do
891 * 32-bit DMA, the 31st bit can be set via its accompanying
892 * ISA bridge. Note that we can't predict whether bus_dma(9)
893 * will actually supply us with a 32-bit buffer and even when
894 * using a low address of BUS_SPACE_MAXADDR_32BIT for both
895 * we might end up with the play buffer being in the 32-bit
896 * range while the record buffer isn't or vice versa. So we
897 * don't enabling the 31st bit.
898 */
899 lowaddr = ALI_MAXADDR;
900 tr->hwchns = ALI_MAXHWCH;
901 tr->bufsz = ALI_BUFSZ;
902 } else {
903 lowaddr = TR_MAXADDR;
904 tr->hwchns = TR_MAXHWCH;
906 65536);
907 }
908
909 if (bus_dma_tag_create(/*parent*/bus_get_dma_tag(dev),
910 /*alignment*/TR_BUFALGN,
911 /*boundary*/0,
912 /*lowaddr*/lowaddr,
913 /*highaddr*/BUS_SPACE_MAXADDR,
914 /*filter*/NULL, /*filterarg*/NULL,
915 /*maxsize*/tr->bufsz, /*nsegments*/1, /*maxsegz*/tr->bufsz,
916 /*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
917 &tr->parent_dmat) != 0) {
918 device_printf(dev, "unable to create dma tag\n");
919 goto bad;
920 }
921
922 snprintf(status, 64, "at io 0x%jx irq %jd %s",
923 rman_get_start(tr->reg), rman_get_start(tr->irq),PCM_KLDSTRING(snd_t4dwave));
924
925 if (pcm_register(dev, tr, dacn, 1))
926 goto bad;
927 pcm_addchan(dev, PCMDIR_REC, &trrchan_class, tr);
928 for (i = 0; i < dacn; i++)
929 pcm_addchan(dev, PCMDIR_PLAY, &trpchan_class, tr);
931
932 return 0;
933
934bad:
935 if (codec) ac97_destroy(codec);
936 if (tr->reg) bus_release_resource(dev, tr->regtype, tr->regid, tr->reg);
937 if (tr->ih) bus_teardown_intr(dev, tr->irq, tr->ih);
938 if (tr->irq) bus_release_resource(dev, SYS_RES_IRQ, tr->irqid, tr->irq);
939 if (tr->parent_dmat) bus_dma_tag_destroy(tr->parent_dmat);
940 if (tr->lock) snd_mtxfree(tr->lock);
941 free(tr, M_DEVBUF);
942 return ENXIO;
943}
944
945static int
947{
948 int r;
949 struct tr_info *tr;
950
952 if (r)
953 return r;
954
955 tr = pcm_getdevinfo(dev);
956 bus_release_resource(dev, tr->regtype, tr->regid, tr->reg);
957 bus_teardown_intr(dev, tr->irq, tr->ih);
958 bus_release_resource(dev, SYS_RES_IRQ, tr->irqid, tr->irq);
959 bus_dma_tag_destroy(tr->parent_dmat);
960 snd_mtxfree(tr->lock);
961 free(tr, M_DEVBUF);
962
963 return 0;
964}
965
966static int
968{
969 int i;
970 struct tr_info *tr;
971
972 tr = pcm_getdevinfo(dev);
973
974 for (i = 0; i < tr->playchns; i++) {
975 tr->chinfo[i].was_active = tr->chinfo[i].active;
976 if (tr->chinfo[i].active) {
977 trpchan_trigger(NULL, &tr->chinfo[i], PCMTRIG_STOP);
978 }
979 }
980
982 if (tr->recchinfo.active) {
984 }
985
986 return 0;
987}
988
989static int
991{
992 int i;
993 struct tr_info *tr;
994
995 tr = pcm_getdevinfo(dev);
996
997 if (tr_init(tr) == -1) {
998 device_printf(dev, "unable to initialize the card\n");
999 return ENXIO;
1000 }
1001
1002 if (mixer_reinit(dev) == -1) {
1003 device_printf(dev, "unable to initialize the mixer\n");
1004 return ENXIO;
1005 }
1006
1007 for (i = 0; i < tr->playchns; i++) {
1008 if (tr->chinfo[i].was_active) {
1009 trpchan_trigger(NULL, &tr->chinfo[i], PCMTRIG_START);
1010 }
1011 }
1012
1013 if (tr->recchinfo.was_active) {
1015 }
1016
1017 return 0;
1018}
1019
1020static device_method_t tr_methods[] = {
1021 /* Device interface */
1022 DEVMETHOD(device_probe, tr_pci_probe),
1023 DEVMETHOD(device_attach, tr_pci_attach),
1024 DEVMETHOD(device_detach, tr_pci_detach),
1025 DEVMETHOD(device_suspend, tr_pci_suspend),
1026 DEVMETHOD(device_resume, tr_pci_resume),
1027 { 0, 0 }
1028};
1029
1030static driver_t tr_driver = {
1031 "pcm",
1032 tr_methods,
1034};
1035
1036DRIVER_MODULE(snd_t4dwave, pci, tr_driver, pcm_devclass, 0, 0);
1038MODULE_VERSION(snd_t4dwave, 1);
kobj_class_t ac97_getmixerclass(void)
Definition: ac97.c:1097
void ac97_destroy(struct ac97_info *codec)
Definition: ac97.c:860
#define AC97_CREATE(dev, devinfo, cls)
Definition: ac97.h:89
u_int32_t data
Definition: ac97_if.m:60
int regno
Definition: ac97_if.m:53
void * devinfo
Definition: ac97_if.m:47
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
unsigned int fmt
Definition: audio_soc.c:91
int sndbuf_alloc(struct snd_dbuf *b, bus_dma_tag_t dmatag, int dmaflags, unsigned int size)
Definition: buffer.c:93
bus_addr_t sndbuf_getbufaddr(struct snd_dbuf *buf)
Definition: buffer.c:66
unsigned int sndbuf_getalign(struct snd_dbuf *b)
Definition: buffer.c:385
unsigned int sndbuf_getsize(struct snd_dbuf *b)
Definition: buffer.c:435
int sndbuf_resize(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
Definition: buffer.c:164
unsigned int sndbuf_runsz(struct snd_dbuf *b)
Definition: buffer.c:453
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_STOP
Definition: channel.h:347
#define PCMDIR_REC
Definition: channel.h:341
#define PCMTRIG_COMMON(x)
Definition: channel.h:350
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 snd_dbuf * b
Definition: channel_if.m:105
uint8_t enable
Definition: hdac.c:213
uint8_t mask
Definition: hdac.c:212
uint8_t reg
Definition: hdac.c:211
int dir
Definition: hdac_if.m:45
uint8_t size
uint8_t r
uint8_t chan
#define KOBJMETHOD_END
Definition: midi.c:76
int mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
Definition: mixer.c:725
int mixer_reinit(device_t dev)
Definition: mixer.c:860
unsigned dev
Definition: mixer_if.m:59
bool * status
#define PCIR_BAR(x)
void * snd_mtxcreate(const char *desc, const char *type)
Definition: sound.c:88
void * pcm_getdevinfo(device_t dev)
Definition: sound.c:832
int pcm_setstatus(device_t dev, char *str)
Definition: sound.c:766
devclass_t pcm_devclass
Definition: sound.c:49
void snd_mtxfree(void *m)
Definition: sound.c:98
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
int snd_setup_intr(device_t dev, struct resource *res, int flags, driver_intr_t hand, void *param, void **cookiep)
Definition: sound.c:117
unsigned int pcm_getbuffersize(device_t dev, unsigned int minbufsz, unsigned int deflt, unsigned int maxbufsz)
Definition: sound.c:840
#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 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 AFMT_SIGNED
Definition: sound.h:194
#define SND_STATUSLEN
Definition: sound.h:98
#define AFMT_16BIT
Definition: sound.h:191
Definition: ac97.c:59
u_int32_t rvol
Definition: t4dwave.c:74
u_int32_t alpha
Definition: t4dwave.c:71
u_int32_t fms
Definition: t4dwave.c:71
u_int32_t ec
Definition: t4dwave.c:71
u_int32_t delta
Definition: t4dwave.c:73
u_int32_t cvol
Definition: t4dwave.c:74
struct pcm_channel * channel
Definition: t4dwave.c:79
int bufhalf
Definition: t4dwave.c:77
u_int32_t eso
Definition: t4dwave.c:73
u_int32_t vol
Definition: t4dwave.c:75
u_int32_t ctrl
Definition: t4dwave.c:75
u_int32_t was_active
Definition: t4dwave.c:76
u_int32_t fmc
Definition: t4dwave.c:71
u_int32_t gvsel
Definition: t4dwave.c:75
struct tr_info * parent
Definition: t4dwave.c:80
u_int32_t lba
Definition: t4dwave.c:72
u_int32_t cso
Definition: t4dwave.c:71
int index
Definition: t4dwave.c:77
u_int32_t active
Definition: t4dwave.c:76
u_int32_t pan
Definition: t4dwave.c:75
struct snd_dbuf * buffer
Definition: t4dwave.c:78
unsigned int bufsz
Definition: t4dwave.c:108
int irqid
Definition: t4dwave.c:101
u_int32_t rev
Definition: t4dwave.c:94
u_int32_t hwchns
Definition: t4dwave.c:106
bus_space_handle_t sh
Definition: t4dwave.c:97
struct tr_rchinfo recchinfo
Definition: t4dwave.c:111
int regid
Definition: t4dwave.c:101
void * ih
Definition: t4dwave.c:102
u_int32_t playchns
Definition: t4dwave.c:107
struct mtx * lock
Definition: t4dwave.c:104
u_int32_t type
Definition: t4dwave.c:93
struct resource * irq
Definition: t4dwave.c:100
int regtype
Definition: t4dwave.c:101
struct resource * reg
Definition: t4dwave.c:100
bus_space_tag_t st
Definition: t4dwave.c:96
struct tr_chinfo chinfo[TR_MAXPLAYCH]
Definition: t4dwave.c:110
bus_dma_tag_t parent_dmat
Definition: t4dwave.c:98
u_int32_t delta
Definition: t4dwave.c:84
u_int32_t was_active
Definition: t4dwave.c:85
struct snd_dbuf * buffer
Definition: t4dwave.c:86
u_int32_t active
Definition: t4dwave.c:85
struct tr_info * parent
Definition: t4dwave.c:88
struct pcm_channel * channel
Definition: t4dwave.c:87
#define TR_BUFALGN
Definition: t4dwave.c:52
static u_int32_t trrchan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
Definition: t4dwave.c:660
static u_int32_t tr_playfmt[]
Definition: t4dwave.c:129
static struct pcmchan_caps * trrchan_getcaps(kobj_t obj, void *data)
Definition: t4dwave.c:712
static int tr_pci_resume(device_t dev)
Definition: t4dwave.c:990
static void tr_wr(struct tr_info *tr, int regno, u_int32_t data, int size)
Definition: t4dwave.c:162
static int tr_wrcd(kobj_t obj, void *devinfo, int regno, u_int32_t data)
Definition: t4dwave.c:240
static u_int32_t trrchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
Definition: t4dwave.c:646
MODULE_VERSION(snd_t4dwave, 1)
#define ALI_BUFSZ
Definition: t4dwave.c:51
#define ALI_MAXHWCH
Definition: t4dwave.c:55
static void * trpchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
Definition: t4dwave.c:502
AC97_DECLARE(tr_ac97)
static void tr_stopch(struct tr_chinfo *ch)
Definition: t4dwave.c:381
static u_int32_t tr_recfmt[]
Definition: t4dwave.c:116
#define TR_MAXHWCH
Definition: t4dwave.c:54
static int trpchan_trigger(kobj_t obj, void *data, int go)
Definition: t4dwave.c:548
static kobj_method_t trrchan_methods[]
Definition: t4dwave.c:717
static int tr_pci_detach(device_t dev)
Definition: t4dwave.c:946
#define TNX_PCI_ID
Definition: t4dwave.c:45
#define TR_MAXPLAYCH
Definition: t4dwave.c:56
static struct pcmchan_caps * trpchan_getcaps(kobj_t obj, void *data)
Definition: t4dwave.c:590
#define ALI_MAXADDR
Definition: t4dwave.c:65
static u_int32_t trpchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
Definition: t4dwave.c:530
CHANNEL_DECLARE(trpchan)
SND_DECLARE_FILE("$FreeBSD$")
#define TR_DEFAULT_BUFSZ
Definition: t4dwave.c:49
#define SPA_PCI_ID
Definition: t4dwave.c:47
DRIVER_MODULE(snd_t4dwave, pci, tr_driver, pcm_devclass, 0, 0)
static u_int32_t trpchan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
Definition: t4dwave.c:539
static u_int32_t trpchan_getptr(kobj_t obj, void *data)
Definition: t4dwave.c:581
static int trrchan_trigger(kobj_t obj, void *data, int go)
Definition: t4dwave.c:670
static kobj_method_t trpchan_methods[]
Definition: t4dwave.c:595
static int trrchan_setformat(kobj_t obj, void *data, u_int32_t format)
Definition: t4dwave.c:628
static int trpchan_setformat(kobj_t obj, void *data, u_int32_t format)
Definition: t4dwave.c:520
#define TDX_PCI_ID
Definition: t4dwave.c:44
#define TR_MAXADDR
Definition: t4dwave.c:64
static void tr_enaint(struct tr_chinfo *ch, int enable)
Definition: t4dwave.c:335
static struct pcmchan_caps tr_playcaps
Definition: t4dwave.c:140
static device_method_t tr_methods[]
Definition: t4dwave.c:1020
static int tr_init(struct tr_info *tr)
Definition: t4dwave.c:783
static void tr_wrch(struct tr_chinfo *ch)
Definition: t4dwave.c:392
#define ALI_MAXPLAYCH
Definition: t4dwave.c:57
static int tr_pci_probe(device_t dev)
Definition: t4dwave.c:803
static kobj_method_t tr_ac97_methods[]
Definition: t4dwave.c:300
static void * trrchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
Definition: t4dwave.c:611
static u_int32_t tr_rd(struct tr_info *tr, int regno, int size)
Definition: t4dwave.c:147
#define TR_TIMEOUT_CDC
Definition: t4dwave.c:53
static void tr_clrint(struct tr_chinfo *ch)
Definition: t4dwave.c:324
MODULE_DEPEND(snd_t4dwave, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
static int tr_rdcd(kobj_t obj, void *devinfo, int regno)
Definition: t4dwave.c:181
static void tr_startch(struct tr_chinfo *ch)
Definition: t4dwave.c:370
static int tr_pci_suspend(device_t dev)
Definition: t4dwave.c:967
#define ALI_PCI_ID
Definition: t4dwave.c:46
static driver_t tr_driver
Definition: t4dwave.c:1030
static int tr_pci_attach(device_t dev)
Definition: t4dwave.c:824
static u_int32_t tr_fmttobits(u_int32_t fmt)
Definition: t4dwave.c:486
static void tr_selch(struct tr_chinfo *ch)
Definition: t4dwave.c:358
static u_int32_t trrchan_getptr(kobj_t obj, void *data)
Definition: t4dwave.c:702
static struct pcmchan_caps tr_reccaps
Definition: t4dwave.c:127
static void tr_intr(void *p)
Definition: t4dwave.c:733
static void tr_rdch(struct tr_chinfo *ch)
Definition: t4dwave.c:442
#define TNX_REG_CODEC2RD
Definition: t4dwave.h:77
#define SPA_REG_CODECST
Definition: t4dwave.h:70
#define TR_CIR_MIDENA
Definition: t4dwave.h:37
#define TNX_CDC_ON
Definition: t4dwave.h:88
#define TR_CDC_DATA
Definition: t4dwave.h:55
#define TR_REG_DMAR11
Definition: t4dwave.h:44
#define TNX_REG_CODECWR
Definition: t4dwave.h:75
#define TR_REG_SBDELTA
Definition: t4dwave.h:53
#define TDX_CDC_ON
Definition: t4dwave.h:66
#define TR_REG_SBBL
Definition: t4dwave.h:51
#define TR_REG_STARTB
Definition: t4dwave.h:96
#define TR_REG_DMAR15
Definition: t4dwave.h:45
#define TDX_CDC_RWSTAT
Definition: t4dwave.h:58
#define TDX_REG_CODECRD
Definition: t4dwave.h:57
#define SPA_REG_CODECWR
Definition: t4dwave.h:69
#define TNX_CDC_SEC
Definition: t4dwave.h:79
#define TR_REG_ADDRINTB
Definition: t4dwave.h:99
#define TR_REG_ADDRINTA
Definition: t4dwave.h:93
#define TR_REG_SBR10
Definition: t4dwave.h:50
#define TR_REG_INTENA
Definition: t4dwave.h:94
#define TR_REG_CHNBASE
Definition: t4dwave.h:102
#define TNX_REG_CODEC1RD
Definition: t4dwave.h:76
#define TR_REG_CIR
Definition: t4dwave.h:34
#define TDX_REG_CODECWR
Definition: t4dwave.h:56
#define TNX_CDC_RWSTAT
Definition: t4dwave.h:78
#define TR_REG_INTENB
Definition: t4dwave.h:100
#define TNX_REG_CODECST
Definition: t4dwave.h:80
#define TR_INT_SB
Definition: t4dwave.h:40
#define TR_REG_MISCINT
Definition: t4dwave.h:38
#define TDX_REG_CODECST
Definition: t4dwave.h:59
#define TR_REG_CSPF_A
Definition: t4dwave.h:92
#define TR_REG_DMAR0
Definition: t4dwave.h:42
#define SPA_RST_OFF
Definition: t4dwave.h:71
#define TR_CHN_REGS
Definition: t4dwave.h:103
#define TR_REG_STARTA
Definition: t4dwave.h:90
#define TR_REG_CSPF_B
Definition: t4dwave.h:98
#define TR_REG_STOPB
Definition: t4dwave.h:97
#define SPA_REG_CODECRD
Definition: t4dwave.h:68
#define TR_REG_SBR9
Definition: t4dwave.h:49
#define SPA_REG_GPIO
Definition: t4dwave.h:72
#define TR_REG_DMAR4
Definition: t4dwave.h:43
#define TR_REG_STOPA
Definition: t4dwave.h:91
#define TR_INT_ADDR
Definition: t4dwave.h:39
#define TR_REG_SBCTRL
Definition: t4dwave.h:52
#define SPA_CDC_RWSTAT
Definition: t4dwave.h:73
#define TR_CIR_ADDRENA
Definition: t4dwave.h:36