exported rt_pend_call() so that comedi_rt_timer can be configured multiple times
authorFrank Mori Hess <fmhess@speakeasy.net>
Sat, 19 May 2001 04:15:52 +0000 (04:15 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sat, 19 May 2001 04:15:52 +0000 (04:15 +0000)
comedi/comedi_ksyms.c
comedi/drivers/comedi_rt_timer.c
include/linux/comedi_rt.h

index 6c7126dc381dd035943a537fa9b7ed6f05845426..c46f0e545996bf0570867823b947978ea48650a5 100644 (file)
@@ -58,6 +58,7 @@ EXPORT_SYMBOL(comedi_free_irq);
 EXPORT_SYMBOL(comedi_request_irq);
 EXPORT_SYMBOL(comedi_switch_to_rt);
 EXPORT_SYMBOL(comedi_switch_to_non_rt);
+EXPORT_SYMBOL(rt_pend_call);
 #endif
 
 /* for kcomedilib */
index dc60111bbf9ac4159999d6eb0c55ee11176ab103..97c6ebf603c27fca6fe24a5a6de83d99d8eefb3f 100644 (file)
@@ -31,8 +31,6 @@ Options:
 TODO:
        Support for digital io commands could be added, except I can't see why
                anyone would want to use them
-       Fix it so more that one comedi_rt_timer can be configured at once
-               (replace broken_rt_dev)
        What happens if device we are emulating for is de-configured?
        Make it work from kernel space (fix problems with comedi_switch_to_rt() etc.)
 
@@ -107,7 +105,6 @@ static comedi_driver driver_timer={
 COMEDI_INITCLEANUP(driver_timer);
 
 
-
 typedef struct{
        int device;
        int subd;
@@ -119,16 +116,9 @@ typedef struct{
 #define devpriv ((timer_private *)dev->private)
 
 
-static comedi_device *broken_rt_dev = NULL;
-
-#ifdef CONFIG_COMEDI_RTL
-static void timer_interrupt(int irq,void *d,struct pt_regs * regs)
-#endif
-#ifdef CONFIG_COMEDI_RTAI
-static void timer_interrupt(void)
-#endif
+static void timer_interrupt(int unused, void *device)
 {
-       comedi_device *dev=broken_rt_dev;
+       comedi_device *dev = (comedi_device*)device;
 
        comedi_unlock(devpriv->device,devpriv->subd);
 }
@@ -207,7 +197,7 @@ static void timer_ai_task_func(int d)
 
 cleanup:
 
-       rt_pend_linux_srq(devpriv->soft_irq);
+       rt_pend_call(timer_interrupt, 0, dev);
        // we are deleting ourself here, no lines afterwards will be executed!
        rt_task_delete(&devpriv->rt_task);
 }
@@ -253,7 +243,7 @@ static void timer_ao_task_func(int d)
 
 cleanup:
 
-       rt_pend_linux_srq(devpriv->soft_irq);
+       rt_pend_call(timer_interrupt, 0, dev);
        // we are deleting ourself here, no lines afterwards will be executed!
        rt_task_delete(&devpriv->rt_task);
 }
@@ -428,7 +418,7 @@ static int timer_cmd(comedi_device *dev,comedi_subdevice *s)
 static int timer_cancel(comedi_device *dev,comedi_subdevice *s)
 {
        rt_task_delete(&devpriv->rt_task);
-       rt_pend_linux_srq(devpriv->soft_irq);
+       rt_pend_call(timer_interrupt, 0, dev);
 
        return 0;
 }
@@ -440,13 +430,6 @@ static int timer_attach(comedi_device *dev,comedi_devconfig *it)
 
        printk("comedi%d: timer: ",dev->minor);
 
-       if(broken_rt_dev)
-       {
-               printk("Only a single comedi_rt_timer can be configured at once.\n"
-                       " Hopefully this will be fixed in the future.\n");
-               return -EBUSY;
-       }
-
        dev->board_name="timer";
 
        dev->n_subdevices=2;
@@ -510,15 +493,6 @@ static int timer_attach(comedi_device *dev,comedi_devconfig *it)
                s->type=COMEDI_SUBD_UNUSED;
        }
 
-       devpriv->soft_irq=rt_request_srq(0,timer_interrupt,NULL);
-       if(devpriv->soft_irq < 0)
-       {
-               return devpriv->soft_irq;
-       }
-       broken_rt_dev=dev;
-
-       printk("\n");
-
        return 1;
 }
 
@@ -527,17 +501,6 @@ static int timer_detach(comedi_device *dev)
 {
        printk("comedi%d: timer: remove\n",dev->minor);
 
-       // make sure dev->private was sucessfully allocated
-       if(devpriv)
-       {
-               if(devpriv->soft_irq > 0)
-               {
-                       rt_free_srq(devpriv->soft_irq);
-               }
-       }
-
-       broken_rt_dev = NULL;
-
        return 0;
 }
 
index 64225872ca5443aff1c0d05b74676371f004e9f8..53c6b772c6e86db5c22bd38e918353afb54795e0 100644 (file)
@@ -55,6 +55,7 @@ void comedi_rt_cleanup(void);
 void comedi_switch_to_rt(comedi_device *dev);
 void comedi_switch_to_non_rt(comedi_device *dev);
 void comedi_rt_pend_wakeup(wait_queue_head_t *q);
+extern int rt_pend_call(void (*func)(int arg1, void * arg2), int arg1, void * arg2);
 
 #else