Added support for VME bus under RT Linux.
authorwentasah <wentasah>
Mon, 30 Aug 2004 19:43:19 +0000 (19:43 +0000)
committerwentasah <wentasah>
Mon, 30 Aug 2004 19:43:19 +0000 (19:43 +0000)
lincan/src/can_devrtl.c

index 25b8b48..5db8b82 100644 (file)
 
 #include <rtl_malloc.h>
 
+#ifdef CAN_ENABLE_VME_SUPPORT
+#include "ca91c042.h"
+/* Modified version of ca91c042 driver can be found in
+ * components/comm/contrib directory. */
+#endif
+
 can_spinlock_t can_irq_manipulation_lock;
 
 unsigned int can_rtl_isr( unsigned int irq_num, struct pt_regs *r )
@@ -160,7 +166,15 @@ int can_chip_setup_irq(struct chip_t *chip)
        }
        
        if(chip->chipspecops->irq_handler){
-               if (rtl_request_irq(chip->chip_irq,can_rtl_isr))
+               int (*my_request_irq)(unsigned int vector, unsigned int (*rtl_handler)(unsigned int irq, struct pt_regs *regs));
+#ifdef CAN_ENABLE_VME_SUPPORT
+               if ((chip->flags & CHIP_IRQ_VME) != 0)
+                       my_request_irq = rtl_request_vmeirq;
+               else
+#endif
+                       my_request_irq = rtl_request_irq;
+
+               if (my_request_irq(chip->chip_irq,can_rtl_isr))
                        return -1;
                else {
                        DEBUGMSG("Registered interrupt %d\n",chip->chip_irq);
@@ -179,7 +193,14 @@ void can_chip_free_irq(struct chip_t *chip)
        if(chip->worker_thread)
                pthread_delete_np(chip->worker_thread);
        if((chip->flags & CHIP_IRQ_SETUP) && (chip->chip_irq>=0)) {
-               rtl_free_irq(chip->chip_irq);
+               int (*my_free_irq)(unsigned int vector);
+#ifdef CAN_ENABLE_VME_SUPPORT
+               if ((chip->flags & CHIP_IRQ_VME) != 0)
+                       my_free_irq = rtl_free_vmeirq;
+               else
+#endif
+                       my_free_irq = rtl_free_irq;
+               my_free_irq(chip->chip_irq);
                chip->flags &= ~CHIP_IRQ_SETUP;
        }
 }