From: Frank Mori Hess Date: Fri, 11 May 2001 04:29:11 +0000 (+0000) Subject: added hack to fix broken rtlinux compatibility headers and let driver work for more... X-Git-Tag: r0_7_59~50 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=78028e71a329a5dd1bc991ffcd7f378ca07be480;p=comedi.git added hack to fix broken rtlinux compatibility headers and let driver work for more than a half hour --- diff --git a/comedi/drivers/comedi_rt_timer.c b/comedi/drivers/comedi_rt_timer.c index 55872d06..0574f846 100644 --- a/comedi/drivers/comedi_rt_timer.c +++ b/comedi/drivers/comedi_rt_timer.c @@ -35,6 +35,26 @@ #include #include #include + +// begin hack to fix HRT_TO_8254() function on rtlinux +#undef HRT_TO_8254(x) +#define HRT_TO_8254(x) nano2tick_hack(x) +long long nano2tick_hack(long long ns) +{ + unsigned long most = ns >> 32; + unsigned long least = ns; + unsigned long denom = 838; + unsigned long remainder = (most % denom); + + most /= denom; + least = remainder * (0xffffffff / denom) + (remainder + least) / denom; + + ns = (long long) most * (long long) 0x100000000 + (long long) least; + + return ns; +} +// end hack + #endif #ifdef CONFIG_COMEDI_RTAI #include @@ -44,7 +64,6 @@ /* 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); static comedi_driver driver_timer={ @@ -335,7 +354,6 @@ static int timer_cmd(comedi_device *dev,comedi_subdevice *s) comedi_error(dev, "error initalizing task"); return ret; } - now=rt_get_time(); ret = rt_task_make_periodic(&devpriv->rt_task,now+delay,period); if(ret < 0)