// SPDX-License-Identifier: GPL-2.0+ /* * kcomedilib/kcomedilib.c * a comedlib interface for kernel modules * * COMEDI - Linux Control and Measurement Device Interface * Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
*/
/* * Most drivers ignore the base channel in insn->chanspec. * Fix this here if the subdevice has <= 32 channels.
*/ if (n_chan <= 32) {
shift = base_channel; if (shift) {
insn.chanspec = 0;
data[0] <<= shift;
data[1] <<= shift;
}
} else {
shift = 0;
}
int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, unsignedint subd)
{ struct comedi_subdevice *s; int ret = -ENODEV;
down_read(&dev->attach_lock); if (dev->attached) for (; subd < dev->n_subdevices; subd++) {
s = &dev->subdevices[subd]; if (s->type == type) {
ret = subd; break;
}
}
up_read(&dev->attach_lock); return ret;
}
EXPORT_SYMBOL_GPL(comedi_find_subdevice_by_type);
int comedi_get_n_channels(struct comedi_device *dev, unsignedint subdevice)
{ int n;
down_read(&dev->attach_lock); if (!dev->attached || subdevice >= dev->n_subdevices)
n = 0; else
n = dev->subdevices[subdevice].n_chan;
up_read(&dev->attach_lock);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.