APCI1710_INCCPT.h revision c995fe9475e062bab6f5a45ed28cd2d3d955ef43
1/** 2@verbatim 3 4Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. 5 6 ADDI-DATA GmbH 7 Dieselstrasse 3 8 D-77833 Ottersweier 9 Tel: +19(0)7223/9493-0 10 Fax: +49(0)7223/9493-92 11 http://www.addi-data-com 12 info@addi-data.com 13 14This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 15 16This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 20You shoud also find the complete GPL in the COPYING file accompanying this source code. 21 22@endverbatim 23*/ 24 25#define APCI1710_16BIT_COUNTER 0x10 26#define APCI1710_32BIT_COUNTER 0x0 27#define APCI1710_QUADRUPLE_MODE 0x0 28#define APCI1710_DOUBLE_MODE 0x3 29#define APCI1710_SIMPLE_MODE 0xF 30#define APCI1710_DIRECT_MODE 0x80 31#define APCI1710_HYSTERESIS_ON 0x60 32#define APCI1710_HYSTERESIS_OFF 0x0 33#define APCI1710_INCREMENT 0x60 34#define APCI1710_DECREMENT 0x0 35#define APCI1710_LATCH_COUNTER 0x1 36#define APCI1710_CLEAR_COUNTER 0x0 37#define APCI1710_LOW 0x0 38#define APCI1710_HIGH 0x1 39 40/*********************/ 41/* Version 0600-0229 */ 42/*********************/ 43 44#define APCI1710_HIGH_EDGE_CLEAR_COUNTER 0x0 45#define APCI1710_HIGH_EDGE_LATCH_COUNTER 0x1 46#define APCI1710_LOW_EDGE_CLEAR_COUNTER 0x2 47#define APCI1710_LOW_EDGE_LATCH_COUNTER 0x3 48#define APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER 0x4 49#define APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER 0x5 50#define APCI1710_SOURCE_0 0x0 51#define APCI1710_SOURCE_1 0x1 52 53#define APCI1710_30MHZ 30 54#define APCI1710_33MHZ 33 55#define APCI1710_40MHZ 40 56 57#define APCI1710_ENABLE_LATCH_INT 0x80 58#define APCI1710_DISABLE_LATCH_INT (~APCI1710_ENABLE_LATCH_INT) 59 60#define APCI1710_INDEX_LATCH_COUNTER 0x10 61#define APCI1710_INDEX_AUTO_MODE 0x8 62#define APCI1710_ENABLE_INDEX 0x4 63#define APCI1710_DISABLE_INDEX (~APCI1710_ENABLE_INDEX) 64#define APCI1710_ENABLE_LATCH_AND_CLEAR 0x8 65#define APCI1710_DISABLE_LATCH_AND_CLEAR (~APCI1710_ENABLE_LATCH_AND_CLEAR) 66#define APCI1710_SET_LOW_INDEX_LEVEL 0x4 67#define APCI1710_SET_HIGH_INDEX_LEVEL (~APCI1710_SET_LOW_INDEX_LEVEL) 68#define APCI1710_INVERT_INDEX_RFERENCE 0x2 69#define APCI1710_DEFAULT_INDEX_RFERENCE (~APCI1710_INVERT_INDEX_RFERENCE) 70 71#define APCI1710_ENABLE_INDEX_INT 0x1 72#define APCI1710_DISABLE_INDEX_INT (~APCI1710_ENABLE_INDEX_INT) 73 74#define APCI1710_ENABLE_FREQUENCY 0x4 75#define APCI1710_DISABLE_FREQUENCY (~APCI1710_ENABLE_FREQUENCY) 76 77#define APCI1710_ENABLE_FREQUENCY_INT 0x8 78#define APCI1710_DISABLE_FREQUENCY_INT (~APCI1710_ENABLE_FREQUENCY_INT) 79 80#define APCI1710_ENABLE_40MHZ_FREQUENCY 0x40 81#define APCI1710_DISABLE_40MHZ_FREQUENCY (~APCI1710_ENABLE_40MHZ_FREQUENCY) 82 83#define APCI1710_ENABLE_40MHZ_FILTER 0x80 84#define APCI1710_DISABLE_40MHZ_FILTER (~APCI1710_ENABLE_40MHZ_FILTER) 85 86#define APCI1710_ENABLE_COMPARE_INT 0x2 87#define APCI1710_DISABLE_COMPARE_INT (~APCI1710_ENABLE_COMPARE_INT) 88 89#define APCI1710_ENABLE_INDEX_ACTION 0x20 90#define APCI1710_DISABLE_INDEX_ACTION (~APCI1710_ENABLE_INDEX_ACTION) 91#define APCI1710_REFERENCE_HIGH 0x40 92#define APCI1710_REFERENCE_LOW (~APCI1710_REFERENCE_HIGH) 93 94#define APCI1710_TOR_GATE_LOW 0x40 95#define APCI1710_TOR_GATE_HIGH (~APCI1710_TOR_GATE_LOW) 96 97// INSN CONFIG 98#define APCI1710_INCCPT_INITCOUNTER 100 99#define APCI1710_INCCPT_COUNTERAUTOTEST 101 100#define APCI1710_INCCPT_INITINDEX 102 101#define APCI1710_INCCPT_INITREFERENCE 103 102#define APCI1710_INCCPT_INITEXTERNALSTROBE 104 103#define APCI1710_INCCPT_INITCOMPARELOGIC 105 104#define APCI1710_INCCPT_INITFREQUENCYMEASUREMENT 106 105 106// INSN READ 107#define APCI1710_INCCPT_READLATCHREGISTERSTATUS 200 108#define APCI1710_INCCPT_READLATCHREGISTERVALUE 201 109#define APCI1710_INCCPT_READ16BITCOUNTERVALUE 202 110#define APCI1710_INCCPT_READ32BITCOUNTERVALUE 203 111#define APCI1710_INCCPT_GETINDEXSTATUS 204 112#define APCI1710_INCCPT_GETREFERENCESTATUS 205 113#define APCI1710_INCCPT_GETUASSTATUS 206 114#define APCI1710_INCCPT_GETCBSTATUS 207 115#define APCI1710_INCCPT_GET16BITCBSTATUS 208 116#define APCI1710_INCCPT_GETUDSTATUS 209 117#define APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS 210 118#define APCI1710_INCCPT_READFREQUENCYMEASUREMENT 211 119#define APCI1710_INCCPT_READINTERRUPT 212 120 121//INSN BITS 122#define APCI1710_INCCPT_CLEARCOUNTERVALUE 300 123#define APCI1710_INCCPT_CLEARALLCOUNTERVALUE 301 124#define APCI1710_INCCPT_SETINPUTFILTER 302 125#define APCI1710_INCCPT_LATCHCOUNTER 303 126#define APCI1710_INCCPT_SETINDEXANDREFERENCESOURCE 304 127#define APCI1710_INCCPT_SETDIGITALCHLON 305 128#define APCI1710_INCCPT_SETDIGITALCHLOFF 306 129 130// INSN WRITE 131#define APCI1710_INCCPT_ENABLELATCHINTERRUPT 400 132#define APCI1710_INCCPT_DISABLELATCHINTERRUPT 401 133#define APCI1710_INCCPT_WRITE16BITCOUNTERVALUE 402 134#define APCI1710_INCCPT_WRITE32BITCOUNTERVALUE 403 135#define APCI1710_INCCPT_ENABLEINDEX 404 136#define APCI1710_INCCPT_DISABLEINDEX 405 137#define APCI1710_INCCPT_ENABLECOMPARELOGIC 406 138#define APCI1710_INCCPT_DISABLECOMPARELOGIC 407 139#define APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT 408 140#define APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT 409 141 142/************ Main Functions *************/ 143INT i_APCI1710_InsnConfigINCCPT(comedi_device * dev, comedi_subdevice * s, 144 comedi_insn * insn, lsampl_t * data); 145 146INT i_APCI1710_InsnBitsINCCPT(comedi_device * dev, comedi_subdevice * s, 147 comedi_insn * insn, lsampl_t * data); 148 149INT i_APCI1710_InsnWriteINCCPT(comedi_device * dev, comedi_subdevice * s, 150 comedi_insn * insn, lsampl_t * data); 151 152INT i_APCI1710_InsnReadINCCPT(comedi_device * dev, comedi_subdevice * s, 153 comedi_insn * insn, lsampl_t * data); 154 155/*********** Supplementary Functions********/ 156 157// INSN CONFIG 158 159INT i_APCI1710_InitCounter(comedi_device * dev, 160 BYTE b_ModulNbr, 161 BYTE b_CounterRange, 162 BYTE b_FirstCounterModus, 163 BYTE b_FirstCounterOption, 164 BYTE b_SecondCounterModus, BYTE b_SecondCounterOption); 165 166INT i_APCI1710_CounterAutoTest(comedi_device * dev, PBYTE pb_TestStatus); 167 168INT i_APCI1710_InitIndex(comedi_device * dev, 169 BYTE b_ModulNbr, 170 BYTE b_ReferenceAction, 171 BYTE b_IndexOperation, BYTE b_AutoMode, BYTE b_InterruptEnable); 172 173INT i_APCI1710_InitReference(comedi_device * dev, 174 BYTE b_ModulNbr, BYTE b_ReferenceLevel); 175 176INT i_APCI1710_InitExternalStrobe(comedi_device * dev, 177 BYTE b_ModulNbr, BYTE b_ExternalStrobe, BYTE b_ExternalStrobeLevel); 178 179INT i_APCI1710_InitCompareLogic(comedi_device * dev, 180 BYTE b_ModulNbr, UINT ui_CompareValue); 181 182INT i_APCI1710_InitFrequencyMeasurement(comedi_device * dev, 183 BYTE b_ModulNbr, 184 BYTE b_PCIInputClock, 185 BYTE b_TimingUnity, 186 ULONG ul_TimingInterval, PULONG pul_RealTimingInterval); 187 188//INSN BITS 189 190INT i_APCI1710_ClearCounterValue(comedi_device * dev, BYTE b_ModulNbr); 191 192INT i_APCI1710_ClearAllCounterValue(comedi_device * dev); 193 194INT i_APCI1710_SetInputFilter(comedi_device * dev, 195 BYTE b_ModulNbr, BYTE b_PCIInputClock, BYTE b_Filter); 196 197INT i_APCI1710_LatchCounter(comedi_device * dev, 198 BYTE b_ModulNbr, BYTE b_LatchReg); 199 200INT i_APCI1710_SetIndexAndReferenceSource(comedi_device * dev, 201 BYTE b_ModulNbr, BYTE b_SourceSelection); 202 203INT i_APCI1710_SetDigitalChlOn(comedi_device * dev, BYTE b_ModulNbr); 204 205INT i_APCI1710_SetDigitalChlOff(comedi_device * dev, BYTE b_ModulNbr); 206 207// INSN WRITE 208INT i_APCI1710_EnableLatchInterrupt(comedi_device * dev, BYTE b_ModulNbr); 209 210INT i_APCI1710_DisableLatchInterrupt(comedi_device * dev, BYTE b_ModulNbr); 211 212INT i_APCI1710_Write16BitCounterValue(comedi_device * dev, 213 BYTE b_ModulNbr, BYTE b_SelectedCounter, UINT ui_WriteValue); 214 215INT i_APCI1710_Write32BitCounterValue(comedi_device * dev, 216 BYTE b_ModulNbr, ULONG ul_WriteValue); 217 218INT i_APCI1710_EnableIndex(comedi_device * dev, BYTE b_ModulNbr); 219 220INT i_APCI1710_DisableIndex(comedi_device * dev, BYTE b_ModulNbr); 221 222INT i_APCI1710_EnableCompareLogic(comedi_device * dev, BYTE b_ModulNbr); 223 224INT i_APCI1710_DisableCompareLogic(comedi_device * dev, BYTE b_ModulNbr); 225 226INT i_APCI1710_EnableFrequencyMeasurement(comedi_device * dev, 227 BYTE b_ModulNbr, BYTE b_InterruptEnable); 228 229INT i_APCI1710_DisableFrequencyMeasurement(comedi_device * dev, 230 BYTE b_ModulNbr); 231 232// INSN READ 233 234INT i_APCI1710_ReadLatchRegisterStatus(comedi_device * dev, 235 BYTE b_ModulNbr, BYTE b_LatchReg, PBYTE pb_LatchStatus); 236 237INT i_APCI1710_ReadLatchRegisterValue(comedi_device * dev, 238 BYTE b_ModulNbr, BYTE b_LatchReg, PULONG pul_LatchValue); 239 240INT i_APCI1710_Read16BitCounterValue(comedi_device * dev, 241 BYTE b_ModulNbr, BYTE b_SelectedCounter, PUINT pui_CounterValue); 242 243INT i_APCI1710_Read32BitCounterValue(comedi_device * dev, 244 BYTE b_ModulNbr, PULONG pul_CounterValue); 245 246INT i_APCI1710_GetIndexStatus(comedi_device * dev, 247 BYTE b_ModulNbr, PBYTE pb_IndexStatus); 248 249INT i_APCI1710_GetReferenceStatus(comedi_device * dev, 250 BYTE b_ModulNbr, PBYTE pb_ReferenceStatus); 251 252INT i_APCI1710_GetUASStatus(comedi_device * dev, 253 BYTE b_ModulNbr, PBYTE pb_UASStatus); 254 255INT i_APCI1710_GetCBStatus(comedi_device * dev, 256 BYTE b_ModulNbr, PBYTE pb_CBStatus); 257 258INT i_APCI1710_Get16BitCBStatus(comedi_device * dev, 259 BYTE b_ModulNbr, PBYTE pb_CBStatusCounter0, PBYTE pb_CBStatusCounter1); 260 261INT i_APCI1710_GetUDStatus(comedi_device * dev, 262 BYTE b_ModulNbr, PBYTE pb_UDStatus); 263 264INT i_APCI1710_GetInterruptUDLatchedStatus(comedi_device * dev, 265 BYTE b_ModulNbr, PBYTE pb_UDStatus); 266 267INT i_APCI1710_ReadFrequencyMeasurement(comedi_device * dev, 268 BYTE b_ModulNbr, 269 PBYTE pb_Status, PBYTE pb_UDStatus, PULONG pul_ReadValue); 270