Added some ack'ing of b interrupts, and do acks before handling
[comedi.git] / comedi / drivers / me4000.h
1 /*
2     me4000.h
3     Register descriptions and defines for the ME-4000 board family
4
5     COMEDI - Linux Control and Measurement Device Interface
6     Copyright (C) 1998-9 David A. Schleef <ds@schleef.org>
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 _ME4000_H_
25 #define _ME4000_H_
26
27
28 /*=============================================================================
29   Debug section
30   ===========================================================================*/
31
32 #undef ME4000_CALL_DEBUG        // Debug function entry and exit
33 #undef ME4000_PORT_DEBUG        // Debug port access
34 #undef ME4000_ISR_DEBUG         // Debug the interrupt service routine
35 #undef ME4000_DEBUG             // General purpose debug masseges
36
37 #ifdef ME4000_CALL_DEBUG
38 #undef CALL_PDEBUG
39 #define CALL_PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor, ##args)
40 #else
41 # define CALL_PDEBUG(fmt, args...) // no debugging, do nothing
42 #endif
43
44 #ifdef ME4000_PORT_DEBUG
45 #undef PORT_PDEBUG
46 #define PORT_PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor,  ##args)
47 #else
48 #define PORT_PDEBUG(fmt, args...) // no debugging, do nothing
49 #endif
50
51 #ifdef ME4000_ISR_DEBUG
52 #undef ISR_PDEBUG
53 #define ISR_PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor,  ##args)
54 #else
55 #define ISR_PDEBUG(fmt, args...) // no debugging, do nothing
56 #endif
57
58 #ifdef ME4000_DEBUG
59 #undef PDEBUG
60 #define PDEBUG(fmt, args...) printk(KERN_DEBUG"comedi%d: me4000: " fmt, dev->minor,  ##args)
61 #else
62 #define PDEBUG(fmt, args...) // no debugging, do nothing
63 #endif
64
65
66 /*=============================================================================
67   PCI vendor and device IDs
68   ===========================================================================*/
69
70 #define PCI_VENDOR_ID_MEILHAUS 0x1402
71
72
73 #define PCI_DEVICE_ID_MEILHAUS_ME4650   0x4650 // Low Cost version
74
75 #define PCI_DEVICE_ID_MEILHAUS_ME4660   0x4660 // Standard version
76 #define PCI_DEVICE_ID_MEILHAUS_ME4660I  0x4661 // Isolated version
77 #define PCI_DEVICE_ID_MEILHAUS_ME4660S  0x4662 // Standard version with Sample and Hold
78 #define PCI_DEVICE_ID_MEILHAUS_ME4660IS 0x4663 // Isolated version with Sample and Hold
79
80 #define PCI_DEVICE_ID_MEILHAUS_ME4670   0x4670 // Standard version
81 #define PCI_DEVICE_ID_MEILHAUS_ME4670I  0x4671 // Isolated version
82 #define PCI_DEVICE_ID_MEILHAUS_ME4670S  0x4672 // Standard version with Sample and Hold
83 #define PCI_DEVICE_ID_MEILHAUS_ME4670IS 0x4673 // Isolated version with Sample and Hold
84
85 #define PCI_DEVICE_ID_MEILHAUS_ME4680   0x4680 // Standard version
86 #define PCI_DEVICE_ID_MEILHAUS_ME4680I  0x4681 // Isolated version
87 #define PCI_DEVICE_ID_MEILHAUS_ME4680S  0x4682 // Standard version with Sample and Hold
88 #define PCI_DEVICE_ID_MEILHAUS_ME4680IS 0x4683 // Isolated version with Sample and Hold
89
90
91 /*=============================================================================
92   ME-4000 base register offsets
93   ===========================================================================*/
94
95 #define ME4000_AO_00_CTRL_REG                   0x00  // R/W
96 #define ME4000_AO_00_STATUS_REG                 0x04  // R/_
97 #define ME4000_AO_00_FIFO_REG                   0x08  // _/W
98 #define ME4000_AO_00_SINGLE_REG                 0x0C  // R/W
99 #define ME4000_AO_00_TIMER_REG                  0x10  // _/W
100
101 #define ME4000_AO_01_CTRL_REG                   0x18  // R/W
102 #define ME4000_AO_01_STATUS_REG                 0x1C  // R/_
103 #define ME4000_AO_01_FIFO_REG                   0x20  // _/W
104 #define ME4000_AO_01_SINGLE_REG                 0x24  // R/W
105 #define ME4000_AO_01_TIMER_REG                  0x28  // _/W
106
107 #define ME4000_AO_02_CTRL_REG                   0x30  // R/W
108 #define ME4000_AO_02_STATUS_REG                 0x34  // R/_
109 #define ME4000_AO_02_FIFO_REG                   0x38  // _/W
110 #define ME4000_AO_02_SINGLE_REG                 0x3C  // R/W
111 #define ME4000_AO_02_TIMER_REG                  0x40  // _/W
112
113 #define ME4000_AO_03_CTRL_REG                   0x48  // R/W
114 #define ME4000_AO_03_STATUS_REG                 0x4C  // R/_
115 #define ME4000_AO_03_FIFO_REG                   0x50  // _/W
116 #define ME4000_AO_03_SINGLE_REG                 0x54  // R/W
117 #define ME4000_AO_03_TIMER_REG                  0x58  // _/W
118
119 #define ME4000_AI_CTRL_REG                      0x74  // _/W
120 #define ME4000_AI_STATUS_REG                    0x74  // R/_
121 #define ME4000_AI_CHANNEL_LIST_REG              0x78  // _/W
122 #define ME4000_AI_DATA_REG                      0x7C  // R/_
123 #define ME4000_AI_CHAN_TIMER_REG                0x80  // _/W
124 #define ME4000_AI_CHAN_PRE_TIMER_REG            0x84  // _/W
125 #define ME4000_AI_SCAN_TIMER_LOW_REG            0x88  // _/W
126 #define ME4000_AI_SCAN_TIMER_HIGH_REG           0x8C  // _/W
127 #define ME4000_AI_SCAN_PRE_TIMER_LOW_REG        0x90  // _/W
128 #define ME4000_AI_SCAN_PRE_TIMER_HIGH_REG       0x94  // _/W
129 #define ME4000_AI_START_REG                     0x98  // R/_
130
131 #define ME4000_IRQ_STATUS_REG                   0x9C  // R/_
132
133 #define ME4000_DIO_PORT_0_REG                   0xA0  // R/W
134 #define ME4000_DIO_PORT_1_REG                   0xA4  // R/W
135 #define ME4000_DIO_PORT_2_REG                   0xA8  // R/W
136 #define ME4000_DIO_PORT_3_REG                   0xAC  // R/W
137 #define ME4000_DIO_DIR_REG                      0xB0  // R/W
138
139 #define ME4000_AO_LOADSETREG_XX                 0xB4  // R/W
140
141 #define ME4000_DIO_CTRL_REG                     0xB8  // R/W
142
143 #define ME4000_AO_DEMUX_ADJUST_REG              0xBC  // -/W
144
145 #define ME4000_AI_SAMPLE_COUNTER_REG            0xC0  // _/W
146
147
148 /*=============================================================================
149   Value to adjust Demux
150   ===========================================================================*/
151
152 #define ME4000_AO_DEMUX_ADJUST_VALUE            0x4C
153
154
155 /*=============================================================================
156   Counter base register offsets
157   ===========================================================================*/
158
159 #define ME4000_CNT_COUNTER_0_REG                0x00
160 #define ME4000_CNT_COUNTER_1_REG                0x01
161 #define ME4000_CNT_COUNTER_2_REG                0x02
162 #define ME4000_CNT_CTRL_REG                     0x03
163
164
165 /*=============================================================================
166   PLX base register offsets
167   ===========================================================================*/
168
169 #define PLX_INTCSR      0x4C    // Interrupt control and status register
170 #define PLX_ICR         0x50    // Initialization control register
171
172
173 /*=============================================================================
174   Bits for the PLX_ICSR register
175   ===========================================================================*/
176
177 #define PLX_INTCSR_LOCAL_INT1_EN             0x01  // If set, local interrupt 1 is enabled (r/w)
178 #define PLX_INTCSR_LOCAL_INT1_POL            0x02  // If set, local interrupt 1 polarity is active high (r/w)
179 #define PLX_INTCSR_LOCAL_INT1_STATE          0x04  // If set, local interrupt 1 is active (r/_)
180 #define PLX_INTCSR_LOCAL_INT2_EN             0x08  // If set, local interrupt 2 is enabled (r/w)
181 #define PLX_INTCSR_LOCAL_INT2_POL            0x10  // If set, local interrupt 2 polarity is active high (r/w)
182 #define PLX_INTCSR_LOCAL_INT2_STATE          0x20  // If set, local interrupt 2 is active  (r/_)
183 #define PLX_INTCSR_PCI_INT_EN                0x40  // If set, PCI interrupt is enabled (r/w)
184 #define PLX_INTCSR_SOFT_INT                  0x80  // If set, a software interrupt is generated (r/w)
185
186
187 /*=============================================================================
188   Bits for the PLX_ICR register
189   ===========================================================================*/
190
191 #define PLX_ICR_BIT_EEPROM_CLOCK_SET            0x01000000
192 #define PLX_ICR_BIT_EEPROM_CHIP_SELECT          0x02000000
193 #define PLX_ICR_BIT_EEPROM_WRITE                0x04000000
194 #define PLX_ICR_BIT_EEPROM_READ                 0x08000000
195 #define PLX_ICR_BIT_EEPROM_VALID                0x10000000
196
197 #define PLX_ICR_MASK_EEPROM                     0x1F000000
198
199 #define EEPROM_DELAY                            1
200
201
202 /*=============================================================================
203   Bits for the ME4000_AO_CTRL_REG register
204   ===========================================================================*/
205
206 #define ME4000_AO_CTRL_BIT_MODE_0               0x001
207 #define ME4000_AO_CTRL_BIT_MODE_1               0x002
208 #define ME4000_AO_CTRL_MASK_MODE                0x003
209 #define ME4000_AO_CTRL_BIT_STOP                 0x004
210 #define ME4000_AO_CTRL_BIT_ENABLE_FIFO          0x008
211 #define ME4000_AO_CTRL_BIT_ENABLE_EX_TRIG       0x010
212 #define ME4000_AO_CTRL_BIT_EX_TRIG_EDGE         0x020
213 #define ME4000_AO_CTRL_BIT_IMMEDIATE_STOP       0x080
214 #define ME4000_AO_CTRL_BIT_ENABLE_DO            0x100
215 #define ME4000_AO_CTRL_BIT_ENABLE_IRQ           0x200
216 #define ME4000_AO_CTRL_BIT_RESET_IRQ            0x400
217
218
219 /*=============================================================================
220   Bits for the ME4000_AO_STATUS_REG register
221   ===========================================================================*/
222
223 #define ME4000_AO_STATUS_BIT_FSM                0x01
224 #define ME4000_AO_STATUS_BIT_FF                 0x02
225 #define ME4000_AO_STATUS_BIT_HF                 0x04
226 #define ME4000_AO_STATUS_BIT_EF                 0x08
227
228
229 /*=============================================================================
230   Bits for the ME4000_AI_CTRL_REG register
231   ===========================================================================*/
232
233 #define ME4000_AI_CTRL_BIT_MODE_0               0x00000001
234 #define ME4000_AI_CTRL_BIT_MODE_1               0x00000002
235 #define ME4000_AI_CTRL_BIT_MODE_2               0x00000004
236 #define ME4000_AI_CTRL_BIT_SAMPLE_HOLD          0x00000008
237 #define ME4000_AI_CTRL_BIT_IMMEDIATE_STOP       0x00000010
238 #define ME4000_AI_CTRL_BIT_STOP                 0x00000020
239 #define ME4000_AI_CTRL_BIT_CHANNEL_FIFO         0x00000040
240 #define ME4000_AI_CTRL_BIT_DATA_FIFO            0x00000080
241 #define ME4000_AI_CTRL_BIT_FULLSCALE            0x00000100
242 #define ME4000_AI_CTRL_BIT_OFFSET               0x00000200
243 #define ME4000_AI_CTRL_BIT_EX_TRIG_ANALOG       0x00000400
244 #define ME4000_AI_CTRL_BIT_EX_TRIG              0x00000800
245 #define ME4000_AI_CTRL_BIT_EX_TRIG_FALLING      0x00001000
246 #define ME4000_AI_CTRL_BIT_EX_IRQ               0x00002000
247 #define ME4000_AI_CTRL_BIT_EX_IRQ_RESET         0x00004000
248 #define ME4000_AI_CTRL_BIT_LE_IRQ               0x00008000
249 #define ME4000_AI_CTRL_BIT_LE_IRQ_RESET         0x00010000
250 #define ME4000_AI_CTRL_BIT_HF_IRQ               0x00020000
251 #define ME4000_AI_CTRL_BIT_HF_IRQ_RESET         0x00040000
252 #define ME4000_AI_CTRL_BIT_SC_IRQ               0x00080000
253 #define ME4000_AI_CTRL_BIT_SC_IRQ_RESET         0x00100000
254 #define ME4000_AI_CTRL_BIT_SC_RELOAD            0x00200000
255 #define ME4000_AI_CTRL_BIT_EX_TRIG_BOTH         0x80000000
256
257
258 /*=============================================================================
259   Bits for the ME4000_AI_STATUS_REG register
260   ===========================================================================*/
261
262 #define ME4000_AI_STATUS_BIT_EF_CHANNEL         0x00400000
263 #define ME4000_AI_STATUS_BIT_HF_CHANNEL         0x00800000
264 #define ME4000_AI_STATUS_BIT_FF_CHANNEL         0x01000000
265 #define ME4000_AI_STATUS_BIT_EF_DATA            0x02000000
266 #define ME4000_AI_STATUS_BIT_HF_DATA            0x04000000
267 #define ME4000_AI_STATUS_BIT_FF_DATA            0x08000000
268 #define ME4000_AI_STATUS_BIT_LE                 0x10000000
269 #define ME4000_AI_STATUS_BIT_FSM                0x20000000
270
271
272 /*=============================================================================
273   Bits for the ME4000_IRQ_STATUS_REG register
274   ===========================================================================*/
275
276 #define ME4000_IRQ_STATUS_BIT_EX                0x01
277 #define ME4000_IRQ_STATUS_BIT_LE                0x02
278 #define ME4000_IRQ_STATUS_BIT_AI_HF             0x04
279 #define ME4000_IRQ_STATUS_BIT_AO_0_HF           0x08
280 #define ME4000_IRQ_STATUS_BIT_AO_1_HF           0x10
281 #define ME4000_IRQ_STATUS_BIT_AO_2_HF           0x20
282 #define ME4000_IRQ_STATUS_BIT_AO_3_HF           0x40
283 #define ME4000_IRQ_STATUS_BIT_SC                0x80
284
285
286 /*=============================================================================
287   Bits for the ME4000_DIO_CTRL_REG register
288   ===========================================================================*/
289
290 #define ME4000_DIO_CTRL_BIT_MODE_0              0x0001
291 #define ME4000_DIO_CTRL_BIT_MODE_1              0x0002
292 #define ME4000_DIO_CTRL_BIT_MODE_2              0x0004
293 #define ME4000_DIO_CTRL_BIT_MODE_3              0x0008
294 #define ME4000_DIO_CTRL_BIT_MODE_4              0x0010
295 #define ME4000_DIO_CTRL_BIT_MODE_5              0x0020
296 #define ME4000_DIO_CTRL_BIT_MODE_6              0x0040
297 #define ME4000_DIO_CTRL_BIT_MODE_7              0x0080
298
299 #define ME4000_DIO_CTRL_BIT_FUNCTION_0          0x0100
300 #define ME4000_DIO_CTRL_BIT_FUNCTION_1          0x0200
301
302 #define ME4000_DIO_CTRL_BIT_FIFO_HIGH_0         0x0400
303 #define ME4000_DIO_CTRL_BIT_FIFO_HIGH_1         0x0800
304 #define ME4000_DIO_CTRL_BIT_FIFO_HIGH_2         0x1000
305 #define ME4000_DIO_CTRL_BIT_FIFO_HIGH_3         0x2000
306
307
308 /*=============================================================================
309   Information about the hardware capabilities
310   ===========================================================================*/
311
312 typedef struct me4000_ao_info {
313     int count;
314     int fifo_count;
315 } me4000_ao_info_t;
316
317
318 typedef struct me4000_ai_info {
319     int count;
320     int sh_count;
321     int diff_count;
322     int ex_trig_analog;
323 } me4000_ai_info_t;
324
325
326 typedef struct me4000_dio_info {
327     int count;
328 } me4000_dio_info_t;
329
330
331 typedef struct me4000_cnt_info {
332     int count;
333 } me4000_cnt_info_t;
334
335
336 typedef struct me4000_board {
337     const char *name;
338     unsigned short device_id;
339     me4000_ao_info_t ao;
340     me4000_ai_info_t ai;
341     me4000_dio_info_t dio;
342     me4000_cnt_info_t cnt;
343 } me4000_board_t;
344
345
346 #define thisboard ((me4000_board_t *)dev->board_ptr)
347
348
349 /*=============================================================================
350   PCI device table.
351   This is used by modprobe to translate PCI IDs to drivers.
352   ===========================================================================*/
353
354 static struct pci_device_id me4000_pci_table[] __devinitdata = {
355     { PCI_VENDOR_ID_MEILHAUS, 0x4650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
356
357     { PCI_VENDOR_ID_MEILHAUS, 0x4660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
358     { PCI_VENDOR_ID_MEILHAUS, 0x4661, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
359     { PCI_VENDOR_ID_MEILHAUS, 0x4662, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
360     { PCI_VENDOR_ID_MEILHAUS, 0x4663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
361
362     { PCI_VENDOR_ID_MEILHAUS, 0x4670, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
363     { PCI_VENDOR_ID_MEILHAUS, 0x4671, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
364     { PCI_VENDOR_ID_MEILHAUS, 0x4672, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
365     { PCI_VENDOR_ID_MEILHAUS, 0x4673, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
366
367     { PCI_VENDOR_ID_MEILHAUS, 0x4680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
368     { PCI_VENDOR_ID_MEILHAUS, 0x4681, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
369     { PCI_VENDOR_ID_MEILHAUS, 0x4682, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
370     { PCI_VENDOR_ID_MEILHAUS, 0x4683, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
371
372     { 0 }
373 };
374
375 MODULE_DEVICE_TABLE(pci, me4000_pci_table);
376
377
378 /*=============================================================================
379   Global board and subdevice information structures
380   ===========================================================================*/
381
382 typedef struct me4000_ao_context {
383     int irq;
384
385     unsigned long mirror; // Store the last written value
386
387     unsigned long ctrl_reg;
388     unsigned long status_reg;
389     unsigned long fifo_reg;
390     unsigned long single_reg;
391     unsigned long timer_reg;
392     unsigned long irq_status_reg;
393     unsigned long preload_reg;
394 } me4000_ao_context_t;
395
396
397 typedef struct me4000_ai_context {
398     int irq;
399
400     unsigned long ctrl_reg;
401     unsigned long status_reg;
402     unsigned long channel_list_reg;
403     unsigned long data_reg;
404     unsigned long chan_timer_reg;
405     unsigned long chan_pre_timer_reg;
406     unsigned long scan_timer_low_reg;
407     unsigned long scan_timer_high_reg;
408     unsigned long scan_pre_timer_low_reg;
409     unsigned long scan_pre_timer_high_reg;
410     unsigned long start_reg;
411     unsigned long irq_status_reg;
412     unsigned long sample_counter_reg;
413 } me4000_ai_context_t;
414
415
416 typedef struct me4000_dio_context {
417     unsigned long dir_reg;
418     unsigned long ctrl_reg;
419     unsigned long port_0_reg;
420     unsigned long port_1_reg;
421     unsigned long port_2_reg;
422     unsigned long port_3_reg;
423 } me4000_dio_context_t;
424
425
426 typedef struct me4000_cnt_context {
427     unsigned long ctrl_reg;
428     unsigned long counter_0_reg;
429     unsigned long counter_1_reg;
430     unsigned long counter_2_reg;
431 } me4000_cnt_context_t;
432
433
434 typedef struct me4000_info {
435     unsigned long plx_regbase;                  // PLX configuration space base address
436     unsigned long me4000_regbase;               // Base address of the ME4000
437     unsigned long timer_regbase;                // Base address of the timer circuit
438     unsigned long program_regbase;              // Base address to set the program pin for the xilinx
439
440     unsigned long plx_regbase_size;             // PLX register set space
441     unsigned long me4000_regbase_size;          // ME4000 register set space
442     unsigned long timer_regbase_size;           // Timer circuit register set space
443     unsigned long program_regbase_size;         // Size of program base address of the ME4000
444
445     unsigned int serial_no;                     // Serial number of the board
446     unsigned char hw_revision;                  // Hardware revision of the board
447     unsigned short vendor_id;                   // Meilhaus vendor id
448     unsigned short device_id;                   // Device id
449
450     struct pci_dev *pci_dev_p;                  // General PCI information
451
452     unsigned int irq;                           // IRQ assigned from the PCI BIOS
453
454     struct me4000_ai_context ai_context;        // Analog input  specific context
455     struct me4000_ao_context ao_context[4];     // Vector with analog output specific context
456     struct me4000_dio_context dio_context;      // Digital I/O specific context
457     struct me4000_cnt_context cnt_context;      // Counter specific context
458 } me4000_info_t;
459
460
461 #define info    ((me4000_info_t *)dev->private)
462
463
464 /*-----------------------------------------------------------------------------
465   Defines for analog input
466  ----------------------------------------------------------------------------*/
467
468 /* General stuff */
469 #define ME4000_AI_FIFO_COUNT                    2048
470
471 #define ME4000_AI_MIN_TICKS                     66
472 #define ME4000_AI_MIN_SAMPLE_TIME               2000 // Minimum sample time [ns]
473 #define ME4000_AI_BASE_FREQUENCY                (unsigned int) 33E6
474
475
476 /* Channel list defines and masks */
477 #define ME4000_AI_CHANNEL_LIST_COUNT            1024
478
479 #define ME4000_AI_LIST_INPUT_SINGLE_ENDED       0x000
480 #define ME4000_AI_LIST_INPUT_DIFFERENTIAL       0x020
481
482 #define ME4000_AI_LIST_RANGE_BIPOLAR_10         0x000
483 #define ME4000_AI_LIST_RANGE_BIPOLAR_2_5        0x040
484 #define ME4000_AI_LIST_RANGE_UNIPOLAR_10        0x080
485 #define ME4000_AI_LIST_RANGE_UNIPOLAR_2_5       0x0C0
486
487 #define ME4000_AI_LIST_LAST_ENTRY               0x100
488
489
490 /*-----------------------------------------------------------------------------
491   Defines for counters
492  ----------------------------------------------------------------------------*/
493
494 #define ME4000_CNT_COUNTER_0  0x00
495 #define ME4000_CNT_COUNTER_1  0x40
496 #define ME4000_CNT_COUNTER_2  0x80
497
498 #define ME4000_CNT_MODE_0     0x00 // Change state if zero crossing
499 #define ME4000_CNT_MODE_1     0x02 // Retriggerable One-Shot
500 #define ME4000_CNT_MODE_2     0x04 // Asymmetrical divider
501 #define ME4000_CNT_MODE_3     0x06 // Symmetrical divider
502 #define ME4000_CNT_MODE_4     0x08 // Counter start by software trigger
503 #define ME4000_CNT_MODE_5     0x0A // Counter start by hardware trigger
504
505
506 #endif