Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[deliverable/linux.git] / drivers / staging / comedi / drivers / ni_labpc.h
CommitLineData
124b13b2
FMH
1/*
2 ni_labpc.h
3
4 Header for ni_labpc.c and ni_labpc_cs.c
5
6 Copyright (C) 2003 Frank Mori Hess <fmhess@users.sourceforge.net>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22*/
23
24#ifndef _NI_LABPC_H
25#define _NI_LABPC_H
26
2696fb57
BP
27#define EEPROM_SIZE 256 /* 256 byte eeprom */
28#define NUM_AO_CHAN 2 /* boards have two analog output channels */
124b13b2
FMH
29
30enum labpc_bustype { isa_bustype, pci_bustype, pcmcia_bustype };
31enum labpc_register_layout { labpc_plus_layout, labpc_1200_layout };
32enum transfer_type { fifo_not_empty_transfer, fifo_half_full_transfer,
0a85b6f0
MT
33 isa_dma_transfer
34};
124b13b2 35
9ad00740 36struct labpc_board_struct {
124b13b2 37 const char *name;
2696fb57
BP
38 int device_id; /* device id for pci and pcmcia boards */
39 int ai_speed; /* maximum input speed in nanoseconds */
40 enum labpc_bustype bustype; /* ISA/PCI/etc. */
8642fc4e
SW
41
42 /* 1200 has extra registers compared to pc+ */
43 enum labpc_register_layout register_layout;
2696fb57 44 int has_ao; /* has analog output true/false */
9ced1de6 45 const struct comedi_lrange *ai_range_table;
124b13b2
FMH
46 const int *ai_range_code;
47 const int *ai_range_is_unipolar;
8642fc4e
SW
48
49 /* board can auto scan up in ai channels, not just down */
50 unsigned ai_scan_up:1;
51
52 /* uses memory mapped io instead of ioports */
53 unsigned memory_mapped_io:1;
9ad00740 54};
124b13b2 55
0a4eb4b6 56struct labpc_private {
2696fb57 57 struct mite_struct *mite; /* for mite chip on pci-1200 */
8642fc4e
SW
58 /* number of data points left to be taken */
59 volatile unsigned long long count;
60 /* software copy of analog output values */
61 unsigned int ao_value[NUM_AO_CHAN];
2696fb57 62 /* software copys of bits written to command registers */
124b13b2
FMH
63 volatile unsigned int command1_bits;
64 volatile unsigned int command2_bits;
65 volatile unsigned int command3_bits;
66 volatile unsigned int command4_bits;
67 volatile unsigned int command5_bits;
68 volatile unsigned int command6_bits;
2696fb57 69 /* store last read of board status registers */
124b13b2
FMH
70 volatile unsigned int status1_bits;
71 volatile unsigned int status2_bits;
8642fc4e
SW
72 /*
73 * value to load into board's counter a0 (conversion pacing) for timed
74 * conversions
75 */
76 unsigned int divisor_a0;
77 /*
78 * value to load into board's counter b0 (master) for timed conversions
79 */
80 unsigned int divisor_b0;
81 /*
82 * value to load into board's counter b1 (scan pacing) for timed
83 * conversions
84 */
85 unsigned int divisor_b1;
2696fb57
BP
86 unsigned int dma_chan; /* dma channel to use */
87 u16 *dma_buffer; /* buffer ai will dma into */
8642fc4e
SW
88 /* transfer size in bytes for current transfer */
89 unsigned int dma_transfer_size;
90 /* we are using dma/fifo-half-full/etc. */
91 enum transfer_type current_transfer;
92 /* stores contents of board's eeprom */
93 unsigned int eeprom_data[EEPROM_SIZE];
94 /* stores settings of calibration dacs */
95 unsigned int caldac[16];
96 /*
97 * function pointers so we can use inb/outb or readb/writeb as
98 * appropriate
99 */
124b13b2
FMH
100 unsigned int (*read_byte) (unsigned long address);
101 void (*write_byte) (unsigned int byte, unsigned long address);
0a4eb4b6 102};
124b13b2 103
da91b269 104int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
0a85b6f0 105 unsigned int irq, unsigned int dma);
da91b269 106int labpc_common_detach(struct comedi_device *dev);
124b13b2
FMH
107
108extern const int labpc_1200_is_unipolar[];
109extern const int labpc_1200_ai_gain_bits[];
9ced1de6 110extern const struct comedi_lrange range_labpc_1200_ai;
124b13b2
FMH
111
112#endif /* _NI_LABPC_H */
This page took 0.22575 seconds and 5 git commands to generate.