drivers/comedi/drivers/dmm32at.c
Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/dmm32at.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/drivers/dmm32at.c- Extension
.c- Size
- 18625 bytes
- Lines
- 661
- Domain
- Driver Families
- Bucket
- drivers/comedi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/delay.hlinux/interrupt.hlinux/comedi/comedidev.hlinux/comedi/comedi_8255.h
Detected Declarations
function dmm32at_ai_set_chanspecfunction dmm32at_ai_get_samplefunction dmm32at_ai_statusfunction dmm32at_ai_insn_readfunction dmm32at_ai_check_chanlistfunction dmm32at_ai_cmdtestfunction dmm32at_setaitimerfunction dmm32at_ai_cmdfunction dmm32at_ai_cancelfunction dmm32at_isrfunction dmm32at_ao_eocfunction dmm32at_ao_insn_writefunction dmm32at_8255_iofunction dmm32at_resetfunction dmm32at_attach
Annotated Snippet
if (chan != (chan0 + i) % s->n_chan) {
dev_dbg(dev->class_dev,
"entries in chanlist must be consecutive channels, counting upwards\n");
return -EINVAL;
}
if (range != range0) {
dev_dbg(dev->class_dev,
"entries in chanlist must all have the same gain\n");
return -EINVAL;
}
}
return 0;
}
static int dmm32at_ai_cmdtest(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
int err = 0;
unsigned int arg;
/* Step 1 : check if triggers are trivially valid */
err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW);
err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER);
err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER);
err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);
if (err)
return 1;
/* Step 2a : make sure trigger sources are unique */
err |= comedi_check_trigger_is_unique(cmd->stop_src);
/* Step 2b : and mutually compatible */
if (err)
return 2;
/* Step 3: check if arguments are trivially valid */
err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0);
err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, 1000000);
err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, 1000000000);
if (cmd->convert_arg >= 17500)
cmd->convert_arg = 20000;
else if (cmd->convert_arg >= 12500)
cmd->convert_arg = 15000;
else if (cmd->convert_arg >= 7500)
cmd->convert_arg = 10000;
else
cmd->convert_arg = 5000;
err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg,
cmd->chanlist_len);
if (cmd->stop_src == TRIG_COUNT)
err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1);
else /* TRIG_NONE */
err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0);
if (err)
return 3;
/* Step 4: fix up any arguments */
arg = cmd->convert_arg * cmd->scan_end_arg;
err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, arg);
if (err)
return 4;
/* Step 5: check channel list if it exists */
if (cmd->chanlist && cmd->chanlist_len > 0)
err |= dmm32at_ai_check_chanlist(dev, s, cmd);
if (err)
return 5;
return 0;
}
static void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec)
{
unsigned long irq_flags;
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/comedi/comedidev.h`, `linux/comedi/comedi_8255.h`.
- Detected declarations: `function dmm32at_ai_set_chanspec`, `function dmm32at_ai_get_sample`, `function dmm32at_ai_status`, `function dmm32at_ai_insn_read`, `function dmm32at_ai_check_chanlist`, `function dmm32at_ai_cmdtest`, `function dmm32at_setaitimer`, `function dmm32at_ai_cmd`, `function dmm32at_ai_cancel`, `function dmm32at_isr`.
- Atlas domain: Driver Families / drivers/comedi.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.