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 / hwdrv_apci16xx.c
index 74b0bd4..988e3fc 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.
 
@@ -57,10 +57,10 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT   i_APCI16XX_InsnConfigInitTTLIO                   |
+| Function Name     : int   i_APCI16XX_InsnConfigInitTTLIO                   |
 |                          (struct comedi_device    *dev,                           |
-|                           comedi_subdevice *s,                             |
-|                           comedi_insn      *insn,                          |
+|                           struct comedi_subdevice *s,                             |
+|                           struct comedi_insn      *insn,                          |
 |                           unsigned int         *data)                          |
 +----------------------------------------------------------------------------+
 | Task           APCI16XX_TTL_INIT (using defaults)   :                      |
@@ -69,11 +69,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                for you call any other function witch access of TTL.        |
 |                APCI16XX_TTL_INITDIRECTION(user inputs for direction)       |
 +----------------------------------------------------------------------------+
-| Input Parameters  : b_InitType    = (BYTE) data[0];                        |
-|                     b_Port0Mode   = (BYTE) data[1];                        |
-|                     b_Port1Mode   = (BYTE) data[2];                        |
-|                     b_Port2Mode   = (BYTE) data[3];                        |
-|                     b_Port3Mode   = (BYTE) data[4];                        |
+| Input Parameters  : b_InitType    = (unsigned char) data[0];                        |
+|                     b_Port0Mode   = (unsigned char) data[1];                        |
+|                     b_Port1Mode   = (unsigned char) data[2];                        |
+|                     b_Port2Mode   = (unsigned char) data[3];                        |
+|                     b_Port3Mode   = (unsigned char) data[4];                        |
 |                     ........                                               |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -90,14 +90,14 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
-       comedi_subdevice * s, comedi_insn * insn, unsigned int * data)
+int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-       INT i_ReturnValue = insn->n;
-       BYTE b_Command = 0;
-       BYTE b_Cpt = 0;
-       BYTE b_NumberOfPort =
-               (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+       int i_ReturnValue = insn->n;
+       unsigned char b_Command = 0;
+       unsigned char b_Cpt = 0;
+       unsigned char b_NumberOfPort =
+               (unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
 
        /************************/
        /* Test the buffer size */
@@ -108,7 +108,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
                /* Get the command */
                /* **************** */
 
-               b_Command = (BYTE) data[0];
+               b_Command = (unsigned char) data[0];
 
           /********************/
                /* Test the command */
@@ -122,7 +122,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
              /***************************************/
 
                        if ((b_Command == APCI16XX_TTL_INITDIRECTION)
-                               && ((BYTE) (insn->n - 1) != b_NumberOfPort)) {
+                               && ((unsigned char) (insn->n - 1) != b_NumberOfPort)) {
                 /*******************/
                                /* Data size error */
                 /*******************/
@@ -132,7 +132,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
                        }
 
                        if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY)
-                               && ((BYTE) (insn->n) != 2)) {
+                               && ((unsigned char) (insn->n) != 2)) {
                 /*******************/
                                /* Data size error */
                 /*******************/
@@ -182,8 +182,8 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
                 /************************/
 
                                printk("\nPort %d direction selection error",
-                                       (INT) b_Cpt);
-                               i_ReturnValue = -(INT) b_Cpt;
+                                       (int) b_Cpt);
+                               i_ReturnValue = -(int) b_Cpt;
                        }
 
              /**************************/
@@ -239,7 +239,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
                }
        }
 
-       return (i_ReturnValue);
+       return i_ReturnValue;
 }
 
 /*
@@ -250,10 +250,10 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT     i_APCI16XX_InsnBitsReadTTLIO                   |
+| Function Name     : int     i_APCI16XX_InsnBitsReadTTLIO                   |
 |                          (struct comedi_device    *dev,                           |
-|                           comedi_subdevice *s,                             |
-|                           comedi_insn      *insn,                          |
+|                           struct comedi_subdevice *s,                             |
+|                           struct comedi_insn      *insn,                          |
 |                           unsigned int         *data)                          |
 +----------------------------------------------------------------------------+
 | Task              : Read the status from selected TTL digital input        |
@@ -266,11 +266,11 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 |              APCI16XX_TTL_READCHANNEL                                      |
 |                    b_SelectedPort= CR_RANGE(insn->chanspec);               |
 |                    b_InputChannel= CR_CHAN(insn->chanspec);                |
-|                    b_ReadType          = (BYTE) data[0];                          |
+|                    b_ReadType          = (unsigned char) data[0];                          |
 |                                                                            |
 |              APCI16XX_TTL_READPORT                                         |
 |                    b_SelectedPort= CR_RANGE(insn->chanspec);               |
-|                    b_ReadType          = (BYTE) data[0];                          |
+|                    b_ReadType          = (unsigned char) data[0];                          |
 +----------------------------------------------------------------------------+
 | Output Parameters : data[0]    0 : Channle is not active                   |
 |                                1 : Channle is active                       |
@@ -283,17 +283,17 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
-       comedi_subdevice * s, comedi_insn * insn, unsigned int * data)
+int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-       INT i_ReturnValue = insn->n;
-       BYTE b_Command = 0;
-       BYTE b_NumberOfPort =
-               (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
-       BYTE b_SelectedPort = CR_RANGE(insn->chanspec);
-       BYTE b_InputChannel = CR_CHAN(insn->chanspec);
-       BYTE *pb_Status;
-       DWORD dw_Status;
+       int i_ReturnValue = insn->n;
+       unsigned char b_Command = 0;
+       unsigned char b_NumberOfPort =
+               (unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+       unsigned char b_SelectedPort = CR_RANGE(insn->chanspec);
+       unsigned char b_InputChannel = CR_CHAN(insn->chanspec);
+       unsigned char *pb_Status;
+       unsigned int dw_Status;
 
        /************************/
        /* Test the buffer size */
@@ -304,7 +304,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
                /* Get the command */
                /* **************** */
 
-               b_Command = (BYTE) data[0];
+               b_Command = (unsigned char) data[0];
 
           /********************/
                /* Test the command */
@@ -380,7 +380,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
        /**************************/
 
        if (i_ReturnValue >= 0) {
-               pb_Status = (PBYTE) & data[0];
+               pb_Status = (unsigned char *) &data[0];
 
           /*******************************/
                /* Get the digital inpu status */
@@ -394,7 +394,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
                /* Save the port value */
           /***********************/
 
-               *pb_Status = (BYTE) dw_Status;
+               *pb_Status = (unsigned char) dw_Status;
 
           /***************************************/
                /* Test if read channel status command */
@@ -405,15 +405,15 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
                }
        }
 
-       return (i_ReturnValue);
+       return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT i_APCI16XX_InsnReadTTLIOAllPortValue               |
+| Function Name     : int i_APCI16XX_InsnReadTTLIOAllPortValue               |
 |                          (struct comedi_device    *dev,                           |
-|                           comedi_subdevice *s,                             |
-|                           comedi_insn      *insn,                          |
+|                           struct comedi_subdevice *s,                             |
+|                           struct comedi_insn      *insn,                          |
 |                           unsigned int         *data)                          |
 +----------------------------------------------------------------------------+
 | Task              : Read the status from all digital input ports           |
@@ -430,13 +430,13 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
-       comedi_subdevice * s, comedi_insn * insn, unsigned int * data)
+int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-       BYTE b_Command = (BYTE) CR_AREF(insn->chanspec);
-       INT i_ReturnValue = insn->n;
-       BYTE b_Cpt = 0;
-       BYTE b_NumberOfPort = 0;
+       unsigned char b_Command = (unsigned char) CR_AREF(insn->chanspec);
+       int i_ReturnValue = insn->n;
+       unsigned char b_Cpt = 0;
+       unsigned char b_NumberOfPort = 0;
        unsigned int *pls_ReadData = data;
 
        /********************/
@@ -450,7 +450,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
           /**********************************/
 
                b_NumberOfPort =
-                       (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32);
+                       (unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32);
                if ((b_NumberOfPort * 32) <
                        devpriv->ps_BoardInfo->i_NbrTTLChannel) {
                        b_NumberOfPort = b_NumberOfPort + 1;
@@ -524,7 +524,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
                i_ReturnValue = -100;
        }
 
-       return (i_ReturnValue);
+       return i_ReturnValue;
 }
 
 /*
@@ -535,10 +535,10 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT     i_APCI16XX_InsnBitsWriteTTLIO                  |
+| Function Name     : int     i_APCI16XX_InsnBitsWriteTTLIO                  |
 |                          (struct comedi_device    *dev,                           |
-|                           comedi_subdevice *s,                             |
-|                           comedi_insn      *insn,                          |
+|                           struct comedi_subdevice *s,                             |
+|                           struct comedi_insn      *insn,                          |
 |                           unsigned int         *data)                          |
 +----------------------------------------------------------------------------+
 | Task              : Set the state from selected TTL digital output         |
@@ -551,11 +551,11 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 |              APCI16XX_TTL_WRITECHANNEL_ON | APCI16XX_TTL_WRITECHANNEL_OFF  |
 |                    b_SelectedPort = CR_RANGE(insn->chanspec);              |
 |                    b_OutputChannel= CR_CHAN(insn->chanspec);               |
-|                    b_Command      = (BYTE) data[0];                        |
+|                    b_Command      = (unsigned char) data[0];                        |
 |                                                                            |
 |              APCI16XX_TTL_WRITEPORT_ON | APCI16XX_TTL_WRITEPORT_OFF        |
 |                    b_SelectedPort = CR_RANGE(insn->chanspec);              |
-|                    b_Command      = (BYTE) data[0];                        |
+|                    b_Command      = (unsigned char) data[0];                        |
 +----------------------------------------------------------------------------+
 | Output Parameters : data[0] : TTL output port 0 to 3 data                  |
 |                     data[1] : TTL output port 4 to 7 data                  |
@@ -570,16 +570,16 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
-       comedi_subdevice * s, comedi_insn * insn, unsigned int * data)
+int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-       INT i_ReturnValue = insn->n;
-       BYTE b_Command = 0;
-       BYTE b_NumberOfPort =
-               (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
-       BYTE b_SelectedPort = CR_RANGE(insn->chanspec);
-       BYTE b_OutputChannel = CR_CHAN(insn->chanspec);
-       DWORD dw_Status = 0;
+       int i_ReturnValue = insn->n;
+       unsigned char b_Command = 0;
+       unsigned char b_NumberOfPort =
+               (unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+       unsigned char b_SelectedPort = CR_RANGE(insn->chanspec);
+       unsigned char b_OutputChannel = CR_CHAN(insn->chanspec);
+       unsigned int dw_Status = 0;
 
        /************************/
        /* Test the buffer size */
@@ -590,7 +590,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
                /* Get the command */
                /* **************** */
 
-               b_Command = (BYTE) data[0];
+               b_Command = (unsigned char) data[0];
 
           /********************/
                /* Test the command */
@@ -758,7 +758,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
                        devpriv->iobase + 20 + ((b_SelectedPort / 4) * 4));
        }
 
-       return (i_ReturnValue);
+       return i_ReturnValue;
 }
 
 /*
@@ -774,7 +774,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_Reset(struct comedi_device * dev)
+int i_APCI16XX_Reset(struct comedi_device *dev)
 {
        return 0;
 }