Commit 4d1fa9bd authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: APCI1710_INCCPT: remove forward declarations

This source file is #include'd when building the addi_apci_1710 driver.
All the functions in this file are actually static and should not be
exported to the kernel.

Move some of the functions to remove the need for the forward declarations
and make all of the functions in this file static. Note, this patch does
not try to fix any of the coding style issues in the functions.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent efc87d0b
...@@ -59,88 +59,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -59,88 +59,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour
#include "APCI1710_INCCPT.h" #include "APCI1710_INCCPT.h"
/*
+----------------------------------------------------------------------------+
| int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev,struct comedi_subdevice *s,
struct comedi_insn *insn,unsigned int *data)
+----------------------------------------------------------------------------+
| Task : Configuration function for INC_CPT |
+----------------------------------------------------------------------------+
| Input Parameters : |
+----------------------------------------------------------------------------+
| Output Parameters : *data
+----------------------------------------------------------------------------+
| Return Value : |
+----------------------------------------------------------------------------+
*/
int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct addi_private *devpriv = dev->private;
unsigned int ui_ConfigType;
int i_ReturnValue = 0;
ui_ConfigType = CR_CHAN(insn->chanspec);
printk("\nINC_CPT");
devpriv->tsk_Current = current; /* Save the current process task structure */
switch (ui_ConfigType) {
case APCI1710_INCCPT_INITCOUNTER:
i_ReturnValue = i_APCI1710_InitCounter(dev,
CR_AREF(insn->chanspec),
(unsigned char) data[0],
(unsigned char) data[1],
(unsigned char) data[2], (unsigned char) data[3], (unsigned char) data[4]);
break;
case APCI1710_INCCPT_COUNTERAUTOTEST:
i_ReturnValue = i_APCI1710_CounterAutoTest(dev,
(unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_INITINDEX:
i_ReturnValue = i_APCI1710_InitIndex(dev,
CR_AREF(insn->chanspec),
(unsigned char) data[0],
(unsigned char) data[1], (unsigned char) data[2], (unsigned char) data[3]);
break;
case APCI1710_INCCPT_INITREFERENCE:
i_ReturnValue = i_APCI1710_InitReference(dev,
CR_AREF(insn->chanspec), (unsigned char) data[0]);
break;
case APCI1710_INCCPT_INITEXTERNALSTROBE:
i_ReturnValue = i_APCI1710_InitExternalStrobe(dev,
CR_AREF(insn->chanspec),
(unsigned char) data[0], (unsigned char) data[1]);
break;
case APCI1710_INCCPT_INITCOMPARELOGIC:
i_ReturnValue = i_APCI1710_InitCompareLogic(dev,
CR_AREF(insn->chanspec), (unsigned int) data[0]);
break;
case APCI1710_INCCPT_INITFREQUENCYMEASUREMENT:
i_ReturnValue = i_APCI1710_InitFrequencyMeasurement(dev,
CR_AREF(insn->chanspec),
(unsigned char) data[0],
(unsigned char) data[1], (unsigned int) data[2], (unsigned int *) &data[0]);
break;
default:
printk("Insn Config : Config Parameter Wrong\n");
}
if (i_ReturnValue >= 0)
i_ReturnValue = insn->n;
return i_ReturnValue;
}
/* /*
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
| Function Name : _INT_ i_APCI1710_InitCounter | | Function Name : _INT_ i_APCI1710_InitCounter |
...@@ -300,13 +218,13 @@ int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevi ...@@ -300,13 +218,13 @@ int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevi
| wrong. | | wrong. |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_InitCounter(struct comedi_device *dev,
int i_APCI1710_InitCounter(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ModulNbr,
unsigned char b_CounterRange, unsigned char b_CounterRange,
unsigned char b_FirstCounterModus, unsigned char b_FirstCounterModus,
unsigned char b_FirstCounterOption, unsigned char b_FirstCounterOption,
unsigned char b_SecondCounterModus, unsigned char b_SecondCounterOption) unsigned char b_SecondCounterModus,
unsigned char b_SecondCounterOption)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -547,8 +465,8 @@ int i_APCI1710_InitCounter(struct comedi_device *dev, ...@@ -547,8 +465,8 @@ int i_APCI1710_InitCounter(struct comedi_device *dev,
| -2: No counter module found | | -2: No counter module found |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_CounterAutoTest(struct comedi_device *dev,
int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char *pb_TestStatus) unsigned char *pb_TestStatus)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned char b_ModulCpt = 0; unsigned char b_ModulCpt = 0;
...@@ -711,11 +629,12 @@ int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char *pb_Test ...@@ -711,11 +629,12 @@ int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char *pb_Test
| See function "i_APCI1710_SetBoardIntRoutineX" | | See function "i_APCI1710_SetBoardIntRoutineX" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_InitIndex(struct comedi_device *dev,
int i_APCI1710_InitIndex(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ModulNbr,
unsigned char b_ReferenceAction, unsigned char b_ReferenceAction,
unsigned char b_IndexOperation, unsigned char b_AutoMode, unsigned char b_InterruptEnable) unsigned char b_IndexOperation,
unsigned char b_AutoMode,
unsigned char b_InterruptEnable)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -1156,9 +1075,9 @@ int i_APCI1710_InitIndex(struct comedi_device *dev, ...@@ -1156,9 +1075,9 @@ int i_APCI1710_InitIndex(struct comedi_device *dev,
| -4: Reference level parameter is wrong | | -4: Reference level parameter is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_InitReference(struct comedi_device *dev,
int i_APCI1710_InitReference(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_ReferenceLevel) unsigned char b_ReferenceLevel)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -1282,9 +1201,10 @@ int i_APCI1710_InitReference(struct comedi_device *dev, ...@@ -1282,9 +1201,10 @@ int i_APCI1710_InitReference(struct comedi_device *dev,
| -5: External strobe level parameter is wrong | | -5: External strobe level parameter is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
int i_APCI1710_InitExternalStrobe(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_ExternalStrobe, unsigned char b_ExternalStrobeLevel) unsigned char b_ExternalStrobe,
unsigned char b_ExternalStrobeLevel)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -1397,9 +1317,9 @@ int i_APCI1710_InitExternalStrobe(struct comedi_device *dev, ...@@ -1397,9 +1317,9 @@ int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
int i_APCI1710_InitCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned int ui_CompareValue) unsigned int ui_CompareValue)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -1494,12 +1414,12 @@ int i_APCI1710_InitCompareLogic(struct comedi_device *dev, ...@@ -1494,12 +1414,12 @@ int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
| -7: 40MHz quartz not on board | | -7: 40MHz quartz not on board |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev,
int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ModulNbr,
unsigned char b_PCIInputClock, unsigned char b_PCIInputClock,
unsigned char b_TimingUnity, unsigned char b_TimingUnity,
unsigned int ul_TimingInterval, unsigned int *pul_RealTimingInterval) unsigned int ul_TimingInterval,
unsigned int *pul_RealTimingInterval)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -2004,74 +1924,70 @@ int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev, ...@@ -2004,74 +1924,70 @@ int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev,
return i_ReturnValue; return i_ReturnValue;
} }
/*########################################################################### */
/* INSN BITS */
/*########################################################################### */
/* /*
+----------------------------------------------------------------------------+ * Configuration function for INC_CPT
| Function Name :INT i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev,struct comedi_subdevice *s, */
struct comedi_insn *insn,unsigned int *data) | static int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev,
+----------------------------------------------------------------------------+ struct comedi_subdevice *s,
| Task : Set & Clear Functions for INC_CPT | struct comedi_insn *insn,
+----------------------------------------------------------------------------+ unsigned int *data)
| Input Parameters :
+----------------------------------------------------------------------------+
| Output Parameters : - |
+----------------------------------------------------------------------------+
| Return Value :
+----------------------------------------------------------------------------+
*/
int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned int ui_BitsType; unsigned int ui_ConfigType;
int i_ReturnValue = 0; int i_ReturnValue = 0;
ui_BitsType = CR_CHAN(insn->chanspec); ui_ConfigType = CR_CHAN(insn->chanspec);
devpriv->tsk_Current = current; /* Save the current process task structure */
switch (ui_BitsType) { printk("\nINC_CPT");
case APCI1710_INCCPT_CLEARCOUNTERVALUE:
i_ReturnValue = i_APCI1710_ClearCounterValue(dev, devpriv->tsk_Current = current; /* Save the current process task structure */
(unsigned char) CR_AREF(insn->chanspec)); switch (ui_ConfigType) {
case APCI1710_INCCPT_INITCOUNTER:
i_ReturnValue = i_APCI1710_InitCounter(dev,
CR_AREF(insn->chanspec),
(unsigned char) data[0],
(unsigned char) data[1],
(unsigned char) data[2], (unsigned char) data[3], (unsigned char) data[4]);
break; break;
case APCI1710_INCCPT_CLEARALLCOUNTERVALUE: case APCI1710_INCCPT_COUNTERAUTOTEST:
i_ReturnValue = i_APCI1710_ClearAllCounterValue(dev); i_ReturnValue = i_APCI1710_CounterAutoTest(dev,
(unsigned char *) &data[0]);
break; break;
case APCI1710_INCCPT_SETINPUTFILTER: case APCI1710_INCCPT_INITINDEX:
i_ReturnValue = i_APCI1710_SetInputFilter(dev, i_ReturnValue = i_APCI1710_InitIndex(dev,
(unsigned char) CR_AREF(insn->chanspec), CR_AREF(insn->chanspec),
(unsigned char) data[0], (unsigned char) data[1]); (unsigned char) data[0],
(unsigned char) data[1], (unsigned char) data[2], (unsigned char) data[3]);
break; break;
case APCI1710_INCCPT_LATCHCOUNTER: case APCI1710_INCCPT_INITREFERENCE:
i_ReturnValue = i_APCI1710_LatchCounter(dev, i_ReturnValue = i_APCI1710_InitReference(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); CR_AREF(insn->chanspec), (unsigned char) data[0]);
break; break;
case APCI1710_INCCPT_SETINDEXANDREFERENCESOURCE: case APCI1710_INCCPT_INITEXTERNALSTROBE:
i_ReturnValue = i_APCI1710_SetIndexAndReferenceSource(dev, i_ReturnValue = i_APCI1710_InitExternalStrobe(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); CR_AREF(insn->chanspec),
(unsigned char) data[0], (unsigned char) data[1]);
break; break;
case APCI1710_INCCPT_SETDIGITALCHLON: case APCI1710_INCCPT_INITCOMPARELOGIC:
i_ReturnValue = i_APCI1710_SetDigitalChlOn(dev, i_ReturnValue = i_APCI1710_InitCompareLogic(dev,
(unsigned char) CR_AREF(insn->chanspec)); CR_AREF(insn->chanspec), (unsigned int) data[0]);
break; break;
case APCI1710_INCCPT_SETDIGITALCHLOFF: case APCI1710_INCCPT_INITFREQUENCYMEASUREMENT:
i_ReturnValue = i_APCI1710_SetDigitalChlOff(dev, i_ReturnValue = i_APCI1710_InitFrequencyMeasurement(dev,
(unsigned char) CR_AREF(insn->chanspec)); CR_AREF(insn->chanspec),
(unsigned char) data[0],
(unsigned char) data[1], (unsigned int) data[2], (unsigned int *) &data[0]);
break; break;
default: default:
printk("Bits Config Parameter Wrong\n"); printk("Insn Config : Config Parameter Wrong\n");
} }
if (i_ReturnValue >= 0) if (i_ReturnValue >= 0)
...@@ -2101,8 +2017,8 @@ int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice ...@@ -2101,8 +2017,8 @@ int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_ClearCounterValue(struct comedi_device *dev,
int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -2162,8 +2078,7 @@ int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_Modu ...@@ -2162,8 +2078,7 @@ int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_Modu
| -2: No counter module found | | -2: No counter module found |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev)
int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned char b_ModulCpt = 0; unsigned char b_ModulCpt = 0;
...@@ -2309,9 +2224,10 @@ int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev) ...@@ -2309,9 +2224,10 @@ int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev)
| -6: 40MHz quartz not on board | | -6: 40MHz quartz not on board |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_SetInputFilter(struct comedi_device *dev,
int i_APCI1710_SetInputFilter(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_PCIInputClock, unsigned char b_Filter) unsigned char b_PCIInputClock,
unsigned char b_Filter)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -2574,9 +2490,9 @@ int i_APCI1710_SetInputFilter(struct comedi_device *dev, ...@@ -2574,9 +2490,9 @@ int i_APCI1710_SetInputFilter(struct comedi_device *dev,
| -4: The selected latch register parameter is wrong | | -4: The selected latch register parameter is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_LatchCounter(struct comedi_device *dev,
int i_APCI1710_LatchCounter(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_LatchReg) unsigned char b_LatchReg)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -2672,9 +2588,9 @@ int i_APCI1710_LatchCounter(struct comedi_device *dev, ...@@ -2672,9 +2588,9 @@ int i_APCI1710_LatchCounter(struct comedi_device *dev,
| -4: The source selection is wrong | | -4: The source selection is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_SourceSelection) unsigned char b_SourceSelection)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -2810,8 +2726,8 @@ int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev, ...@@ -2810,8 +2726,8 @@ int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev,
int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -2891,8 +2807,8 @@ int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulN ...@@ -2891,8 +2807,8 @@ int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulN
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev,
int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -2950,89 +2866,59 @@ int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_Modul ...@@ -2950,89 +2866,59 @@ int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_Modul
return i_ReturnValue; return i_ReturnValue;
} }
/*########################################################################### */
/* INSN WRITE */
/*########################################################################### */
/* /*
+----------------------------------------------------------------------------+ * Set & Clear Functions for INC_CPT
| Function Name :INT i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev,struct comedi_subdevice *s, */
struct comedi_insn *insn,unsigned int *data) | static int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev,
+----------------------------------------------------------------------------+ struct comedi_subdevice *s,
| Task : Enable Disable functions for INC_CPT | struct comedi_insn *insn,
+----------------------------------------------------------------------------+ unsigned int *data)
| Input Parameters :
+----------------------------------------------------------------------------+
| Output Parameters : - |
+----------------------------------------------------------------------------+
| Return Value :
+----------------------------------------------------------------------------+
*/
int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned int ui_WriteType; unsigned int ui_BitsType;
int i_ReturnValue = 0; int i_ReturnValue = 0;
ui_WriteType = CR_CHAN(insn->chanspec); ui_BitsType = CR_CHAN(insn->chanspec);
devpriv->tsk_Current = current; /* Save the current process task structure */ devpriv->tsk_Current = current; /* Save the current process task structure */
switch (ui_WriteType) { switch (ui_BitsType) {
case APCI1710_INCCPT_ENABLELATCHINTERRUPT: case APCI1710_INCCPT_CLEARCOUNTERVALUE:
i_ReturnValue = i_APCI1710_EnableLatchInterrupt(dev, i_ReturnValue = i_APCI1710_ClearCounterValue(dev,
(unsigned char) CR_AREF(insn->chanspec)); (unsigned char) CR_AREF(insn->chanspec));
break; break;
case APCI1710_INCCPT_DISABLELATCHINTERRUPT: case APCI1710_INCCPT_CLEARALLCOUNTERVALUE:
i_ReturnValue = i_APCI1710_DisableLatchInterrupt(dev, i_ReturnValue = i_APCI1710_ClearAllCounterValue(dev);
(unsigned char) CR_AREF(insn->chanspec));
break; break;
case APCI1710_INCCPT_WRITE16BITCOUNTERVALUE: case APCI1710_INCCPT_SETINPUTFILTER:
i_ReturnValue = i_APCI1710_Write16BitCounterValue(dev, i_ReturnValue = i_APCI1710_SetInputFilter(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char) CR_AREF(insn->chanspec),
(unsigned char) data[0], (unsigned int) data[1]); (unsigned char) data[0], (unsigned char) data[1]);
break;
case APCI1710_INCCPT_WRITE32BITCOUNTERVALUE:
i_ReturnValue = i_APCI1710_Write32BitCounterValue(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned int) data[0]);
break;
case APCI1710_INCCPT_ENABLEINDEX:
i_APCI1710_EnableIndex(dev, (unsigned char) CR_AREF(insn->chanspec));
break; break;
case APCI1710_INCCPT_DISABLEINDEX: case APCI1710_INCCPT_LATCHCOUNTER:
i_ReturnValue = i_APCI1710_DisableIndex(dev, i_ReturnValue = i_APCI1710_LatchCounter(dev,
(unsigned char) CR_AREF(insn->chanspec)); (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
break; break;
case APCI1710_INCCPT_ENABLECOMPARELOGIC: case APCI1710_INCCPT_SETINDEXANDREFERENCESOURCE:
i_ReturnValue = i_APCI1710_EnableCompareLogic(dev, i_ReturnValue = i_APCI1710_SetIndexAndReferenceSource(dev,
(unsigned char) CR_AREF(insn->chanspec)); (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
break; break;
case APCI1710_INCCPT_DISABLECOMPARELOGIC: case APCI1710_INCCPT_SETDIGITALCHLON:
i_ReturnValue = i_APCI1710_DisableCompareLogic(dev, i_ReturnValue = i_APCI1710_SetDigitalChlOn(dev,
(unsigned char) CR_AREF(insn->chanspec)); (unsigned char) CR_AREF(insn->chanspec));
break; break;
case APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT: case APCI1710_INCCPT_SETDIGITALCHLOFF:
i_ReturnValue = i_APCI1710_EnableFrequencyMeasurement(dev, i_ReturnValue = i_APCI1710_SetDigitalChlOff(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
break;
case APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT:
i_ReturnValue = i_APCI1710_DisableFrequencyMeasurement(dev,
(unsigned char) CR_AREF(insn->chanspec)); (unsigned char) CR_AREF(insn->chanspec));
break; break;
default: default:
printk("Write Config Parameter Wrong\n"); printk("Bits Config Parameter Wrong\n");
} }
if (i_ReturnValue >= 0) if (i_ReturnValue >= 0)
...@@ -3065,8 +2951,8 @@ int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevic ...@@ -3065,8 +2951,8 @@ int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevic
| "i_APCI1710_SetBoardIntRoutine" | | "i_APCI1710_SetBoardIntRoutine" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev,
int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3152,8 +3038,8 @@ int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_M ...@@ -3152,8 +3038,8 @@ int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_M
| "i_APCI1710_SetBoardIntRoutine" | | "i_APCI1710_SetBoardIntRoutine" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev,
int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3251,9 +3137,10 @@ int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ ...@@ -3251,9 +3137,10 @@ int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_
| -4: The selected 16-Bit counter parameter is wrong | | -4: The selected 16-Bit counter parameter is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int ui_WriteValue) unsigned char b_SelectedCounter,
unsigned int ui_WriteValue)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3337,9 +3224,9 @@ int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev, ...@@ -3337,9 +3224,9 @@ int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned int ul_WriteValue) unsigned int ul_WriteValue)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3405,8 +3292,8 @@ int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev, ...@@ -3405,8 +3292,8 @@ int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
| "i_APCI1710_InitIndex" | | "i_APCI1710_InitIndex" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_EnableIndex(struct comedi_device *dev,
int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3504,8 +3391,8 @@ int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr) ...@@ -3504,8 +3391,8 @@ int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
| "i_APCI1710_InitIndex" | | "i_APCI1710_InitIndex" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_DisableIndex(struct comedi_device *dev,
int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3604,8 +3491,8 @@ int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr) ...@@ -3604,8 +3491,8 @@ int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
| See function "i_APCI1710_SetBoardIntRoutineX" | | See function "i_APCI1710_SetBoardIntRoutineX" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_EnableCompareLogic(struct comedi_device *dev,
int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3705,8 +3592,8 @@ int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_Mod ...@@ -3705,8 +3592,8 @@ int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_Mod
| See function "i_APCI1710_InitCompareLogic" | | See function "i_APCI1710_InitCompareLogic" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_DisableCompareLogic(struct comedi_device *dev,
int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3815,9 +3702,9 @@ int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_Mo ...@@ -3815,9 +3702,9 @@ int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_Mo
| -6: Interrupt function not initialised. | | -6: Interrupt function not initialised. |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_InterruptEnable) unsigned char b_InterruptEnable)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -3963,8 +3850,8 @@ int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev, ...@@ -3963,8 +3850,8 @@ int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
| See function "i_APCI1710_InitFrequencyMeasurement" | | See function "i_APCI1710_InitFrequencyMeasurement" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev,
int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned char b_ModulNbr) unsigned char b_ModulNbr)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4058,135 +3945,80 @@ int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned c ...@@ -4058,135 +3945,80 @@ int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned c
return i_ReturnValue; return i_ReturnValue;
} }
/*########################################################################### */
/* INSN READ */
/*########################################################################### */
/* /*
+----------------------------------------------------------------------------+ * Enable Disable functions for INC_CPT
| Function Name :INT i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev,struct comedi_subdevice *s, */
struct comedi_insn *insn,unsigned int *data) | static int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev,
+----------------------------------------------------------------------------+ struct comedi_subdevice *s,
| Task : Read and Get functions for INC_CPT | struct comedi_insn *insn,
+----------------------------------------------------------------------------+ unsigned int *data)
| Input Parameters :
+----------------------------------------------------------------------------+
| Output Parameters : - |
+----------------------------------------------------------------------------+
| Return Value :
+----------------------------------------------------------------------------+
*/
int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned int ui_ReadType; unsigned int ui_WriteType;
int i_ReturnValue = 0; int i_ReturnValue = 0;
ui_ReadType = CR_CHAN(insn->chanspec); ui_WriteType = CR_CHAN(insn->chanspec);
devpriv->tsk_Current = current; /* Save the current process task structure */ devpriv->tsk_Current = current; /* Save the current process task structure */
switch (ui_ReadType) {
case APCI1710_INCCPT_READLATCHREGISTERSTATUS:
i_ReturnValue = i_APCI1710_ReadLatchRegisterStatus(dev,
(unsigned char) CR_AREF(insn->chanspec),
(unsigned char) CR_RANGE(insn->chanspec), (unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_READLATCHREGISTERVALUE:
i_ReturnValue = i_APCI1710_ReadLatchRegisterValue(dev,
(unsigned char) CR_AREF(insn->chanspec),
(unsigned char) CR_RANGE(insn->chanspec), (unsigned int *) &data[0]);
printk("Latch Register Value %d\n", data[0]);
break;
case APCI1710_INCCPT_READ16BITCOUNTERVALUE: switch (ui_WriteType) {
i_ReturnValue = i_APCI1710_Read16BitCounterValue(dev, case APCI1710_INCCPT_ENABLELATCHINTERRUPT:
(unsigned char) CR_AREF(insn->chanspec), i_ReturnValue = i_APCI1710_EnableLatchInterrupt(dev,
(unsigned char) CR_RANGE(insn->chanspec), (unsigned int *) &data[0]); (unsigned char) CR_AREF(insn->chanspec));
break; break;
case APCI1710_INCCPT_READ32BITCOUNTERVALUE: case APCI1710_INCCPT_DISABLELATCHINTERRUPT:
i_ReturnValue = i_APCI1710_Read32BitCounterValue(dev, i_ReturnValue = i_APCI1710_DisableLatchInterrupt(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned int *) &data[0]); (unsigned char) CR_AREF(insn->chanspec));
break; break;
case APCI1710_INCCPT_GETINDEXSTATUS: case APCI1710_INCCPT_WRITE16BITCOUNTERVALUE:
i_ReturnValue = i_APCI1710_GetIndexStatus(dev, i_ReturnValue = i_APCI1710_Write16BitCounterValue(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); (unsigned char) CR_AREF(insn->chanspec),
(unsigned char) data[0], (unsigned int) data[1]);
break; break;
case APCI1710_INCCPT_GETREFERENCESTATUS: case APCI1710_INCCPT_WRITE32BITCOUNTERVALUE:
i_ReturnValue = i_APCI1710_GetReferenceStatus(dev, i_ReturnValue = i_APCI1710_Write32BitCounterValue(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); (unsigned char) CR_AREF(insn->chanspec), (unsigned int) data[0]);
break;
case APCI1710_INCCPT_GETUASSTATUS:
i_ReturnValue = i_APCI1710_GetUASStatus(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
break; break;
case APCI1710_INCCPT_GETCBSTATUS: case APCI1710_INCCPT_ENABLEINDEX:
i_ReturnValue = i_APCI1710_GetCBStatus(dev, i_APCI1710_EnableIndex(dev, (unsigned char) CR_AREF(insn->chanspec));
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
break; break;
case APCI1710_INCCPT_GET16BITCBSTATUS: case APCI1710_INCCPT_DISABLEINDEX:
i_ReturnValue = i_APCI1710_Get16BitCBStatus(dev, i_ReturnValue = i_APCI1710_DisableIndex(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char) CR_AREF(insn->chanspec));
(unsigned char *) &data[0], (unsigned char *) &data[1]);
break; break;
case APCI1710_INCCPT_GETUDSTATUS: case APCI1710_INCCPT_ENABLECOMPARELOGIC:
i_ReturnValue = i_APCI1710_GetUDStatus(dev, i_ReturnValue = i_APCI1710_EnableCompareLogic(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); (unsigned char) CR_AREF(insn->chanspec));
break; break;
case APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS: case APCI1710_INCCPT_DISABLECOMPARELOGIC:
i_ReturnValue = i_APCI1710_GetInterruptUDLatchedStatus(dev, i_ReturnValue = i_APCI1710_DisableCompareLogic(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); (unsigned char) CR_AREF(insn->chanspec));
break; break;
case APCI1710_INCCPT_READFREQUENCYMEASUREMENT: case APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT:
i_ReturnValue = i_APCI1710_ReadFrequencyMeasurement(dev, i_ReturnValue = i_APCI1710_EnableFrequencyMeasurement(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
(unsigned char *) &data[0],
(unsigned char *) &data[1], (unsigned int *) &data[2]);
break; break;
case APCI1710_INCCPT_READINTERRUPT: case APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT:
data[0] = devpriv->s_InterruptParameters. i_ReturnValue = i_APCI1710_DisableFrequencyMeasurement(dev,
s_FIFOInterruptParameters[devpriv-> (unsigned char) CR_AREF(insn->chanspec));
s_InterruptParameters.ui_Read].b_OldModuleMask;
data[1] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv->
s_InterruptParameters.ui_Read].ul_OldInterruptMask;
data[2] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv->
s_InterruptParameters.ui_Read].ul_OldCounterLatchValue;
/**************************/
/* Increment the read FIFO */
/***************************/
devpriv->
s_InterruptParameters.
ui_Read = (devpriv->s_InterruptParameters.
ui_Read + 1) % APCI1710_SAVE_INTERRUPT;
break; break;
default: default:
printk("ReadType Parameter wrong\n"); printk("Write Config Parameter Wrong\n");
} }
if (i_ReturnValue >= 0) if (i_ReturnValue >= 0)
i_ReturnValue = insn->n; i_ReturnValue = insn->n;
return i_ReturnValue; return i_ReturnValue;
} }
/* /*
...@@ -4222,9 +4054,10 @@ int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice ...@@ -4222,9 +4054,10 @@ int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice
| -4: The selected latch register parameter is wrong | | -4: The selected latch register parameter is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned char *pb_LatchStatus) unsigned char b_LatchReg,
unsigned char *pb_LatchStatus)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4310,9 +4143,10 @@ int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev, ...@@ -4310,9 +4143,10 @@ int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
| -4: The selected latch register parameter is wrong | | -4: The selected latch register parameter is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned int *pul_LatchValue) unsigned char b_LatchReg,
unsigned int *pul_LatchValue)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4395,9 +4229,10 @@ int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev, ...@@ -4395,9 +4229,10 @@ int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
| -4: The selected 16-Bit counter parameter is wrong | | -4: The selected 16-Bit counter parameter is wrong |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int *pui_CounterValue) unsigned char b_SelectedCounter,
unsigned int *pui_CounterValue)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4491,9 +4326,9 @@ int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev, ...@@ -4491,9 +4326,9 @@ int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned int *pul_CounterValue) unsigned int *pul_CounterValue)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4568,9 +4403,9 @@ int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev, ...@@ -4568,9 +4403,9 @@ int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
| "i_APCI1710_InitIndex" | | "i_APCI1710_InitIndex" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
int i_APCI1710_GetIndexStatus(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char *pb_IndexStatus) unsigned char *pb_IndexStatus)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4653,9 +4488,9 @@ int i_APCI1710_GetIndexStatus(struct comedi_device *dev, ...@@ -4653,9 +4488,9 @@ int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
| "i_APCI1710_InitReference" | | "i_APCI1710_InitReference" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
int i_APCI1710_GetReferenceStatus(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char *pb_ReferenceStatus) unsigned char *pb_ReferenceStatus)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4738,9 +4573,9 @@ int i_APCI1710_GetReferenceStatus(struct comedi_device *dev, ...@@ -4738,9 +4573,9 @@ int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_GetUASStatus(struct comedi_device *dev,
int i_APCI1710_GetUASStatus(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char *pb_UASStatus) unsigned char *pb_UASStatus)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4807,9 +4642,9 @@ int i_APCI1710_GetUASStatus(struct comedi_device *dev, ...@@ -4807,9 +4642,9 @@ int i_APCI1710_GetUASStatus(struct comedi_device *dev,
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_GetCBStatus(struct comedi_device *dev,
int i_APCI1710_GetCBStatus(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char *pb_CBStatus) unsigned char *pb_CBStatus)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -4890,9 +4725,10 @@ int i_APCI1710_GetCBStatus(struct comedi_device *dev, ...@@ -4890,9 +4725,10 @@ int i_APCI1710_GetCBStatus(struct comedi_device *dev,
| -5: Firmware revision error | | -5: Firmware revision error |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char *pb_CBStatusCounter0, unsigned char *pb_CBStatusCounter1) unsigned char *pb_CBStatusCounter0,
unsigned char *pb_CBStatusCounter1)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -5004,9 +4840,9 @@ int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev, ...@@ -5004,9 +4840,9 @@ int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
| "i_APCI1710_InitCounter" | | "i_APCI1710_InitCounter" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_GetUDStatus(struct comedi_device *dev,
int i_APCI1710_GetUDStatus(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char *pb_UDStatus) unsigned char *pb_UDStatus)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -5079,9 +4915,9 @@ int i_APCI1710_GetUDStatus(struct comedi_device *dev, ...@@ -5079,9 +4915,9 @@ int i_APCI1710_GetUDStatus(struct comedi_device *dev,
| See function "i_APCI1710_SetBoardIntRoutineX" | | See function "i_APCI1710_SetBoardIntRoutineX" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev, unsigned char b_ModulNbr,
unsigned char b_ModulNbr, unsigned char *pb_UDStatus) unsigned char *pb_UDStatus)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -5185,10 +5021,11 @@ int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev, ...@@ -5185,10 +5021,11 @@ int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
| See function "i_APCI1710_InitFrequencyMeasurement" | | See function "i_APCI1710_InitFrequencyMeasurement" |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
static int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ModulNbr,
unsigned char *pb_Status, unsigned char *pb_UDStatus, unsigned int *pul_ReadValue) unsigned char *pb_Status,
unsigned char *pb_UDStatus,
unsigned int *pul_ReadValue)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -5403,3 +5240,118 @@ int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev, ...@@ -5403,3 +5240,118 @@ int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
return i_ReturnValue; return i_ReturnValue;
} }
/*
* Read and Get functions for INC_CPT
*/
static int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
struct addi_private *devpriv = dev->private;
unsigned int ui_ReadType;
int i_ReturnValue = 0;
ui_ReadType = CR_CHAN(insn->chanspec);
devpriv->tsk_Current = current; /* Save the current process task structure */
switch (ui_ReadType) {
case APCI1710_INCCPT_READLATCHREGISTERSTATUS:
i_ReturnValue = i_APCI1710_ReadLatchRegisterStatus(dev,
(unsigned char) CR_AREF(insn->chanspec),
(unsigned char) CR_RANGE(insn->chanspec), (unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_READLATCHREGISTERVALUE:
i_ReturnValue = i_APCI1710_ReadLatchRegisterValue(dev,
(unsigned char) CR_AREF(insn->chanspec),
(unsigned char) CR_RANGE(insn->chanspec), (unsigned int *) &data[0]);
printk("Latch Register Value %d\n", data[0]);
break;
case APCI1710_INCCPT_READ16BITCOUNTERVALUE:
i_ReturnValue = i_APCI1710_Read16BitCounterValue(dev,
(unsigned char) CR_AREF(insn->chanspec),
(unsigned char) CR_RANGE(insn->chanspec), (unsigned int *) &data[0]);
break;
case APCI1710_INCCPT_READ32BITCOUNTERVALUE:
i_ReturnValue = i_APCI1710_Read32BitCounterValue(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned int *) &data[0]);
break;
case APCI1710_INCCPT_GETINDEXSTATUS:
i_ReturnValue = i_APCI1710_GetIndexStatus(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_GETREFERENCESTATUS:
i_ReturnValue = i_APCI1710_GetReferenceStatus(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_GETUASSTATUS:
i_ReturnValue = i_APCI1710_GetUASStatus(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_GETCBSTATUS:
i_ReturnValue = i_APCI1710_GetCBStatus(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_GET16BITCBSTATUS:
i_ReturnValue = i_APCI1710_Get16BitCBStatus(dev,
(unsigned char) CR_AREF(insn->chanspec),
(unsigned char *) &data[0], (unsigned char *) &data[1]);
break;
case APCI1710_INCCPT_GETUDSTATUS:
i_ReturnValue = i_APCI1710_GetUDStatus(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS:
i_ReturnValue = i_APCI1710_GetInterruptUDLatchedStatus(dev,
(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
break;
case APCI1710_INCCPT_READFREQUENCYMEASUREMENT:
i_ReturnValue = i_APCI1710_ReadFrequencyMeasurement(dev,
(unsigned char) CR_AREF(insn->chanspec),
(unsigned char *) &data[0],
(unsigned char *) &data[1], (unsigned int *) &data[2]);
break;
case APCI1710_INCCPT_READINTERRUPT:
data[0] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv->
s_InterruptParameters.ui_Read].b_OldModuleMask;
data[1] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv->
s_InterruptParameters.ui_Read].ul_OldInterruptMask;
data[2] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv->
s_InterruptParameters.ui_Read].ul_OldCounterLatchValue;
/**************************/
/* Increment the read FIFO */
/***************************/
devpriv->
s_InterruptParameters.
ui_Read = (devpriv->s_InterruptParameters.
ui_Read + 1) % APCI1710_SAVE_INTERRUPT;
break;
default:
printk("ReadType Parameter wrong\n");
}
if (i_ReturnValue >= 0)
i_ReturnValue = insn->n;
return i_ReturnValue;
}
...@@ -130,142 +130,3 @@ ...@@ -130,142 +130,3 @@
#define APCI1710_INCCPT_DISABLECOMPARELOGIC 407 #define APCI1710_INCCPT_DISABLECOMPARELOGIC 407
#define APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT 408 #define APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT 408
#define APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT 409 #define APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT 409
/************ Main Functions *************/
int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int * data);
int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
struct comedi_insn *insn, unsigned int * data);
int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
struct comedi_insn *insn, unsigned int * data);
int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
struct comedi_insn *insn, unsigned int * data);
/*********** Supplementary Functions********/
/* INSN CONFIG */
int i_APCI1710_InitCounter(struct comedi_device *dev,
unsigned char b_ModulNbr,
unsigned char b_CounterRange,
unsigned char b_FirstCounterModus,
unsigned char b_FirstCounterOption,
unsigned char b_SecondCounterModus,
unsigned char b_SecondCounterOption);
int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char * pb_TestStatus);
int i_APCI1710_InitIndex(struct comedi_device *dev,
unsigned char b_ModulNbr,
unsigned char b_ReferenceAction,
unsigned char b_IndexOperation, unsigned char b_AutoMode,
unsigned char b_InterruptEnable);
int i_APCI1710_InitReference(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ReferenceLevel);
int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ExternalStrobe,
unsigned char b_ExternalStrobeLevel);
int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned int ui_CompareValue);
int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev,
unsigned char b_ModulNbr,
unsigned char b_PCIInputClock,
unsigned char b_TimingUnity,
unsigned int ul_TimingInterval,
unsigned int *pul_RealTimingInterval);
/* INSN BITS */
int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr);
int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev);
int i_APCI1710_SetInputFilter(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_PCIInputClock,
unsigned char b_Filter);
int i_APCI1710_LatchCounter(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_LatchReg);
int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
unsigned char b_ModulNbr,
unsigned char b_SourceSelection);
int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr);
int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr);
/* INSN WRITE */
int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr);
int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr);
int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_SelectedCounter,
unsigned int ui_WriteValue);
int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned int ul_WriteValue);
int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr);
int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr);
int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr);
int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr);
int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
unsigned char b_ModulNbr,
unsigned char b_InterruptEnable);
int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev,
unsigned char b_ModulNbr);
/* INSN READ */
int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_LatchReg,
unsigned char *pb_LatchStatus);
int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_LatchReg,
unsigned int *pul_LatchValue);
int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_SelectedCounter,
unsigned int *pui_CounterValue);
int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned int *pul_CounterValue);
int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_IndexStatus);
int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_ReferenceStatus);
int i_APCI1710_GetUASStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_UASStatus);
int i_APCI1710_GetCBStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_CBStatus);
int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_CBStatusCounter0,
unsigned char *pb_CBStatusCounter1);
int i_APCI1710_GetUDStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_UDStatus);
int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_UDStatus);
int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
unsigned char b_ModulNbr,
unsigned char *pb_Status, unsigned char *pb_UDStatus,
unsigned int *pul_ReadValue);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment