Esempio n. 1
0
int comedi_buf_get(struct comedi_async *async, short *x)
{
    unsigned int n = comedi_buf_read_n_available(async);

    if (n < sizeof(short))
        return 0;
    comedi_buf_read_alloc(async, sizeof(short));
    *x = *(short *)(async->prealloc_buf + async->buf_read_ptr);
    comedi_buf_read_free(async, sizeof(short));
    return 1;
}
Esempio n. 2
0
int comedi_get_buffer_contents(void *d, unsigned int subdevice)
{
	struct comedi_device *dev = (struct comedi_device *) d;
	struct comedi_subdevice *s = dev->subdevices + subdevice;
	struct comedi_async *async;
	unsigned int num_bytes;

	if (subdevice >= dev->n_subdevices)
		return -1;
	async = s->async;
	if (async == NULL)
		return 0;
	num_bytes = comedi_buf_read_n_available(s->async);
	return num_bytes;
}