From 6041d44c20cc24df521743a9302e435620f67214 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 6 Mar 2000 02:58:07 +0000 Subject: [PATCH] fixes to compile for RTAI (doesn't work) --- comedi/realtime/vd_dds.c | 16 +++++++++++--- comedi/realtime/vd_timer.c | 44 ++++++++++++++++++++++++++++++++------ 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/comedi/realtime/vd_dds.c b/comedi/realtime/vd_dds.c index bab70f41..2f94dc6f 100644 --- a/comedi/realtime/vd_dds.c +++ b/comedi/realtime/vd_dds.c @@ -115,10 +115,10 @@ static void dds_ao_task_func(int d) if(ret<0){ /* eek! */ } -#ifdef CONFIG_COMEDI_RTAI +#ifdef CONFIG_COMEDI_RTL rt_task_wait(); #endif -#ifdef CONFIG_COMEDI_RTL +#ifdef CONFIG_COMEDI_RTAI rt_task_yield(); #endif } @@ -163,9 +163,15 @@ static int dds_ao_mode2(comedi_device *dev,comedi_subdevice *s,comedi_trig *it) ts.tv_sec=0; ts.tv_nsec=it->trigvar; - period=timespec_to_RTIME(ts); +#ifdef CONFIG_COMEDI_RTAI + //period=timespec_to_RTIME(ts); + //rt_task_init(&devpriv->rt_task,dds_ao_task_func,(int)dev,3000,4); +#endif +#ifdef CONFIG_COMEDI_RTL + period=timespec_to_RTIME(ts); rt_task_init(&devpriv->rt_task,dds_ao_task_func,(int)dev,3000,4); +#endif now=rt_get_time(); rt_task_make_periodic(&devpriv->rt_task,now+period,period); @@ -218,7 +224,11 @@ int dds_attach(comedi_device *dev,comedi_devconfig *it) s->range_table=devpriv->s->range_table; s->range_table_list=devpriv->s->range_table_list; +#ifdef CONFIG_COMEDI_RTAI +#endif +#ifdef CONFIG_COMEDI_RTL devpriv->soft_irq=rtl_get_soft_irq(dds_interrupt,"dds"); +#endif broken_rtl_dev=dev; printk("\n"); diff --git a/comedi/realtime/vd_timer.c b/comedi/realtime/vd_timer.c index dffe1091..bb69e588 100644 --- a/comedi/realtime/vd_timer.c +++ b/comedi/realtime/vd_timer.c @@ -121,9 +121,19 @@ static void timer_ai_task_func(int d) for(i=0;idata[i]); } +#ifdef CONFIG_COMEDI_RTL rt_task_wait(); +#endif +#ifdef CONFIG_COMEDI_RTAI + //rt_task_wait(); +#endif } +#ifdef CONFIG_COMEDI_RTL rtl_global_pend_irq(devpriv->soft_irq); +#endif +#ifdef CONFIG_COMEDI_RTAI + //rtl_global_pend_irq(devpriv->soft_irq); +#endif rt_task_delete(&devpriv->rt_task); @@ -137,11 +147,12 @@ static int timer_ai_mode0(comedi_device *dev,comedi_subdevice *s,comedi_trig *it static int timer_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd) { - if(cmd->scan_start_arg<100000) /* 10 khz */ - cmd->scan_start_arg=100000; - if(cmd->scan_start_arg>1e9) /* 1 hz */ - cmd->scan_start_arg=1e9; + if(cmd->scan_begin_arg<100000) /* 10 khz */ + cmd->scan_begin_arg=100000; + if(cmd->scan_begin_arg>1e9) /* 1 hz */ + cmd->scan_begin_arg=1e9; + return 0; } static int timer_cmd(comedi_device *dev,comedi_subdevice *s) @@ -149,6 +160,7 @@ static int timer_cmd(comedi_device *dev,comedi_subdevice *s) int ret; RTIME now,period; struct timespec ts; + comedi_cmd *cmd = &s->cmd; ret=comedi_lock_ioctl(devpriv->device,devpriv->subd); if(ret<0)return ret; @@ -166,10 +178,17 @@ static int timer_cmd(comedi_device *dev,comedi_subdevice *s) devpriv->trig.n=1; ts.tv_sec=0; - ts.tv_nsec=it->trigvar; - period=timespec_to_RTIME(ts); + ts.tv_nsec=cmd->scan_begin_arg; +#ifdef CONFIG_COMEDI_RTL + period=timespec_to_RTIME(ts); rt_task_init(&devpriv->rt_task,timer_ai_task_func,(int)dev,3000,4); +#endif +#ifdef CONFIG_COMEDI_RTAI + period = 0; + //period=timespec_to_RTIME(ts); + //rt_task_init(&devpriv->rt_task,timer_ai_task_func,(int)dev,3000,4); +#endif now=rt_get_time(); rt_task_make_periodic(&devpriv->rt_task,now+period,period); @@ -214,9 +233,15 @@ static int timer_ai_mode2(comedi_device *dev,comedi_subdevice *s,comedi_trig *it ts.tv_sec=0; ts.tv_nsec=it->trigvar; +#ifdef CONFIG_COMEDI_RTL period=timespec_to_RTIME(ts); - rt_task_init(&devpriv->rt_task,timer_ai_task_func,(int)dev,3000,4); +#endif +#ifdef CONFIG_COMEDI_RTAI + period = 0; + //period=timespec_to_RTIME(ts); + //rt_task_init(&devpriv->rt_task,timer_ai_task_func,(int)dev,3000,4); +#endif now=rt_get_time(); rt_task_make_periodic(&devpriv->rt_task,now+period,period); @@ -272,8 +297,13 @@ static int timer_attach(comedi_device *dev,comedi_devconfig *it) s->range_table=devpriv->s->range_table; s->range_table_list=devpriv->s->range_table_list; +#ifdef CONFIG_COMEDI_RTL devpriv->soft_irq=rtl_get_soft_irq(timer_interrupt,"timer"); broken_rtl_dev=dev; +#endif +#ifdef CONFIG_COMEDI_RTAI + //devpriv->soft_irq=rtl_get_soft_irq(timer_interrupt,"timer"); +#endif printk("\n"); -- 2.26.2