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