staging: comedi: APCI1710_INCCPT: remove forward declarations
authorH Hartley Sweeten <hartleys@visionengravers.com>
Wed, 31 Oct 2012 00:02:37 +0000 (17:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Oct 2012 22:15:56 +0000 (15:15 -0700)
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: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c
drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h

index 834685b..7c997f6 100644 (file)
@@ -61,88 +61,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour
 
 /*
 +----------------------------------------------------------------------------+
-| 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                           |
 |                               (unsigned char_          b_BoardHandle,               |
 |                                unsigned char_          b_ModulNbr,                  |
@@ -300,13 +218,13 @@ int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevi
 |                        wrong.                                              |
 +----------------------------------------------------------------------------+
 */
-
-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)
+static 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)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -547,8 +465,8 @@ int i_APCI1710_InitCounter(struct comedi_device *dev,
 |                     -2: No counter module found                            |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char *pb_TestStatus)
+static int i_APCI1710_CounterAutoTest(struct comedi_device *dev,
+                                     unsigned char *pb_TestStatus)
 {
        struct addi_private *devpriv = dev->private;
        unsigned char b_ModulCpt = 0;
@@ -711,11 +629,12 @@ int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char *pb_Test
 |                         See function "i_APCI1710_SetBoardIntRoutineX"      |
 +----------------------------------------------------------------------------+
 */
-
-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)
+static 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)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -1156,9 +1075,9 @@ int i_APCI1710_InitIndex(struct comedi_device *dev,
 |                     -4: Reference level parameter is wrong                 |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_InitReference(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_ReferenceLevel)
+static int i_APCI1710_InitReference(struct comedi_device *dev,
+                                   unsigned char b_ModulNbr,
+                                   unsigned char b_ReferenceLevel)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -1282,9 +1201,10 @@ int i_APCI1710_InitReference(struct comedi_device *dev,
 |                     -5: External strobe level parameter is wrong           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_ExternalStrobe, unsigned char b_ExternalStrobeLevel)
+static int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
+                                        unsigned char b_ModulNbr,
+                                        unsigned char b_ExternalStrobe,
+                                        unsigned char b_ExternalStrobeLevel)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -1397,9 +1317,9 @@ int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
           |                         "i_APCI1710_InitCounter"                           |
           +----------------------------------------------------------------------------+
         */
-
-int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned int ui_CompareValue)
+static int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
+                                      unsigned char b_ModulNbr,
+                                      unsigned int ui_CompareValue)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -1494,12 +1414,12 @@ int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
 |                    -7: 40MHz quartz not on board                          |
 +----------------------------------------------------------------------------+
 */
-
-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)
+static 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)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -2004,74 +1924,70 @@ int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev,
        return i_ReturnValue;
 }
 
-/*########################################################################### */
-
-                                                       /* INSN BITS */
-/*########################################################################### */
-
 /*
-+----------------------------------------------------------------------------+
-| Function Name     :INT       i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev,struct comedi_subdevice *s,
-struct comedi_insn *insn,unsigned int *data)                   |
-+----------------------------------------------------------------------------+
-| Task              : Set & Clear Functions for INC_CPT                                          |
-+----------------------------------------------------------------------------+
-| 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)
+ * Configuration function for INC_CPT
+ */
+static 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_BitsType;
+       unsigned int ui_ConfigType;
        int i_ReturnValue = 0;
 
-       ui_BitsType = CR_CHAN(insn->chanspec);
-       devpriv->tsk_Current = current; /*  Save the current process task structure */
+       ui_ConfigType = CR_CHAN(insn->chanspec);
 
-       switch (ui_BitsType) {
-       case APCI1710_INCCPT_CLEARCOUNTERVALUE:
-               i_ReturnValue = i_APCI1710_ClearCounterValue(dev,
-                       (unsigned char) CR_AREF(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_CLEARALLCOUNTERVALUE:
-               i_ReturnValue = i_APCI1710_ClearAllCounterValue(dev);
+       case APCI1710_INCCPT_COUNTERAUTOTEST:
+               i_ReturnValue = i_APCI1710_CounterAutoTest(dev,
+                       (unsigned char *) &data[0]);
                break;
 
-       case APCI1710_INCCPT_SETINPUTFILTER:
-               i_ReturnValue = i_APCI1710_SetInputFilter(dev,
-                       (unsigned char) CR_AREF(insn->chanspec),
-                       (unsigned char) data[0], (unsigned char) data[1]);
+       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_LATCHCOUNTER:
-               i_ReturnValue = i_APCI1710_LatchCounter(dev,
-                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
+       case APCI1710_INCCPT_INITREFERENCE:
+               i_ReturnValue = i_APCI1710_InitReference(dev,
+                       CR_AREF(insn->chanspec), (unsigned char) data[0]);
                break;
 
-       case APCI1710_INCCPT_SETINDEXANDREFERENCESOURCE:
-               i_ReturnValue = i_APCI1710_SetIndexAndReferenceSource(dev,
-                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
+       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_SETDIGITALCHLON:
-               i_ReturnValue = i_APCI1710_SetDigitalChlOn(dev,
-                       (unsigned char) CR_AREF(insn->chanspec));
+       case APCI1710_INCCPT_INITCOMPARELOGIC:
+               i_ReturnValue = i_APCI1710_InitCompareLogic(dev,
+                       CR_AREF(insn->chanspec), (unsigned int) data[0]);
                break;
 
-       case APCI1710_INCCPT_SETDIGITALCHLOFF:
-               i_ReturnValue = i_APCI1710_SetDigitalChlOff(dev,
-                       (unsigned char) CR_AREF(insn->chanspec));
+       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("Bits Config Parameter Wrong\n");
+               printk("Insn Config : Config Parameter Wrong\n");
+
        }
 
        if (i_ReturnValue >= 0)
@@ -2101,8 +2017,8 @@ int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice
 |                         "i_APCI1710_InitCounter"                           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_ClearCounterValue(struct comedi_device *dev,
+                                       unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -2162,8 +2078,7 @@ int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_Modu
 |                     -2: No counter module found                            |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev)
+static int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev)
 {
        struct addi_private *devpriv = dev->private;
        unsigned char b_ModulCpt = 0;
@@ -2309,9 +2224,10 @@ int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev)
 |                                        -6: 40MHz quartz not on board                          |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_SetInputFilter(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_PCIInputClock, unsigned char b_Filter)
+static int i_APCI1710_SetInputFilter(struct comedi_device *dev,
+                                    unsigned char b_ModulNbr,
+                                    unsigned char b_PCIInputClock,
+                                    unsigned char b_Filter)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -2574,9 +2490,9 @@ int i_APCI1710_SetInputFilter(struct comedi_device *dev,
 |                     -4: The selected latch register parameter is wrong     |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_LatchCounter(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_LatchReg)
+static int i_APCI1710_LatchCounter(struct comedi_device *dev,
+                                  unsigned char b_ModulNbr,
+                                  unsigned char b_LatchReg)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -2672,9 +2588,9 @@ int i_APCI1710_LatchCounter(struct comedi_device *dev,
 |                    -4: The source selection is wrong                      |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_SourceSelection)
+static int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
+                                                unsigned char b_ModulNbr,
+                                                unsigned char b_SourceSelection)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -2810,8 +2726,8 @@ int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
 |                        "i_APCI1710_InitCounter"                           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev,
+                                     unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -2891,8 +2807,8 @@ int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulN
 |                        "i_APCI1710_InitCounter"                           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev,
+                                      unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -2950,89 +2866,59 @@ int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_Modul
        return i_ReturnValue;
 }
 
-/*########################################################################### */
-
-                                                       /*  INSN WRITE */
-/*########################################################################### */
-
 /*
-+----------------------------------------------------------------------------+
-| Function Name     :INT       i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev,struct comedi_subdevice *s,
-struct comedi_insn *insn,unsigned int *data)                   |
-+----------------------------------------------------------------------------+
-| Task              : Enable Disable functions for INC_CPT                                       |
-+----------------------------------------------------------------------------+
-| 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)
+ * Set & Clear Functions for INC_CPT
+ */
+static 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;
-       unsigned int ui_WriteType;
+       unsigned int ui_BitsType;
        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 */
 
-       switch (ui_WriteType) {
-       case APCI1710_INCCPT_ENABLELATCHINTERRUPT:
-               i_ReturnValue = i_APCI1710_EnableLatchInterrupt(dev,
+       switch (ui_BitsType) {
+       case APCI1710_INCCPT_CLEARCOUNTERVALUE:
+               i_ReturnValue = i_APCI1710_ClearCounterValue(dev,
                        (unsigned char) CR_AREF(insn->chanspec));
                break;
 
-       case APCI1710_INCCPT_DISABLELATCHINTERRUPT:
-               i_ReturnValue = i_APCI1710_DisableLatchInterrupt(dev,
-                       (unsigned char) CR_AREF(insn->chanspec));
+       case APCI1710_INCCPT_CLEARALLCOUNTERVALUE:
+               i_ReturnValue = i_APCI1710_ClearAllCounterValue(dev);
                break;
 
-       case APCI1710_INCCPT_WRITE16BITCOUNTERVALUE:
-               i_ReturnValue = i_APCI1710_Write16BitCounterValue(dev,
+       case APCI1710_INCCPT_SETINPUTFILTER:
+               i_ReturnValue = i_APCI1710_SetInputFilter(dev,
                        (unsigned char) CR_AREF(insn->chanspec),
-                       (unsigned char) data[0], (unsigned int) 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));
+                       (unsigned char) data[0], (unsigned char) data[1]);
                break;
 
-       case APCI1710_INCCPT_DISABLEINDEX:
-               i_ReturnValue = i_APCI1710_DisableIndex(dev,
-                       (unsigned char) CR_AREF(insn->chanspec));
+       case APCI1710_INCCPT_LATCHCOUNTER:
+               i_ReturnValue = i_APCI1710_LatchCounter(dev,
+                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
                break;
 
-       case APCI1710_INCCPT_ENABLECOMPARELOGIC:
-               i_ReturnValue = i_APCI1710_EnableCompareLogic(dev,
-                       (unsigned char) CR_AREF(insn->chanspec));
+       case APCI1710_INCCPT_SETINDEXANDREFERENCESOURCE:
+               i_ReturnValue = i_APCI1710_SetIndexAndReferenceSource(dev,
+                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
                break;
 
-       case APCI1710_INCCPT_DISABLECOMPARELOGIC:
-               i_ReturnValue = i_APCI1710_DisableCompareLogic(dev,
+       case APCI1710_INCCPT_SETDIGITALCHLON:
+               i_ReturnValue = i_APCI1710_SetDigitalChlOn(dev,
                        (unsigned char) CR_AREF(insn->chanspec));
                break;
 
-       case APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT:
-               i_ReturnValue = i_APCI1710_EnableFrequencyMeasurement(dev,
-                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
-               break;
-
-       case APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT:
-               i_ReturnValue = i_APCI1710_DisableFrequencyMeasurement(dev,
+       case APCI1710_INCCPT_SETDIGITALCHLOFF:
+               i_ReturnValue = i_APCI1710_SetDigitalChlOff(dev,
                        (unsigned char) CR_AREF(insn->chanspec));
                break;
 
        default:
-               printk("Write Config Parameter Wrong\n");
+               printk("Bits Config Parameter Wrong\n");
        }
 
        if (i_ReturnValue >= 0)
@@ -3065,8 +2951,8 @@ int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevic
 |                         "i_APCI1710_SetBoardIntRoutine"                    |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev,
+                                          unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3152,8 +3038,8 @@ int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_M
 |                         "i_APCI1710_SetBoardIntRoutine"                    |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev,
+                                           unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3251,9 +3137,10 @@ int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_
 |                     -4: The selected 16-Bit counter parameter is wrong     |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int ui_WriteValue)
+static int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
+                                            unsigned char b_ModulNbr,
+                                            unsigned char b_SelectedCounter,
+                                            unsigned int ui_WriteValue)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3337,9 +3224,9 @@ int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
 |                         "i_APCI1710_InitCounter"                           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned int ul_WriteValue)
+static int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
+                                            unsigned char b_ModulNbr,
+                                            unsigned int ul_WriteValue)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3405,8 +3292,8 @@ int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
 |                         "i_APCI1710_InitIndex"                             |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_EnableIndex(struct comedi_device *dev,
+                                 unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3504,8 +3391,8 @@ int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
 |                         "i_APCI1710_InitIndex"                             |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_DisableIndex(struct comedi_device *dev,
+                                  unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3604,8 +3491,8 @@ int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
 |                         See function "i_APCI1710_SetBoardIntRoutineX"      |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_EnableCompareLogic(struct comedi_device *dev,
+                                        unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3705,8 +3592,8 @@ int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_Mod
 |                         See function "i_APCI1710_InitCompareLogic"         |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_DisableCompareLogic(struct comedi_device *dev,
+                                         unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3815,9 +3702,9 @@ int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_Mo
           |                     -6: Interrupt function not initialised.                |
           +----------------------------------------------------------------------------+
         */
-
-int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_InterruptEnable)
+static int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
+                                                unsigned char b_ModulNbr,
+                                                unsigned char b_InterruptEnable)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -3963,8 +3850,8 @@ int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
           |                      See function "i_APCI1710_InitFrequencyMeasurement" |
           +----------------------------------------------------------------------------+
         */
-
-int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned char b_ModulNbr)
+static int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev,
+                                                 unsigned char b_ModulNbr)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4058,135 +3945,80 @@ int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned c
        return i_ReturnValue;
 }
 
-/*########################################################################### */
-
-                                                       /*  INSN READ */
-
-/*########################################################################### */
-
 /*
-+----------------------------------------------------------------------------+
-| Function Name     :INT       i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev,struct comedi_subdevice *s,
-struct comedi_insn *insn,unsigned int *data)                   |
-+----------------------------------------------------------------------------+
-| Task              : Read and Get functions for INC_CPT                                       |
-+----------------------------------------------------------------------------+
-| 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)
+ * Enable Disable functions for INC_CPT
+ */
+static 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;
-       unsigned int ui_ReadType;
+       unsigned int ui_WriteType;
        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 */
-       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]);
+       switch (ui_WriteType) {
+       case APCI1710_INCCPT_ENABLELATCHINTERRUPT:
+               i_ReturnValue = i_APCI1710_EnableLatchInterrupt(dev,
+                       (unsigned char) CR_AREF(insn->chanspec));
                break;
 
-       case APCI1710_INCCPT_READ32BITCOUNTERVALUE:
-               i_ReturnValue = i_APCI1710_Read32BitCounterValue(dev,
-                       (unsigned char) CR_AREF(insn->chanspec), (unsigned int *) &data[0]);
+       case APCI1710_INCCPT_DISABLELATCHINTERRUPT:
+               i_ReturnValue = i_APCI1710_DisableLatchInterrupt(dev,
+                       (unsigned char) CR_AREF(insn->chanspec));
                break;
 
-       case APCI1710_INCCPT_GETINDEXSTATUS:
-               i_ReturnValue = i_APCI1710_GetIndexStatus(dev,
-                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
+       case APCI1710_INCCPT_WRITE16BITCOUNTERVALUE:
+               i_ReturnValue = i_APCI1710_Write16BitCounterValue(dev,
+                       (unsigned char) CR_AREF(insn->chanspec),
+                       (unsigned char) data[0], (unsigned int) data[1]);
                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_WRITE32BITCOUNTERVALUE:
+               i_ReturnValue = i_APCI1710_Write32BitCounterValue(dev,
+                       (unsigned char) CR_AREF(insn->chanspec), (unsigned int) data[0]);
 
-       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]);
+       case APCI1710_INCCPT_ENABLEINDEX:
+               i_APCI1710_EnableIndex(dev, (unsigned char) CR_AREF(insn->chanspec));
                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]);
+       case APCI1710_INCCPT_DISABLEINDEX:
+               i_ReturnValue = i_APCI1710_DisableIndex(dev,
+                       (unsigned char) CR_AREF(insn->chanspec));
                break;
 
-       case APCI1710_INCCPT_GETUDSTATUS:
-               i_ReturnValue = i_APCI1710_GetUDStatus(dev,
-                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
-
+       case APCI1710_INCCPT_ENABLECOMPARELOGIC:
+               i_ReturnValue = i_APCI1710_EnableCompareLogic(dev,
+                       (unsigned char) CR_AREF(insn->chanspec));
                break;
 
-       case APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS:
-               i_ReturnValue = i_APCI1710_GetInterruptUDLatchedStatus(dev,
-                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
+       case APCI1710_INCCPT_DISABLECOMPARELOGIC:
+               i_ReturnValue = i_APCI1710_DisableCompareLogic(dev,
+                       (unsigned char) CR_AREF(insn->chanspec));
                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]);
+       case APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT:
+               i_ReturnValue = i_APCI1710_EnableFrequencyMeasurement(dev,
+                       (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
                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;
-
+       case APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT:
+               i_ReturnValue = i_APCI1710_DisableFrequencyMeasurement(dev,
+                       (unsigned char) CR_AREF(insn->chanspec));
                break;
 
        default:
-               printk("ReadType Parameter wrong\n");
+               printk("Write Config Parameter Wrong\n");
        }
 
        if (i_ReturnValue >= 0)
                i_ReturnValue = insn->n;
        return i_ReturnValue;
-
 }
 
 /*
@@ -4222,9 +4054,10 @@ int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice
 |                     -4: The selected latch register parameter is wrong     |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned char *pb_LatchStatus)
+static int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
+                                             unsigned char b_ModulNbr,
+                                             unsigned char b_LatchReg,
+                                             unsigned char *pb_LatchStatus)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4310,9 +4143,10 @@ int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
 |                     -4: The selected latch register parameter is wrong     |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned int *pul_LatchValue)
+static int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
+                                            unsigned char b_ModulNbr,
+                                            unsigned char b_LatchReg,
+                                            unsigned int *pul_LatchValue)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4395,9 +4229,10 @@ int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
 |                     -4: The selected 16-Bit counter parameter is wrong     |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int *pui_CounterValue)
+static int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
+                                           unsigned char b_ModulNbr,
+                                           unsigned char b_SelectedCounter,
+                                           unsigned int *pui_CounterValue)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4491,9 +4326,9 @@ int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
 |                         "i_APCI1710_InitCounter"                           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned int *pul_CounterValue)
+static int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
+                                           unsigned char b_ModulNbr,
+                                           unsigned int *pul_CounterValue)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4568,9 +4403,9 @@ int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
 |                         "i_APCI1710_InitIndex"                             |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char *pb_IndexStatus)
+static int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
+                                    unsigned char b_ModulNbr,
+                                    unsigned char *pb_IndexStatus)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4653,9 +4488,9 @@ int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
 |                         "i_APCI1710_InitReference"                         |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char *pb_ReferenceStatus)
+static int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
+                                        unsigned char b_ModulNbr,
+                                        unsigned char *pb_ReferenceStatus)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4738,9 +4573,9 @@ int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
 |                         "i_APCI1710_InitCounter"                           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_GetUASStatus(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char *pb_UASStatus)
+static int i_APCI1710_GetUASStatus(struct comedi_device *dev,
+                                  unsigned char b_ModulNbr,
+                                  unsigned char *pb_UASStatus)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4807,9 +4642,9 @@ int i_APCI1710_GetUASStatus(struct comedi_device *dev,
 |                         "i_APCI1710_InitCounter"                           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_GetCBStatus(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char *pb_CBStatus)
+static int i_APCI1710_GetCBStatus(struct comedi_device *dev,
+                                 unsigned char b_ModulNbr,
+                                 unsigned char *pb_CBStatus)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -4890,9 +4725,10 @@ int i_APCI1710_GetCBStatus(struct comedi_device *dev,
 |                     -5: Firmware revision error                            |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char *pb_CBStatusCounter0, unsigned char *pb_CBStatusCounter1)
+static int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
+                                      unsigned char b_ModulNbr,
+                                      unsigned char *pb_CBStatusCounter0,
+                                      unsigned char *pb_CBStatusCounter1)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -5004,9 +4840,9 @@ int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
 |                         "i_APCI1710_InitCounter"                           |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_GetUDStatus(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char *pb_UDStatus)
+static int i_APCI1710_GetUDStatus(struct comedi_device *dev,
+                                 unsigned char b_ModulNbr,
+                                 unsigned char *pb_UDStatus)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -5079,9 +4915,9 @@ int i_APCI1710_GetUDStatus(struct comedi_device *dev,
 |                         See function "i_APCI1710_SetBoardIntRoutineX"      |
 +----------------------------------------------------------------------------+
 */
-
-int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
-       unsigned char b_ModulNbr, unsigned char *pb_UDStatus)
+static int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
+                                                 unsigned char b_ModulNbr,
+                                                 unsigned char *pb_UDStatus)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -5185,10 +5021,11 @@ int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
           |                      See function "i_APCI1710_InitFrequencyMeasurement" |
           +----------------------------------------------------------------------------+
         */
-
-int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
-       unsigned char b_ModulNbr,
-       unsigned char *pb_Status, unsigned char *pb_UDStatus, unsigned int *pul_ReadValue)
+static int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
+                                              unsigned char b_ModulNbr,
+                                              unsigned char *pb_Status,
+                                              unsigned char *pb_UDStatus,
+                                              unsigned int *pul_ReadValue)
 {
        struct addi_private *devpriv = dev->private;
        int i_ReturnValue = 0;
@@ -5403,3 +5240,118 @@ int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
 
        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;
+
+}
index 358298b..ff3ea6e 100644 (file)
 #define APCI1710_INCCPT_DISABLECOMPARELOGIC                    407
 #define APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT             408
 #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);