Merge branch 'for-2.6.31' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / drivers / staging / comedi / drivers / addi-data / APCI1710_Inp_cpt.c
index 3ac6a26..0fc2285 100644 (file)
@@ -3,13 +3,13 @@
 
 Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
 
-        ADDI-DATA GmbH
-        Dieselstrasse 3
-        D-77833 Ottersweier
-        Tel: +19(0)7223/9493-0
-        Fax: +49(0)7223/9493-92
-        http://www.addi-data-com
-        info@addi-data.com
+       ADDI-DATA GmbH
+       Dieselstrasse 3
+       D-77833 Ottersweier
+       Tel: +19(0)7223/9493-0
+       Fax: +49(0)7223/9493-92
+       http://www.addi-data-com
+       info@addi-data.com
 
 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
 
@@ -60,11 +60,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_InitPulseEncoder                      |
-|                               (BYTE_          b_BoardHandle,               |
-|                                BYTE_          b_ModulNbr,                  |
-|                                BYTE_          b_PulseEncoderNbr,           |
-|                                BYTE_          b_InputLevelSelection,       |
-|                                BYTE_          b_TriggerOutputAction,       |
+|                               (unsigned char_          b_BoardHandle,               |
+|                                unsigned char_          b_ModulNbr,                  |
+|                                unsigned char_          b_PulseEncoderNbr,           |
+|                                unsigned char_          b_InputLevelSelection,       |
+|                                unsigned char_          b_TriggerOutputAction,       |
 |                                ULONG_        ul_StartValue)                |
 +----------------------------------------------------------------------------+
 | Task              : Configure the pulse encoder operating mode selected via|
@@ -74,12 +74,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                     You must calling this function be for you call any     |
 |                     other function witch access of pulse encoders.         |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr            : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr            : Module number to         |
 |                                                   configure (0 to 3)       |
-|                     BYTE_ b_PulseEncoderNbr     : Pulse encoder selection  |
+|                     unsigned char_ b_PulseEncoderNbr     : Pulse encoder selection  |
 |                                                   (0 to 3)                 |
-|                     BYTE_ b_InputLevelSelection : Input level selection    |
+|                     unsigned char_ b_InputLevelSelection : Input level selection    |
 |                                                   (0 or 1)                 |
 |                                                       0 : Set pulse encoder|
 |                                                           count the the low|
@@ -87,7 +87,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                                                       1 : Set pulse encoder|
 |                                                           count the the    |
 |                                                           high level pulse.|
-|                     BYTE_ b_TriggerOutputAction : Digital TRIGGER output   |
+|                     unsigned char_ b_TriggerOutputAction : Digital TRIGGER output   |
 |                                                   action                   |
 |                                                       0 : No action        |
 |                                                       1 : Set the trigger  |
@@ -104,11 +104,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                                                           encoder          |
 |                     ULONG_ ul_StartValue        : Pulse encoder start value|
 |                                                   (1 to 4294967295)
-       b_ModulNbr                              =(BYTE) CR_AREF(insn->chanspec);
-       b_PulseEncoderNbr               =(BYTE) data[0];
-       b_InputLevelSelection   =(BYTE) data[1];
-       b_TriggerOutputAction   =(BYTE) data[2];
-       ul_StartValue                   =(ULONG) data[3];
+       b_ModulNbr                              =(unsigned char) CR_AREF(insn->chanspec);
+       b_PulseEncoderNbr               =(unsigned char) data[0];
+       b_InputLevelSelection   =(unsigned char) data[1];
+       b_TriggerOutputAction   =(unsigned char) data[2];
+       ul_StartValue                   =(unsigned int) data[3];
        |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -123,23 +123,23 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
-       struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-       INT i_ReturnValue = 0;
-       DWORD dw_IntRegister;
+       int i_ReturnValue = 0;
+       unsigned int dw_IntRegister;
 
-       BYTE b_ModulNbr;
-       BYTE b_PulseEncoderNbr;
-       BYTE b_InputLevelSelection;
-       BYTE b_TriggerOutputAction;
-       ULONG ul_StartValue;
+       unsigned char b_ModulNbr;
+       unsigned char b_PulseEncoderNbr;
+       unsigned char b_InputLevelSelection;
+       unsigned char b_TriggerOutputAction;
+       unsigned int ul_StartValue;
 
-       b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-       b_PulseEncoderNbr = (BYTE) data[0];
-       b_InputLevelSelection = (BYTE) data[1];
-       b_TriggerOutputAction = (BYTE) data[2];
-       ul_StartValue = (ULONG) data[3];
+       b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+       b_PulseEncoderNbr = (unsigned char) data[0];
+       b_InputLevelSelection = (unsigned char) data[1];
+       b_TriggerOutputAction = (unsigned char) data[2];
+       ul_StartValue = (unsigned int) data[3];
 
        i_ReturnValue = insn->n;
 
@@ -346,17 +346,17 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
                i_ReturnValue = -2;
        }
 
-       return (i_ReturnValue);
+       return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_EnablePulseEncoder                    |
-|                                       (BYTE_  b_BoardHandle,               |
-|                                        BYTE_  b_ModulNbr,                  |
-|                                        BYTE_  b_PulseEncoderNbr,           |
-|                                        BYTE_  b_CycleSelection,            |
-|                                        BYTE_  b_InterruptHandling)         |
+|                                       (unsigned char_  b_BoardHandle,               |
+|                                        unsigned char_  b_ModulNbr,                  |
+|                                        unsigned char_  b_PulseEncoderNbr,           |
+|                                        unsigned char_  b_CycleSelection,            |
+|                                        unsigned char_  b_InterruptHandling)         |
 +----------------------------------------------------------------------------+
 | Task              : Enableor disable  the selected pulse encoder (b_PulseEncoderNbr)  |
 |                     from selected module (b_ModulNbr). Each input pulse    |
@@ -365,12 +365,12 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 |                     interrupt is generated when the pulse encoder has run  |
 |                     down.                                                  |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle       : Handle of board APCI-1710|
-|                     BYTE_   b_ModulNbr          : Module number to         |
+| Input Parameters  : unsigned char_   b_BoardHandle       : Handle of board APCI-1710|
+|                     unsigned char_   b_ModulNbr          : Module number to         |
 |                                                   configure (0 to 3)       |
-|                     BYTE_   b_PulseEncoderNbr   : Pulse encoder selection  |
+|                     unsigned char_   b_PulseEncoderNbr   : Pulse encoder selection  |
 |                                                   (0 to 3)                 |
-|                     BYTE_   b_CycleSelection    : APCI1710_CONTINUOUS:     |
+|                     unsigned char_   b_CycleSelection    : APCI1710_CONTINUOUS:     |
 |                                                       Each time the        |
 |                                                       counting value is set|
 |                                                       on "0", the pulse    |
@@ -381,7 +381,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 |                                                       If the counter is set|
 |                                                       on "0", the pulse    |
 |                                                       encoder is stopped.  |
-|                     BYTE_   b_InterruptHandling : Interrupts can be        |
+|                     unsigned char_   b_InterruptHandling : Interrupts can be        |
 |                                                   generated, when the pulse|
 |                                                   encoder has run down.    |
 |                                                   With this parameter the  |
@@ -393,11 +393,11 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 |                                                     APCI1710_DISABLE:      |
 |                                                     Interrupts are disabled
 
-       b_ModulNbr                      =(BYTE) CR_AREF(insn->chanspec);
-       b_Action                        =(BYTE) data[0];
-       b_PulseEncoderNbr       =(BYTE) data[1];
-       b_CycleSelection        =(BYTE) data[2];
-       b_InterruptHandling     =(BYTE) data[3];|
+       b_ModulNbr                      =(unsigned char) CR_AREF(insn->chanspec);
+       b_Action                        =(unsigned char) data[0];
+       b_PulseEncoderNbr       =(unsigned char) data[1];
+       b_CycleSelection        =(unsigned char) data[2];
+       b_InterruptHandling     =(unsigned char) data[3];|
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -414,22 +414,22 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
-       struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-       INT i_ReturnValue = 0;
-       BYTE b_ModulNbr;
-       BYTE b_PulseEncoderNbr;
-       BYTE b_CycleSelection;
-       BYTE b_InterruptHandling;
-       BYTE b_Action;
+       int i_ReturnValue = 0;
+       unsigned char b_ModulNbr;
+       unsigned char b_PulseEncoderNbr;
+       unsigned char b_CycleSelection;
+       unsigned char b_InterruptHandling;
+       unsigned char b_Action;
 
        i_ReturnValue = insn->n;
-       b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-       b_Action = (BYTE) data[0];
-       b_PulseEncoderNbr = (BYTE) data[1];
-       b_CycleSelection = (BYTE) data[2];
-       b_InterruptHandling = (BYTE) data[3];
+       b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+       b_Action = (unsigned char) data[0];
+       b_PulseEncoderNbr = (unsigned char) data[1];
+       b_CycleSelection = (unsigned char) data[2];
+       b_InterruptHandling = (unsigned char) data[3];
 
        /***********************************/
        /* Test the selected module number */
@@ -515,7 +515,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
                                                                        | (1UL
                                                                        <<
                                                                        b_PulseEncoderNbr);
-                                                               devpriv->tsk_Current = current; // Save the current process task structure
+                                                               devpriv->tsk_Current = current; /*  Save the current process task structure */
 
                                                        }
 
@@ -629,7 +629,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
                                                (64 * b_ModulNbr));
 
                                        break;
-                               }       // switch End
+                               }       /*  switch End */
 
                        } else {
                 /*********************************/
@@ -656,39 +656,39 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
                i_ReturnValue = -2;
        }
 
-       return (i_ReturnValue);
+       return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadPulseEncoderStatus                |
-|                                       (BYTE_  b_BoardHandle,               |
-|                                        BYTE_  b_ModulNbr,                  |
-|                                        BYTE_  b_PulseEncoderNbr,           |
-|                                        PBYTE_ pb_Status)                   |
+|                                       (unsigned char_  b_BoardHandle,               |
+|                                        unsigned char_  b_ModulNbr,                  |
+|                                        unsigned char_  b_PulseEncoderNbr,           |
+|                                        unsigned char *_ pb_Status)                   |
 +----------------------------------------------------------------------------+
 | Task    APCI1710_PULSEENCODER_READ          : Reads the pulse encoder status
                                                                                        and valuefrom selected pulse     |
 |                     encoder (b_PulseEncoderNbr) from selected module       |
 |                     (b_ModulNbr).                                          |
 +----------------------------------------------------------------------------+
-       BYTE   b_Type; data[0]
+       unsigned char   b_Type; data[0]
    APCI1710_PULSEENCODER_WRITE
  Writes a 32-bit value (ul_WriteValue) into the selected|
 |                     pulse encoder (b_PulseEncoderNbr) from selected module |
 |                     (b_ModulNbr). This operation set the new start pulse   |
 |                     encoder value.
  APCI1710_PULSEENCODER_READ
-| Input Parameters  : BYTE_   b_BoardHandle       : Handle of board APCI-1710|
-|            CRAREF()         BYTE_   b_ModulNbr          : Module number to         |
+| Input Parameters  : unsigned char_   b_BoardHandle       : Handle of board APCI-1710|
+|            CRAREF()         unsigned char_   b_ModulNbr          : Module number to         |
 |                                                   configure (0 to 3)       |
-|              data[1]       BYTE_   b_PulseEncoderNbr   : Pulse encoder selection  |
+|              data[1]       unsigned char_   b_PulseEncoderNbr   : Pulse encoder selection  |
 |                                                   (0 to 3)
    APCI1710_PULSEENCODER_WRITE
                                data[2]         ULONG_ ul_WriteValue        : 32-bit value to be       |
 |                                                   written             |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_Status            : Pulse encoder status.    |
+| Output Parameters : unsigned char *_ pb_Status            : Pulse encoder status.    |
 |                                                       0 : No overflow occur|
 |                                                       1 : Overflow occur
                                                PULONG_ pul_ReadValue       : Pulse encoder value      |  |
@@ -702,30 +702,30 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-/*_INT_   i_APCI1710_ReadPulseEncoderStatus       (BYTE_   b_BoardHandle,
-                                                BYTE_   b_ModulNbr,
-                                                BYTE_   b_PulseEncoderNbr,
+/*_INT_   i_APCI1710_ReadPulseEncoderStatus       (unsigned char_   b_BoardHandle,
+                                                unsigned char_   b_ModulNbr,
+                                                unsigned char_   b_PulseEncoderNbr,
 
-                                                PBYTE_ pb_Status)
+                                                unsigned char *_ pb_Status)
                                                 */
-INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
-       struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-       INT i_ReturnValue = 0;
-       DWORD dw_StatusRegister;
-       BYTE b_ModulNbr;
-       BYTE b_PulseEncoderNbr;
-       PBYTE pb_Status;
-       BYTE b_Type;
-       PULONG pul_ReadValue;
-       ULONG ul_WriteValue;
+       int i_ReturnValue = 0;
+       unsigned int dw_StatusRegister;
+       unsigned char b_ModulNbr;
+       unsigned char b_PulseEncoderNbr;
+       unsigned char *pb_Status;
+       unsigned char b_Type;
+       unsigned int *pul_ReadValue;
+       unsigned int ul_WriteValue;
 
        i_ReturnValue = insn->n;
-       b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-       b_Type = (BYTE) data[0];
-       b_PulseEncoderNbr = (BYTE) data[1];
-       pb_Status = (PBYTE) & data[0];
-       pul_ReadValue = (PULONG) & data[1];
+       b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+       b_Type = (unsigned char) data[0];
+       b_PulseEncoderNbr = (unsigned char) data[1];
+       pb_Status = (unsigned char *) &data[0];
+       pul_ReadValue = (unsigned int *) &data[1];
 
        /***********************************/
        /* Test the selected module number */
@@ -766,7 +766,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
                                                dw_StatusRegister;
 
                                        *pb_Status =
-                                               (BYTE) (devpriv->
+                                               (unsigned char) (devpriv->
                                                s_ModuleInfo[b_ModulNbr].
                                                s_PulseEncoderModuleInfo.
                                                dw_StatusRegister >> (1 +
@@ -794,7 +794,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
                                        break;
 
                                case APCI1710_PULSEENCODER_WRITE:
-                                       ul_WriteValue = (ULONG) data[2];
+                                       ul_WriteValue = (unsigned int) data[2];
                        /*******************/
                                        /* Write the value */
                        /*******************/
@@ -805,7 +805,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
                                                (4 * b_PulseEncoderNbr) +
                                                (64 * b_ModulNbr));
 
-                               }       //end of switch
+                               }       /* end of switch */
                        } else {
                 /*********************************/
                                /* Pulse encoder not initialised */
@@ -831,11 +831,11 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
                i_ReturnValue = -2;
        }
 
-       return (i_ReturnValue);
+       return i_ReturnValue;
 }
 
-INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device * dev,
-       struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 
        data[0] = devpriv->s_InterruptParameters.