- From: Alex Fielding <afielding_at_adelphia.net>
- Date: Sun, 2 May 2004 22:09:42 -0400
Is there a way to make software-triggered DMA scans automatically (and
quickly) recycle the trigger when completed?
I can recycle the trigger now by issuing comedi_cancel() / comedi_command(),
but that takes too much time and I find my fastest interrupt time is around
100 microseconds.
I tried setting,
s->async->inttrig=1
in my real-time interrupt (looking into kcomedilib_main to see how to define
s) , but that generated an exception and so I imagine it's not the way to do
it.
Alex
Here's the code setup to try to do this now and the output. Once the
pre-set number of scans are completed, new trigger commands are ignored.
issue command to collect 40 scans
// command ------------
cmd.subdev = 0;
cmd.flags = 0;
cmd.flags |= TRIG_WAKE_EOS;
cmd.start_src = TRIG_INT;
cmd.start_arg = 0;
cmd.scan_begin_src = TRIG_TIMER;
cmd.scan_begin_arg = 800;
cmd.convert_src = TRIG_TIMER;
cmd.convert_arg = 800;
cmd.scan_end_src = TRIG_COUNT;
cmd.scan_end_arg = 1;
cmd.stop_src = TRIG_COUNT;
cmd.stop_arg = 40;
// ---------------------
// instruction setup ------------
comedi_insn inst;
unsigned int id[1];
inst.insn= INSN_INTTRIG;
inst.n= 1;
id[0]= 0;
inst.data= id;
inst.subdev= ADC_SUBDEVICE;
// ---------------------
// -------- real-time interrupt ----------------
tv1= clock_gethrtime( CLOCK_REALTIME);
dt= tv1-tv0;
ret1= comedi_poll(cm_device, ADC_SUBDEVICE);
ret2= comedi_get_buffer_contents(cm_device, ADC_SUBDEVICE);
if (ret2!=0)
comedi_mark_buffer_read(cm_device, ADC_SUBDEVICE, ret2);
ret3= comedi_do_insn( cm_device, &inst);
rtl_printf("rtdma_mod.o: %3d, dt= %6d nsec, poll= %d, buffer= %d, insn
INTTRIG= %d\n", Count, dt, ret1, ret2, ret3);
Count++;
tv0= tv1;
// ---------------------------------------------
rtdma_mod.o: comedi buffer size= 65536 bytes
rtdma_mod.o: comedi buffer address= 0xd09d4000
rtdma_mod.o: command test 1 returned 0
rtdma_mod.o: command test 2 returned 0
comedi: cannot switch shared interrupt to RT priority
rtdma_mod.o: command exec returned 0
rtdma_mod.o: DMA thread: Start Task
rtdma_mod.o: 0, dt= 4896 nsec, poll= 0, buffer= 0, insn INTTRIG= 1
no inttrig
rtdma_mod.o: 1, dt= 57728 nsec, poll= 80, buffer= 80, insn INTTRIG= -11
no inttrig
rtdma_mod.o: 2, dt= 53280 nsec, poll= 0, buffer= 0, insn INTTRIG= -11
no inttrig
rtdma_mod.o: 3, dt= 37216 nsec, poll= 0, buffer= 0, insn INTTRIG= -11
no inttrig
rtdma_mod.o: 4, dt= 62464 nsec, poll= 0, buffer= 0, insn INTTRIG= -11
no inttrig
rtdma_mod.o: 5, dt= 45408 nsec, poll= 0, buffer= 0, insn INTTRIG= -11
no inttrig
rtdma_mod.o: 6, dt= 50304 nsec, poll= 0, buffer= 0, insn INTTRIG= -11
Received on 2004-05-03Z01:09:42