xref: /linux/drivers/comedi/drivers/ni_labpc.h (revision 8ffdff6a)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Header for ni_labpc ISA/PCMCIA/PCI drivers
4  *
5  * Copyright (C) 2003 Frank Mori Hess <fmhess@users.sourceforge.net>
6  */
7 
8 #ifndef _NI_LABPC_H
9 #define _NI_LABPC_H
10 
11 enum transfer_type { fifo_not_empty_transfer, fifo_half_full_transfer,
12 	isa_dma_transfer
13 };
14 
15 struct labpc_boardinfo {
16 	const char *name;
17 	int ai_speed;			/* maximum input speed in ns */
18 	unsigned ai_scan_up:1;		/* can auto scan up in ai channels */
19 	unsigned has_ao:1;		/* has analog outputs */
20 	unsigned is_labpc1200:1;	/* has extra regs compared to pc+ */
21 };
22 
23 struct labpc_private {
24 	struct comedi_isadma *dma;
25 	struct comedi_8254 *counter;
26 
27 	/*  number of data points left to be taken */
28 	unsigned long long count;
29 	/*  software copys of bits written to command registers */
30 	unsigned int cmd1;
31 	unsigned int cmd2;
32 	unsigned int cmd3;
33 	unsigned int cmd4;
34 	unsigned int cmd5;
35 	unsigned int cmd6;
36 	/*  store last read of board status registers */
37 	unsigned int stat1;
38 	unsigned int stat2;
39 
40 	/* we are using dma/fifo-half-full/etc. */
41 	enum transfer_type current_transfer;
42 	/*
43 	 * function pointers so we can use inb/outb or readb/writeb as
44 	 * appropriate
45 	 */
46 	unsigned int (*read_byte)(struct comedi_device *dev, unsigned long reg);
47 	void (*write_byte)(struct comedi_device *dev,
48 			   unsigned int byte, unsigned long reg);
49 };
50 
51 int labpc_common_attach(struct comedi_device *dev,
52 			unsigned int irq, unsigned long isr_flags);
53 void labpc_common_detach(struct comedi_device *dev);
54 
55 #endif /* _NI_LABPC_H */
56