int init_module(void) { int dmatype = 0; printk(KERN_INFO "MAD16 audio driver Copyright (C) by Hannu Savolainen 1993-1996\n"); if (io == -1 || dma == -1 || irq == -1) { printk(KERN_ERR "I/O, DMA and irq are mandatory\n"); return -EINVAL; } printk(KERN_INFO "CDROM "); switch (cdtype) { case 0x00: printk("Disabled"); cdirq = 0; break; case 0x02: printk("Sony CDU31A"); dmatype = 2; break; case 0x04: printk("Mitsumi"); dmatype = 1; break; case 0x06: printk("Panasonic Lasermate"); dmatype = 2; break; case 0x08: printk("Secondary IDE"); dmatype = 1; break; case 0x0A: printk("Primary IDE"); dmatype = 1; break; default: printk("\n"); printk(KERN_ERR "Invalid CDROM type\n"); return -EINVAL; } if (dmatype) { if (cddma > 7 || cddma < 0 || dma_map[dmatype][cddma] == -1) { printk("\n"); printk(KERN_ERR "Invalid CDROM DMA\n"); return -EINVAL; } if (cddma) printk(", DMA %d", cddma); else printk(", no DMA"); } if (cdtype && !cdirq) printk(", no IRQ"); else if (cdirq < 0 || cdirq > 15 || irq_map[cdirq] == -1) { printk(", invalid IRQ (disabling)"); cdirq = 0; } else printk(", IRQ %d", cdirq); printk(".\n"); printk(KERN_INFO "Joystick port "); if (joystick == 1) printk("enabled.\n"); else { joystick = 0; printk("disabled.\n"); } /* * Build the config words */ mad16_conf = (joystick ^ 1) | cdtype; mad16_cdsel = 0; if (opl4) mad16_cdsel |= 0x20; mad16_cdsel |= dma_map[dmatype][cddma]; if (cdtype < 0x08) { switch (cdport) { case 0x340: mad16_cdsel |= 0x00; break; case 0x330: mad16_cdsel |= 0x40; break; case 0x360: mad16_cdsel |= 0x80; break; case 0x320: mad16_cdsel |= 0xC0; break; default: printk(KERN_ERR "Unknown CDROM I/O base %d\n", cdport); return -EINVAL; } } mad16_cdsel |= irq_map[cdirq]; config.io_base = io; config.irq = irq; config.dma = dma; config.dma2 = dma16; if (!probe_mad16(&config)) return -ENODEV; config_mpu.io_base = mpu_io; config_mpu.irq = mpu_irq; attach_mad16(&config); found_mpu = probe_mad16_mpu(&config_mpu); if (found_mpu) attach_mad16_mpu(&config_mpu); SOUND_LOCK; return 0; }
static int __init init_mad16(void) { int dmatype = 0; printk(KERN_INFO "MAD16 audio driver Copyright (C) by Hannu Savolainen 1993-1996\n"); printk(KERN_INFO "CDROM "); switch (cdtype) { case 0x00: printk("Disabled"); cdirq = 0; break; case 0x02: printk("Sony CDU31A"); dmatype = 1; if(cddma == -1) cddma = 3; break; case 0x04: printk("Mitsumi"); dmatype = 0; if(cddma == -1) cddma = 5; break; case 0x06: printk("Panasonic Lasermate"); dmatype = 1; if(cddma == -1) cddma = 3; break; case 0x08: printk("Secondary IDE"); dmatype = 0; if(cddma == -1) cddma = 5; break; case 0x0A: printk("Primary IDE"); dmatype = 0; if(cddma == -1) cddma = 5; break; default: printk("\n"); printk(KERN_ERR "Invalid CDROM type\n"); return -EINVAL; } /* * Build the config words */ mad16_conf = (joystick ^ 1) | cdtype; mad16_cdsel = 0; if (opl4) mad16_cdsel |= 0x20; if(cdtype){ if (cddma > 7 || cddma < 0 || dma_map[dmatype][cddma] == -1) { printk("\n"); printk(KERN_ERR "Invalid CDROM DMA\n"); return -EINVAL; } if (cddma) printk(", DMA %d", cddma); else printk(", no DMA"); if (!cdirq) printk(", no IRQ"); else if (cdirq < 0 || cdirq > 15 || irq_map[cdirq] == -1) { printk(", invalid IRQ (disabling)"); cdirq = 0; } else printk(", IRQ %d", cdirq); mad16_cdsel |= dma_map[dmatype][cddma]; if (cdtype < 0x08) { switch (cdport) { case 0x340: mad16_cdsel |= 0x00; break; case 0x330: mad16_cdsel |= 0x40; break; case 0x360: mad16_cdsel |= 0x80; break; case 0x320: mad16_cdsel |= 0xC0; break; default: printk(KERN_ERR "Unknown CDROM I/O base %d\n", cdport); return -EINVAL; } } mad16_cdsel |= irq_map[cdirq]; } printk(".\n"); cfg.io_base = io; cfg.irq = irq; cfg.dma = dma; cfg.dma2 = dma16; if (cfg.io_base == -1 || cfg.dma == -1 || cfg.irq == -1) { printk(KERN_ERR "I/O, DMA and irq are mandatory\n"); return -EINVAL; } if (!probe_mad16(&cfg)) return -ENODEV; cfg_mpu.io_base = mpu_io; cfg_mpu.irq = mpu_irq; attach_mad16(&cfg); found_mpu = probe_mad16_mpu(&cfg_mpu); if (joystick == 1) { /* register gameport */ if (!request_region(0x201, 1, "mad16 gameport")) printk(KERN_ERR "mad16: gameport address 0x201 already in use\n"); else { printk(KERN_ERR "mad16: gameport enabled at 0x201\n"); gameport.io = 0x201; gameport_register_port(&gameport); } } else printk(KERN_ERR "mad16: gameport disabled.\n"); return 0; }