comedi instructions in RTAI

Hi All,

I'm using RTAI 3.1 and comedi69/comedilib22 to do a small RT application
that reads voltage in the AI0 of my daq card (NI6062E) and writes out
(sample by sample) to my output channel AO0 using FIFO's. The function
in the module looks like this:

	comedi_data_read(device,subdevice,chan,range,aref,&datab);
	mv=100*(((float)datab/4096)*10-5);
	tauh=10000/(237*exp((mv+60)/12)+17*exp(-(mv+60)/25))+0.6;
	hinf=1/(1+exp((mv+76)/7));
	h=hinf+(h-hinf)*exp(-0.2/tauh);
	ih=h*(mv+45);
	pdatab=(int)(ih*10)+2048;
	comedi_data_write(device,1,chan,0,aref,pdatab);
	rtf_put(FIFO, &counter, sizeof(ih));
	rtf_put(FIFO, &mv, sizeof(mv));
	rt_task_wait_period();

That works beautifully but then I needed to read the voltage from
another channel and I decided to use comedi instructions following the
example they have in the comedi website:

  comedi_insn insn[2];
  comedi_insnlist il;
...
  il.n_insns=3;
  il.insns=insn;

  /* Instruction 0: perform a gettimeofday() */
  insn[0].insn=INSN_READ;
  insn[0].n=1;
  insn[0].data=&datab;
  insn[0].subdev=subdevice;
  insn[0].chanspec=CR_PACK(0,range,aref);

  insn[1].insn=INSN_READ;
  insn[1].n=1;
  insn[1].data=&datac;
  insn[1].subdev=subdevice;
  insn[1].chanspec=CR_PACK(channel,range,aref);

ret=comedi_do_insnlist(device,&il);

 It compile OK but when I load the module it says that the module cannot be loaded because
comedi_do_insnlist is not a known function.

My includes in the module are the following:

#include <linux/module.h>
#include <asm/io.h>
#include <math.h>
#include <rtai.h>
#include <rtai_sched.h>
#include <rtai_fifos.h>
#include <linux/comedi.h>
#include <linux/comedilib.h>

and I have the following modules loaded in the kernel:

rtai_hal
rtai_ksched
rtai_math
rtai_fifos
rtai_comedi
comedi
kcomedilib
ni_mio_cs

I suppose I either have to load another module or include something else to my code, or maybe it's not possible to use 
comedi_do_insnlist in rtai threads. Does anybody have any idea??? Many thanks.

richard



-- 
Dr Richard Leao <richardson.leao_at_anu.edu.au>
Division of Neuroscience, JCSMR,
Australian National University

Received on 2004-11-30Z23:26:43