drivers/comedi/drivers/pcl818.c
Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/pcl818.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/drivers/pcl818.c- Extension
.c- Size
- 30345 bytes
- Lines
- 1156
- 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.
- 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/gfp.hlinux/delay.hlinux/io.hlinux/interrupt.hlinux/comedi/comedidev.hlinux/comedi/comedi_8254.hlinux/comedi/comedi_isadma.h
Detected Declarations
struct pcl818_boardstruct pcl818_privatefunction pcl818_ai_setup_dmafunction pcl818_ai_set_chan_rangefunction pcl818_ai_set_chan_scanfunction pcl818_ai_setup_chanlistfunction pcl818_ai_clear_eocfunction pcl818_ai_soft_trigfunction pcl818_ai_get_fifo_samplefunction pcl818_ai_get_samplefunction pcl818_ai_eocfunction pcl818_ai_write_samplefunction pcl818_handle_eocfunction pcl818_handle_dmafunction pcl818_handle_fifofunction pcl818_interruptfunction check_channel_listfunction check_single_endedfunction ai_cmdtestfunction pcl818_ai_cmdfunction pcl818_ai_cancelfunction pcl818_ai_insn_readfunction pcl818_ao_insn_writefunction pcl818_di_insn_bitsfunction pcl818_do_insn_bitsfunction pcl818_resetfunction pcl818_set_ai_range_tablefunction pcl818_alloc_dmafunction pcl818_free_dmafunction pcl818_attachfunction pcl818_detach
Annotated Snippet
struct pcl818_board {
const char *name;
unsigned int ns_min;
int n_aochan;
const struct comedi_lrange *ai_range_type;
unsigned int has_dma:1;
unsigned int has_fifo:1;
unsigned int is_818:1;
};
static const struct pcl818_board boardtypes[] = {
{
.name = "pcl818l",
.ns_min = 25000,
.n_aochan = 1,
.ai_range_type = &range_pcl818l_l_ai,
.has_dma = 1,
.is_818 = 1,
}, {
.name = "pcl818h",
.ns_min = 10000,
.n_aochan = 1,
.ai_range_type = &range_pcl818h_ai,
.has_dma = 1,
.is_818 = 1,
}, {
.name = "pcl818hd",
.ns_min = 10000,
.n_aochan = 1,
.ai_range_type = &range_pcl818h_ai,
.has_dma = 1,
.has_fifo = 1,
.is_818 = 1,
}, {
.name = "pcl818hg",
.ns_min = 10000,
.n_aochan = 1,
.ai_range_type = &range_pcl818hg_ai,
.has_dma = 1,
.has_fifo = 1,
.is_818 = 1,
}, {
.name = "pcl818",
.ns_min = 10000,
.n_aochan = 2,
.ai_range_type = &range_pcl818h_ai,
.has_dma = 1,
.is_818 = 1,
}, {
.name = "pcl718",
.ns_min = 16000,
.n_aochan = 2,
.ai_range_type = &range_unipolar5,
.has_dma = 1,
}, {
.name = "pcm3718",
.ns_min = 10000,
.ai_range_type = &range_pcl818h_ai,
.has_dma = 1,
.is_818 = 1,
},
};
struct pcl818_private {
struct comedi_isadma *dma;
/* manimal allowed delay between samples (in us) for actual card */
unsigned int ns_min;
/* MUX setting for actual AI operations */
unsigned int act_chanlist[16];
unsigned int act_chanlist_len; /* how long is actual MUX list */
unsigned int act_chanlist_pos; /* actual position in MUX list */
unsigned int usefifo:1;
unsigned int ai_cmd_running:1;
unsigned int ai_cmd_canceled:1;
};
static void pcl818_ai_setup_dma(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int unread_samples)
{
struct pcl818_private *devpriv = dev->private;
struct comedi_isadma *dma = devpriv->dma;
struct comedi_isadma_desc *desc = &dma->desc[dma->cur_dma];
unsigned int max_samples = comedi_bytes_to_samples(s, desc->maxsize);
unsigned int nsamples;
comedi_isadma_disable(dma->chan);
/*
* Determine dma size based on the buffer maxsize plus the number of
Annotation
- Immediate include surface: `linux/module.h`, `linux/gfp.h`, `linux/delay.h`, `linux/io.h`, `linux/interrupt.h`, `linux/comedi/comedidev.h`, `linux/comedi/comedi_8254.h`, `linux/comedi/comedi_isadma.h`.
- Detected declarations: `struct pcl818_board`, `struct pcl818_private`, `function pcl818_ai_setup_dma`, `function pcl818_ai_set_chan_range`, `function pcl818_ai_set_chan_scan`, `function pcl818_ai_setup_chanlist`, `function pcl818_ai_clear_eoc`, `function pcl818_ai_soft_trig`, `function pcl818_ai_get_fifo_sample`, `function pcl818_ai_get_sample`.
- Atlas domain: Driver Families / drivers/comedi.
- Implementation status: source implementation candidate.
- 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.