Added skeleton of IRQ support on VME bus
[lincan.git] / lincan / src / setup.c
index 83eef72..c071b00 100644 (file)
@@ -611,11 +611,19 @@ int can_chip_setup_irq(struct chip_t *chip)
        if(!chip->chipspecops->irq_handler)
                return 0;
                        
-       if (request_irq(chip->chip_irq,chip->chipspecops->irq_handler,SA_SHIRQ,DEVICE_NAME,chip))
-               return -1;
-       else {
-               DEBUGMSG("Registered interrupt %d\n",chip->chip_irq);
-               chip->flags |= CHIP_IRQ_SETUP;
+       if ((chip->flags & CHIP_IRQ_VME) == 0) {
+               if (request_irq(chip->chip_irq,chip->chipspecops->irq_handler,SA_SHIRQ,DEVICE_NAME,chip))
+                       return -1;
+               else {
+                       DEBUGMSG("Registered interrupt %d\n",chip->chip_irq);
+                       chip->flags |= CHIP_IRQ_SETUP;
+               }
+       } else {
+#ifdef CAN_ENABLE_VME_SUPPORT          
+               /* TODO: Move here the irq setup from
+                * unican_vme_request_io(). To do this, the VME bridge
+                * driver should be modified. */
+#endif
        }
        return 1;
 }
@@ -628,8 +636,16 @@ int can_chip_setup_irq(struct chip_t *chip)
 void can_chip_free_irq(struct chip_t *chip)
 {
        if((chip->flags & CHIP_IRQ_SETUP) && (chip->chip_irq>=0)) {
-               free_irq(chip->chip_irq, chip);
-               chip->flags &= ~CHIP_IRQ_SETUP;
+               if ((chip->flags & CHIP_IRQ_VME) == 0)
+                       free_irq(chip->chip_irq, chip);
+               else { 
+#ifdef CAN_ENABLE_VME_SUPPORT
+               /* TODO: Move here the irq cleanup from
+                * unican_vme_release_io(). To do this, the VME bridge
+                * driver should be modified. */
+#endif
+               }
+                       chip->flags &= ~CHIP_IRQ_SETUP;
        }
 }