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.)
COMEDI_INITCLEANUP(driver_timer);
-
typedef struct{
int device;
int subd;
#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);
}
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);
}
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);
}
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;
}
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;
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;
}
{
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;
}