From 9e345b88846667b23bc3667ea350a8f53f386ab9 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sat, 12 May 2001 00:00:01 +0000 Subject: [PATCH] fixed spurious EINVAL errors on read and possibility of never becoming_nonbusy --- comedi/drivers/comedi_rt_timer.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/comedi/drivers/comedi_rt_timer.c b/comedi/drivers/comedi_rt_timer.c index dd364978..9538c319 100644 --- a/comedi/drivers/comedi_rt_timer.c +++ b/comedi/drivers/comedi_rt_timer.c @@ -162,6 +162,17 @@ static void timer_ai_task_func(int d) s->async->events = 0; for(n=0;nstop_arg;n++){ + /* pause goes at beginning so task can not be interrupted between + * writing last point to buffer (buf_add()) and comedi_done() + */ + if(n != 0){ +#ifdef CONFIG_COMEDI_RTL + rt_task_wait(); +#endif +#ifdef CONFIG_COMEDI_RTAI + rt_task_wait_period(); +#endif + } for(i=0;iscan_end_arg;i++){ ret = comedi_data_read(devpriv->device,devpriv->subd, CR_CHAN(cmd->chanlist[i]), @@ -176,12 +187,6 @@ static void timer_ai_task_func(int d) s->async->events |= COMEDI_CB_EOS; comedi_event(dev,s,s->async->events); s->async->events = 0; -#ifdef CONFIG_COMEDI_RTL - rt_task_wait(); -#endif -#ifdef CONFIG_COMEDI_RTAI - rt_task_wait_period(); -#endif } comedi_done(dev,s); #ifdef CONFIG_COMEDI_RTL @@ -299,8 +304,9 @@ static int timer_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd) int err = 0; int stop_src = TRIG_COUNT; - if(s == dev->write_subdev) - stop_src |= TRIG_NONE; +// stop_src TRIG_NONE does not work yet +// if(s == dev->write_subdev) +// stop_src |= TRIG_NONE; err = cmdtest_helper(cmd, TRIG_NOW, /* start_src */ -- 2.26.2