From: David Schleef Date: Tue, 3 Apr 2001 09:19:10 +0000 (+0000) Subject: Fixes for comedi_rt_timer. Still needs work; doesn't even X-Git-Tag: r0_7_58~27 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1375b7c758a588c2a1c958a157ba726d479da146;p=comedi.git Fixes for comedi_rt_timer. Still needs work; doesn't even compile right now. --- diff --git a/comedi/Config.in b/comedi/Config.in index 937e3c4b..86c1ee4b 100644 --- a/comedi/Config.in +++ b/comedi/Config.in @@ -106,6 +106,6 @@ dep_tristate 'Generic ISA driver for simple boards' CONFIG_COMEDI_POC $CONFIG_CO dep_tristate 'Skeleton driver' CONFIG_COMEDI_SKEL $CONFIG_COMEDI if [ "$CONFIG_COMEDI_RT" = "y" ];then - dep_tristate 'Real-time command emulator (timer)' CONFIG_COMEDI_XXX $CONFIG_COMEDI + dep_tristate 'Real-time command emulator (timer)' CONFIG_COMEDI_RT_TIMER $CONFIG_COMEDI fi diff --git a/comedi/drivers/Makefile b/comedi/drivers/Makefile index d6b1e48a..b68ceed8 100644 --- a/comedi/drivers/Makefile +++ b/comedi/drivers/Makefile @@ -70,13 +70,13 @@ obj-$(CONFIG_COMEDI_QUATECH_DAQP) += quatech_daqp_cs.o obj-$(CONFIG_COMEDI_PARPORT) += comedi_parport.o +obj-$(CONFIG_COMEDI_RT_TIMER) += comedi_rt_timer.o + obj-$(CONFIG_COMEDI_RTI800) += rti800.o obj-$(CONFIG_COMEDI_RTI802) += rti802.o obj-$(CONFIG_COMEDI_SKEL) += skel.o -obj-$(CONFIG_COMEDI_RT_TIMER) += comedi_rt_timer.o - #obj-m += $(obj-y) O_OBJS := $(sort $(filter-out $(export-objs), $(obj-y))) diff --git a/comedi/drivers/comedi_rt_timer.c b/comedi/drivers/comedi_rt_timer.c index a041ed03..2a09d791 100644 --- a/comedi/drivers/comedi_rt_timer.c +++ b/comedi/drivers/comedi_rt_timer.c @@ -23,15 +23,7 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include #ifdef CONFIG_COMEDI_RTL_V1 @@ -48,9 +40,14 @@ #include #endif +/* Change this if you need more channels */ +#define N_CHANLIST 16 + + static int timer_attach(comedi_device *dev,comedi_devconfig *it); static int timer_detach(comedi_device *dev); comedi_driver driver_timer={ + module: THIS_MODULE, driver_name: "timer", attach: timer_attach, detach: timer_detach, @@ -66,9 +63,11 @@ typedef struct{ comedi_device *dev; comedi_subdevice *s; RT_TASK rt_task; - sampl_t *data; - comedi_trig trig; int soft_irq; + int n_chan; + int n_samples; + int chanlist[N_CHANLIST]; + lsampl_t data[N_CHANLIST]; }timer_private; #define devpriv ((timer_private *)dev->private) @@ -86,9 +85,9 @@ static void timer_interrupt(int irq,void *d,struct pt_regs * regs) static inline void buf_add(comedi_device *dev,comedi_subdevice *s,sampl_t x) { - *(sampl_t *)(((void *)(s->cur_trig.data))+s->buf_int_ptr)=x&0xfff; + *(sampl_t *)((s->async->data)+s->buf_int_ptr)=x&0xfff; s->buf_int_ptr+=sizeof(sampl_t); - if(s->buf_int_ptr>=s->cur_trig.data_len){ + if(s->buf_int_ptr>=s->async->data_len){ s->buf_int_ptr=0; comedi_eobuf(dev,s); } @@ -105,19 +104,25 @@ static void timer_ai_task_func(int d) int i,n,ret; int n_chan; - n_chan=s->cur_trig.n_chan; + n_chan=devpriv->n_chan; - for(n=0;nn;n++){ + for(n=0;nn;n++){ for(i=0;in_chan=1; it->data=devpriv->data+i; - it->chanlist=my_trig->chanlist+i; - - ret=comedi_trig_ioctl(devpriv->device,devpriv->subd,it); + it->chanlist=devpriv->chanlist+i; + ret = comedi_data_read(devpriv->device,devpriv->subd, + CR_CHAN(devpriv->chanlist[i]), + CR_RANGE(devpriv->chanlist[i]), + CR_AREF(devpriv->chanlist[i]), + &data); if(ret<0){ /* eek! */ } + + devpriv->data[i]=data; + } for(i=0;idata[i]); @@ -316,7 +321,9 @@ static int timer_detach(comedi_device *dev) { printk("comedi%d: timer: remove\n",dev->minor); +#ifdef CONFIG_COMEDI_RTL free_irq(devpriv->soft_irq,NULL); +#endif return 0; }