Deleted Added
full compact
emu10kx.c (161057) emu10kx.c (165833)
1/*-
2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org>
3 * Copyright (c) 2003-2006 Yuriy Tsibizov <yuriy.tsibizov@gfk.ru>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org>
3 * Copyright (c) 2003-2006 Yuriy Tsibizov <yuriy.tsibizov@gfk.ru>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/sound/pci/emu10kx.c 161057 2006-08-07 22:56:41Z netchild $
27 * $FreeBSD: head/sys/dev/sound/pci/emu10kx.c 165833 2007-01-06 18:59:35Z netchild $
28 */
29
30#include <sys/param.h>
31#include <sys/types.h>
32#include <sys/bus.h>
33#include <machine/bus.h>
34#include <sys/rman.h>
35#include <sys/systm.h>

--- 108 unchanged lines hidden (view full) ---

144#define OUT_HEADPHONE OUT_HEADPHONE_L
145#define OUT_REAR_L 0x08
146#define OUT_REAR_R 0x09
147#define OUT_REAR OUT_REAR_L
148#define OUT_ADC_REC_L 0x0a
149#define OUT_ADC_REC_R 0x0b
150#define OUT_ADC_REC OUT_ADC_REC_L
151#define OUT_MIC_CAP 0x0c
28 */
29
30#include <sys/param.h>
31#include <sys/types.h>
32#include <sys/bus.h>
33#include <machine/bus.h>
34#include <sys/rman.h>
35#include <sys/systm.h>

--- 108 unchanged lines hidden (view full) ---

144#define OUT_HEADPHONE OUT_HEADPHONE_L
145#define OUT_REAR_L 0x08
146#define OUT_REAR_R 0x09
147#define OUT_REAR OUT_REAR_L
148#define OUT_ADC_REC_L 0x0a
149#define OUT_ADC_REC_R 0x0b
150#define OUT_ADC_REC OUT_ADC_REC_L
151#define OUT_MIC_CAP 0x0c
152
153/* Live! 5.1 Digital, non-standart 5.1 (center & sub) outputs */
152#define OUT_A_CENTER 0x11
153#define OUT_A_SUB 0x12
154
155/* Audigy Inputs */
156#define A_IN_AC97_L 0x00
157#define A_IN_AC97_R 0x01
158#define A_IN_AC97 A_IN_AC97_L
159#define A_IN_SPDIF_CD_L 0x02

--- 59 unchanged lines hidden (view full) ---

219#define C_REAR_L 4
220#define C_REAR_R 5
221#define C_CENTER 6
222#define C_SUB 7
223#define C_SIDE_L 8
224#define C_SIDE_R 9
225#define NUM_CACHES 10
226
154#define OUT_A_CENTER 0x11
155#define OUT_A_SUB 0x12
156
157/* Audigy Inputs */
158#define A_IN_AC97_L 0x00
159#define A_IN_AC97_R 0x01
160#define A_IN_AC97 A_IN_AC97_L
161#define A_IN_SPDIF_CD_L 0x02

--- 59 unchanged lines hidden (view full) ---

221#define C_REAR_L 4
222#define C_REAR_R 5
223#define C_CENTER 6
224#define C_SUB 7
225#define C_SIDE_L 8
226#define C_SIDE_R 9
227#define NUM_CACHES 10
228
229#define NUM_DUMMIES 64
230
227#define EMU_MAX_GPR 512
228#define EMU_MAX_IRQ_CONSUMERS 32
229
230struct emu_voice {
231 int vnum;
232 unsigned int b16:1, stereo:1, busy:1, running:1, ismaster:1;
233 int speed;
234 int start;

--- 42 unchanged lines hidden (view full) ---

277};
278
279struct emu_sc_info {
280 struct mtx lock;
281 struct mtx rw; /* Hardware exclusive access lock */
282
283 /* Hardware and subdevices */
284 device_t dev;
231#define EMU_MAX_GPR 512
232#define EMU_MAX_IRQ_CONSUMERS 32
233
234struct emu_voice {
235 int vnum;
236 unsigned int b16:1, stereo:1, busy:1, running:1, ismaster:1;
237 int speed;
238 int start;

--- 42 unchanged lines hidden (view full) ---

281};
282
283struct emu_sc_info {
284 struct mtx lock;
285 struct mtx rw; /* Hardware exclusive access lock */
286
287 /* Hardware and subdevices */
288 device_t dev;
285 device_t pcm[5];
289 device_t pcm[RT_COUNT];
286 device_t midi[2];
287 uint32_t type;
288 uint32_t rev;
289
290 bus_space_tag_t st;
291 bus_space_handle_t sh;
292
293 struct cdev *cdev; /* /dev/emu10k character device */

--- 42 unchanged lines hidden (view full) ---

336 int timerinterval;
337 struct emu_rm *rm;
338 struct emu_mem mem; /* memory */
339
340 /* Mixer */
341 int mixer_gpr[NUM_MIXERS];
342 int mixer_volcache[NUM_MIXERS];
343 int cache_gpr[NUM_CACHES];
290 device_t midi[2];
291 uint32_t type;
292 uint32_t rev;
293
294 bus_space_tag_t st;
295 bus_space_handle_t sh;
296
297 struct cdev *cdev; /* /dev/emu10k character device */

--- 42 unchanged lines hidden (view full) ---

340 int timerinterval;
341 struct emu_rm *rm;
342 struct emu_mem mem; /* memory */
343
344 /* Mixer */
345 int mixer_gpr[NUM_MIXERS];
346 int mixer_volcache[NUM_MIXERS];
347 int cache_gpr[NUM_CACHES];
348 int dummy_gpr[NUM_DUMMIES];
344 struct sysctl_ctx_list *ctx;
345 struct sysctl_oid *root;
346};
347
348static void emu_setmap(void *arg, bus_dma_segment_t * segs, int nseg, int error);
349static void* emu_malloc(struct emu_mem *mem, uint32_t sz, bus_addr_t * addr);
350static void emu_free(struct emu_mem *mem, void *dmabuf);
351static void* emu_memalloc(struct emu_mem *mem, uint32_t sz, bus_addr_t * addr, const char * owner);

--- 10 unchanged lines hidden (view full) ---

362static void emumix_set_fxvol(struct emu_sc_info *sc, unsigned gpr, int32_t vol);
363static void emumix_set_gpr(struct emu_sc_info *sc, unsigned gpr, int32_t val);
364static int sysctl_emu_mixer_control(SYSCTL_HANDLER_ARGS);
365
366static int emu_rm_init(struct emu_sc_info *sc);
367static int emu_rm_uninit(struct emu_sc_info *sc);
368static int emu_rm_gpr_alloc(struct emu_rm *rm, int count);
369
349 struct sysctl_ctx_list *ctx;
350 struct sysctl_oid *root;
351};
352
353static void emu_setmap(void *arg, bus_dma_segment_t * segs, int nseg, int error);
354static void* emu_malloc(struct emu_mem *mem, uint32_t sz, bus_addr_t * addr);
355static void emu_free(struct emu_mem *mem, void *dmabuf);
356static void* emu_memalloc(struct emu_mem *mem, uint32_t sz, bus_addr_t * addr, const char * owner);

--- 10 unchanged lines hidden (view full) ---

367static void emumix_set_fxvol(struct emu_sc_info *sc, unsigned gpr, int32_t vol);
368static void emumix_set_gpr(struct emu_sc_info *sc, unsigned gpr, int32_t val);
369static int sysctl_emu_mixer_control(SYSCTL_HANDLER_ARGS);
370
371static int emu_rm_init(struct emu_sc_info *sc);
372static int emu_rm_uninit(struct emu_sc_info *sc);
373static int emu_rm_gpr_alloc(struct emu_rm *rm, int count);
374
370static int emu_getcard(device_t dev);
375static unsigned int emu_getcard(device_t dev);
371static uint32_t emu_rd_nolock(struct emu_sc_info *sc, unsigned int regno, unsigned int size);
372static void emu_wr_nolock(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size);
373static void emu_wr_cbptr(struct emu_sc_info *sc, uint32_t data);
374
375static void emu_vstop(struct emu_sc_info *sc, char channel, int enable);
376
377static void emu_intr(void *p);
378static void emu_wrefx(struct emu_sc_info *sc, unsigned int pc, unsigned int data);

--- 20 unchanged lines hidden (view full) ---

399 uint16_t subvendor;
400 uint16_t subdevice;
401 char SBcode[8];
402 char desc[32];
403 int flags;
404};
405
406static struct emu_hwinfo emu_cards[] = {
376static uint32_t emu_rd_nolock(struct emu_sc_info *sc, unsigned int regno, unsigned int size);
377static void emu_wr_nolock(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size);
378static void emu_wr_cbptr(struct emu_sc_info *sc, uint32_t data);
379
380static void emu_vstop(struct emu_sc_info *sc, char channel, int enable);
381
382static void emu_intr(void *p);
383static void emu_wrefx(struct emu_sc_info *sc, unsigned int pc, unsigned int data);

--- 20 unchanged lines hidden (view full) ---

404 uint16_t subvendor;
405 uint16_t subdevice;
406 char SBcode[8];
407 char desc[32];
408 int flags;
409};
410
411static struct emu_hwinfo emu_cards[] = {
412 {0xffff, 0xffff, 0xffff, 0xffff, "BADCRD", "Not a compatible card", 0},
407 /* 0x0020..0x002f 4.0 EMU10K1 cards */
408 {0x1102, 0x0002, 0x1102, 0x0020, "CT4850", "SBLive! Value", HAS_AC97 | IS_EMU10K1},
409 {0x1102, 0x0002, 0x1102, 0x0021, "CT4620", "SBLive!", HAS_AC97 | IS_EMU10K1},
410 {0x1102, 0x0002, 0x1102, 0x002f, "CT????", "SBLive! mainboard implementation", HAS_AC97 | IS_EMU10K1},
411
412 /* (range unknown) 5.1 EMU10K1 cards */
413 {0x1102, 0x0002, 0x1102, 0x100a, "CT????", "SBLive! 5.1", HAS_AC97 | HAS_51 | IS_EMU10K1},
414

--- 32 unchanged lines hidden (view full) ---

447 /* 0x1002..0x1009 5.1 CA0102-IAT cards */
448 {0x1102, 0x0004, 0x1102, 0x1002, "SB????", "Audigy 2 Platinum", HAS_51 | IS_CA0102},
449 {0x1102, 0x0004, 0x1102, 0x1005, "SB????", "Audigy 2 Platinum EX", HAS_51 | IS_CA0102},
450 {0x1102, 0x0004, 0x1102, 0x1007, "SB0240", "Audigy 2", HAS_AC97 | HAS_51 | IS_CA0102},
451
452 /* 0x2001..0x2003 7.1 CA0102-ICT cards */
453 {0x1102, 0x0004, 0x1102, 0x2001, "SB0350", "Audigy 2 ZS", HAS_AC97 | HAS_71 | IS_CA0102},
454 {0x1102, 0x0004, 0x1102, 0x2002, "SB0350", "Audigy 2 ZS", HAS_AC97 | HAS_71 | IS_CA0102},
413 /* 0x0020..0x002f 4.0 EMU10K1 cards */
414 {0x1102, 0x0002, 0x1102, 0x0020, "CT4850", "SBLive! Value", HAS_AC97 | IS_EMU10K1},
415 {0x1102, 0x0002, 0x1102, 0x0021, "CT4620", "SBLive!", HAS_AC97 | IS_EMU10K1},
416 {0x1102, 0x0002, 0x1102, 0x002f, "CT????", "SBLive! mainboard implementation", HAS_AC97 | IS_EMU10K1},
417
418 /* (range unknown) 5.1 EMU10K1 cards */
419 {0x1102, 0x0002, 0x1102, 0x100a, "CT????", "SBLive! 5.1", HAS_AC97 | HAS_51 | IS_EMU10K1},
420

--- 32 unchanged lines hidden (view full) ---

453 /* 0x1002..0x1009 5.1 CA0102-IAT cards */
454 {0x1102, 0x0004, 0x1102, 0x1002, "SB????", "Audigy 2 Platinum", HAS_51 | IS_CA0102},
455 {0x1102, 0x0004, 0x1102, 0x1005, "SB????", "Audigy 2 Platinum EX", HAS_51 | IS_CA0102},
456 {0x1102, 0x0004, 0x1102, 0x1007, "SB0240", "Audigy 2", HAS_AC97 | HAS_51 | IS_CA0102},
457
458 /* 0x2001..0x2003 7.1 CA0102-ICT cards */
459 {0x1102, 0x0004, 0x1102, 0x2001, "SB0350", "Audigy 2 ZS", HAS_AC97 | HAS_71 | IS_CA0102},
460 {0x1102, 0x0004, 0x1102, 0x2002, "SB0350", "Audigy 2 ZS", HAS_AC97 | HAS_71 | IS_CA0102},
461 /* XXX No reports about 0x2003 & 0x2004 cards */
462 {0x1102, 0x0004, 0x1102, 0x2003, "SB0350", "Audigy 2 ZS", HAS_AC97 | HAS_71 | IS_CA0102},
463 {0x1102, 0x0004, 0x1102, 0x2004, "SB0350", "Audigy 2 ZS", HAS_AC97 | HAS_71 | IS_CA0102},
464 {0x1102, 0x0004, 0x1102, 0x2005, "SB0350", "Audigy 2 ZS", HAS_AC97 | HAS_71 | IS_CA0102},
455
456 /* (range unknown) 7.1 CA0102-xxx Audigy 4 cards */
457 {0x1102, 0x0004, 0x1102, 0x2007, "SB0380", "Audigy 4 Pro", HAS_AC97 | HAS_71 | IS_CA0102},
458
459 /* Generic Audigy or Audigy 2 */
460 {0x1102, 0x0004, 0x1102, 0x0000, "SB????", "Audigy (Unknown model)", HAS_AC97 | HAS_51 | IS_EMU10K2},
461
462 /* We don't support CA0103-DAT (Audigy LS) cards */

--- 22 unchanged lines hidden (view full) ---

485 {0x1102, 0x8064, 0x0000, 0x0000, "SB0100", "SBLive! 5.1 OEM", 0},
486 {0x1102, 0x0006, 0x0000, 0x0000, "SB0200", "DELL OEM SBLive! Value", 0},
487 {0x1102, 0x0007, 0x0000, 0x0000, "SB0310", "Audigy LS", 0},
488};
489
490/*
491 * Get best known information about device.
492 */
465
466 /* (range unknown) 7.1 CA0102-xxx Audigy 4 cards */
467 {0x1102, 0x0004, 0x1102, 0x2007, "SB0380", "Audigy 4 Pro", HAS_AC97 | HAS_71 | IS_CA0102},
468
469 /* Generic Audigy or Audigy 2 */
470 {0x1102, 0x0004, 0x1102, 0x0000, "SB????", "Audigy (Unknown model)", HAS_AC97 | HAS_51 | IS_EMU10K2},
471
472 /* We don't support CA0103-DAT (Audigy LS) cards */

--- 22 unchanged lines hidden (view full) ---

495 {0x1102, 0x8064, 0x0000, 0x0000, "SB0100", "SBLive! 5.1 OEM", 0},
496 {0x1102, 0x0006, 0x0000, 0x0000, "SB0200", "DELL OEM SBLive! Value", 0},
497 {0x1102, 0x0007, 0x0000, 0x0000, "SB0310", "Audigy LS", 0},
498};
499
500/*
501 * Get best known information about device.
502 */
493static int
503static unsigned int
494emu_getcard(device_t dev)
495{
496 uint16_t device;
497 uint16_t subdevice;
498 int n_cards;
504emu_getcard(device_t dev)
505{
506 uint16_t device;
507 uint16_t subdevice;
508 int n_cards;
499 int thiscard;
509 unsigned int thiscard;
500 int i;
501
502 device = pci_read_config(dev, PCIR_DEVICE, /* bytes */ 2);
503 subdevice = pci_read_config(dev, PCIR_SUBDEV_0, /* bytes */ 2);
504
505 n_cards = sizeof(emu_cards) / sizeof(struct emu_hwinfo);
510 int i;
511
512 device = pci_read_config(dev, PCIR_DEVICE, /* bytes */ 2);
513 subdevice = pci_read_config(dev, PCIR_SUBDEV_0, /* bytes */ 2);
514
515 n_cards = sizeof(emu_cards) / sizeof(struct emu_hwinfo);
506 thiscard = (-1);
507 for (i = 0; i < n_cards; i++) {
516 thiscard = 0;
517 for (i = 1; i < n_cards; i++) {
508 if (device == emu_cards[i].device) {
509 if (subdevice == emu_cards[i].subdevice) {
510 thiscard = i;
511 break;
512 }
513 if (0x0000 == emu_cards[i].subdevice) {
514 thiscard = i;
515 /* don't break, we can get more specific card
516 * later in the list */
517 }
518 }
519 }
520
521 n_cards = sizeof(emu_bad_cards) / sizeof(struct emu_hwinfo);
522 for (i = 0; i < n_cards; i++) {
523 if (device == emu_bad_cards[i].device) {
524 if (subdevice == emu_bad_cards[i].subdevice) {
518 if (device == emu_cards[i].device) {
519 if (subdevice == emu_cards[i].subdevice) {
520 thiscard = i;
521 break;
522 }
523 if (0x0000 == emu_cards[i].subdevice) {
524 thiscard = i;
525 /* don't break, we can get more specific card
526 * later in the list */
527 }
528 }
529 }
530
531 n_cards = sizeof(emu_bad_cards) / sizeof(struct emu_hwinfo);
532 for (i = 0; i < n_cards; i++) {
533 if (device == emu_bad_cards[i].device) {
534 if (subdevice == emu_bad_cards[i].subdevice) {
525 thiscard = (-1);
535 thiscard = 0;
526 break;
527 }
528 if (0x0000 == emu_bad_cards[i].subdevice) {
536 break;
537 }
538 if (0x0000 == emu_bad_cards[i].subdevice) {
529 thiscard = (-1);
539 thiscard = 0;
530 break; /* we avoid all this cards */
531 }
532 }
533 }
534 return (thiscard);
535}
536
537

--- 209 unchanged lines hidden (view full) ---

747 return (-1);
748}
749
750int
751emu_timer_set(struct emu_sc_info *sc, int timer, int delay)
752{
753 int i;
754
540 break; /* we avoid all this cards */
541 }
542 }
543 }
544 return (thiscard);
545}
546
547

--- 209 unchanged lines hidden (view full) ---

757 return (-1);
758}
759
760int
761emu_timer_set(struct emu_sc_info *sc, int timer, int delay)
762{
763 int i;
764
765 if(timer < 0)
766 return (-1);
767
755 RANGE(delay, 16, 1024);
768 RANGE(delay, 16, 1024);
756 RANGE(timer, 0, EMU_MAX_IRQ_CONSUMERS);
769 RANGE(timer, 0, EMU_MAX_IRQ_CONSUMERS-1);
757
758 sc->timer[timer] = delay;
759 for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++)
760 if (sc->timerinterval > sc->timer[i])
761 sc->timerinterval = sc->timer[i];
762
763 emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2);
764 return (timer);
765}
766
767int
768emu_timer_enable(struct emu_sc_info *sc, int timer, int go)
769{
770 uint32_t x;
771 int ena_int;
772 int i;
773
770
771 sc->timer[timer] = delay;
772 for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++)
773 if (sc->timerinterval > sc->timer[i])
774 sc->timerinterval = sc->timer[i];
775
776 emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2);
777 return (timer);
778}
779
780int
781emu_timer_enable(struct emu_sc_info *sc, int timer, int go)
782{
783 uint32_t x;
784 int ena_int;
785 int i;
786
787 if(timer < 0)
788 return (-1);
789
790 RANGE(timer, 0, EMU_MAX_IRQ_CONSUMERS-1);
791
774 mtx_lock(&sc->lock);
775
776 if ((go == 1) && (sc->timer[timer] < 0))
777 sc->timer[timer] = -sc->timer[timer];
778 if ((go == 0) && (sc->timer[timer] > 0))
779 sc->timer[timer] = -sc->timer[timer];
780
781 ena_int = 0;

--- 17 unchanged lines hidden (view full) ---

799 }
800 mtx_unlock(&sc->lock);
801 return (0);
802}
803
804int
805emu_timer_clear(struct emu_sc_info *sc, int timer)
806{
792 mtx_lock(&sc->lock);
793
794 if ((go == 1) && (sc->timer[timer] < 0))
795 sc->timer[timer] = -sc->timer[timer];
796 if ((go == 0) && (sc->timer[timer] > 0))
797 sc->timer[timer] = -sc->timer[timer];
798
799 ena_int = 0;

--- 17 unchanged lines hidden (view full) ---

817 }
818 mtx_unlock(&sc->lock);
819 return (0);
820}
821
822int
823emu_timer_clear(struct emu_sc_info *sc, int timer)
824{
825 if(timer < 0)
826 return (-1);
827
828 RANGE(timer, 0, EMU_MAX_IRQ_CONSUMERS-1);
829
807 emu_timer_enable(sc, timer, 0);
808
809 mtx_lock(&sc->lock);
810 if (sc->timer[timer] != 0)
811 sc->timer[timer] = 0;
812 mtx_unlock(&sc->lock);
813
814 return (timer);

--- 14 unchanged lines hidden (view full) ---

829 sc->ihandler[i].inte_mask = inte_mask;
830 sc->ihandler[i].intr_mask = intr_mask;
831 sc->ihandler[i].softc = isc;
832 sc->ihandler[i].irq_func = func;
833 x = emu_rd(sc, INTE, 4);
834 x |= inte_mask;
835 emu_wr(sc, INTE, x, 4);
836 mtx_unlock(&sc->lock);
830 emu_timer_enable(sc, timer, 0);
831
832 mtx_lock(&sc->lock);
833 if (sc->timer[timer] != 0)
834 sc->timer[timer] = 0;
835 mtx_unlock(&sc->lock);
836
837 return (timer);

--- 14 unchanged lines hidden (view full) ---

852 sc->ihandler[i].inte_mask = inte_mask;
853 sc->ihandler[i].intr_mask = intr_mask;
854 sc->ihandler[i].softc = isc;
855 sc->ihandler[i].irq_func = func;
856 x = emu_rd(sc, INTE, 4);
857 x |= inte_mask;
858 emu_wr(sc, INTE, x, 4);
859 mtx_unlock(&sc->lock);
860#ifdef SND_EMU10KX_DEBUG
861 device_printf(sc->dev, "ihandle %d registered\n", i);
862#endif
837 return (i);
838 }
839 mtx_unlock(&sc->lock);
863 return (i);
864 }
865 mtx_unlock(&sc->lock);
866#ifdef SND_EMU10KX_DEBUG
867 device_printf(sc->dev, "ihandle not registered\n");
868#endif
840 return (-1);
841}
842
843int
844emu_intr_unregister(struct emu_sc_info *sc, int hnumber)
845{
846 uint32_t x;
847 int i;

--- 39 unchanged lines hidden (view full) ---

887 emu_wr(sc, IPR, stat, 4);
888 for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) {
889 if ((((sc->ihandler[i].intr_mask) & stat) != 0) &&
890 (((void *)sc->ihandler[i].irq_func) != NULL)) {
891 ack |= sc->ihandler[i].irq_func(sc->ihandler[i].softc,
892 (sc->ihandler[i].intr_mask) & stat);
893 }
894 }
869 return (-1);
870}
871
872int
873emu_intr_unregister(struct emu_sc_info *sc, int hnumber)
874{
875 uint32_t x;
876 int i;

--- 39 unchanged lines hidden (view full) ---

916 emu_wr(sc, IPR, stat, 4);
917 for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) {
918 if ((((sc->ihandler[i].intr_mask) & stat) != 0) &&
919 (((void *)sc->ihandler[i].irq_func) != NULL)) {
920 ack |= sc->ihandler[i].irq_func(sc->ihandler[i].softc,
921 (sc->ihandler[i].intr_mask) & stat);
922 }
923 }
924#ifdef SND_EMU10KX_DEBUG
925 if(stat & (~ack))
926 device_printf(sc->dev, "Unhandled interrupt: %08x\n", stat & (~ack));
927#endif
895 }
896
897 if ((sc->is_ca0102) || (sc->is_ca0108))
898 for (;;) {
899 stat = emu_rd(sc, IPR2, 4);
900 ack = 0;
901 if (stat == 0)
902 break;

--- 591 unchanged lines hidden (view full) ---

1494 emu_addefxop(sc, MACS, \
1495 OUTP(OUTP_NR), \
1496 DSP_CONST(0), \
1497 GPR(sc->cache_gpr[OUT_CACHE_IDX]), \
1498 GPR(sc->mixer_gpr[OUT_GPR_IDX]), \
1499 &pc); \
1500} while(0)
1501
928 }
929
930 if ((sc->is_ca0102) || (sc->is_ca0108))
931 for (;;) {
932 stat = emu_rd(sc, IPR2, 4);
933 ack = 0;
934 if (stat == 0)
935 break;

--- 591 unchanged lines hidden (view full) ---

1527 emu_addefxop(sc, MACS, \
1528 OUTP(OUTP_NR), \
1529 DSP_CONST(0), \
1530 GPR(sc->cache_gpr[OUT_CACHE_IDX]), \
1531 GPR(sc->mixer_gpr[OUT_GPR_IDX]), \
1532 &pc); \
1533} while(0)
1534
1535/* mute, if FLAG != 0 */
1536/* XXX */
1537#define EFX_MUTEIF(GPR_IDX, FLAG) do { \
1538} while(0)
1539
1540/* allocate dummy GPR. It's content will be used somewhere */
1541#define EFX_DUMMY(DUMMY_IDX, DUMMY_VALUE) do { \
1542 sc->dummy_gpr[DUMMY_IDX] = emu_rm_gpr_alloc(sc->rm, 1); \
1543 emumix_set_gpr(sc, sc->dummy_gpr[DUMMY_IDX], DUMMY_VALUE); \
1544 emu_addefxop(sc, ACC3, \
1545 FX2(DUMMY_IDX), \
1546 GPR(sc->dummy_gpr[DUMMY_IDX]), \
1547 DSP_CONST(0), \
1548 DSP_CONST(0), \
1549 &pc); \
1550} while (0)
1551
1552
1502static void
1503emu_initefx(struct emu_sc_info *sc)
1504{
1553static void
1554emu_initefx(struct emu_sc_info *sc)
1555{
1505 unsigned int c;
1556 unsigned int i;
1506 uint32_t pc;
1507
1508 /* stop DSP */
1509 if (sc->is_emu10k1) {
1510 emu_wrptr(sc, 0, DBG, EMU10K1_DBG_SINGLE_STEP);
1511 } else {
1512 emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP);
1513 }
1514
1515 /* code size is in instructions */
1516 pc = 0;
1557 uint32_t pc;
1558
1559 /* stop DSP */
1560 if (sc->is_emu10k1) {
1561 emu_wrptr(sc, 0, DBG, EMU10K1_DBG_SINGLE_STEP);
1562 } else {
1563 emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP);
1564 }
1565
1566 /* code size is in instructions */
1567 pc = 0;
1517 for (c = 0; c < sc->code_size; c++) {
1568 for (i = 0; i < sc->code_size; i++) {
1518 if (sc->is_emu10k1) {
1519 emu_addefxop(sc, ACC3, DSP_CONST(0x0), DSP_CONST(0x0), DSP_CONST(0x0), DSP_CONST(0x0), &pc);
1520 } else {
1521 emu_addefxop(sc, SKIP, DSP_CONST(0x0), DSP_CONST(0x0), DSP_CONST(0xf), DSP_CONST(0x0), &pc);
1522 }
1523 }
1524
1525 pc = 0;
1526
1527 /*
1528 * DSP code below is not good, because:
1529 * 1. It can be written smaller, if it can use DSP accumulator register
1530 * instead of cache_gpr[].
1531 * 2. It can be more careful when volume is 100%, because in DSP
1532 * x*0x7fffffff may not be equal to x !
1533 */
1534
1535 /* clean outputs */
1569 if (sc->is_emu10k1) {
1570 emu_addefxop(sc, ACC3, DSP_CONST(0x0), DSP_CONST(0x0), DSP_CONST(0x0), DSP_CONST(0x0), &pc);
1571 } else {
1572 emu_addefxop(sc, SKIP, DSP_CONST(0x0), DSP_CONST(0x0), DSP_CONST(0xf), DSP_CONST(0x0), &pc);
1573 }
1574 }
1575
1576 pc = 0;
1577
1578 /*
1579 * DSP code below is not good, because:
1580 * 1. It can be written smaller, if it can use DSP accumulator register
1581 * instead of cache_gpr[].
1582 * 2. It can be more careful when volume is 100%, because in DSP
1583 * x*0x7fffffff may not be equal to x !
1584 */
1585
1586 /* clean outputs */
1536 for (c = 0; c < 16 ; c++) {
1537 emu_addefxop(sc, ACC3, OUTP(c), DSP_CONST(0), DSP_CONST(0), DSP_CONST(0), &pc);
1587 for (i = 0; i < 16 ; i++) {
1588 emu_addefxop(sc, ACC3, OUTP(i), DSP_CONST(0), DSP_CONST(0), DSP_CONST(0), &pc);
1538 }
1539
1540
1541 if (sc->is_emu10k1) {
1542 EFX_CACHE(C_FRONT_L);
1543 EFX_CACHE(C_FRONT_R);
1544 EFX_CACHE(C_REC_L);
1545 EFX_CACHE(C_REC_R);

--- 7 unchanged lines hidden (view full) ---

1553 /* in0, from AC97 codec output */
1554 EFX_ROUTE("ac97_front_l", INP(IN_AC97_L), M_IN0_FRONT_L, C_FRONT_L, 0);
1555 EFX_ROUTE("ac97_front_r", INP(IN_AC97_R), M_IN0_FRONT_R, C_FRONT_R, 0);
1556 EFX_ROUTE("ac97_rec_l", INP(IN_AC97_L), M_IN0_REC_L, C_REC_L, 0);
1557 EFX_ROUTE("ac97_rec_r", INP(IN_AC97_R), M_IN0_REC_R, C_REC_R, 0);
1558
1559 /* in1, from CD S/PDIF */
1560 EFX_ROUTE("cdspdif_front_l", INP(IN_SPDIF_CD_L), M_IN1_FRONT_L, C_FRONT_L, 0);
1589 }
1590
1591
1592 if (sc->is_emu10k1) {
1593 EFX_CACHE(C_FRONT_L);
1594 EFX_CACHE(C_FRONT_R);
1595 EFX_CACHE(C_REC_L);
1596 EFX_CACHE(C_REC_R);

--- 7 unchanged lines hidden (view full) ---

1604 /* in0, from AC97 codec output */
1605 EFX_ROUTE("ac97_front_l", INP(IN_AC97_L), M_IN0_FRONT_L, C_FRONT_L, 0);
1606 EFX_ROUTE("ac97_front_r", INP(IN_AC97_R), M_IN0_FRONT_R, C_FRONT_R, 0);
1607 EFX_ROUTE("ac97_rec_l", INP(IN_AC97_L), M_IN0_REC_L, C_REC_L, 0);
1608 EFX_ROUTE("ac97_rec_r", INP(IN_AC97_R), M_IN0_REC_R, C_REC_R, 0);
1609
1610 /* in1, from CD S/PDIF */
1611 EFX_ROUTE("cdspdif_front_l", INP(IN_SPDIF_CD_L), M_IN1_FRONT_L, C_FRONT_L, 0);
1612 EFX_MUTEIF(M_IN1_FRONT_L, CDSPDIFMUTE);
1561 EFX_ROUTE("cdspdif_front_r", INP(IN_SPDIF_CD_R), M_IN1_FRONT_R, C_FRONT_R, 0);
1613 EFX_ROUTE("cdspdif_front_r", INP(IN_SPDIF_CD_R), M_IN1_FRONT_R, C_FRONT_R, 0);
1614 EFX_MUTEIF(M_IN1_FRONT_R, CDSPDIFMUTE);
1562 EFX_ROUTE("cdspdif_rec_l", INP(IN_SPDIF_CD_L), M_IN1_REC_L, C_REC_L, 0);
1615 EFX_ROUTE("cdspdif_rec_l", INP(IN_SPDIF_CD_L), M_IN1_REC_L, C_REC_L, 0);
1616 EFX_MUTEIF(M_IN1_REC_L, CDSPDIFMUTE);
1563 EFX_ROUTE("cdspdif_rec_r", INP(IN_SPDIF_CD_R), M_IN1_REC_R, C_REC_R, 0);
1617 EFX_ROUTE("cdspdif_rec_r", INP(IN_SPDIF_CD_R), M_IN1_REC_R, C_REC_R, 0);
1564#if 0
1618 EFX_MUTEIF(M_IN1_REC_L, CDSPDIFMUTE);
1619#ifdef SND_EMU10KX_DEBUG_OUTPUTS
1565 /* in2, ZoomVide (???) */
1566 EFX_ROUTE("zoom_front_l", INP(IN_ZOOM_L), M_IN2_FRONT_L, C_FRONT_L, 0);
1567 EFX_ROUTE("zoom_front_r", INP(IN_ZOOM_R), M_IN2_FRONT_R, C_FRONT_R, 0);
1568 EFX_ROUTE("zoom_rec_l", INP(IN_ZOOM_L), M_IN2_REC_L, C_REC_L, 0);
1569 EFX_ROUTE("zoom_rec_r", INP(IN_ZOOM_R), M_IN2_REC_R, C_REC_R, 0);
1570#endif
1620 /* in2, ZoomVide (???) */
1621 EFX_ROUTE("zoom_front_l", INP(IN_ZOOM_L), M_IN2_FRONT_L, C_FRONT_L, 0);
1622 EFX_ROUTE("zoom_front_r", INP(IN_ZOOM_R), M_IN2_FRONT_R, C_FRONT_R, 0);
1623 EFX_ROUTE("zoom_rec_l", INP(IN_ZOOM_L), M_IN2_REC_L, C_REC_L, 0);
1624 EFX_ROUTE("zoom_rec_r", INP(IN_ZOOM_R), M_IN2_REC_R, C_REC_R, 0);
1625#endif
1571#if 0
1626#ifdef SND_EMU10KX_DEBUG_OUTPUTS
1572 /* in3, TOSLink (???) */
1573 EFX_ROUTE("toslink_front_l", INP(IN_TOSLINK_L), M_IN3_FRONT_L, C_FRONT_L, 0);
1574 EFX_ROUTE("toslink_front_r", INP(IN_TOSLINK_R), M_IN3_FRONT_R, C_FRONT_R, 0);
1575 EFX_ROUTE("toslink_rec_l", INP(IN_TOSLINK_L), M_IN3_REC_L, C_REC_L, 0);
1576 EFX_ROUTE("toslink_rec_r", INP(IN_TOSLINK_R), M_IN3_REC_R, C_REC_R, 0);
1577#endif
1578 /* in4, LineIn */
1579 EFX_ROUTE("linein_front_l", INP(IN_LINE1_L), M_IN4_FRONT_L, C_FRONT_L, 0);

--- 7 unchanged lines hidden (view full) ---

1587 EFX_ROUTE("spdif_rec_l", INP(IN_COAX_SPDIF_L), M_IN5_REC_L, C_REC_L, 0);
1588 EFX_ROUTE("spdif_rec_r", INP(IN_COAX_SPDIF_R), M_IN5_REC_R, C_REC_R, 0);
1589
1590 /* in6, Line2 on Live!Drive */
1591 EFX_ROUTE("line2_front_l", INP(IN_LINE2_L), M_IN6_FRONT_L, C_FRONT_L, 0);
1592 EFX_ROUTE("line2_front_r", INP(IN_LINE2_R), M_IN6_FRONT_R, C_FRONT_R, 0);
1593 EFX_ROUTE("line2_rec_l", INP(IN_LINE2_L), M_IN6_REC_L, C_REC_L, 0);
1594 EFX_ROUTE("line2_rec_r", INP(IN_LINE2_R), M_IN6_REC_R, C_REC_R, 0);
1627 /* in3, TOSLink (???) */
1628 EFX_ROUTE("toslink_front_l", INP(IN_TOSLINK_L), M_IN3_FRONT_L, C_FRONT_L, 0);
1629 EFX_ROUTE("toslink_front_r", INP(IN_TOSLINK_R), M_IN3_FRONT_R, C_FRONT_R, 0);
1630 EFX_ROUTE("toslink_rec_l", INP(IN_TOSLINK_L), M_IN3_REC_L, C_REC_L, 0);
1631 EFX_ROUTE("toslink_rec_r", INP(IN_TOSLINK_R), M_IN3_REC_R, C_REC_R, 0);
1632#endif
1633 /* in4, LineIn */
1634 EFX_ROUTE("linein_front_l", INP(IN_LINE1_L), M_IN4_FRONT_L, C_FRONT_L, 0);

--- 7 unchanged lines hidden (view full) ---

1642 EFX_ROUTE("spdif_rec_l", INP(IN_COAX_SPDIF_L), M_IN5_REC_L, C_REC_L, 0);
1643 EFX_ROUTE("spdif_rec_r", INP(IN_COAX_SPDIF_R), M_IN5_REC_R, C_REC_R, 0);
1644
1645 /* in6, Line2 on Live!Drive */
1646 EFX_ROUTE("line2_front_l", INP(IN_LINE2_L), M_IN6_FRONT_L, C_FRONT_L, 0);
1647 EFX_ROUTE("line2_front_r", INP(IN_LINE2_R), M_IN6_FRONT_R, C_FRONT_R, 0);
1648 EFX_ROUTE("line2_rec_l", INP(IN_LINE2_L), M_IN6_REC_L, C_REC_L, 0);
1649 EFX_ROUTE("line2_rec_r", INP(IN_LINE2_R), M_IN6_REC_R, C_REC_R, 0);
1595#if 0
1650#ifdef SND_EMU10KX_DEBUG_OUTPUTS
1596 /* in7, unknown */
1597 EFX_ROUTE("in7_front_l", INP(0xE), M_IN7_FRONT_L, C_FRONT_L, 0);
1598 EFX_ROUTE("in7_front_r", INP(0xF), M_IN7_FRONT_R, C_FRONT_R, 0);
1599 EFX_ROUTE("in7_rec_l", INP(0xE), M_IN7_REC_L, C_REC_L, 0);
1600 EFX_ROUTE("in7_rec_r", INP(0xF), M_IN7_REC_R, C_REC_R, 0);
1601#endif
1651 /* in7, unknown */
1652 EFX_ROUTE("in7_front_l", INP(0xE), M_IN7_FRONT_L, C_FRONT_L, 0);
1653 EFX_ROUTE("in7_front_r", INP(0xF), M_IN7_FRONT_R, C_FRONT_R, 0);
1654 EFX_ROUTE("in7_rec_l", INP(0xE), M_IN7_REC_L, C_REC_L, 0);
1655 EFX_ROUTE("in7_rec_r", INP(0xF), M_IN7_REC_R, C_REC_R, 0);
1656#endif
1602 /* front output to both analog and digital */
1657 /* front output to hedaphones and both analog and digital */
1603 EFX_OUTPUT("master_front_l", C_FRONT_L, M_MASTER_FRONT_L, OUT_AC97_L, 100);
1604 EFX_OUTPUT("master_front_r", C_FRONT_R, M_MASTER_FRONT_R, OUT_AC97_R, 100);
1658 EFX_OUTPUT("master_front_l", C_FRONT_L, M_MASTER_FRONT_L, OUT_AC97_L, 100);
1659 EFX_OUTPUT("master_front_r", C_FRONT_R, M_MASTER_FRONT_R, OUT_AC97_R, 100);
1660 EFX_OUTPUTD(C_FRONT_L, M_MASTER_FRONT_L, OUT_HEADPHONE_L);
1661 EFX_OUTPUTD(C_FRONT_R, M_MASTER_FRONT_R, OUT_HEADPHONE_R);
1605
1606 /* rec output to "ADC" */
1607 EFX_OUTPUT("master_rec_l", C_REC_L, M_MASTER_REC_L, OUT_ADC_REC_L, 100);
1608 EFX_OUTPUT("master_rec_r", C_REC_R, M_MASTER_REC_R, OUT_ADC_REC_R, 100);
1609#ifdef SND_EMU10KX_MULTICHANNEL
1610 /*
1611 * Additional channel volume is controlled by mixer in
1612 * emu_dspmixer_set() in -pcm.c
1613 */
1614
1615 /* fx2/3 (pcm1) to rear */
1616 EFX_CACHE(C_REAR_L);
1617 EFX_CACHE(C_REAR_R);
1618 EFX_ROUTE(NULL, FX(2), M_FX2_REAR_L, C_REAR_L, 100);
1619 EFX_ROUTE(NULL, FX(3), M_FX3_REAR_R, C_REAR_R, 100);
1620
1621 EFX_OUTPUT(NULL, C_REAR_L, M_MASTER_REAR_L, OUT_REAR_L, 100);
1622 EFX_OUTPUT(NULL, C_REAR_R, M_MASTER_REAR_R, OUT_REAR_R, 100);
1662
1663 /* rec output to "ADC" */
1664 EFX_OUTPUT("master_rec_l", C_REC_L, M_MASTER_REC_L, OUT_ADC_REC_L, 100);
1665 EFX_OUTPUT("master_rec_r", C_REC_R, M_MASTER_REC_R, OUT_ADC_REC_R, 100);
1666#ifdef SND_EMU10KX_MULTICHANNEL
1667 /*
1668 * Additional channel volume is controlled by mixer in
1669 * emu_dspmixer_set() in -pcm.c
1670 */
1671
1672 /* fx2/3 (pcm1) to rear */
1673 EFX_CACHE(C_REAR_L);
1674 EFX_CACHE(C_REAR_R);
1675 EFX_ROUTE(NULL, FX(2), M_FX2_REAR_L, C_REAR_L, 100);
1676 EFX_ROUTE(NULL, FX(3), M_FX3_REAR_R, C_REAR_R, 100);
1677
1678 EFX_OUTPUT(NULL, C_REAR_L, M_MASTER_REAR_L, OUT_REAR_L, 100);
1679 EFX_OUTPUT(NULL, C_REAR_R, M_MASTER_REAR_R, OUT_REAR_R, 100);
1680 if (sc->has_51) {
1681 /* fx4 (pcm2) to center */
1682 EFX_CACHE(C_CENTER);
1683 EFX_ROUTE(NULL, FX(4), M_FX4_CENTER, C_CENTER, 100);
1684 EFX_OUTPUT(NULL, C_CENTER, M_MASTER_CENTER, OUT_D_CENTER, 100);
1685#if 0
1686 /* XXX in digital mode (default) this should be muted because
1687 this output is shared with digital out */
1688 EFX_OUTPUTD(C_CENTER, M_MASTER_CENTER, OUT_A_CENTER);
1689#endif
1690 /* fx5 (pcm3) to sub */
1691 EFX_CACHE(C_SUB);
1692 EFX_ROUTE(NULL, FX(5), M_FX5_SUBWOOFER, C_SUB, 100);
1693 EFX_OUTPUT(NULL, C_SUB, M_MASTER_SUBWOOFER, OUT_D_SUB, 100);
1694#if 0
1695 /* XXX in digital mode (default) this should be muted because
1696 this output is shared with digital out */
1697 EFX_OUTPUTD(C_SUB, M_MASTER_SUBWOOFER, OUT_A_SUB);
1698#endif
1699 }
1700#ifdef SND_EMU10KX_MCH_RECORDING
1701 /* MCH RECORDING , hight 16 slots. On 5.1 cards first 4 slots are used
1702 as outputs and already filled with data */
1703 for(i = (sc->has_51 ? 4 : 0); i < 16; i++) {
1704 /* XXX fill with dummy data */
1705 EFX_DUMMY(i,i*0x10000);
1706 emu_addefxop(sc, ACC3,
1707 FX2(i),
1708 DSP_CONST(0),
1709 DSP_CONST(0),
1710 GPR(sc->dummy_gpr[i]),
1711 &pc);
1712
1713 }
1714#endif
1623#else /* !SND_EMU10KX_MULTICHANNEL */
1624 EFX_OUTPUTD(C_FRONT_L, M_MASTER_FRONT_L, OUT_REAR_L);
1625 EFX_OUTPUTD(C_FRONT_R, M_MASTER_FRONT_R, OUT_REAR_R);
1626#endif
1627 } else /* emu10k2 and later */ {
1628 EFX_CACHE(C_FRONT_L);
1629 EFX_CACHE(C_FRONT_R);
1630 EFX_CACHE(C_REC_L);

--- 17 unchanged lines hidden (view full) ---

1648
1649 /* in1, from CD S/PDIF */
1650 EFX_ROUTE("cdspdif_front_l", INP(A_IN_SPDIF_CD_L), M_IN1_FRONT_L, C_FRONT_L, 0);
1651 EFX_ROUTE("cdspdif_front_r", INP(A_IN_SPDIF_CD_R), M_IN1_FRONT_R, C_FRONT_R, 0);
1652 EFX_ROUTE("cdspdif_rec_l", INP(A_IN_SPDIF_CD_L), M_IN1_REC_L, C_REC_L, 0);
1653 EFX_ROUTE("cdspdif_rec_r", INP(A_IN_SPDIF_CD_R), M_IN1_REC_R, C_REC_R, 0);
1654
1655 /* in2, optical & coax S/PDIF on AudigyDrive*/
1715#else /* !SND_EMU10KX_MULTICHANNEL */
1716 EFX_OUTPUTD(C_FRONT_L, M_MASTER_FRONT_L, OUT_REAR_L);
1717 EFX_OUTPUTD(C_FRONT_R, M_MASTER_FRONT_R, OUT_REAR_R);
1718#endif
1719 } else /* emu10k2 and later */ {
1720 EFX_CACHE(C_FRONT_L);
1721 EFX_CACHE(C_FRONT_R);
1722 EFX_CACHE(C_REC_L);

--- 17 unchanged lines hidden (view full) ---

1740
1741 /* in1, from CD S/PDIF */
1742 EFX_ROUTE("cdspdif_front_l", INP(A_IN_SPDIF_CD_L), M_IN1_FRONT_L, C_FRONT_L, 0);
1743 EFX_ROUTE("cdspdif_front_r", INP(A_IN_SPDIF_CD_R), M_IN1_FRONT_R, C_FRONT_R, 0);
1744 EFX_ROUTE("cdspdif_rec_l", INP(A_IN_SPDIF_CD_L), M_IN1_REC_L, C_REC_L, 0);
1745 EFX_ROUTE("cdspdif_rec_r", INP(A_IN_SPDIF_CD_R), M_IN1_REC_R, C_REC_R, 0);
1746
1747 /* in2, optical & coax S/PDIF on AudigyDrive*/
1748 /* XXX Should be muted when GPRSCS valid stream == 0 */
1656 EFX_ROUTE("ospdif_front_l", INP(A_IN_O_SPDIF_L), M_IN2_FRONT_L, C_FRONT_L, 0);
1657 EFX_ROUTE("ospdif_front_r", INP(A_IN_O_SPDIF_R), M_IN2_FRONT_R, C_FRONT_R, 0);
1658 EFX_ROUTE("ospdif_rec_l", INP(A_IN_O_SPDIF_L), M_IN2_REC_L, C_REC_L, 0);
1659 EFX_ROUTE("ospdif_rec_r", INP(A_IN_O_SPDIF_R), M_IN2_REC_R, C_REC_R, 0);
1749 EFX_ROUTE("ospdif_front_l", INP(A_IN_O_SPDIF_L), M_IN2_FRONT_L, C_FRONT_L, 0);
1750 EFX_ROUTE("ospdif_front_r", INP(A_IN_O_SPDIF_R), M_IN2_FRONT_R, C_FRONT_R, 0);
1751 EFX_ROUTE("ospdif_rec_l", INP(A_IN_O_SPDIF_L), M_IN2_REC_L, C_REC_L, 0);
1752 EFX_ROUTE("ospdif_rec_r", INP(A_IN_O_SPDIF_R), M_IN2_REC_R, C_REC_R, 0);
1660#if 0
1753#ifdef SND_EMU10KX_DEBUG_OUTPUTS
1661 /* in3, unknown */
1662 EFX_ROUTE("in3_front_l", INP(0x6), M_IN3_FRONT_L, C_FRONT_L, 0);
1663 EFX_ROUTE("in3_front_r", INP(0x7), M_IN3_FRONT_R, C_FRONT_R, 0);
1664 EFX_ROUTE("in3_rec_l", INP(0x6), M_IN3_REC_L, C_REC_L, 0);
1665 EFX_ROUTE("in3_rec_r", INP(0x7), M_IN3_REC_R, C_REC_R, 0);
1666#endif
1667 /* in4, LineIn 2 on AudigyDrive */
1668 EFX_ROUTE("linein2_front_l", INP(A_IN_LINE2_L), M_IN4_FRONT_L, C_FRONT_L, 0);

--- 7 unchanged lines hidden (view full) ---

1676 EFX_ROUTE("spdif_rec_l", INP(A_IN_R_SPDIF_L), M_IN5_REC_L, C_REC_L, 0);
1677 EFX_ROUTE("spdif_rec_r", INP(A_IN_R_SPDIF_R), M_IN5_REC_R, C_REC_R, 0);
1678
1679 /* in6, AUX2 on AudigyDrive */
1680 EFX_ROUTE("aux2_front_l", INP(A_IN_AUX2_L), M_IN6_FRONT_L, C_FRONT_L, 0);
1681 EFX_ROUTE("aux2_front_r", INP(A_IN_AUX2_R), M_IN6_FRONT_R, C_FRONT_R, 0);
1682 EFX_ROUTE("aux2_rec_l", INP(A_IN_AUX2_L), M_IN6_REC_L, C_REC_L, 0);
1683 EFX_ROUTE("aux2_rec_r", INP(A_IN_AUX2_R), M_IN6_REC_R, C_REC_R, 0);
1754 /* in3, unknown */
1755 EFX_ROUTE("in3_front_l", INP(0x6), M_IN3_FRONT_L, C_FRONT_L, 0);
1756 EFX_ROUTE("in3_front_r", INP(0x7), M_IN3_FRONT_R, C_FRONT_R, 0);
1757 EFX_ROUTE("in3_rec_l", INP(0x6), M_IN3_REC_L, C_REC_L, 0);
1758 EFX_ROUTE("in3_rec_r", INP(0x7), M_IN3_REC_R, C_REC_R, 0);
1759#endif
1760 /* in4, LineIn 2 on AudigyDrive */
1761 EFX_ROUTE("linein2_front_l", INP(A_IN_LINE2_L), M_IN4_FRONT_L, C_FRONT_L, 0);

--- 7 unchanged lines hidden (view full) ---

1769 EFX_ROUTE("spdif_rec_l", INP(A_IN_R_SPDIF_L), M_IN5_REC_L, C_REC_L, 0);
1770 EFX_ROUTE("spdif_rec_r", INP(A_IN_R_SPDIF_R), M_IN5_REC_R, C_REC_R, 0);
1771
1772 /* in6, AUX2 on AudigyDrive */
1773 EFX_ROUTE("aux2_front_l", INP(A_IN_AUX2_L), M_IN6_FRONT_L, C_FRONT_L, 0);
1774 EFX_ROUTE("aux2_front_r", INP(A_IN_AUX2_R), M_IN6_FRONT_R, C_FRONT_R, 0);
1775 EFX_ROUTE("aux2_rec_l", INP(A_IN_AUX2_L), M_IN6_REC_L, C_REC_L, 0);
1776 EFX_ROUTE("aux2_rec_r", INP(A_IN_AUX2_R), M_IN6_REC_R, C_REC_R, 0);
1684#if 0
1777#ifdef SND_EMU10KX_DEBUG_OUTPUTS
1685 /* in7, unknown */
1686 EFX_ROUTE("in7_front_l", INP(0xE), M_IN7_FRONT_L, C_FRONT_L, 0);
1687 EFX_ROUTE("in7_front_r", INP(0xF), M_IN7_FRONT_R, C_FRONT_R, 0);
1688 EFX_ROUTE("in7_rec_l", INP(0xE), M_IN7_REC_L, C_REC_L, 0);
1689 EFX_ROUTE("in7_rec_r", INP(0xF), M_IN7_REC_R, C_REC_R, 0);
1690#endif
1691 /* front output to headphones and alog and digital *front */
1692 /* volume controlled by AC97 emulation */

--- 50 unchanged lines hidden (view full) ---

1743 EFX_CACHE(C_SIDE_R);
1744 EFX_ROUTE(NULL, FX(6), M_FX6_SIDE_L, C_SIDE_L, 100);
1745 EFX_ROUTE(NULL, FX(7), M_FX7_SIDE_R, C_SIDE_R, 100);
1746 EFX_OUTPUT(NULL, C_SIDE_L, M_MASTER_SIDE_L, A_OUT_A_SIDE_L, 100);
1747 EFX_OUTPUT(NULL, C_SIDE_R, M_MASTER_SIDE_R, A_OUT_A_SIDE_R, 100);
1748 EFX_OUTPUTD(C_SIDE_L, M_MASTER_SIDE_L, A_OUT_D_SIDE_L);
1749 EFX_OUTPUTD(C_SIDE_R, M_MASTER_SIDE_R, A_OUT_D_SIDE_R);
1750 }
1778 /* in7, unknown */
1779 EFX_ROUTE("in7_front_l", INP(0xE), M_IN7_FRONT_L, C_FRONT_L, 0);
1780 EFX_ROUTE("in7_front_r", INP(0xF), M_IN7_FRONT_R, C_FRONT_R, 0);
1781 EFX_ROUTE("in7_rec_l", INP(0xE), M_IN7_REC_L, C_REC_L, 0);
1782 EFX_ROUTE("in7_rec_r", INP(0xF), M_IN7_REC_R, C_REC_R, 0);
1783#endif
1784 /* front output to headphones and alog and digital *front */
1785 /* volume controlled by AC97 emulation */

--- 50 unchanged lines hidden (view full) ---

1836 EFX_CACHE(C_SIDE_R);
1837 EFX_ROUTE(NULL, FX(6), M_FX6_SIDE_L, C_SIDE_L, 100);
1838 EFX_ROUTE(NULL, FX(7), M_FX7_SIDE_R, C_SIDE_R, 100);
1839 EFX_OUTPUT(NULL, C_SIDE_L, M_MASTER_SIDE_L, A_OUT_A_SIDE_L, 100);
1840 EFX_OUTPUT(NULL, C_SIDE_R, M_MASTER_SIDE_R, A_OUT_A_SIDE_R, 100);
1841 EFX_OUTPUTD(C_SIDE_L, M_MASTER_SIDE_L, A_OUT_D_SIDE_L);
1842 EFX_OUTPUTD(C_SIDE_R, M_MASTER_SIDE_R, A_OUT_D_SIDE_R);
1843 }
1844#ifdef SND_EMU10KX_MCH_RECORDING
1845 /* MCH RECORDING, high 32 slots */
1846 for(i = 0; i < 32; i++) {
1847 /* XXX fill with dummy data */
1848 EFX_DUMMY(i,i*0x10000);
1849 emu_addefxop(sc, ACC3,
1850 FX2(i),
1851 DSP_CONST(0),
1852 DSP_CONST(0),
1853 GPR(sc->dummy_gpr[i]),
1854 &pc);
1855 }
1856#endif
1751#else /* !SND_EMU10KX_MULTICHANNEL */
1752 EFX_OUTPUTD(C_FRONT_L, M_MASTER_FRONT_L, A_OUT_A_REAR_L);
1753 EFX_OUTPUTD(C_FRONT_R, M_MASTER_FRONT_R, A_OUT_A_REAR_R);
1754
1755 EFX_OUTPUTD(C_FRONT_L, M_MASTER_FRONT_L, A_OUT_D_REAR_L);
1756 EFX_OUTPUTD(C_FRONT_R, M_MASTER_FRONT_R, A_OUT_D_REAR_R);
1757#endif
1758 }

--- 119 unchanged lines hidden (view full) ---

1878 if (sc->is_ca0102)
1879 sbuf_printf(s, ", Audigy DSP code with Audigy2 hacks");
1880 if (sc->is_ca0108)
1881 sbuf_printf(s, ", Audigy DSP code with Audigy2Value hacks");
1882 sbuf_printf(s, "\n");
1883 if (sc->broken_digital)
1884 sbuf_printf(s, "Digital mode unsupported\n");
1885 sbuf_printf(s, "\nInstalled devices:\n");
1857#else /* !SND_EMU10KX_MULTICHANNEL */
1858 EFX_OUTPUTD(C_FRONT_L, M_MASTER_FRONT_L, A_OUT_A_REAR_L);
1859 EFX_OUTPUTD(C_FRONT_R, M_MASTER_FRONT_R, A_OUT_A_REAR_R);
1860
1861 EFX_OUTPUTD(C_FRONT_L, M_MASTER_FRONT_L, A_OUT_D_REAR_L);
1862 EFX_OUTPUTD(C_FRONT_R, M_MASTER_FRONT_R, A_OUT_D_REAR_R);
1863#endif
1864 }

--- 119 unchanged lines hidden (view full) ---

1984 if (sc->is_ca0102)
1985 sbuf_printf(s, ", Audigy DSP code with Audigy2 hacks");
1986 if (sc->is_ca0108)
1987 sbuf_printf(s, ", Audigy DSP code with Audigy2Value hacks");
1988 sbuf_printf(s, "\n");
1989 if (sc->broken_digital)
1990 sbuf_printf(s, "Digital mode unsupported\n");
1991 sbuf_printf(s, "\nInstalled devices:\n");
1886 for (i = 0; i < 5; i++)
1992 for (i = 0; i < RT_COUNT; i++)
1887 if (sc->pcm[i] != NULL)
1888 if (device_is_attached(sc->pcm[i])) {
1889 sbuf_printf(s, "%s on %s\n", device_get_desc(sc->pcm[i]), device_get_nameunit(sc->pcm[i]));
1890 }
1891 if (sc->midi[0] != NULL)
1892 if (device_is_attached(sc->midi[0])) {
1893 sbuf_printf(s, "EMU10Kx MIDI Interface\n");
1894 sbuf_printf(s, "\tOn-card connector on %s\n", device_get_nameunit(sc->midi[0]));

--- 664 unchanged lines hidden (view full) ---

2559 return (ENOENT);
2560 }
2561}
2562
2563static int
2564emu_pci_probe(device_t dev)
2565{
2566 struct sbuf *s;
1993 if (sc->pcm[i] != NULL)
1994 if (device_is_attached(sc->pcm[i])) {
1995 sbuf_printf(s, "%s on %s\n", device_get_desc(sc->pcm[i]), device_get_nameunit(sc->pcm[i]));
1996 }
1997 if (sc->midi[0] != NULL)
1998 if (device_is_attached(sc->midi[0])) {
1999 sbuf_printf(s, "EMU10Kx MIDI Interface\n");
2000 sbuf_printf(s, "\tOn-card connector on %s\n", device_get_nameunit(sc->midi[0]));

--- 664 unchanged lines hidden (view full) ---

2665 return (ENOENT);
2666 }
2667}
2668
2669static int
2670emu_pci_probe(device_t dev)
2671{
2672 struct sbuf *s;
2567 int thiscard = 0;
2673 unsigned int thiscard = 0;
2568 uint16_t vendor;
2569
2570 vendor = pci_read_config(dev, PCIR_DEVVENDOR, /* bytes */ 2);
2571 if (vendor != 0x1102)
2572 return (ENXIO); /* Not Creative */
2573
2574 thiscard = emu_getcard(dev);
2674 uint16_t vendor;
2675
2676 vendor = pci_read_config(dev, PCIR_DEVVENDOR, /* bytes */ 2);
2677 if (vendor != 0x1102)
2678 return (ENXIO); /* Not Creative */
2679
2680 thiscard = emu_getcard(dev);
2575 if (thiscard < 0)
2681 if (thiscard == 0)
2576 return (ENXIO);
2577
2578 s = sbuf_new(NULL, NULL, 4096, 0);
2579 if (s == NULL)
2580 return (ENOMEM);
2581 sbuf_printf(s, "Creative %s [%s]", emu_cards[thiscard].desc, emu_cards[thiscard].SBcode);
2582 sbuf_finish(s);
2583

--- 66 unchanged lines hidden (view full) ---

2650 sc->broken_digital = 1;
2651 if (device_flags & HAS_AC97)
2652 sc->has_ac97 = 1;
2653
2654 sc->opcode_shift = 0;
2655 if ((sc->is_emu10k2) || (sc->is_ca0102) || (sc->is_ca0108)) {
2656 sc->opcode_shift = 24;
2657 sc->high_operand_shift = 12;
2682 return (ENXIO);
2683
2684 s = sbuf_new(NULL, NULL, 4096, 0);
2685 if (s == NULL)
2686 return (ENOMEM);
2687 sbuf_printf(s, "Creative %s [%s]", emu_cards[thiscard].desc, emu_cards[thiscard].SBcode);
2688 sbuf_finish(s);
2689

--- 66 unchanged lines hidden (view full) ---

2756 sc->broken_digital = 1;
2757 if (device_flags & HAS_AC97)
2758 sc->has_ac97 = 1;
2759
2760 sc->opcode_shift = 0;
2761 if ((sc->is_emu10k2) || (sc->is_ca0102) || (sc->is_ca0108)) {
2762 sc->opcode_shift = 24;
2763 sc->high_operand_shift = 12;
2658 sc->code_base = A_MICROCODEBASE;
2659 sc->code_size = 0x800 / 2; /* 0x600-0xdff, 2048 words,
2660 * 1024 instructions */
2661 sc->gpr_base = A_FXGPREGBASE;
2662 sc->num_gprs = 0x200;
2764
2765 /* DSP map */
2766 /* sc->fx_base = 0x0 */
2663 sc->input_base = 0x40;
2767 sc->input_base = 0x40;
2664/* sc->p16vinput_base = 0x50; */
2768 /* sc->p16vinput_base = 0x50; */
2665 sc->output_base = 0x60;
2666 sc->efxc_base = 0x80;
2769 sc->output_base = 0x60;
2770 sc->efxc_base = 0x80;
2667/* sc->output32h_base = 0xa0; */
2668/* sc->output32l_base = 0xb0; */
2771 /* sc->output32h_base = 0xa0; */
2772 /* sc->output32l_base = 0xb0; */
2669 sc->dsp_zero = 0xc0;
2773 sc->dsp_zero = 0xc0;
2774 /* 0xe0...0x100 are unknown */
2775 /* sc->tram_base = 0x200 */
2776 /* sc->tram_addr_base = 0x300 */
2777 sc->gpr_base = A_FXGPREGBASE;
2778 sc->num_gprs = 0x200;
2779 sc->code_base = A_MICROCODEBASE;
2780 sc->code_size = 0x800 / 2; /* 0x600-0xdff, 2048 words,
2781 * 1024 instructions */
2782
2670 sc->mchannel_fx = 8;
2671 sc->num_fxbuses = 16;
2672 sc->num_inputs = 8;
2673 sc->num_outputs = 16;
2674 sc->address_mask = A_PTR_ADDRESS_MASK;
2675 }
2676 if (sc->is_emu10k1) {
2677 sc->has_51 = 0; /* We don't support 5.1 sound Live! 5.1 */
2678 sc->opcode_shift = 20;
2679 sc->high_operand_shift = 10;
2680 sc->code_base = MICROCODEBASE;
2681 sc->code_size = 0x400 / 2; /* 0x400-0x7ff, 1024 words,
2682 * 512 instructions */
2683 sc->gpr_base = FXGPREGBASE;
2684 sc->num_gprs = 0x100;
2685 sc->input_base = 0x10;
2686 sc->output_base = 0x20;
2783 sc->mchannel_fx = 8;
2784 sc->num_fxbuses = 16;
2785 sc->num_inputs = 8;
2786 sc->num_outputs = 16;
2787 sc->address_mask = A_PTR_ADDRESS_MASK;
2788 }
2789 if (sc->is_emu10k1) {
2790 sc->has_51 = 0; /* We don't support 5.1 sound Live! 5.1 */
2791 sc->opcode_shift = 20;
2792 sc->high_operand_shift = 10;
2793 sc->code_base = MICROCODEBASE;
2794 sc->code_size = 0x400 / 2; /* 0x400-0x7ff, 1024 words,
2795 * 512 instructions */
2796 sc->gpr_base = FXGPREGBASE;
2797 sc->num_gprs = 0x100;
2798 sc->input_base = 0x10;
2799 sc->output_base = 0x20;
2800 /*
2801 * XXX 5.1 Analog outputs are inside efxc address space!
2802 * They use ouput+0x11/+0x12 (=efxc+1/+2).
2803 * Don't use this efx registers for recording on SB Live! 5.1!
2804 */
2687 sc->efxc_base = 0x30;
2688 sc->dsp_zero = 0x40;
2689 sc->mchannel_fx = 0;
2690 sc->num_fxbuses = 8;
2691 sc->num_inputs = 8;
2692 sc->num_outputs = 16;
2693 sc->address_mask = PTR_ADDRESS_MASK;
2694 }

--- 78 unchanged lines hidden (view full) ---

2773 }
2774 pcminfo->card = sc;
2775 pcminfo->route = RT_FRONT;
2776
2777 func->func = SCF_PCM;
2778 func->varinfo = pcminfo;
2779 sc->pcm[RT_FRONT] = device_add_child(dev, "pcm", -1);
2780 device_set_ivars(sc->pcm[RT_FRONT], func);
2805 sc->efxc_base = 0x30;
2806 sc->dsp_zero = 0x40;
2807 sc->mchannel_fx = 0;
2808 sc->num_fxbuses = 8;
2809 sc->num_inputs = 8;
2810 sc->num_outputs = 16;
2811 sc->address_mask = PTR_ADDRESS_MASK;
2812 }

--- 78 unchanged lines hidden (view full) ---

2891 }
2892 pcminfo->card = sc;
2893 pcminfo->route = RT_FRONT;
2894
2895 func->func = SCF_PCM;
2896 func->varinfo = pcminfo;
2897 sc->pcm[RT_FRONT] = device_add_child(dev, "pcm", -1);
2898 device_set_ivars(sc->pcm[RT_FRONT], func);
2899
2900#ifdef SND_EMU10KX_MULTICHANNEL
2781 /* REAR */
2782 func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
2783 if (func == NULL) {
2784 error = ENOMEM;
2785 goto bad;
2786 }
2787 pcminfo = malloc(sizeof(struct emu_pcminfo), M_DEVBUF, M_NOWAIT | M_ZERO);
2788 if (pcminfo == NULL) {
2789 error = ENOMEM;
2790 goto bad;
2791 }
2901 /* REAR */
2902 func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
2903 if (func == NULL) {
2904 error = ENOMEM;
2905 goto bad;
2906 }
2907 pcminfo = malloc(sizeof(struct emu_pcminfo), M_DEVBUF, M_NOWAIT | M_ZERO);
2908 if (pcminfo == NULL) {
2909 error = ENOMEM;
2910 goto bad;
2911 }
2792#ifdef SND_EMU10KX_MULTICHANNEL
2793 pcminfo->card = sc;
2794 pcminfo->route = RT_REAR;
2795
2796 func->func = SCF_PCM;
2797 func->varinfo = pcminfo;
2798 sc->pcm[RT_REAR] = device_add_child(dev, "pcm", -1);
2799 device_set_ivars(sc->pcm[RT_REAR], func);
2800 if (sc->has_51) {

--- 49 unchanged lines hidden (view full) ---

2850 pcminfo->card = sc;
2851 pcminfo->route = RT_SIDE;
2852
2853 func->func = SCF_PCM;
2854 func->varinfo = pcminfo;
2855 sc->pcm[RT_SIDE] = device_add_child(dev, "pcm", -1);
2856 device_set_ivars(sc->pcm[RT_SIDE], func);
2857 };
2912 pcminfo->card = sc;
2913 pcminfo->route = RT_REAR;
2914
2915 func->func = SCF_PCM;
2916 func->varinfo = pcminfo;
2917 sc->pcm[RT_REAR] = device_add_child(dev, "pcm", -1);
2918 device_set_ivars(sc->pcm[RT_REAR], func);
2919 if (sc->has_51) {

--- 49 unchanged lines hidden (view full) ---

2969 pcminfo->card = sc;
2970 pcminfo->route = RT_SIDE;
2971
2972 func->func = SCF_PCM;
2973 func->varinfo = pcminfo;
2974 sc->pcm[RT_SIDE] = device_add_child(dev, "pcm", -1);
2975 device_set_ivars(sc->pcm[RT_SIDE], func);
2976 };
2977#ifdef SND_EMU10KX_MCH_RECORDING
2978 /* MULTICHANNEL RECORDING */
2979 func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
2980 if (func == NULL) {
2981 error = ENOMEM;
2982 goto bad;
2983 }
2984 pcminfo = malloc(sizeof(struct emu_pcminfo), M_DEVBUF, M_NOWAIT | M_ZERO);
2985 if (pcminfo == NULL) {
2986 error = ENOMEM;
2987 goto bad;
2988 }
2989 pcminfo->card = sc;
2990 pcminfo->route = RT_MCHRECORD;
2991
2992 func->func = SCF_PCM;
2993 func->varinfo = pcminfo;
2994 sc->pcm[RT_MCHRECORD] = device_add_child(dev, "pcm", -1);
2995 device_set_ivars(sc->pcm[RT_MCHRECORD], func);
2996
2997#endif /* SMD_EMU10KX_MCH_RECORDING */
2858#endif /* SND_EMU10KX_MULTICHANNEL */
2859
2860 /* Midi Interface 1: Live!, Audigy, Audigy 2 */
2861 if ((sc->is_emu10k1) || (sc->is_emu10k2) || (sc->is_ca0102)) {
2862 func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
2863 if (func == NULL) {
2864 error = ENOMEM;
2865 goto bad;

--- 64 unchanged lines hidden (view full) ---

2930{
2931 struct emu_sc_info *sc;
2932 int devcount, i;
2933 device_t *childlist;
2934 int r = 0;
2935
2936 sc = device_get_softc(dev);
2937
2998#endif /* SND_EMU10KX_MULTICHANNEL */
2999
3000 /* Midi Interface 1: Live!, Audigy, Audigy 2 */
3001 if ((sc->is_emu10k1) || (sc->is_emu10k2) || (sc->is_ca0102)) {
3002 func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
3003 if (func == NULL) {
3004 error = ENOMEM;
3005 goto bad;

--- 64 unchanged lines hidden (view full) ---

3070{
3071 struct emu_sc_info *sc;
3072 int devcount, i;
3073 device_t *childlist;
3074 int r = 0;
3075
3076 sc = device_get_softc(dev);
3077
2938 for (i = 0; i < 5; i++) {
3078 for (i = 0; i < RT_COUNT; i++) {
2939 if (sc->pcm[i] != NULL)
2940 r = device_delete_child(dev, sc->pcm[i]);
2941 if (r)
2942 return (r);
2943 }
2944 if (sc->midi[0] != NULL)
2945 r = device_delete_child(dev, sc->midi[0]);
2946 if (r)

--- 79 unchanged lines hidden ---
3079 if (sc->pcm[i] != NULL)
3080 r = device_delete_child(dev, sc->pcm[i]);
3081 if (r)
3082 return (r);
3083 }
3084 if (sc->midi[0] != NULL)
3085 r = device_delete_child(dev, sc->midi[0]);
3086 if (r)

--- 79 unchanged lines hidden ---