]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/main.c
LinCAN can be compiled in mode with RT-Linux chip worker threads now.
[lincan.git] / lincan / src / main.c
index 918c2f76ecb30a07ac7e4fc38e4dfaf40fe4fd8d..c40310dbde3cc2738d6189ce1488e27246056ec5 100644 (file)
@@ -154,6 +154,10 @@ int init_module(void)
                return -ENODEV;
        }
 
+       #ifdef CAN_WITH_RTL
+       canqueue_rtl_initialize();
+       #endif /*CAN_WITH_RTL*/
+
        for (i=0; i<hardware_p->nr_boards; i++) {
                candev=hardware_p->candevice[i];
                if (candev->hwspecops->request_io(candev)) 
@@ -175,14 +179,9 @@ int init_module(void)
                for(j=0; j<candev->nr_all_chips; j++) {
                        if((chip=candev->chip[j])==NULL)
                                continue;
-                       if(!chip->chipspecops->irq_handler)
-                               continue;
-                       
-                       if (request_irq(chip->chip_irq,chip->chipspecops->irq_handler,SA_SHIRQ,DEVICE_NAME,chip))
+                       if(can_chip_setup_irq(chip)<0) {
+                               CANMSG("IRQ setup failed\n");
                                goto interrupt_error;
-                       else {
-                               DEBUGMSG("Registered interrupt %d\n",chip->chip_irq);
-                               chip->flags |= CHIP_IRQ_SETUP;
                        }
                }
                
@@ -233,6 +232,10 @@ int init_module(void)
        memory_error: ;
                canhardware_done(hardware_p);
 
+               #ifdef CAN_WITH_RTL
+               canqueue_rtl_done();
+               #endif /*CAN_WITH_RTL*/
+
                res=unregister_chrdev(major,DEVICE_NAME);
                if (res<0)
                        CANMSG("Error unloading CAN driver, error: %d\n",res);
@@ -268,6 +271,10 @@ void cleanup_module(void)
 
        canhardware_done(hardware_p);
 
+       #ifdef CAN_WITH_RTL
+       canqueue_rtl_done();
+       #endif /*CAN_WITH_RTL*/
+
        if ( can_del_mem_list() ) 
                CANMSG("Error deallocating memory\n");