Re: Calling Comedi functions in RTLinux

>
> +++++++++++++++++++++++++++++++++++++++++++++++++
> RTLinux Code
> +++++++++++++++++++++++++++++++++++++++++++++++++
>
> #include <rtl.h>
> #include <time.h>
> #include <rtl_sched.h>
> #include <rtl_fifo.h>
> #include <pthread.h>
> #include <rtl_time.h>
>
> #include "/usr/src/comedi-0.7.66/include/linux/comedilib.h"
>
> int subdev = 0;
> int chan = 0;
> int range = 0;
> int aref = AREF_GROUND;
> comedi_t *it;
>
> pthread_t thread;
>
> void * start_routine(void *arg)
> {
>   struct sched_param p;
>
>   p.sched_priority = 1;
>   pthread_setschedparam (pthread_self(), SCHED_FIFO, &p);
>
>   pthread_make_periodic_np (pthread_self(), gethrtime(), 100000000);
>
>   while (1)
>   {
>     lsampl_t data;
>     it=comedi_open("/dev/comedi0");

I am not sure if calling comedi_open() from realtime is a safe thing to
do..

>     comedi_data_read(it,subdev,chan,range,aref,&data);
>     rtl_printf("%d\n",data);
>     pthread_wait_np();
>   }
>   return 0;
> }

Received on 2003-06-30Z16:18:47