drivers/comedi/drivers/pcl724.c

Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/pcl724.c

File Facts

System
Linux kernel
Corpus path
drivers/comedi/drivers/pcl724.c
Extension
.c
Size
4048 bytes
Lines
173
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct pcl724_board {
	const char *name;
	unsigned int io_range;
	unsigned int min_io_start;
	unsigned int max_io_end;
	unsigned int can_have96:1;
	unsigned int is_pet48:1;
	int numofports;
};

static const struct pcl724_board boardtypes[] = {
	{
		.name		= "pcl724",
		.io_range	= 0x04,
		.min_io_start	= 0x200,
		.max_io_end	= 0x3ff,
		.numofports	= 1,	/* 24 DIO channels */
	}, {
		.name		= "pcl722",
		.io_range	= 0x20,
		.min_io_start	= 0x200,
		.max_io_end	= 0x3ff,
		.can_have96	= 1,
		.numofports	= 6,	/* 144 (or 96) DIO channels */
	}, {
		.name		= "pcl731",
		.io_range	= 0x08,
		.min_io_start	= 0,
		.max_io_end	= 0x3ff,
		.numofports	= 2,	/* 48 DIO channels */
	}, {
		.name		= "acl7122",
		.io_range	= 0x20,
		.min_io_start	= 0x200,
		.max_io_end	= 0x3ff,
		.can_have96	= 1,
		.numofports	= 6,	/* 144 (or 96) DIO channels */
	}, {
		.name		= "acl7124",
		.io_range	= 0x04,
		.min_io_start	= 0x200,
		.max_io_end	= 0x3ff,
		.numofports	= 1,	/* 24 DIO channels */
	}, {
		.name		= "pet48dio",
		.io_range	= 0x02,
		.min_io_start	= 0,
		.max_io_end	= 0x3ff,
		.is_pet48	= 1,
		.numofports	= 2,	/* 48 DIO channels */
	}, {
		.name		= "pcmio48",
		.io_range	= 0x08,
		.min_io_start	= 0x100,
		.max_io_end	= 0x17f,
		.numofports	= 2,	/* 48 DIO channels */
	}, {
		.name		= "onyx-mm-dio",
		.io_range	= 0x10,
		.min_io_start	= 0,
		.max_io_end	= 0x3ff,
		.numofports	= 2,	/* 48 DIO channels */
	},
};

static int pcl724_8255mapped_io(struct comedi_device *dev,
				int dir, int port, int data,
				unsigned long iobase)
{
	int movport = I8255_SIZE * (iobase >> 12);

	iobase &= 0x0fff;

	outb(port + movport, iobase);
	if (dir) {
		outb(data, iobase + 1);
		return 0;
	}
	return inb(iobase + 1);
}

static int pcl724_attach(struct comedi_device *dev,
			 struct comedi_devconfig *it)
{
	const struct pcl724_board *board = dev->board_ptr;
	struct comedi_subdevice *s;
	unsigned long iobase;
	unsigned int iorange;
	int n_subdevices;
	int ret;

Annotation

Implementation Notes