Staging: comedi: Remove C99 comments
[safe/jmp/linux-2.6] / drivers / staging / comedi / drivers / addi-data / addi_eeprom.c
index 5184c6d..1de2917 100644 (file)
@@ -45,11 +45,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
   +----------+-----------+------------------------------------------------+
 */
 
-#define NVCMD_BEGIN_READ       (0x7 << 5 )     // nvRam begin read command
-#define NVCMD_LOAD_LOW         (0x4 << 5 )     // nvRam load low command
-#define NVCMD_LOAD_HIGH        (0x5 << 5 )     // nvRam load high command
-#define EE76_CMD_LEN           13      // bits in instructions
-#define EE_READ                0x0180  // 01 1000 0000 read instruction
+#define NVCMD_BEGIN_READ       (0x7 << 5 )     /*  nvRam begin read command */
+#define NVCMD_LOAD_LOW         (0x4 << 5 )     /*  nvRam load low command */
+#define NVCMD_LOAD_HIGH        (0x5 << 5 )     /*  nvRam load high command */
+#define EE76_CMD_LEN           13      /*  bits in instructions */
+#define EE_READ                0x0180  /*  01 1000 0000 read instruction */
 
 #define EEPROM_DIGITALINPUT                    0
 #define EEPROM_DIGITALOUTPUT                   1
@@ -70,43 +70,50 @@ struct str_MainHeader {
        struct str_Functionality s_Functions[7];
 };
 
-typedef struct {
+struct str_DigitalInputHeader {
        unsigned short w_Nchannel;
        unsigned char b_Interruptible;
        unsigned short w_NinterruptLogic;
-} str_DigitalInputHeader;
+};
+
+struct str_DigitalOutputHeader {
 
-typedef struct {
        unsigned short w_Nchannel;
-} str_DigitalOutputHeader;
+};
 
-// used for timer as well as watchdog
 
-typedef struct {
+/* used for timer as well as watchdog */
+
+struct str_TimerDetails {
+
        unsigned short w_HeaderSize;
        unsigned char b_Resolution;
-       unsigned char b_Mode;           // in case of Watchdog it is functionality
+       unsigned char b_Mode;           /*  in case of Watchdog it is functionality */
        unsigned short w_MinTiming;
        unsigned char b_TimeBase;
-} str_TimerDetails;
-typedef struct {
+};
+
+struct str_TimerMainHeader {
+
 
        unsigned short w_Ntimer;
-       str_TimerDetails s_TimerDetails[4];     //  supports 4 timers
-} str_TimerMainHeader;
+       struct str_TimerDetails s_TimerDetails[4];      /*   supports 4 timers */
+};
+
 
 typedef struct {
        unsigned short w_Nchannel;
        unsigned char b_Resolution;
 } str_AnalogOutputHeader;
 
-typedef struct {
+struct str_AnalogInputHeader {
        unsigned short w_Nchannel;
        unsigned short w_MinConvertTiming;
        unsigned short w_MinDelayTiming;
        unsigned char b_HasDma;
        unsigned char b_Resolution;
-} str_AnalogInputHeader;
+};
+
 
                /*****************************************/
                /*            Read Header Functions              */
@@ -117,15 +124,15 @@ int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
 
 int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
-       str_DigitalInputHeader * s_Header);
+       struct str_DigitalInputHeader * s_Header);
 
 int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
-       str_DigitalOutputHeader * s_Header);
+       struct str_DigitalOutputHeader * s_Header);
 
 int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
-       str_TimerMainHeader * s_Header);
+       struct str_TimerMainHeader * s_Header);
 
 int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
@@ -133,7 +140,7 @@ int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
 
 int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
-       str_AnalogInputHeader * s_Header);
+       struct str_AnalogInputHeader * s_Header);
 
                /******************************************/
                /*      Eeprom Specific Functions                         */
@@ -199,9 +206,9 @@ unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc
                for (b_Counter = 0; b_Counter < 2; b_Counter++)
                {
 
-                       b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256;        //Read the low 8 bit part
+                       b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256;        /* Read the low 8 bit part */
 
-                       b_SelectedAddressHigh = (w_EepromStartAddress + b_Counter) / 256;       //Read the high 8 bit part
+                       b_SelectedAddressHigh = (w_EepromStartAddress + b_Counter) / 256;       /* Read the high 8 bit part */
 
              /************************************/
 
@@ -312,20 +319,20 @@ unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc
 
                                b_ReadLowByte = b_ReadByte;
 
-                       }       // if(b_Counter==0)
+                       }       /*  if(b_Counter==0) */
 
                        else
                        {
 
                                b_ReadHighByte = b_ReadByte;
 
-                       }       // if(b_Counter==0)
+                       }       /*  if(b_Counter==0) */
 
-               }               // for (b_Counter=0; b_Counter<2; b_Counter++)
+               }               /*  for (b_Counter=0; b_Counter<2; b_Counter++) */
 
                w_ReadWord = (b_ReadLowByte | (((unsigned short) b_ReadHighByte) * 256));
 
-       }                       // end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933")))
+       }                       /*  end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933"))) */
 
        if (!strcmp(pc_PCIChipInformation, "93C76"))
        {
@@ -802,11 +809,11 @@ int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
        unsigned short w_Temp, i, w_Count = 0;
        unsigned int ui_Temp;
        struct str_MainHeader s_MainHeader;
-       str_DigitalInputHeader s_DigitalInputHeader;
-       str_DigitalOutputHeader s_DigitalOutputHeader;
-       //str_TimerMainHeader     s_TimerMainHeader,s_WatchdogMainHeader;
+       struct str_DigitalInputHeader s_DigitalInputHeader;
+       struct str_DigitalOutputHeader s_DigitalOutputHeader;
+       //struct str_TimerMainHeader     s_TimerMainHeader,s_WatchdogMainHeader;
        str_AnalogOutputHeader s_AnalogOutputHeader;
-       str_AnalogInputHeader s_AnalogInputHeader;
+       struct str_AnalogInputHeader s_AnalogInputHeader;
 
        // Read size
        s_MainHeader.w_HeaderSize =
@@ -895,15 +902,15 @@ int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
                        break;
 
                case EEPROM_TIMER:
-                       this_board->i_Timer = 1;        //Timer subdevice present
+                       this_board->i_Timer = 1;        /* Timer subdevice present */
                        break;
 
                case EEPROM_WATCHDOG:
-                       this_board->i_Timer = 1;        //Timer subdevice present
+                       this_board->i_Timer = 1;        /* Timer subdevice present */
                        break;
 
                case EEPROM_TIMER_WATCHDOG_COUNTER:
-                       this_board->i_Timer = 1;        //Timer subdevice present
+                       this_board->i_Timer = 1;        /* Timer subdevice present */
                }
        }
 
@@ -914,7 +921,7 @@ int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
 +----------------------------------------------------------------------------+
 | Function Name  : int i_EepromReadDigitalInputHeader(unsigned short                                    |
 |                      w_PCIBoardEepromAddress,char *pc_PCIChipInformation,     |
-|                      unsigned short w_Address,str_DigitalInputHeader *s_Header)               |
+|                      unsigned short w_Address,struct str_DigitalInputHeader *s_Header)                |
 |                                                                                                                                       |
 +----------------------------------------------------------------------------+
 | Task              : Read Digital Input Header                              |
@@ -923,7 +930,7 @@ int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
 |                                                                                                                                       |
 |                    char *pc_PCIChipInformation  : PCI Chip Type.          |
 |                                                                                                                                       |
-|                       str_DigitalInputHeader *s_Header: Digita Input Header   |
+|                       struct str_DigitalInputHeader *s_Header: Digita Input Header   |
 |                                                                                                 Pointer                       |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -933,21 +940,21 @@ int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
 */
 int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
-       str_DigitalInputHeader * s_Header)
+       struct str_DigitalInputHeader *s_Header)
 {
        unsigned short w_Temp;
 
-       // read nbr of channels
+       /*  read nbr of channels */
        s_Header->w_Nchannel =
                w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
                0x100 + w_Address + 6);
 
-       // interruptible or not
+       /*  interruptible or not */
        w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
                pc_PCIChipInformation, 0x100 + w_Address + 8);
        s_Header->b_Interruptible = (unsigned char) (w_Temp >> 7) & 0x01;
 
-// How many interruptible logic
+/* How many interruptible logic */
        s_Header->w_NinterruptLogic =
                w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
                0x100 + w_Address + 10);
@@ -959,7 +966,7 @@ int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
 +----------------------------------------------------------------------------+
 | Function Name  : int i_EepromReadDigitalOutputHeader(unsigned short                           |
 |                      w_PCIBoardEepromAddress,char *pc_PCIChipInformation,     |
-|                      unsigned short w_Address,str_DigitalOutputHeader *s_Header)          |
+|                      unsigned short w_Address,struct str_DigitalOutputHeader *s_Header)           |
 |                                                                                                                                       |
 +----------------------------------------------------------------------------+
 | Task              : Read Digital Output Header                             |
@@ -968,7 +975,7 @@ int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
 |                                                                                                                                       |
 |                    char *pc_PCIChipInformation  : PCI Chip Type.          |
 |                                                                                                                                       |
-|                       str_DigitalOutputHeader *s_Header: Digital Output Header|
+|                       struct str_DigitalOutputHeader *s_Header: Digital Output Header|
 |                                                                                         Pointer                               |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -978,9 +985,9 @@ int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
 */
 int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
-       str_DigitalOutputHeader * s_Header)
+       struct str_DigitalOutputHeader * s_Header)
 {
-// Read Nbr channels
+/* Read Nbr channels */
        s_Header->w_Nchannel =
                w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
                0x100 + w_Address + 6);
@@ -991,7 +998,7 @@ int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
 +----------------------------------------------------------------------------+
 | Function Name  : int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, |
 |                      char *pc_PCIChipInformation,WORD w_Address,                              |
-|                      str_TimerMainHeader *s_Header)                                                   |
+|                      struct str_TimerMainHeader *s_Header)                                                    |
 +----------------------------------------------------------------------------+
 | Task              : Read Timer or Watchdog Header                          |
 +----------------------------------------------------------------------------+
@@ -999,7 +1006,7 @@ int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
 |                                                                                                                                       |
 |                    char *pc_PCIChipInformation  : PCI Chip Type.          |
 |                                                                                                                                       |
-|                       str_TimerMainHeader *s_Header: Timer Header                     |
+|                       struct str_TimerMainHeader *s_Header: Timer Header                      |
 |                                                                                         Pointer                               |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -1009,16 +1016,16 @@ int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
 */
 int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
-       str_TimerMainHeader * s_Header)
+       struct str_TimerMainHeader * s_Header)
 {
 
        unsigned short i, w_Size = 0, w_Temp;
 
-//Read No of Timer
+/* Read No of Timer */
        s_Header->w_Ntimer =
                w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
                0x100 + w_Address + 6);
-//Read header size
+/* Read header size */
 
        for (i = 0; i < s_Header->w_Ntimer; i++) {
                s_Header->s_TimerDetails[i].w_HeaderSize =
@@ -1029,11 +1036,11 @@ int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
                        pc_PCIChipInformation,
                        0x100 + w_Address + 8 + w_Size + 2);
 
-               //Read Resolution
+               /* Read Resolution */
                s_Header->s_TimerDetails[i].b_Resolution =
                        (unsigned char) (w_Temp >> 10) & 0x3F;
 
-               //Read Mode
+               /* Read Mode */
                s_Header->s_TimerDetails[i].b_Mode =
                        (unsigned char) (w_Temp >> 4) & 0x3F;
 
@@ -1041,10 +1048,10 @@ int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
                        pc_PCIChipInformation,
                        0x100 + w_Address + 8 + w_Size + 4);
 
-               //Read MinTiming
+               /* Read MinTiming */
                s_Header->s_TimerDetails[i].w_MinTiming = (w_Temp >> 6) & 0x3FF;
 
-               //Read Timebase
+               /* Read Timebase */
                s_Header->s_TimerDetails[i].b_TimeBase = (unsigned char) (w_Temp) & 0x3F;
                w_Size += s_Header->s_TimerDetails[i].w_HeaderSize;
        }
@@ -1078,11 +1085,11 @@ int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
        str_AnalogOutputHeader * s_Header)
 {
        unsigned short w_Temp;
-       // No of channels for 1st hard component
+       /*  No of channels for 1st hard component */
        w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
                pc_PCIChipInformation, 0x100 + w_Address + 10);
        s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
-       // Resolution for 1st hard component
+       /*  Resolution for 1st hard component */
        w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
                pc_PCIChipInformation, 0x100 + w_Address + 16);
        s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF;
@@ -1093,7 +1100,7 @@ int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
 +----------------------------------------------------------------------------+
 | Function Name  : int i_EepromReadAnlogInputHeader(unsigned short                                      |
 |                      w_PCIBoardEepromAddress,char *pc_PCIChipInformation,     |
-|                      unsigned short w_Address,str_AnalogInputHeader *s_Header)          |
+|                      unsigned short w_Address,struct str_AnalogInputHeader *s_Header)          |
 +----------------------------------------------------------------------------+
 | Task              : Read Nalog Output  Header                              |
 +----------------------------------------------------------------------------+
@@ -1101,7 +1108,7 @@ int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
 |                                                                                                                                       |
 |                    char *pc_PCIChipInformation  : PCI Chip Type.          |
 |                                                                                                                                       |
-|                       str_AnalogInputHeader *s_Header:Anlog Input Header      |
+|                       struct str_AnalogInputHeader *s_Header:Anlog Input Header      |
 |                                                                                         Pointer                               |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -1110,10 +1117,10 @@ int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
 +----------------------------------------------------------------------------+
 */
 
-// Reads only for ONE  hardware component
+/* Reads only for ONE  hardware component */
 int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
        char *pc_PCIChipInformation, unsigned short w_Address,
-       str_AnalogInputHeader * s_Header)
+       struct str_AnalogInputHeader * s_Header)
 {
        unsigned short w_Temp, w_Offset;
        w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
@@ -1127,24 +1134,24 @@ int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
                0x100 + w_Address + 30);
        w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
                pc_PCIChipInformation, 0x100 + w_Address + 20);
-       s_Header->b_HasDma = (w_Temp >> 13) & 0x01;     // whether dma present or not
+       s_Header->b_HasDma = (w_Temp >> 13) & 0x01;     /*  whether dma present or not */
 
-       w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 72);      // reading Y
+       w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 72);      /*  reading Y */
        w_Temp = w_Temp & 0x00FF;
-       if (w_Temp)             //Y>0
+       if (w_Temp)             /* Y>0 */
        {
-               w_Offset = 74 + (2 * w_Temp) + (10 * (1 + (w_Temp / 16)));      // offset of first analog input single header
-               w_Offset = w_Offset + 2;        // resolution
-       } else                  //Y=0
+               w_Offset = 74 + (2 * w_Temp) + (10 * (1 + (w_Temp / 16)));      /*  offset of first analog input single header */
+               w_Offset = w_Offset + 2;        /*  resolution */
+       } else                  /* Y=0 */
        {
                w_Offset = 74;
-               w_Offset = w_Offset + 2;        // resolution
+               w_Offset = w_Offset + 2;        /*  resolution */
        }
 
-// read Resolution
+/* read Resolution */
        w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
                pc_PCIChipInformation, 0x100 + w_Address + w_Offset);
-       s_Header->b_Resolution = w_Temp & 0x001F;       // last 5 bits
+       s_Header->b_Resolution = w_Temp & 0x001F;       /*  last 5 bits */
 
        return 0;
 }