Merge branch 'for-linus' of git://git.kernel.dk/linux-block
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / comedi / drivers / amplc_dio200.h
1 /*
2 comedi/drivers/amplc_dio.h
3
4 Header for amplc_dio200.c, amplc_dio200_common.c and
5 amplc_dio200_pci.c.
6
7 Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
8
9 COMEDI - Linux Control and Measurement Device Interface
10 Copyright (C) 1998,2000 David A. Schleef <ds@schleef.org>
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
26 */
27
28 #ifndef AMPLC_DIO200_H_INCLUDED
29 #define AMPLC_DIO200_H_INCLUDED
30
31 /* 200 series register area sizes */
32 #define DIO200_IO_SIZE 0x20
33 #define DIO200_PCIE_IO_SIZE 0x4000
34
35 /*
36 * Register region.
37 */
38 enum dio200_regtype { no_regtype = 0, io_regtype, mmio_regtype };
39 struct dio200_region {
40 union {
41 unsigned long iobase; /* I/O base address */
42 unsigned char __iomem *membase; /* mapped MMIO base address */
43 } u;
44 enum dio200_regtype regtype;
45 };
46
47 /*
48 * Subdevice types.
49 */
50 enum dio200_sdtype { sd_none, sd_intr, sd_8255, sd_8254, sd_timer };
51
52 #define DIO200_MAX_SUBDEVS 8
53 #define DIO200_MAX_ISNS 6
54
55 /*
56 * Board descriptions.
57 */
58
59 struct dio200_layout {
60 unsigned short n_subdevs; /* number of subdevices */
61 unsigned char sdtype[DIO200_MAX_SUBDEVS]; /* enum dio200_sdtype */
62 unsigned char sdinfo[DIO200_MAX_SUBDEVS]; /* depends on sdtype */
63 bool has_int_sce:1; /* has interrupt enable/status reg */
64 bool has_clk_gat_sce:1; /* has clock/gate selection registers */
65 bool has_enhancements:1; /* has enhanced features */
66 };
67
68 enum dio200_bustype { isa_bustype, pci_bustype };
69
70 struct dio200_board {
71 const char *name;
72 struct dio200_layout layout;
73 enum dio200_bustype bustype;
74 unsigned char mainbar;
75 unsigned char mainshift;
76 unsigned int mainsize;
77 };
78
79 /*
80 * Comedi device private data.
81 */
82 struct dio200_private {
83 struct dio200_region io; /* Register region */
84 int intr_sd;
85 };
86
87 int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq,
88 unsigned long req_irq_flags);
89
90 void amplc_dio200_common_detach(struct comedi_device *dev);
91
92 /* Used by initialization of PCIe boards. */
93 void amplc_dio200_set_enhance(struct comedi_device *dev, unsigned char val);
94
95 #endif