Commit | Line | Data |
---|---|---|
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. | |
124b13b2 FMH |
17 | */ |
18 | ||
19 | #ifndef _NI_LABPC_H | |
20 | #define _NI_LABPC_H | |
21 | ||
2696fb57 BP |
22 | #define EEPROM_SIZE 256 /* 256 byte eeprom */ |
23 | #define NUM_AO_CHAN 2 /* boards have two analog output channels */ | |
124b13b2 | 24 | |
124b13b2 | 25 | enum transfer_type { fifo_not_empty_transfer, fifo_half_full_transfer, |
0a85b6f0 MT |
26 | isa_dma_transfer |
27 | }; | |
124b13b2 | 28 | |
f65d971d | 29 | struct labpc_boardinfo { |
124b13b2 | 30 | const char *name; |
124b13b2 | 31 | const int *ai_range_code; |
63d6ba20 HS |
32 | int ai_speed; /* maximum input speed in ns */ |
33 | unsigned ai_scan_up:1; /* can auto scan up in ai channels */ | |
34 | unsigned has_ao:1; /* has analog outputs */ | |
35 | unsigned is_labpc1200:1; /* has extra regs compared to pc+ */ | |
36 | unsigned has_mmio:1; /* uses memory mapped io */ | |
9ad00740 | 37 | }; |
124b13b2 | 38 | |
0a4eb4b6 | 39 | struct labpc_private { |
2696fb57 | 40 | struct mite_struct *mite; /* for mite chip on pci-1200 */ |
8642fc4e | 41 | /* number of data points left to be taken */ |
8263dfdf | 42 | unsigned long long count; |
8642fc4e SW |
43 | /* software copy of analog output values */ |
44 | unsigned int ao_value[NUM_AO_CHAN]; | |
2696fb57 | 45 | /* software copys of bits written to command registers */ |
74df5760 HS |
46 | unsigned int cmd1; |
47 | unsigned int cmd2; | |
48 | unsigned int cmd3; | |
49 | unsigned int cmd4; | |
50 | unsigned int cmd5; | |
51 | unsigned int cmd6; | |
2696fb57 | 52 | /* store last read of board status registers */ |
74df5760 HS |
53 | unsigned int stat1; |
54 | unsigned int stat2; | |
8642fc4e SW |
55 | /* |
56 | * value to load into board's counter a0 (conversion pacing) for timed | |
57 | * conversions | |
58 | */ | |
59 | unsigned int divisor_a0; | |
60 | /* | |
61 | * value to load into board's counter b0 (master) for timed conversions | |
62 | */ | |
63 | unsigned int divisor_b0; | |
64 | /* | |
65 | * value to load into board's counter b1 (scan pacing) for timed | |
66 | * conversions | |
67 | */ | |
68 | unsigned int divisor_b1; | |
2696fb57 BP |
69 | unsigned int dma_chan; /* dma channel to use */ |
70 | u16 *dma_buffer; /* buffer ai will dma into */ | |
8642fc4e SW |
71 | /* transfer size in bytes for current transfer */ |
72 | unsigned int dma_transfer_size; | |
73 | /* we are using dma/fifo-half-full/etc. */ | |
74 | enum transfer_type current_transfer; | |
75 | /* stores contents of board's eeprom */ | |
76 | unsigned int eeprom_data[EEPROM_SIZE]; | |
77 | /* stores settings of calibration dacs */ | |
78 | unsigned int caldac[16]; | |
79 | /* | |
80 | * function pointers so we can use inb/outb or readb/writeb as | |
81 | * appropriate | |
82 | */ | |
124b13b2 FMH |
83 | unsigned int (*read_byte) (unsigned long address); |
84 | void (*write_byte) (unsigned int byte, unsigned long address); | |
0a4eb4b6 | 85 | }; |
124b13b2 | 86 | |
de024b3d | 87 | int labpc_common_attach(struct comedi_device *dev, |
3e034797 | 88 | unsigned int irq, unsigned long isr_flags); |
484ecc95 | 89 | void labpc_common_detach(struct comedi_device *dev); |
124b13b2 | 90 | |
124b13b2 | 91 | extern const int labpc_1200_ai_gain_bits[]; |
124b13b2 FMH |
92 | |
93 | #endif /* _NI_LABPC_H */ |