Got rid of unnecessary casts when initializing comedi_driver.board_name
[comedi.git] / comedi / drivers / ni_labpc.h
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
27 #define EEPROM_SIZE     256     // 256 byte eeprom
28 #define NUM_AO_CHAN     2       // boards have two analog output channels
29
30 enum labpc_bustype {isa_bustype, pci_bustype, pcmcia_bustype};
31 enum labpc_register_layout {labpc_plus_layout, labpc_1200_layout};
32 enum transfer_type {fifo_not_empty_transfer, fifo_half_full_transfer, isa_dma_transfer};
33
34 typedef struct labpc_board_struct{
35         const char *name;
36         int device_id;  // device id for pci and pcmcia boards
37         int ai_speed;   // maximum input speed in nanoseconds
38         enum labpc_bustype bustype;     // ISA/PCI/etc.
39         enum labpc_register_layout register_layout;     // 1200 has extra registers compared to pc+
40         int has_ao;     // has analog output true/false
41         comedi_lrange *ai_range_table;
42         int *ai_range_code;
43         int *ai_range_is_unipolar;
44         unsigned ai_scan_up : 1;        // board can auto scan up in ai channels, not just down
45         unsigned memory_mapped_io : 1; /* uses memory mapped io instead of ioports */
46 }labpc_board;
47
48 typedef struct{
49         struct mite_struct *mite;       // for mite chip on pci-1200
50         volatile unsigned long long count;  /* number of data points left to be taken */
51         unsigned int ao_value[NUM_AO_CHAN];     // software copy of analog output values
52         // software copys of bits written to command registers
53         volatile unsigned int command1_bits;
54         volatile unsigned int command2_bits;
55         volatile unsigned int command3_bits;
56         volatile unsigned int command4_bits;
57         volatile unsigned int command5_bits;
58         volatile unsigned int command6_bits;
59         // store last read of board status registers
60         volatile unsigned int status1_bits;
61         volatile unsigned int status2_bits;
62         unsigned int divisor_a0;        /* value to load into board's counter a0 (conversion pacing) for timed conversions */
63         unsigned int divisor_b0;        /* value to load into board's counter b0 (master) for timed conversions */
64         unsigned int divisor_b1;        /* value to load into board's counter b1 (scan pacing) for timed conversions */
65         unsigned int dma_chan;  // dma channel to use
66         u16 *dma_buffer;        // buffer ai will dma into
67         unsigned int dma_transfer_size; // transfer size in bytes for current transfer
68         enum transfer_type current_transfer;    // we are using dma/fifo-half-full/etc.
69         unsigned int eeprom_data[EEPROM_SIZE];  // stores contents of board's eeprom
70         unsigned int caldac[16];        // stores settings of calibration dacs
71         // function pointers so we can use inb/outb or readb/writeb as appropriate
72         unsigned int (*read_byte)(unsigned long address);
73         void (*write_byte)(unsigned int byte, unsigned long address);
74 }labpc_private;
75
76 #define NUM_LABPC_CS_BOARDS 2
77 extern labpc_board labpc_cs_boards[NUM_LABPC_CS_BOARDS];
78
79 int labpc_common_attach( comedi_device *dev, unsigned long iobase,
80         unsigned int irq, unsigned int dma );
81 int labpc_common_detach( comedi_device *dev );
82
83
84 #endif  /* _NI_LABPC_H */