interrupt.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /***************************************************************************
  2. ines/interrupt.c
  3. -------------------
  4. begin : Dec 2001
  5. copyright : (C) 2001, 2002 by Frank Mori Hess
  6. email : fmhess@users.sourceforge.net
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. #include "ines.h"
  17. #include <asm/bitops.h>
  18. #include <asm/dma.h>
  19. #include <linux/sched.h>
  20. /*
  21. * GPIB interrupt service routines
  22. */
  23. irqreturn_t ines_pci_interrupt(int irq, void *arg PT_REGS_ARG)
  24. {
  25. gpib_board_t *board = arg;
  26. ines_private_t *priv = board->private_data;
  27. nec7210_private_t *nec_priv = &priv->nec7210_priv;
  28. if(priv->pci_chip_type == PCI_CHIP_QUANCOM )
  29. {
  30. if((inb((unsigned long)nec_priv->iobase + QUANCOM_IRQ_CONTROL_STATUS_REG) & QUANCOM_IRQ_ASSERTED_BIT))
  31. outb(QUANCOM_IRQ_ENABLE_BIT, (unsigned long)(nec_priv->iobase) + QUANCOM_IRQ_CONTROL_STATUS_REG );
  32. }
  33. return ines_interrupt(board);
  34. }
  35. irqreturn_t ines_interrupt(gpib_board_t *board)
  36. {
  37. ines_private_t *priv = board->private_data;
  38. nec7210_private_t *nec_priv = &priv->nec7210_priv;
  39. unsigned int isr3_bits, isr4_bits;
  40. unsigned long flags;
  41. int wake = 0;
  42. spin_lock_irqsave( &board->spinlock, flags );
  43. nec7210_interrupt( board, nec_priv );
  44. isr3_bits = ines_inb( priv, ISR3 );
  45. isr4_bits = ines_inb( priv, ISR4 );
  46. if( isr3_bits & IFC_ACTIVE_BIT )
  47. {
  48. push_gpib_event( board, EventIFC );
  49. wake++;
  50. }
  51. if( isr3_bits & FIFO_ERROR_BIT )
  52. printk( "ines gpib: fifo error\n" );
  53. if( isr3_bits & XFER_COUNT_BIT )
  54. wake++;
  55. if( isr4_bits & ( IN_FIFO_WATERMARK_BIT | IN_FIFO_FULL_BIT | OUT_FIFO_WATERMARK_BIT |
  56. OUT_FIFO_EMPTY_BIT ) )
  57. wake++;
  58. if(wake) wake_up_interruptible(&board->wait);
  59. spin_unlock_irqrestore( &board->spinlock, flags );
  60. return IRQ_HANDLED;
  61. }