int msnd_disable_irq(multisound_dev_t *dev) { unsigned long flags; if (--dev->irq_ref > 0) return 0; if (dev->irq_ref < 0) printk(KERN_DEBUG LOGNAME ": IRQ ref count is %d\n", dev->irq_ref); printk(KERN_DEBUG LOGNAME ": Disabling IRQ\n"); spin_lock_irqsave(&dev->lock, flags); if (msnd_wait_TXDE(dev) == 0) { outb(inb(dev->io + HP_ICR) & ~HPICR_RREQ, dev->io + HP_ICR); if (dev->type == msndClassic) outb(HPIRQ_NONE, dev->io + HP_IRQM); disable_irq(dev->irq); spin_unlock_irqrestore(&dev->lock, flags); return 0; } spin_unlock_irqrestore(&dev->lock, flags); printk(KERN_DEBUG LOGNAME ": Disable IRQ failed\n"); return -EIO; }
int msnd_enable_irq(multisound_dev_t *dev) { unsigned long flags; if (dev->irq_ref++) return 0; printk(KERN_DEBUG LOGNAME ": Enabling IRQ\n"); spin_lock_irqsave(&dev->lock, flags); if (msnd_wait_TXDE(dev) == 0) { outb(inb(dev->io + HP_ICR) | HPICR_TREQ, dev->io + HP_ICR); if (dev->type == msndClassic) outb(dev->irqid, dev->io + HP_IRQM); outb(inb(dev->io + HP_ICR) & ~HPICR_TREQ, dev->io + HP_ICR); outb(inb(dev->io + HP_ICR) | HPICR_RREQ, dev->io + HP_ICR); enable_irq(dev->irq); msnd_init_queue(dev->DSPQ, dev->dspq_data_buff, dev->dspq_buff_size); spin_unlock_irqrestore(&dev->lock, flags); return 0; } spin_unlock_irqrestore(&dev->lock, flags); printk(KERN_DEBUG LOGNAME ": Enable IRQ failed\n"); return -EIO; }
int msnd_disable_irq(multisound_dev_t *dev) { unsigned long flags; if (--dev->irq_ref > 0) return 0; if (dev->irq_ref < 0) ; ; spin_lock_irqsave(&dev->lock, flags); if (msnd_wait_TXDE(dev) == 0) { msnd_outb(msnd_inb(dev->io + HP_ICR) & ~HPICR_RREQ, dev->io + HP_ICR); if (dev->type == msndClassic) msnd_outb(HPIRQ_NONE, dev->io + HP_IRQM); disable_irq(dev->irq); spin_unlock_irqrestore(&dev->lock, flags); return 0; } spin_unlock_irqrestore(&dev->lock, flags); ; return -EIO; }
int msnd_enable_irq(multisound_dev_t *dev) { unsigned long flags; if (dev->irq_ref++) return 0; ; spin_lock_irqsave(&dev->lock, flags); if (msnd_wait_TXDE(dev) == 0) { msnd_outb(msnd_inb(dev->io + HP_ICR) | HPICR_TREQ, dev->io + HP_ICR); if (dev->type == msndClassic) msnd_outb(dev->irqid, dev->io + HP_IRQM); msnd_outb(msnd_inb(dev->io + HP_ICR) & ~HPICR_TREQ, dev->io + HP_ICR); msnd_outb(msnd_inb(dev->io + HP_ICR) | HPICR_RREQ, dev->io + HP_ICR); enable_irq(dev->irq); msnd_init_queue(dev->DSPQ, dev->dspq_data_buff, dev->dspq_buff_size); spin_unlock_irqrestore(&dev->lock, flags); return 0; } spin_unlock_irqrestore(&dev->lock, flags); ; return -EIO; }
int msnd_send_word(multisound_dev_t *dev, unsigned char high, unsigned char mid, unsigned char low) { register unsigned int io = dev->io; if (msnd_wait_TXDE(dev) == 0) { outb(high, io + HP_TXH); outb(mid, io + HP_TXM); outb(low, io + HP_TXL); return 0; } printk(KERN_DEBUG LOGNAME ": Send host word timeout\n"); return -EIO; }
int msnd_send_word(multisound_dev_t *dev, unsigned char high, unsigned char mid, unsigned char low) { register unsigned int io = dev->io; if (msnd_wait_TXDE(dev) == 0) { msnd_outb(high, io + HP_TXH); msnd_outb(mid, io + HP_TXM); msnd_outb(low, io + HP_TXL); return 0; } ; return -EIO; }