toccata.c revision 1.10 1 /* $NetBSD: toccata.c,v 1.10 2005/01/15 15:19:51 kent Exp $ */
2
3 /*-
4 * Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Paul Kranenburg and Ignatios Souvatzis.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #include <sys/cdefs.h>
40 __KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.10 2005/01/15 15:19:51 kent Exp $");
41
42 #include <sys/types.h>
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/kernel.h>
46 #include <sys/device.h>
47 #include <sys/fcntl.h> /* FREAD */
48
49 #include <machine/bus.h>
50
51 #include <sys/audioio.h>
52 #include <dev/audio_if.h>
53
54 #include <dev/ic/ad1848reg.h>
55 #include <dev/ic/ad1848var.h>
56
57 #include <amiga/dev/zbusvar.h>
58 #include <amiga/amiga/isr.h>
59
60
61 /* Register offsets. XXX All of this is guesswork. */
62
63 /*
64 * The Toccata board consists of: GALs for ZBus AutoConfig(tm) glue, GALs
65 * that interface the FIFO chips and the audio codec chip to the ZBus,
66 * an AD1848 (or AD1845), and 2 Integrated Device Technology 7202LA
67 * (1024x9bit FIFO) chips.
68 */
69
70 #define TOCC_FIFO_STAT 0x1ffe
71 #define TOCC_FIFO_DATA 0x2000
72
73 /*
74 * I don't know whether the AD1848 PIO data registers are connected... and
75 * at 2 or 3 accesses to read or write a data byte in the best case, I better
76 * don't even think about it. The AD1848 address/status and data port are
77 * here:
78 */
79 #define TOCC_CODEC_ADDR 0x67FF
80 #define TOCC_CODEC_STAT TOCC_CODEC_ADDR
81 #define TOCC_CODEC_REG 0x6801
82
83 /* fifo status bits, read */
84
85 #define TOCC_FIFO_INT 0x80 /* active low; together with one of those: */
86
87 #define TOCC_FIFO_PBHE 0x08 /* playback fifo is half empty (active high) */
88 #define TOCC_FIFO_CPHF 0x04 /* capture fifo is half full (active high) */
89
90 /* fifo status bits, write */
91
92 /*
93 * seems to work like this:
94 * init: write 2; delay; write 1
95 *
96 * capture: write 1; write 1+4+8+0x40 (0x4D)
97 * capt. int: read 512 bytes out of fifo.
98 * capt. int off by writing 1+4+8 (0x0D)
99 *
100 * playback: write 1; write 1 + 0x10; (0x11)
101 * 3/4 fill fifo with silence; init codec;
102 * write 1+4+0x10+0x80 (0x95)
103 * pb int: write 512 bytes to fifo
104 * pb int off by writing 1+4+0x10 (0x15)
105 */
106
107 #define TOCC_RST 0x02
108 #define TOCC_ACT 0x01
109 #define TOCC_MAGIC 0x04
110
111 #define TOCC_PB_INTENA 0x80
112 #define TOCC_PB_FILL 0x10
113
114 #define TOCC_PB_PREP (TOCC_ACT + TOCC_PB_FILL)
115 #define TOCC_PB_TAIL (TOCC_PB_PREP + TOCC_MAGIC)
116 #define TOCC_PB_MAIN (TOCC_PB_TAIL + TOCC_PB_INTENA)
117
118 #define TOCC_CP_INTENA 0x40
119 #define TOCC_CP_RUN 0x08
120
121 #define TOCC_CP_TAIL (TOCC_ACT + TOCC_CP_RUN)
122 #define TOCC_CP_MAIN (TOCC_CP_TAIL + TOCC_CP_INTENA + TOCC_MAGIC)
123
124 /*
125 * For the port stuff. Similar to the cs4231 table, but MONO is not wired
126 * on the Toccata, which was designed for the AD1848. Also we know how
127 * to handle input.
128 */
129
130 #define TOCCATA_INPUT_CLASS 0
131 #define TOCCATA_OUTPUT_CLASS 1
132 #define TOCCATA_MONITOR_CLASS 2
133 #define TOCCATA_RECORD_CLASS 3
134
135 #define TOCCATA_RECORD_SOURCE 4
136 #define TOCCATA_REC_LVL 5
137
138 #define TOCCATA_MIC_IN_LVL 6
139
140 #define TOCCATA_AUX1_LVL 7
141 #define TOCCATA_AUX1_MUTE 8
142
143 #define TOCCATA_AUX2_LVL 9
144 #define TOCCATA_AUX2_MUTE 10
145
146 #define TOCCATA_MONITOR_LVL 11
147 #define TOCCATA_MONITOR_MUTE 12
148 #define TOCCATA_OUTPUT_LVL 13
149
150 /* only on AD1845 in mode 2 */
151
152 #define TOCCATA_LINE_IN_LVL 14
153 #define TOCCATA_LINE_IN_MUTE 15
154
155 /* special, need support */
156 #define TOCCATA_MIC_LVL 16
157 #define TOCCATA_MIC_MUTE 17
158
159
160
161 /* prototypes */
162
163 int toccata_intr(void *);
164 int toccata_readreg(struct ad1848_softc *, int);
165 void toccata_writereg(struct ad1848_softc *, int, int);
166
167 int toccata_round_blocksize(void *, int, int, const audio_params_t *);
168 size_t toccata_round_buffersize(void *, int, size_t);
169
170 int toccata_open(void *, int);
171 void toccata_close(void *);
172 int toccata_getdev(void *, struct audio_device *);
173 int toccata_get_props(void *);
174
175 int toccata_halt_input(void *);
176 int toccata_halt_output(void *);
177 int toccata_start_input(void *, void *, int, void (*)(void *), void *);
178 int toccata_start_output(void *, void *, int, void (*)(void *), void *);
179
180 /* I suspect those should be in a shared file */
181 int toccata_set_port(void *, mixer_ctrl_t *);
182 int toccata_get_port(void *, mixer_ctrl_t *);
183 int toccata_query_devinfo(void *, mixer_devinfo_t *);
184
185 const struct audio_hw_if audiocs_hw_if = {
186 toccata_open,
187 toccata_close,
188 0, /*
189 * XXX toccata_drain could be written:
190 * sleep for play interrupt. This loses less then 512 bytes of
191 * sample data, otherwise up to 1024.
192 */
193 ad1848_query_encoding,
194 ad1848_set_params,
195 toccata_round_blocksize,
196 ad1848_commit_settings,
197 0, /* init_output */ /* XXX need this to prefill? */
198 0, /* init_input */
199 toccata_start_output,
200 toccata_start_input,
201 toccata_halt_output,
202 toccata_halt_input,
203 0, /* speaker */
204 toccata_getdev,
205 0, /* setfd */
206 toccata_set_port,
207 toccata_get_port,
208 toccata_query_devinfo,
209 0, /* alloc/free */
210 0,
211 toccata_round_buffersize, /* round_buffer */
212 0, /* mappage */
213 toccata_get_props,
214 0, /* trigger_output */
215 0,
216 };
217
218 struct toccata_softc {
219 struct ad1848_softc sc_ad;
220 struct isr sc_isr;
221 volatile uint8_t *sc_boardp; /* only need a few addresses! */
222
223 void (*sc_captmore)(void *);
224 void *sc_captarg;
225 void *sc_captbuf;
226 int sc_captbufsz;
227
228 void (*sc_playmore)(void *);
229 void *sc_playarg;
230 };
231
232 int toccata_match(struct device *, struct cfdata *, void *);
233 void toccata_attach(struct device *, struct device *, void *);
234
235 CFATTACH_DECL(toccata, sizeof(struct toccata_softc),
236 toccata_match, toccata_attach, NULL, NULL);
237
238 int
239 toccata_match(struct device *parent, struct cfdata *cfp, void *aux)
240 {
241 struct zbus_args *zap;
242
243 zap = aux;
244
245 if (zap->manid != 18260)
246 return (0);
247
248 if (zap->prodid != 12)
249 return (0);
250
251 return (1);
252 }
253
254 void
255 toccata_attach(struct device *parent, struct device *self, void *aux)
256 {
257 struct toccata_softc *sc;
258 struct ad1848_softc *asc;
259 struct zbus_args *zap;
260 volatile uint8_t *boardp;
261
262 sc = (struct toccata_softc *)self;
263 asc = &sc->sc_ad;
264 zap = aux;
265
266 boardp = (volatile uint8_t *)zap->va;
267 sc->sc_boardp = boardp;
268
269 *boardp = TOCC_RST;
270 delay(500000); /* look up value */
271 *boardp = TOCC_ACT;
272
273 asc->parent = sc;
274 asc->sc_readreg = toccata_readreg;
275 asc->sc_writereg = toccata_writereg;
276
277 asc->chip_name = "ad1848";
278 asc->mode = 1;
279 ad1848_attach(asc);
280 printf("\n");
281
282 sc->sc_captbuf = 0;
283 sc->sc_playmore = 0;
284
285 sc->sc_isr.isr_ipl = 6;
286 sc->sc_isr.isr_arg = sc;
287 sc->sc_isr.isr_intr = toccata_intr;
288 add_isr(&sc->sc_isr);
289
290 audio_attach_mi(&audiocs_hw_if, sc, &asc->sc_dev);
291
292 }
293
294 /* interrupt handler */
295 int
296 toccata_intr(void *tag) {
297 struct toccata_softc *sc;
298 uint8_t *buf;
299 volatile uint8_t *fifo;
300 uint8_t status;
301 int i;
302
303 sc = tag;
304 status = *(sc->sc_boardp);
305
306 if (status & TOCC_FIFO_INT) /* active low */
307 return 0;
308
309 if (status & TOCC_FIFO_PBHE) {
310 if (sc->sc_playmore) {
311 (*sc->sc_playmore)(sc->sc_playarg);
312 return 1;
313 }
314 } else if (status & TOCC_FIFO_CPHF) {
315 if (sc->sc_captbuf) {
316 buf = sc->sc_captbuf;
317 fifo = sc->sc_boardp + TOCC_FIFO_DATA;
318
319 for (i = sc->sc_captbufsz/4 - 1; i>=0; --i) {
320 *buf++ = *fifo;
321 *buf++ = *fifo;
322 *buf++ = *fifo;
323 *buf++ = *fifo;
324 }
325
326 /* XXX if (sc->sc_captmore) { */
327 (*sc->sc_captmore)(sc->sc_captarg);
328 return 1;
329 }
330 }
331
332 /*
333 * Something is wrong; switch interrupts off to avoid wedging the
334 * machine, and notify the alpha tester.
335 * Normally, the halt_* functions should have switched off the
336 * FIFO interrupt.
337 */
338 #ifdef DEBUG
339 printf("%s: got unexpected interrupt %x\n", sc->sc_ad.sc_dev.dv_xname,
340 status);
341 #endif
342 *sc->sc_boardp = TOCC_ACT;
343 return 1;
344 }
345
346 /* support for ad1848 functions */
347
348 int
349 toccata_readreg(struct ad1848_softc *asc, int offset)
350 {
351 struct toccata_softc *sc;
352
353 sc = (struct toccata_softc *)asc;
354 return *(sc->sc_boardp + TOCC_CODEC_ADDR +
355 offset * (TOCC_CODEC_REG - TOCC_CODEC_ADDR));
356 }
357
358 void
359 toccata_writereg(struct ad1848_softc *asc, int offset, int value)
360 {
361 struct toccata_softc *sc;
362
363 sc = (struct toccata_softc *)asc;
364 *(sc->sc_boardp + TOCC_CODEC_ADDR +
365 offset * (TOCC_CODEC_REG - TOCC_CODEC_ADDR)) = value;
366 }
367
368 /* our own copy of open/close; we don't ever enable the ad1848 interrupts */
369 int
370 toccata_open(void *addr, int flags)
371 {
372 struct toccata_softc *sc;
373 struct ad1848_softc *asc;
374
375 sc = addr;
376 asc = &sc->sc_ad;
377
378 asc->open_mode = flags;
379 /* If recording && monitoring, the playback part is also used. */
380 if (flags & FREAD && asc->mute[AD1848_MONITOR_CHANNEL] == 0)
381 ad1848_mute_wave_output(asc, WAVE_UNMUTE1, 1);
382
383 #ifdef AUDIO_DEBUG
384 if (ad1848debug)
385 ad1848_dump_regs(asc);
386 #endif
387
388 return 0;
389 }
390
391 void
392 toccata_close(void *addr)
393 {
394 struct toccata_softc *sc;
395 struct ad1848_softc *asc;
396 unsigned reg;
397
398 sc = addr;
399 asc = &sc->sc_ad;
400 asc->open_mode = 0;
401
402 ad1848_mute_wave_output(asc, WAVE_UNMUTE1, 0);
403
404 reg = ad_read(&sc->sc_ad, SP_INTERFACE_CONFIG);
405 ad_write(&sc->sc_ad, SP_INTERFACE_CONFIG,
406 (reg & ~(CAPTURE_ENABLE|PLAYBACK_ENABLE)));
407
408 /* Disable interrupts */
409 *sc->sc_boardp = TOCC_ACT;
410 #ifdef AUDIO_DEBUG
411 if (ad1848debug)
412 ad1848_dump_regs(asc);
413 #endif
414 }
415
416 int
417 toccata_round_blocksize(void *addr, int blk,
418 int mode, const audio_params_t *param)
419 {
420 int ret;
421
422 ret = blk > 512 ? 512 : (blk & -4);
423
424 return ret;
425 }
426
427 size_t
428 toccata_round_buffersize(void *addr, int direction, size_t suggested)
429 {
430
431 return suggested & -4;
432 }
433
434 struct audio_device toccata_device = {
435 "toccata", "x", "audio"
436 };
437
438 int
439 toccata_getdev(void *addr, struct audio_device *retp)
440 {
441
442 *retp = toccata_device;
443 return 0;
444 }
445
446 int
447 toccata_get_props(void *addr)
448 {
449 return 0;
450 }
451
452 int
453 toccata_halt_input(void *addr)
454 {
455 struct toccata_softc *sc;
456 struct ad1848_softc *asc;
457 unsigned reg;
458
459 sc = addr;
460 asc = &sc->sc_ad;
461
462 /* we're half_duplex; be brutal */
463 *sc->sc_boardp = TOCC_CP_TAIL;
464 sc->sc_captmore = 0;
465 sc->sc_captbuf = 0;
466
467 reg = ad_read(&sc->sc_ad, SP_INTERFACE_CONFIG);
468 ad_write(&sc->sc_ad, SP_INTERFACE_CONFIG, (reg & ~CAPTURE_ENABLE));
469
470 return 0;
471 }
472
473 int
474 toccata_start_input(void *addr, void *block, int blksize,
475 void (*intr)(void *), void *intrarg)
476 {
477 struct toccata_softc *sc;
478 unsigned int reg;
479 volatile uint8_t *cmd;
480
481 sc = addr;
482 cmd = sc->sc_boardp;
483
484 if (sc->sc_captmore == 0) {
485
486 /* we're half-duplex, be brutal */
487 *cmd = TOCC_ACT;
488 *cmd = TOCC_CP_MAIN;
489
490 reg = ad_read(&sc->sc_ad, SP_INTERFACE_CONFIG);
491 ad_write(&sc->sc_ad, SP_INTERFACE_CONFIG,
492 (reg | CAPTURE_ENABLE));
493
494 }
495
496 sc->sc_captarg = intrarg;
497 sc->sc_captmore = intr;
498 sc->sc_captbuf = (uint8_t *)block;
499 sc->sc_captbufsz = blksize;
500
501 return 0;
502 }
503
504 int
505 toccata_halt_output(void *addr)
506 {
507 struct toccata_softc *sc;
508 struct ad1848_softc *asc;
509 unsigned int reg;
510
511 sc = addr;
512 asc = &sc->sc_ad;
513
514 /* we're half_duplex; be brutal */
515 *sc->sc_boardp = TOCC_PB_TAIL;
516 sc->sc_playmore = 0;
517
518 reg = ad_read(&sc->sc_ad, SP_INTERFACE_CONFIG);
519 ad_write(&sc->sc_ad, SP_INTERFACE_CONFIG, (reg & ~PLAYBACK_ENABLE));
520
521 return 0;
522 }
523
524 int
525 toccata_start_output(void *addr, void *block, int blksize,
526 void (*intr)(void*), void *intrarg)
527 {
528 struct toccata_softc *sc;
529 unsigned reg;
530 int i;
531 volatile uint8_t *cmd, *fifo;
532 uint8_t *buf;
533
534 sc = addr;
535 buf = block;
536
537 cmd = sc->sc_boardp;
538 fifo = sc->sc_boardp + TOCC_FIFO_DATA;
539
540 if (sc->sc_playmore == 0) {
541 *cmd = TOCC_ACT;
542 *cmd = TOCC_PB_PREP;
543 }
544
545 /*
546 * We rounded the blocksize to a multiple of 4 bytes. Modest
547 * unrolling saves 2% of cputime playing 48000 16bit stereo
548 * on 68040/25MHz.
549 */
550
551 for (i = blksize/4 - 1; i>=0; --i) {
552 *fifo = *buf++;
553 *fifo = *buf++;
554 *fifo = *buf++;
555 *fifo = *buf++;
556 }
557
558 if (sc->sc_playmore == 0) {
559 reg = ad_read(&sc->sc_ad, SP_INTERFACE_CONFIG);
560 ad_write(&sc->sc_ad, SP_INTERFACE_CONFIG,
561 (reg | PLAYBACK_ENABLE));
562
563 /* we're half-duplex, be brutal */
564 *sc->sc_boardp = TOCC_PB_MAIN;
565 }
566
567 sc->sc_playarg = intrarg;
568 sc->sc_playmore = intr;
569
570 return 0;
571 }
572
573 static ad1848_devmap_t csmapping[] = {
574 { TOCCATA_MIC_IN_LVL, AD1848_KIND_MICGAIN, -1 },
575 { TOCCATA_AUX1_LVL, AD1848_KIND_LVL, AD1848_AUX1_CHANNEL },
576 { TOCCATA_AUX1_MUTE, AD1848_KIND_MUTE, AD1848_AUX1_CHANNEL },
577 { TOCCATA_AUX2_LVL, AD1848_KIND_LVL, AD1848_AUX2_CHANNEL },
578 { TOCCATA_AUX2_MUTE, AD1848_KIND_MUTE, AD1848_AUX2_CHANNEL },
579 { TOCCATA_OUTPUT_LVL, AD1848_KIND_LVL, AD1848_DAC_CHANNEL },
580 { TOCCATA_MONITOR_LVL, AD1848_KIND_LVL, AD1848_MONITOR_CHANNEL },
581 { TOCCATA_MONITOR_MUTE, AD1848_KIND_MUTE, AD1848_MONITOR_CHANNEL },
582 { TOCCATA_REC_LVL, AD1848_KIND_RECORDGAIN, -1 },
583 { TOCCATA_RECORD_SOURCE, AD1848_KIND_RECORDSOURCE, -1 },
584 /* only in mode 2: */
585 { TOCCATA_LINE_IN_LVL, AD1848_KIND_LVL, AD1848_LINE_CHANNEL },
586 { TOCCATA_LINE_IN_MUTE, AD1848_KIND_MUTE, AD1848_LINE_CHANNEL },
587 };
588
589 #define nummap (sizeof(csmapping) / sizeof(csmapping[0]))
590
591 int
592 toccata_set_port(void *addr, mixer_ctrl_t *cp)
593 {
594 struct ad1848_softc *ac;
595
596 /* printf("set_port(%d)\n", cp->dev); */
597 ac = addr;
598 return ad1848_mixer_set_port(ac, csmapping,
599 ac->mode == 2 ? nummap : nummap - 2, cp);
600 }
601
602 int
603 toccata_get_port(void *addr, mixer_ctrl_t *cp)
604 {
605 struct ad1848_softc *ac;
606
607 /* printf("get_port(%d)\n", cp->dev); */
608 ac = addr;
609 return ad1848_mixer_get_port(ac, csmapping,
610 ac->mode == 2 ? nummap : nummap - 2, cp);
611 }
612
613 int
614 toccata_query_devinfo(void *addr, mixer_devinfo_t *dip)
615 {
616
617 switch(dip->index) {
618 case TOCCATA_MIC_IN_LVL: /* Microphone */
619 dip->type = AUDIO_MIXER_VALUE;
620 dip->mixer_class = TOCCATA_INPUT_CLASS;
621 dip->prev = dip->next = AUDIO_MIXER_LAST;
622 strcpy(dip->label.name, AudioNmicrophone);
623 dip->un.v.num_channels = 1;
624 strcpy(dip->un.v.units.name, AudioNvolume);
625 break;
626 #if 0
627
628 case TOCCATA_MONO_LVL: /* mono/microphone mixer */
629 dip->type = AUDIO_MIXER_VALUE;
630 dip->mixer_class = TOCCATA_INPUT_CLASS;
631 dip->prev = AUDIO_MIXER_LAST;
632 dip->next = TOCCATA_MONO_MUTE;
633 strcpy(dip->label.name, AudioNmicrophone);
634 dip->un.v.num_channels = 1;
635 strcpy(dip->un.v.units.name, AudioNvolume);
636 break;
637 #endif
638
639 case TOCCATA_AUX1_LVL: /* dacout */
640 dip->type = AUDIO_MIXER_VALUE;
641 dip->mixer_class = TOCCATA_INPUT_CLASS;
642 dip->prev = AUDIO_MIXER_LAST;
643 dip->next = TOCCATA_AUX1_MUTE;
644 strcpy(dip->label.name, "aux1");
645 dip->un.v.num_channels = 2;
646 strcpy(dip->un.v.units.name, AudioNvolume);
647 break;
648
649 case TOCCATA_AUX1_MUTE:
650 dip->mixer_class = TOCCATA_INPUT_CLASS;
651 dip->type = AUDIO_MIXER_ENUM;
652 dip->prev = TOCCATA_AUX1_LVL;
653 dip->next = AUDIO_MIXER_LAST;
654 goto mute;
655
656
657
658 case TOCCATA_AUX2_LVL:
659 dip->type = AUDIO_MIXER_VALUE;
660 dip->mixer_class = TOCCATA_INPUT_CLASS;
661 dip->prev = AUDIO_MIXER_LAST;
662 dip->next = TOCCATA_AUX2_MUTE;
663 strcpy(dip->label.name, "aux2");
664 dip->un.v.num_channels = 2;
665 strcpy(dip->un.v.units.name, AudioNvolume);
666 break;
667
668 case TOCCATA_AUX2_MUTE:
669 dip->mixer_class = TOCCATA_INPUT_CLASS;
670 dip->type = AUDIO_MIXER_ENUM;
671 dip->prev = TOCCATA_AUX2_LVL;
672 dip->next = AUDIO_MIXER_LAST;
673 goto mute;
674
675
676 case TOCCATA_MONITOR_LVL: /* monitor level */
677 dip->type = AUDIO_MIXER_VALUE;
678 dip->mixer_class = TOCCATA_MONITOR_CLASS;
679 dip->next = TOCCATA_MONITOR_MUTE;
680 dip->prev = AUDIO_MIXER_LAST;
681 strcpy(dip->label.name, AudioNmonitor);
682 dip->un.v.num_channels = 1;
683 strcpy(dip->un.v.units.name, AudioNvolume);
684 break;
685
686 case TOCCATA_OUTPUT_LVL: /* output volume */
687 dip->type = AUDIO_MIXER_VALUE;
688 dip->mixer_class = TOCCATA_OUTPUT_CLASS;
689 dip->prev = dip->next = AUDIO_MIXER_LAST;
690 strcpy(dip->label.name, AudioNmaster);
691 dip->un.v.num_channels = 2;
692 strcpy(dip->un.v.units.name, AudioNvolume);
693 break;
694 #if 0
695 case TOCCATA_LINE_IN_LVL: /* line */
696 dip->type = AUDIO_MIXER_VALUE;
697 dip->mixer_class = TOCCATA_INPUT_CLASS;
698 dip->prev = AUDIO_MIXER_LAST;
699 dip->next = TOCCATA_LINE_IN_MUTE;
700 strcpy(dip->label.name, AudioNline);
701 dip->un.v.num_channels = 2;
702 strcpy(dip->un.v.units.name, AudioNvolume);
703 break;
704
705 case TOCCATA_LINE_IN_MUTE:
706 dip->mixer_class = TOCCATA_INPUT_CLASS;
707 dip->type = AUDIO_MIXER_ENUM;
708 dip->prev = TOCCATA_LINE_IN_LVL;
709 dip->next = AUDIO_MIXER_LAST;
710 goto mute;
711 #endif
712 case TOCCATA_MONITOR_MUTE:
713 dip->mixer_class = TOCCATA_MONITOR_CLASS;
714 dip->type = AUDIO_MIXER_ENUM;
715 dip->prev = TOCCATA_MONITOR_LVL;
716 dip->next = AUDIO_MIXER_LAST;
717 mute:
718 strcpy(dip->label.name, AudioNmute);
719 dip->un.e.num_mem = 2;
720 strcpy(dip->un.e.member[0].label.name, AudioNoff);
721 dip->un.e.member[0].ord = 0;
722 strcpy(dip->un.e.member[1].label.name, AudioNon);
723 dip->un.e.member[1].ord = 1;
724 break;
725
726 case TOCCATA_REC_LVL: /* record level */
727 dip->type = AUDIO_MIXER_VALUE;
728 dip->mixer_class = TOCCATA_INPUT_CLASS;
729 dip->prev = AUDIO_MIXER_LAST;
730 dip->next = TOCCATA_RECORD_SOURCE;
731 strcpy(dip->label.name, AudioNrecord);
732 dip->un.v.num_channels = 2;
733 strcpy(dip->un.v.units.name, AudioNvolume);
734 break;
735
736 case TOCCATA_RECORD_SOURCE:
737 dip->mixer_class = TOCCATA_RECORD_CLASS;
738 dip->type = AUDIO_MIXER_ENUM;
739 dip->prev = TOCCATA_REC_LVL;
740 dip->next = AUDIO_MIXER_LAST;
741 strcpy(dip->label.name, AudioNsource);
742 dip->un.e.num_mem = 4;
743 strcpy(dip->un.e.member[0].label.name, AudioNmicrophone);
744 dip->un.e.member[1].ord = MIC_IN_PORT;
745 strcpy(dip->un.e.member[1].label.name, AudioNline);
746 dip->un.e.member[3].ord = LINE_IN_PORT;
747 strcpy(dip->un.e.member[2].label.name, "aux1");
748 dip->un.e.member[2].ord = AUX1_IN_PORT;
749 strcpy(dip->un.e.member[3].label.name, AudioNoutput);
750 dip->un.e.member[0].ord = DAC_IN_PORT;
751 break;
752
753 case TOCCATA_INPUT_CLASS: /* input class descriptor */
754 dip->type = AUDIO_MIXER_CLASS;
755 dip->mixer_class = TOCCATA_INPUT_CLASS;
756 dip->next = dip->prev = AUDIO_MIXER_LAST;
757 strcpy(dip->label.name, AudioCinputs);
758 break;
759
760 case TOCCATA_OUTPUT_CLASS: /* output class descriptor */
761 dip->type = AUDIO_MIXER_CLASS;
762 dip->mixer_class = TOCCATA_OUTPUT_CLASS;
763 dip->next = dip->prev = AUDIO_MIXER_LAST;
764 strcpy(dip->label.name, AudioCoutputs);
765 break;
766
767 case TOCCATA_MONITOR_CLASS: /* monitor class descriptor */
768 dip->type = AUDIO_MIXER_CLASS;
769 dip->mixer_class = TOCCATA_MONITOR_CLASS;
770 dip->next = dip->prev = AUDIO_MIXER_LAST;
771 strcpy(dip->label.name, AudioCmonitor);
772 break;
773
774 case TOCCATA_RECORD_CLASS: /* record source class */
775 dip->type = AUDIO_MIXER_CLASS;
776 dip->mixer_class = TOCCATA_RECORD_CLASS;
777 dip->next = dip->prev = AUDIO_MIXER_LAST;
778 strcpy(dip->label.name, AudioCrecord);
779 break;
780
781 default:
782 return ENXIO;
783 /*NOTREACHED*/
784 }
785
786 return 0;
787 }
788