Added skeleton of IRQ support on VME bus
authorwentasah <wentasah>
Tue, 27 Apr 2004 16:34:15 +0000 (16:34 +0000)
committerwentasah <wentasah>
Tue, 27 Apr 2004 16:34:15 +0000 (16:34 +0000)
lincan/include/constants.h
lincan/src/setup.c

index e466e2d..4e18c7b 100644 (file)
@@ -73,6 +73,7 @@
 #define CHIP_SEGMENTED   (1<<1)
 #define CHIP_IRQ_SETUP   (1<<2)
 #define CHIP_IRQ_PCI     (1<<3)
 #define CHIP_SEGMENTED   (1<<1)
 #define CHIP_IRQ_SETUP   (1<<2)
 #define CHIP_IRQ_PCI     (1<<3)
+#define CHIP_IRQ_VME     (1<<4)
 
 /* These flags can be used for the candevices_t structure flags data entry */
 #define CANDEV_PROGRAMMABLE_IRQ (1<<0)
 
 /* These flags can be used for the candevices_t structure flags data entry */
 #define CANDEV_PROGRAMMABLE_IRQ (1<<0)
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(!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;
 }
        }
        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)) {
 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;
        }
 }
 
        }
 }