- From: Tomasz Motylewski <motyl_at_stan.chemie.unibas.ch>
- Date: Sat, 19 Oct 2002 20:35:16 +0200 (CEST)
Well, I have RT kernel application which uses Comedi just to set up the
channel list and DMA transfer to a given buffer and then only querries
the present position in the buffer. I want the driver to just set up a
circular DMA ring and then to leave the hardware alone. It was working
fine with comedi CVS from about Sat Jul 14 02:33:13 2001
(ni_pcimio.c/1.37-8, ni_mio_common.c/1.86-7)
But now I am getting the "ni_mio_common: buffer overflow" error
with:
int shm_buf_alloc(comedi_device *dev, comedi_subdevice *s, unsigned long new_size) {
comedi_async *async = s->async;
if(new_size == 0 || new_size > sizeof(sampl_t)*IN_BUFFER) {
async->prealloc_buf = NULL;
async->prealloc_bufsz = 0;
return -ENOMEM;
}
async->prealloc_buf = ((char*)shd + DATA_OFFSET);
async->prealloc_bufsz = new_size;
mite_load_buffer(devpriv->mite,async);
return 0;
}
.........
memset(cmd,0,sizeof(*cmd));
cmd->subdev = shd->analog_input_sdev0;
cmd->flags = CMDF_RAWDATA; //TRIG_RT;
cmd->start_src = TRIG_NOW;
cmd->start_arg = 0;
cmd->scan_begin_src = TRIG_TIMER;
cmd->scan_begin_arg = S_SAMPLES*800;
cmd->scan_end_src = TRIG_COUNT;
cmd->scan_end_arg = S_SAMPLES;
cmd->convert_src = TRIG_TIMER;
cmd->convert_arg = 800; //1000/shd->crd_sampl_frq;
shd->crd_sampl_frq = 1000.0/cmd->convert_arg;
cmd->stop_src=TRIG_NONE;
cmd->stop_arg=0;
cmd->chanlist = shd->chq;
cmd->chanlist_len = S_SAMPLES;
cmd->data = (sampl_t *)((char*)shd + DATA_OFFSET);
data = (volatile short int*) (cmd->data);
rtl_printf("data: %p\n", data);
cmd->data_len = IN_BUFFER * sizeof(sampl_t);
printk("measure_setup , %p %d\n", pci_mio_fd, cmd->subdev);
if(shd->analog_input_buf_alloc0 == NULL) {
comedi_device *dev = (comedi_device *)pci_mio_fd;
comedi_subdevice *s = dev->subdevices+cmd->subdev;
comedi_async *async = s->async;
s->buf_alloc(dev, s, 0); // free internal COMEDI buffer
printk("measure_setup freed buffer\n");
shd->analog_input_buf_alloc0 = s->buf_alloc; // save original function
s->buf_alloc = shm_buf_alloc; // substitute our own
s->buf_alloc(dev, s, cmd->data_len);
printk("measure_setup allocated buffer\n");
}
comedi_command(pci_mio_fd, cmd);
Is it now possible to set up a continuous transfer which just runs by
itself?
Best regards,
--
Tomasz Motylewski
Received on 2002-10-19Z17:35:16