drivers/comedi/drivers/ni_daq_700.c
Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/ni_daq_700.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/drivers/ni_daq_700.c- Extension
.c- Size
- 7711 bytes
- Lines
- 280
- 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.
- 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/comedi_pcmcia.h
Detected Declarations
function daq700_dio_insn_bitsfunction daq700_dio_insn_configfunction daq700_ai_eocfunction daq700_ai_rinsnfunction daq700_ai_configfunction daq700_auto_attachfunction daq700_cs_attach
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* comedi/drivers/ni_daq_700.c
* Driver for DAQCard-700 DIO/AI
* copied from 8255
*
* COMEDI - Linux Control and Measurement Device Interface
* Copyright (C) 1998 David A. Schleef <ds@schleef.org>
*/
/*
* Driver: ni_daq_700
* Description: National Instruments PCMCIA DAQCard-700
* Author: Fred Brooks <nsaspook@nsaspook.com>,
* based on ni_daq_dio24 by Daniel Vecino Castel <dvecino@able.es>
* Devices: [National Instruments] PCMCIA DAQ-Card-700 (ni_daq_700)
* Status: works
* Updated: Wed, 21 May 2014 12:07:20 +0000
*
* The daqcard-700 appears in Comedi as a digital I/O subdevice (0) with
* 16 channels and a analog input subdevice (1) with 16 single-ended channels
* or 8 differential channels, and three input ranges.
*
* Digital: The channel 0 corresponds to the daqcard-700's output
* port, bit 0; channel 8 corresponds to the input port, bit 0.
*
* Digital direction configuration: channels 0-7 output, 8-15 input.
*
* Analog: The input range is 0 to 4095 with a default of -10 to +10 volts.
* Valid ranges:
* 0 for -10 to 10V bipolar
* 1 for -5 to 5V bipolar
* 2 for -2.5 to 2.5V bipolar
*
* IRQ is assigned but not used.
*
* Manuals: Register level: https://www.ni.com/pdf/manuals/340698.pdf
* User Manual: https://www.ni.com/pdf/manuals/320676d.pdf
*/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/comedi/comedi_pcmcia.h>
/* daqcard700 registers */
#define DIO_W 0x04 /* WO 8bit */
#define DIO_R 0x05 /* RO 8bit */
#define CMD_R1 0x00 /* WO 8bit */
#define CMD_R2 0x07 /* RW 8bit */
#define CMD_R3 0x05 /* W0 8bit */
#define STA_R1 0x00 /* RO 8bit */
#define STA_R2 0x01 /* RO 8bit */
#define ADFIFO_R 0x02 /* RO 16bit */
#define ADCLEAR_R 0x01 /* WO 8bit */
#define CDA_R0 0x08 /* RW 8bit */
#define CDA_R1 0x09 /* RW 8bit */
#define CDA_R2 0x0A /* RW 8bit */
#define CMO_R 0x0B /* RO 8bit */
#define TIC_R 0x06 /* WO 8bit */
/* daqcard700 modes */
#define CMD_R3_DIFF 0x04 /* diff mode */
static const struct comedi_lrange range_daq700_ai = {
3,
{
BIP_RANGE(10),
BIP_RANGE(5),
BIP_RANGE(2.5)
}
};
static int daq700_dio_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
unsigned int mask;
unsigned int val;
mask = comedi_dio_update_state(s, data);
if (mask) {
if (mask & 0xff)
outb(s->state & 0xff, dev->iobase + DIO_W);
}
val = s->state & 0xff;
val |= inb(dev->iobase + DIO_R) << 8;
data[1] = val;
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/comedi/comedi_pcmcia.h`.
- Detected declarations: `function daq700_dio_insn_bits`, `function daq700_dio_insn_config`, `function daq700_ai_eoc`, `function daq700_ai_rinsn`, `function daq700_ai_config`, `function daq700_auto_attach`, `function daq700_cs_attach`.
- Atlas domain: Driver Families / drivers/comedi.
- Implementation status: source implementation candidate.
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.