drivers/comedi/drivers/comedi_parport.c
Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/comedi_parport.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/drivers/comedi_parport.c- Extension
.c- Size
- 8035 bytes
- Lines
- 308
- 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/interrupt.hlinux/comedi/comedidev.h
Detected Declarations
function Copyrightfunction parport_data_reg_insn_configfunction parport_status_reg_insn_bitsfunction parport_ctrl_reg_insn_bitsfunction parport_intr_insn_bitsfunction parport_intr_cmdtestfunction parport_intr_cmdfunction parport_intr_cancelfunction parport_interruptfunction parport_attach
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* comedi_parport.c
* Comedi driver for standard parallel port
*
* For more information see:
* http://retired.beyondlogic.org/spp/parallel.htm
*
* COMEDI - Linux Control and Measurement Device Interface
* Copyright (C) 1998,2001 David A. Schleef <ds@schleef.org>
*/
/*
* Driver: comedi_parport
* Description: Standard PC parallel port
* Author: ds
* Status: works in immediate mode
* Devices: [standard] parallel port (comedi_parport)
* Updated: Tue, 30 Apr 2002 21:11:45 -0700
*
* A cheap and easy way to get a few more digital I/O lines. Steal
* additional parallel ports from old computers or your neighbors'
* computers.
*
* Option list:
* 0: I/O port base for the parallel port.
* 1: IRQ (optional)
*
* Parallel Port Lines:
*
* pin subdev chan type name
* ----- ------ ---- ---- --------------
* 1 2 0 DO strobe
* 2 0 0 DIO data 0
* 3 0 1 DIO data 1
* 4 0 2 DIO data 2
* 5 0 3 DIO data 3
* 6 0 4 DIO data 4
* 7 0 5 DIO data 5
* 8 0 6 DIO data 6
* 9 0 7 DIO data 7
* 10 1 3 DI ack
* 11 1 4 DI busy
* 12 1 2 DI paper out
* 13 1 1 DI select in
* 14 2 1 DO auto LF
* 15 1 0 DI error
* 16 2 2 DO init
* 17 2 3 DO select printer
* 18-25 ground
*
* When an IRQ is configured subdevice 3 pretends to be a digital
* input subdevice, but it always returns 0 when read. However, if
* you run a command with scan_begin_src=TRIG_EXT, it uses pin 10
* as a external trigger, which can be used to wake up tasks.
*/
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/comedi/comedidev.h>
/*
* Register map
*/
#define PARPORT_DATA_REG 0x00
#define PARPORT_STATUS_REG 0x01
#define PARPORT_CTRL_REG 0x02
#define PARPORT_CTRL_IRQ_ENA BIT(4)
#define PARPORT_CTRL_BIDIR_ENA BIT(5)
static int parport_data_reg_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
if (comedi_dio_update_state(s, data))
outb(s->state, dev->iobase + PARPORT_DATA_REG);
data[1] = inb(dev->iobase + PARPORT_DATA_REG);
return insn->n;
}
static int parport_data_reg_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
unsigned int ctrl;
int ret;
Annotation
- Immediate include surface: `linux/module.h`, `linux/interrupt.h`, `linux/comedi/comedidev.h`.
- Detected declarations: `function Copyright`, `function parport_data_reg_insn_config`, `function parport_status_reg_insn_bits`, `function parport_ctrl_reg_insn_bits`, `function parport_intr_insn_bits`, `function parport_intr_cmdtest`, `function parport_intr_cmd`, `function parport_intr_cancel`, `function parport_interrupt`, `function parport_attach`.
- 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.