static void __init attach_uart6850(struct address_info *hw_config) { int ok, timeout; unsigned long flags; if (!uart6850_detected) return; if ((my_dev = sound_alloc_mididev()) == -1) { printk(KERN_INFO "uart6850: Too many midi devices detected\n"); return; } uart6850_base = hw_config->io_base; uart6850_osp = hw_config->osp; uart6850_irq = hw_config->irq; spin_lock_irqsave(&lock,flags); for (timeout = 30000; timeout > 0 && !output_ready(); timeout--); /* * Wait */ uart6850_cmd(UART_MODE_ON); ok = 1; spin_unlock_irqrestore(&lock,flags); conf_printf("6850 Midi Interface", hw_config); std_midi_synth.midi_dev = my_dev; hw_config->slots[4] = my_dev; midi_devs[my_dev] = &uart6850_operations; sequencer_init(); }
void __init gus_midi_init(struct address_info *hw_config) { int dev = sound_alloc_mididev(); if (dev == -1) { printk(KERN_INFO "gus_midi: Too many midi devices detected\n"); return; } outb((MIDI_RESET), u_MidiControl); std_midi_synth.midi_dev = my_dev = dev; hw_config->slots[2] = dev; midi_devs[dev] = &gus_midi_operations; sequencer_init(); return; }
void sb_dsp_midi_init(sb_devc * devc, struct module *owner) { int dev; if (devc->model < 2) /* No MIDI support for SB 1.x */ return; dev = sound_alloc_mididev(); if (dev == -1) { printk(KERN_ERR "sb_midi: too many MIDI devices detected\n"); return; } std_midi_synth.midi_dev = devc->my_mididev = dev; midi_devs[dev] = (struct midi_operations *)kmalloc(sizeof(struct midi_operations), GFP_KERNEL); if (midi_devs[dev] == NULL) { printk(KERN_WARNING "Sound Blaster: failed to allocate MIDI memory.\n"); sound_unload_mididev(dev); return; } memcpy((char *) midi_devs[dev], (char *) &sb_midi_operations, sizeof(struct midi_operations)); if (owner) midi_devs[dev]->owner = owner; midi_devs[dev]->devc = devc; midi_devs[dev]->converter = (struct synth_operations *)kmalloc(sizeof(struct synth_operations), GFP_KERNEL); if (midi_devs[dev]->converter == NULL) { printk(KERN_WARNING "Sound Blaster: failed to allocate MIDI memory.\n"); kfree(midi_devs[dev]); sound_unload_mididev(dev); return; } memcpy((char *) midi_devs[dev]->converter, (char *) &std_midi_synth, sizeof(struct synth_operations)); midi_devs[dev]->converter->id = "SBMIDI"; sequencer_init(); }
void attach_v_midi (struct address_info *hw_config) { struct vmidi_memory *m; /* printk("Attaching v_midi device.....\n"); */ midi1 = sound_alloc_mididev(); if (midi1 == -1) { printk(KERN_ERR "v_midi: Too many midi devices detected\n"); return; } m=(struct vmidi_memory *)kmalloc(sizeof(struct vmidi_memory), GFP_KERNEL); if (m == NULL) { printk(KERN_WARNING "Loopback MIDI: Failed to allocate memory\n"); sound_unload_mididev(midi1); return; } midi_mem = m; midi_devs[midi1] = &m->m_ops[0]; midi2 = sound_alloc_mididev(); if (midi2 == -1) { printk (KERN_ERR "v_midi: Too many midi devices detected\n"); kfree(m); sound_unload_mididev(midi1); return; } midi_devs[midi2] = &m->m_ops[1]; /* printk("VMIDI1: %d VMIDI2: %d\n",midi1,midi2); */ /* for MIDI-1 */ v_devc[0] = &m->v_ops[0]; memcpy ((char *) midi_devs[midi1], (char *) &v_midi_operations, sizeof (struct midi_operations)); v_devc[0]->my_mididev = midi1; v_devc[0]->pair_mididev = midi2; v_devc[0]->opened = v_devc[0]->input_opened = 0; v_devc[0]->intr_active = 0; v_devc[0]->midi_input_intr = NULL; midi_devs[midi1]->devc = v_devc[0]; midi_devs[midi1]->converter = &m->s_ops[0]; std_midi_synth.midi_dev = midi1; memcpy ((char *) midi_devs[midi1]->converter, (char *) &std_midi_synth, sizeof (struct synth_operations)); midi_devs[midi1]->converter->id = "V_MIDI 1"; /* for MIDI-2 */ v_devc[1] = &m->v_ops[1]; memcpy ((char *) midi_devs[midi2], (char *) &v_midi_operations2, sizeof (struct midi_operations)); v_devc[1]->my_mididev = midi2; v_devc[1]->pair_mididev = midi1; v_devc[1]->opened = v_devc[1]->input_opened = 0; v_devc[1]->intr_active = 0; v_devc[1]->midi_input_intr = NULL; midi_devs[midi2]->devc = v_devc[1]; midi_devs[midi2]->converter = &m->s_ops[1]; std_midi_synth.midi_dev = midi2; memcpy ((char *) midi_devs[midi2]->converter, (char *) &std_midi_synth, sizeof (struct synth_operations)); midi_devs[midi2]->converter->id = "V_MIDI 2"; sequencer_init(); /* printk("Attached v_midi device\n"); */ }
int probe_uart401(struct address_info *hw_config, struct module *owner) { uart401_devc *devc; char *name = "MPU-401 (UART) MIDI"; int ok = 0; unsigned long flags; DDB(printk("Entered probe_uart401()\n")); /* Default to "not found" */ hw_config->slots[4] = -1; if (!request_region(hw_config->io_base, 4, "MPU-401 UART")) { printk(KERN_INFO "uart401: could not request_region(%d, 4)\n", hw_config->io_base); return 0; } devc = kmalloc(sizeof(uart401_devc), GFP_KERNEL); if (!devc) { printk(KERN_WARNING "uart401: Can't allocate memory\n"); goto cleanup_region; } devc->base = hw_config->io_base; devc->irq = hw_config->irq; devc->osp = hw_config->osp; devc->midi_input_intr = NULL; devc->opened = 0; devc->input_byte = 0; devc->my_dev = 0; devc->share_irq = 0; spin_lock_init(&devc->lock); spin_lock_irqsave(&devc->lock,flags); ok = reset_uart401(devc); spin_unlock_irqrestore(&devc->lock,flags); if (!ok) goto cleanup_devc; if (hw_config->name) name = hw_config->name; if (devc->irq < 0) { devc->share_irq = 1; devc->irq *= -1; } else devc->share_irq = 0; if (!devc->share_irq) if (request_irq(devc->irq, uart401intr, 0, "MPU-401 UART", devc) < 0) { printk(KERN_WARNING "uart401: Failed to allocate IRQ%d\n", devc->irq); devc->share_irq = 1; } devc->my_dev = sound_alloc_mididev(); enter_uart_mode(devc); if (devc->my_dev == -1) { printk(KERN_INFO "uart401: Too many midi devices detected\n"); goto cleanup_irq; } conf_printf(name, hw_config); midi_devs[devc->my_dev] = kmemdup(&uart401_operations, sizeof(struct midi_operations), GFP_KERNEL); if (!midi_devs[devc->my_dev]) { printk(KERN_ERR "uart401: Failed to allocate memory\n"); goto cleanup_unload_mididev; } if (owner) midi_devs[devc->my_dev]->owner = owner; midi_devs[devc->my_dev]->devc = devc; midi_devs[devc->my_dev]->converter = kmemdup(&std_midi_synth, sizeof(struct synth_operations),