hwdrv_apci1564.h revision 15d8826a6a2ed954ce7daf1d321cce99d5c12668
1/*
2 * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
3 *
4 *	ADDI-DATA GmbH
5 *	Dieselstrasse 3
6 *	D-77833 Ottersweier
7 *	Tel: +19(0)7223/9493-0
8 *	Fax: +49(0)7223/9493-92
9 *	http://www.addi-data-com
10 *	info@addi-data.com
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
16 */
17
18/*********      Definitions for APCI-1564 card  *****/
19
20#define APCI1564_BOARD_VENDOR_ID                0x15B8
21#define APCI1564_ADDRESS_RANGE                  128
22
23//DIGITAL INPUT-OUTPUT DEFINE
24// Input defines
25#define APCI1564_DIGITAL_IP                     0x04
26#define APCI1564_DIGITAL_IP_INTERRUPT_MODE1     4
27#define APCI1564_DIGITAL_IP_INTERRUPT_MODE2     8
28#define APCI1564_DIGITAL_IP_IRQ                 16
29
30// Output defines
31#define APCI1564_DIGITAL_OP                 	0x18
32#define APCI1564_DIGITAL_OP_RW               	0
33#define APCI1564_DIGITAL_OP_INTERRUPT           4
34#define APCI1564_DIGITAL_OP_IRQ                 12
35
36//Digital Input IRQ Function Selection
37#define ADDIDATA_OR                             0
38#define ADDIDATA_AND                            1
39
40//Digital Input Interrupt Status
41#define APCI1564_DIGITAL_IP_INTERRUPT_STATUS    12
42
43//Digital Output Interrupt Status
44#define APCI1564_DIGITAL_OP_INTERRUPT_STATUS    8
45
46//Digital Input Interrupt Enable Disable.
47#define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE    0x4
48#define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE   0xFFFFFFFB
49
50//Digital Output Interrupt Enable Disable.
51#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE   0x1
52#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
53#define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
54#define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
55
56//ADDIDATA Enable Disable
57
58#define ADDIDATA_ENABLE                            1
59#define ADDIDATA_DISABLE                           0
60
61// TIMER COUNTER WATCHDOG DEFINES
62
63#define ADDIDATA_TIMER                             0
64#define ADDIDATA_COUNTER                           1
65#define ADDIDATA_WATCHDOG                          2
66#define APCI1564_DIGITAL_OP_WATCHDOG               0x28
67#define APCI1564_TIMER                             0x48
68#define APCI1564_COUNTER1                          0x0
69#define APCI1564_COUNTER2                          0x20
70#define APCI1564_COUNTER3                          0x40
71#define APCI1564_COUNTER4                          0x60
72#define APCI1564_TCW_SYNC_ENABLEDISABLE            0
73#define APCI1564_TCW_RELOAD_VALUE                  4
74#define APCI1564_TCW_TIMEBASE                      8
75#define APCI1564_TCW_PROG                          12
76#define APCI1564_TCW_TRIG_STATUS                   16
77#define APCI1564_TCW_IRQ                           20
78#define APCI1564_TCW_WARN_TIMEVAL                  24
79#define APCI1564_TCW_WARN_TIMEBASE                 28
80
81// Hardware Layer  functions for Apci1564
82
83//DI
84// for di read
85INT i_APCI1564_ConfigDigitalInput(comedi_device *dev, comedi_subdevice *s,
86				  comedi_insn *insn, lsampl_t *data);
87INT i_APCI1564_Read1DigitalInput(comedi_device *dev, comedi_subdevice *s,
88				 comedi_insn *insn, lsampl_t *data);
89INT i_APCI1564_ReadMoreDigitalInput(comedi_device *dev, comedi_subdevice *s,
90				    comedi_insn *insn, lsampl_t *data);
91
92//DO
93int i_APCI1564_ConfigDigitalOutput(comedi_device *dev, comedi_subdevice *s,
94				   comedi_insn *insn, lsampl_t *data);
95INT i_APCI1564_WriteDigitalOutput(comedi_device *dev, comedi_subdevice *s,
96				  comedi_insn *insn, lsampl_t *data);
97INT i_APCI1564_ReadDigitalOutput(comedi_device *dev, comedi_subdevice *s,
98				 comedi_insn *insn, lsampl_t *data);
99int i_APCI1564_ReadInterruptStatus(comedi_device *dev, comedi_subdevice *s,
100				   comedi_insn *insn, lsampl_t *data);
101
102// TIMER
103// timer value is passed as u seconds
104INT i_APCI1564_ConfigTimerCounterWatchdog(comedi_device *dev,
105					  comedi_subdevice *s,
106					  comedi_insn *insn, lsampl_t *data);
107int i_APCI1564_StartStopWriteTimerCounterWatchdog(comedi_device *dev,
108						  comedi_subdevice *s,
109						  comedi_insn *insn,
110						  lsampl_t *data);
111int i_APCI1564_ReadTimerCounterWatchdog(comedi_device *dev,
112					comedi_subdevice *s,
113					comedi_insn *insn, lsampl_t *data);
114
115// INTERRUPT
116static VOID v_APCI1564_Interrupt(int irq, void *d);
117
118// RESET
119INT i_APCI1564_Reset(comedi_device *dev);
120