diff options
Diffstat (limited to 'drivers/staging/comedi/drivers/addi-data')
51 files changed, 6083 insertions, 6092 deletions
diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c index c96aee09e1b..60213d292a5 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c @@ -23,16 +23,16 @@ /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitTimer | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | -| BYTE_ b_TimerMode, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | +| unsigned char_ b_TimerMode, | | ULONG_ ul_ReloadValue, | -| BYTE_ b_InputClockSelection, | -| BYTE_ b_InputClockLevel, | -| BYTE_ b_OutputLevel, | -| BYTE_ b_HardwareGateLevel) -INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, +| unsigned char_ b_InputClockSelection, | +| unsigned char_ b_InputClockLevel, | +| unsigned char_ b_OutputLevel, | +| unsigned char_ b_HardwareGateLevel) +int i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ @@ -148,13 +148,13 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, | +--------------------------------+------------------------------------+ | | | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Module number to | +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to | +| unsigned char_ b_TimerNbr : Timer number to | | configure (0 to 2) | -| BYTE_ b_TimerMode : Timer mode selection | +| unsigned char_ b_TimerMode : Timer mode selection | | (0 to 5) | | 0: Interrupt on terminal| | count | @@ -173,21 +173,21 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, | or division factor | | See timer mode | | description table. | -| BYTE_ b_InputClockSelection : Selection from input | +| unsigned char_ b_InputClockSelection : Selection from input | | timer clock. | | See input clock | | selection table. | -| BYTE_ b_InputClockLevel : Selection from input | +| unsigned char_ b_InputClockLevel : Selection from input | | clock level. | | 0 : Low active | | (Input inverted) | | 1 : High active | -| BYTE_ b_OutputLevel, : Selection from output | +| unsigned char_ b_OutputLevel, : Selection from output | | clock level. | | 0 : Low active | | 1 : High active | | (Output inverted) | -| BYTE_ b_HardwareGateLevel : Selection from | +| unsigned char_ b_HardwareGateLevel : Selection from | | hardware gate level. | | 0 : Low active | | (Input inverted) | @@ -195,14 +195,14 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, | If you will not used | | the hardware gate set | | this value to 0. -|b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); - b_TimerMode = (BYTE) data[0]; - ul_ReloadValue = (ULONG) data[1]; - b_InputClockSelection =(BYTE) data[2]; - b_InputClockLevel =(BYTE) data[3]; - b_OutputLevel =(BYTE) data[4]; - b_HardwareGateLevel =(BYTE) data[5]; +|b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec); + b_TimerMode = (unsigned char) data[0]; + ul_ReloadValue = (unsigned int) data[1]; + b_InputClockSelection =(unsigned char) data[2]; + b_InputClockLevel =(unsigned char) data[3]; + b_OutputLevel =(unsigned char) data[4]; + b_HardwareGateLevel =(unsigned char) data[5]; +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -219,33 +219,33 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr; - BYTE b_TimerNbr; - BYTE b_TimerMode; - ULONG ul_ReloadValue; - BYTE b_InputClockSelection; - BYTE b_InputClockLevel; - BYTE b_OutputLevel; - BYTE b_HardwareGateLevel; + int i_ReturnValue = 0; + unsigned char b_ModulNbr; + unsigned char b_TimerNbr; + unsigned char b_TimerMode; + unsigned int ul_ReloadValue; + unsigned char b_InputClockSelection; + unsigned char b_InputClockLevel; + unsigned char b_OutputLevel; + unsigned char b_HardwareGateLevel; - //BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz - DWORD dw_Test = 0; - //END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + /* BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */ + unsigned int dw_Test = 0; + /* END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */ i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); - b_TimerMode = (BYTE) data[0]; - ul_ReloadValue = (ULONG) data[1]; - b_InputClockSelection = (BYTE) data[2]; - b_InputClockLevel = (BYTE) data[3]; - b_OutputLevel = (BYTE) data[4]; - b_HardwareGateLevel = (BYTE) data[5]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec); + b_TimerMode = (unsigned char) data[0]; + ul_ReloadValue = (unsigned int) data[1]; + b_InputClockSelection = (unsigned char) data[2]; + b_InputClockLevel = (unsigned char) data[3]; + b_OutputLevel = (unsigned char) data[4]; + b_HardwareGateLevel = (unsigned char) data[5]; /* Test the module number */ if (b_ModulNbr < 4) { @@ -256,7 +256,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub if (b_TimerNbr <= 2) { /* Test the timer mode */ if (b_TimerMode <= 5) { - //BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + /* BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */ /* Test te imput clock selection */ /* if (((b_TimerNbr == 0) && (b_InputClockSelection == 0)) || @@ -271,11 +271,11 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub ((b_InputClockSelection == APCI1710_PCI_BUS_CLOCK) || (b_InputClockSelection == APCI1710_FRONT_CONNECTOR_INPUT) || (b_InputClockSelection == APCI1710_10MHZ)))) { - //BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + /* BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */ if (((b_InputClockSelection == APCI1710_10MHZ) && ((devpriv->s_BoardInfos.dw_MolduleConfiguration[b_ModulNbr] & 0x0000FFFFUL) >= 0x3131)) || (b_InputClockSelection != APCI1710_10MHZ)) { - //END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + /* END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */ /* Test the input clock level selection */ if ((b_InputClockLevel == 0) || @@ -284,7 +284,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) { /* Test the hardware gate level selection */ if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) { - //BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + /* BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */ /* Test if version > 1.1 and clock selection = 10MHz */ if ((b_InputClockSelection == APCI1710_10MHZ) && ((devpriv->s_BoardInfos.dw_MolduleConfiguration[b_ModulNbr] & 0x0000FFFFUL) > 0x3131)) { /* Test if 40MHz quartz on board */ @@ -297,7 +297,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub /* Test if detection OK */ if (dw_Test == 1) { - //END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + /* END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */ /* Initialisation OK */ devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_82X54Init = 1; @@ -314,12 +314,12 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_HardwareGateLevel = b_HardwareGateLevel; /* Set the configuration word and disable the timer */ - //BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + /* BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */ /* devpriv->s_ModuleInfo [b_ModulNbr]. s_82X54ModuleInfo. s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord = (DWORD) (((b_HardwareGateLevel << 0) & 0x1) | + dw_ConfigurationWord = (unsigned int) (((b_HardwareGateLevel << 0) & 0x1) | ((b_InputClockLevel << 1) & 0x2) | (((~b_OutputLevel & 1) << 2) & 0x4) | ((b_InputClockSelection << 4) & 0x10)); @@ -329,40 +329,40 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub b_InputClockSelection = 2; } - devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = (DWORD)(((b_HardwareGateLevel << 0) & 0x1) | ((b_InputClockLevel << 1) & 0x2) | (((~b_OutputLevel & 1) << 2) & 0x4) | ((b_InputClockSelection << 4) & 0x30)); - //END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = (unsigned int)(((b_HardwareGateLevel << 0) & 0x1) | ((b_InputClockLevel << 1) & 0x2) | (((~b_OutputLevel & 1) << 2) & 0x4) | ((b_InputClockSelection << 4) & 0x30)); + /* END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */ outl(devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord, devpriv->s_BoardInfos.ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); /* Initialise the 82X54 Timer */ - outl((DWORD) b_TimerMode, devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + outl((unsigned int) b_TimerMode, devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); /* Write the reload value */ outl(ul_ReloadValue, devpriv->s_BoardInfos.ui_Address + 0 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - //BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz - } // if (dw_Test == 1) + /* BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */ + } /* if (dw_Test == 1) */ else { /* Input timer clock selection is wrong */ i_ReturnValue = -6; - } // if (dw_Test == 1) - //END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz - } // if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) + } /* if (dw_Test == 1) */ + /* END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */ + } /* if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) */ else { /* Selection from hardware gate level is wrong */ DPRINTK("Selection from hardware gate level is wrong\n"); i_ReturnValue = -9; - } // if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) - } // if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) + } /* if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) */ + } /* if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) */ else { /* Selection from output clock level is wrong */ DPRINTK("Selection from output clock level is wrong\n"); i_ReturnValue = -8; - } // if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) - } // if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) + } /* if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) */ + } /* if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) */ else { /* Selection from input clock level is wrong */ DPRINTK("Selection from input clock level is wrong\n"); i_ReturnValue = -7; - } // if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) + } /* if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) */ } else { /* Input timer clock selection is wrong */ DPRINTK("Input timer clock selection is wrong\n"); @@ -373,18 +373,18 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub DPRINTK("Input timer clock selection is wrong\n"); i_ReturnValue = -6; } - } // if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) + } /* if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) */ else { /* Timer mode selection is wrong */ DPRINTK("Timer mode selection is wrong\n"); i_ReturnValue = -5; - } // if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) */ + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ else { /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); @@ -396,17 +396,17 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableTimer | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | -| BYTE_ b_InterruptEnable) -INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct comedi_subdevice *s, +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | +| unsigned char_ b_InterruptEnable) +int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Enable OR Disable the Timer (b_TimerNbr) from selected module | @@ -416,22 +416,22 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct come | generate a interrupt after the timer value reach | | the zero. See function "i_APCI1710_SetBoardIntRoutineX"| +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to enable | +| unsigned char_ b_TimerNbr : Timer number to enable | | (0 to 2) | -| BYTE_ b_InterruptEnable : Enable or disable the | +| unsigned char_ b_InterruptEnable : Enable or disable the | | timer interrupt. | | APCI1710_ENABLE : | | Enable the timer interrupt | | APCI1710_DISABLE : | | Disable the timer interrupt| i_ReturnValue=insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); - b_ActionType = (BYTE) data[0]; // enable disable + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec); + b_ActionType = (unsigned char) data[0]; /* enable disable */ +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -448,21 +448,21 @@ i_ReturnValue=insn->n; +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, - struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_DummyRead; - BYTE b_ModulNbr; - BYTE b_TimerNbr; - BYTE b_ActionType; - BYTE b_InterruptEnable; + int i_ReturnValue = 0; + unsigned int dw_DummyRead; + unsigned char b_ModulNbr; + unsigned char b_TimerNbr; + unsigned char b_ActionType; + unsigned char b_InterruptEnable; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); - b_ActionType = (BYTE) data[0]; // enable disable + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec); + b_ActionType = (unsigned char) data[0]; /* enable disable */ /* Test the module number */ if (b_ModulNbr < 4) { @@ -475,7 +475,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, switch (b_ActionType) { case APCI1710_ENABLE: - b_InterruptEnable = (BYTE) data[1]; + b_InterruptEnable = (unsigned char) data[1]; /* Test the interrupt selection */ if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) { @@ -487,9 +487,9 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord | 0x8; outl(devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord, devpriv->s_BoardInfos.ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ - } // if (b_InterruptEnable == APCI1710_ENABLE) + } /* if (b_InterruptEnable == APCI1710_ENABLE) */ else { /* Disable the interrupt */ devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord & 0xF7; @@ -498,7 +498,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, /* Save the interrupt flag */ devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.b_InterruptMask = devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.b_InterruptMask & (0xFF - (1 << b_TimerNbr)); - } // if (b_InterruptEnable == APCI1710_ENABLE) + } /* if (b_InterruptEnable == APCI1710_ENABLE) */ /* Test if error occur */ if (i_ReturnValue >= 0) { @@ -530,7 +530,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, /* Disable the timer */ outl(0, devpriv->s_BoardInfos.ui_Address + 44 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); break; - } // Switch end + } /* Switch end */ } else { /* Timer not initialised see function */ DPRINTK ("Timer not initialised see function\n"); @@ -540,7 +540,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); @@ -552,24 +552,24 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadAllTimerValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | | PULONG_ pul_TimerValueArray) -INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_subdevice *s, +int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Return the all timer values from selected timer | | module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_TimerValueArray : Timer value array. | @@ -590,16 +590,16 @@ INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_sub +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr, b_ReadType; - PULONG pul_TimerValueArray; + int i_ReturnValue = 0; + unsigned char b_ModulNbr, b_ReadType; + unsigned int *pul_TimerValueArray; b_ModulNbr = CR_AREF(insn->chanspec); b_ReadType = CR_CHAN(insn->chanspec); - pul_TimerValueArray = (PULONG) data; + pul_TimerValueArray = (unsigned int *) data; i_ReturnValue = insn->n; switch (b_ReadType) { @@ -662,8 +662,8 @@ INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_su i_ReturnValue = -2; } - } // End of Switch - return (i_ReturnValue); + } /* End of Switch */ + return i_ReturnValue; } /* @@ -681,11 +681,11 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnBitsTimer(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - BYTE b_BitsType; - INT i_ReturnValue = 0; + unsigned char b_BitsType; + int i_ReturnValue = 0; b_BitsType = data[0]; printk("\n82X54"); @@ -693,30 +693,30 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice switch (b_BitsType) { case APCI1710_TIMER_READVALUE: i_ReturnValue = i_APCI1710_ReadTimerValue(dev, - (BYTE)CR_AREF(insn->chanspec), - (BYTE)CR_CHAN(insn->chanspec), - (PULONG) & data[0]); + (unsigned char)CR_AREF(insn->chanspec), + (unsigned char)CR_CHAN(insn->chanspec), + (unsigned int *) &data[0]); break; case APCI1710_TIMER_GETOUTPUTLEVEL: i_ReturnValue = i_APCI1710_GetTimerOutputLevel(dev, - (BYTE)CR_AREF(insn->chanspec), - (BYTE)CR_CHAN(insn->chanspec), - (PBYTE) &data[0]); + (unsigned char)CR_AREF(insn->chanspec), + (unsigned char)CR_CHAN(insn->chanspec), + (unsigned char *) &data[0]); break; case APCI1710_TIMER_GETPROGRESSSTATUS: i_ReturnValue = i_APCI1710_GetTimerProgressStatus(dev, - (BYTE)CR_AREF(insn->chanspec), - (BYTE)CR_CHAN(insn->chanspec), - (PBYTE)&data[0]); + (unsigned char)CR_AREF(insn->chanspec), + (unsigned char)CR_CHAN(insn->chanspec), + (unsigned char *)&data[0]); break; case APCI1710_TIMER_WRITEVALUE: i_ReturnValue = i_APCI1710_WriteTimerValue(dev, - (BYTE)CR_AREF(insn->chanspec), - (BYTE)CR_CHAN(insn->chanspec), - (ULONG)data[1]); + (unsigned char)CR_AREF(insn->chanspec), + (unsigned char)CR_CHAN(insn->chanspec), + (unsigned int)data[1]); break; @@ -727,25 +727,25 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice if (i_ReturnValue >= 0) i_ReturnValue = insn->n; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadTimerValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | | PULONG_ pul_TimerValue) | +----------------------------------------------------------------------------+ | Task : Return the timer value from selected digital timer | | (b_TimerNbr) from selected timer module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to read | +| unsigned char_ b_TimerNbr : Timer number to read | | (0 to 2) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_TimerValue : Timer value | @@ -760,11 +760,11 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadTimerValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PULONG pul_TimerValue) +int i_APCI1710_ReadTimerValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned int *pul_TimerValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /* Test the module number */ if (b_ModulNbr < 4) { @@ -800,7 +800,7 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev, /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); @@ -812,29 +812,29 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetTimerOutputLevel | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr, | - | BYTE_ b_TimerNbr, | - | PBYTE_ pb_OutputLevel) | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr, | + | unsigned char_ b_TimerNbr, | + | unsigned char *_ pb_OutputLevel) | +----------------------------------------------------------------------------+ | Task : Return the output signal level (pb_OutputLevel) from | | selected digital timer (b_TimerNbr) from selected timer| | module (b_ModulNbr). | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | - | BYTE_ b_ModulNbr : Selected module number | + | unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | - | BYTE_ b_TimerNbr : Timer number to test | + | unsigned char_ b_TimerNbr : Timer number to test | | (0 to 2) | +----------------------------------------------------------------------------+ - | Output Parameters : PBYTE_ pb_OutputLevel : Output signal level | + | Output Parameters : unsigned char *_ pb_OutputLevel : Output signal level | | 0 : The output is low | | 1 : The output is high | +----------------------------------------------------------------------------+ @@ -848,12 +848,12 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PBYTE pb_OutputLevel) +int i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned char *pb_OutputLevel) { - INT i_ReturnValue = 0; - DWORD dw_TimerStatus; + int i_ReturnValue = 0; + unsigned int dw_TimerStatus; /* Test the module number */ if (b_ModulNbr < 4) { @@ -869,7 +869,7 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, /* Read the timer status */ dw_TimerStatus = inl(devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - *pb_OutputLevel = (BYTE) (((dw_TimerStatus >> 7) & 1) ^ devpriv-> s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_OutputLevel); + *pb_OutputLevel = (unsigned char) (((dw_TimerStatus >> 7) & 1) ^ devpriv-> s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_OutputLevel); } else { /* Timer not initialised see function */ DPRINTK("Timer not initialised see function\n"); @@ -879,7 +879,7 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); @@ -891,29 +891,29 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetTimerProgressStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | -| PBYTE_ pb_TimerStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | +| unsigned char *_ pb_TimerStatus) | +----------------------------------------------------------------------------+ | Task : Return the progress status (pb_TimerStatus) from | | selected digital timer (b_TimerNbr) from selected timer| | module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to test | +| unsigned char_ b_TimerNbr : Timer number to test | | (0 to 2) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TimerStatus : Output signal level | +| Output Parameters : unsigned char *_ pb_TimerStatus : Output signal level | | 0 : Timer not in progress | | 1 : Timer in progress | +----------------------------------------------------------------------------+ @@ -927,12 +927,12 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PBYTE pb_TimerStatus) +int i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned char *pb_TimerStatus) { - INT i_ReturnValue = 0; - DWORD dw_TimerStatus; + int i_ReturnValue = 0; + unsigned int dw_TimerStatus; /* Test the module number */ if (b_ModulNbr < 4) { @@ -949,7 +949,7 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, /* Read the timer status */ dw_TimerStatus = inl(devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - *pb_TimerStatus = (BYTE) ((dw_TimerStatus) >> 8) & 1; + *pb_TimerStatus = (unsigned char) ((dw_TimerStatus) >> 8) & 1; printk("ProgressStatus : %d", *pb_TimerStatus); } else { /* Timer not initialised see function */ @@ -958,7 +958,7 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, } else { /* Timer selection wrong */ i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ @@ -976,9 +976,9 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_WriteTimerValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | | ULONG_ ul_WriteValue) | +----------------------------------------------------------------------------+ | Task : Write the value (ul_WriteValue) into the selected timer| @@ -986,11 +986,11 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, | The action in depend of the time mode selection. | | See timer mode description table. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to write | +| unsigned char_ b_TimerNbr : Timer number to write | | (0 to 2) | | ULONG_ ul_WriteValue : Value to write | +----------------------------------------------------------------------------+ @@ -1006,11 +1006,11 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_WriteTimerValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - ULONG ul_WriteValue) +int i_APCI1710_WriteTimerValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned int ul_WriteValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /* Test the module number */ if (b_ModulNbr < 4) { @@ -1031,7 +1031,7 @@ INT i_APCI1710_WriteTimerValue(struct comedi_device * dev, /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h index 4797c0b77a4..9698ae13509 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h @@ -34,40 +34,40 @@ /* * 82X54 TIMER INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev, +int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * 82X54 READ FUNCTION */ -INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnBitsTimer(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnBitsTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * 82X54 READ & WRITE FUNCTION */ -INT i_APCI1710_ReadTimerValue(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PULONG pul_TimerValue); +int i_APCI1710_ReadTimerValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned int *pul_TimerValue); -INT i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PBYTE pb_OutputLevel); +int i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned char *pb_OutputLevel); -INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PBYTE pb_TimerStatus); +int i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned char *pb_TimerStatus); /* * 82X54 WRITE FUNCTION */ -INT i_APCI1710_WriteTimerValue(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - ULONG ul_WriteValue); +int i_APCI1710_WriteTimerValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned int ul_WriteValue); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c index 1a54d3b2c69..ccb109a851f 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c @@ -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. @@ -62,11 +62,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitChrono | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_ChronoMode, | -| BYTE_ b_PCIInputClock, | -| BYTE_ b_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_ChronoMode, | +| unsigned char_ b_PCIInputClock, | +| unsigned char_ b_TimingUnit, | | ULONG_ ul_TimingInterval, | | PULONG_ pul_RealTimingInterval) @@ -88,12 +88,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | The mode 4 to 7 is appropriate for measuring the timing| | between two event. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr CR_AREF(insn->chanspec) : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr CR_AREF(insn->chanspec) : Module number to configure | | (0 to 3) | -| BYTE_ b_ChronoMode data[0] : Chronometer action mode | +| unsigned char_ b_ChronoMode data[0] : Chronometer action mode | | (0 to 7). | -| BYTE_ b_PCIInputClock data[1] : Selection from PCI bus clock| +| unsigned char_ b_PCIInputClock data[1] : Selection from PCI bus clock| | - APCI1710_30MHZ : | | The PC have a PCI bus | | clock from 30 MHz | @@ -104,7 +104,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | The APCI-1710 have a | | integrated 40Mhz | | quartz. | -| BYTE_ b_TimingUnit data[2] : Base timing unity (0 to 4) | +| unsigned char_ b_TimingUnit data[2] : Base timing unity (0 to 4) | | 0 : ns | | 1 : µs | | 2 : ms | @@ -131,23 +131,23 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - ULONG ul_TimerValue = 0; - ULONG ul_TimingInterval = 0; - ULONG ul_RealTimingInterval = 0; + int i_ReturnValue = 0; + unsigned int ul_TimerValue = 0; + unsigned int ul_TimingInterval = 0; + unsigned int ul_RealTimingInterval = 0; double d_RealTimingInterval = 0; - DWORD dw_ModeArray[8] = + unsigned int dw_ModeArray[8] = { 0x01, 0x05, 0x00, 0x04, 0x02, 0x0E, 0x0A, 0x06 }; - BYTE b_ModulNbr, b_ChronoMode, b_PCIInputClock, b_TimingUnit; + unsigned char b_ModulNbr, b_ChronoMode, b_PCIInputClock, b_TimingUnit; b_ModulNbr = CR_AREF(insn->chanspec); - b_ChronoMode = (BYTE) data[0]; - b_PCIInputClock = (BYTE) data[1]; - b_TimingUnit = (BYTE) data[2]; - ul_TimingInterval = (ULONG) data[3]; + b_ChronoMode = (unsigned char) data[0]; + b_PCIInputClock = (unsigned char) data[1]; + b_TimingUnit = (unsigned char) data[2]; + ul_TimingInterval = (unsigned int) data[3]; i_ReturnValue = insn->n; /**************************/ @@ -214,7 +214,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.001 * b_PCIInputClock)); @@ -237,7 +237,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.001 * (double)b_PCIInputClock)); @@ -272,7 +272,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -294,7 +294,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (1.0 * b_PCIInputClock)); @@ -317,7 +317,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (1.0 * (double)b_PCIInputClock)); @@ -354,7 +354,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -400,7 +400,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (1000.0 * (double)b_PCIInputClock)); @@ -435,7 +435,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -457,7 +457,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (1000000.0 @@ -482,7 +482,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (1000000.0 @@ -520,7 +520,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -542,7 +542,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_TimerValue = - (ULONG) + (unsigned int) ( (ul_TimingInterval * @@ -570,7 +570,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (1000000.0 @@ -608,7 +608,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -736,7 +736,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su DPRINTK("Base timing selection is wrong\n"); i_ReturnValue = -7; } - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ else { /***********************************/ /* Timing unity selection is wrong */ @@ -744,8 +744,8 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su DPRINTK("Timing unity selection is wrong\n"); i_ReturnValue = -6; - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */ else { /*****************************************/ /* The selected PCI input clock is wrong */ @@ -753,8 +753,8 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su DPRINTK("The selected PCI input clock is wrong\n"); i_ReturnValue = -5; - } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) - } // if (b_ChronoMode >= 0 && b_ChronoMode <= 7) + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */ + } /* if (b_ChronoMode >= 0 && b_ChronoMode <= 7) */ else { /***************************************/ /* Chronometer mode selection is wrong */ @@ -762,7 +762,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su DPRINTK("Chronometer mode selection is wrong\n"); i_ReturnValue = -4; - } // if (b_ChronoMode >= 0 && b_ChronoMode <= 7) + } /* if (b_ChronoMode >= 0 && b_ChronoMode <= 7) */ } else { /******************************************/ /* The module is not a Chronometer module */ @@ -780,17 +780,17 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su i_ReturnValue = -2; } data[0] = ul_RealTimingInterval; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableChrono | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_CycleMode, | -| BYTE_ b_InterruptEnable) -INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_CycleMode, | +| unsigned char_ b_InterruptEnable) +int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Enable the chronometer from selected module | @@ -810,12 +810,12 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | | witch the " i_APCI1710_EnableChrono" function, if no | | stop signal occur this start signal is ignored. +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr CR_AREF(chanspec) : Selected module number (0 to 3) | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr CR_AREF(chanspec) : Selected module number (0 to 3) | data[0] ENABle/Disable chrono -| BYTE_ b_CycleMode : Selected the chronometer | +| unsigned char_ b_CycleMode : Selected the chronometer | | data[1] acquisition mode | -| BYTE_ b_InterruptEnable : Enable or disable the | +| unsigned char_ b_InterruptEnable : Enable or disable the | | data[2] chronometer interrupt. | | APCI1710_ENABLE: | | Enable the chronometer | @@ -840,15 +840,15 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action; + int i_ReturnValue = 0; + unsigned char b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action; b_ModulNbr = CR_AREF(insn->chanspec); - b_Action = (BYTE) data[0]; - b_CycleMode = (BYTE) data[1]; - b_InterruptEnable = (BYTE) data[2]; + b_Action = (unsigned char) data[0]; + b_CycleMode = (unsigned char) data[1]; + b_InterruptEnable = (unsigned char) data[2]; i_ReturnValue = insn->n; /**************************/ @@ -951,7 +951,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, ui_Address + 32 + (64 * b_ModulNbr)); - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ } /***********************************/ @@ -980,7 +980,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, 36 + (64 * b_ModulNbr)); - } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) + } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */ else { /********************************/ /* Interrupt parameter is wrong */ @@ -988,8 +988,8 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, DPRINTK("Interrupt parameter is wrong\n"); i_ReturnValue = -6; - } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) - } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) + } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */ + } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */ else { /***********************************************/ /* Chronometer acquisition mode cycle is wrong */ @@ -997,7 +997,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, DPRINTK("Chronometer acquisition mode cycle is wrong\n"); i_ReturnValue = -5; - } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) + } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */ break; case APCI1710_DISABLE: @@ -1046,7 +1046,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, default: DPRINTK("Inputs wrong! Enable or Disable chrono\n"); i_ReturnValue = -8; - } // switch ENABLE/DISABLE + } /* switch ENABLE/DISABLE */ } else { /*******************************/ /* Chronometer not initialised */ @@ -1072,7 +1072,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1090,36 +1090,36 @@ struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - BYTE b_ReadType; - INT i_ReturnValue = insn->n; + unsigned char b_ReadType; + int i_ReturnValue = insn->n; b_ReadType = CR_CHAN(insn->chanspec); switch (b_ReadType) { case APCI1710_CHRONO_PROGRESS_STATUS: i_ReturnValue = i_APCI1710_GetChronoProgressStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); break; case APCI1710_CHRONO_READVALUE: i_ReturnValue = i_APCI1710_ReadChronoValue(dev, - (BYTE) CR_AREF(insn->chanspec), - (UINT) insn->unused[0], - (PBYTE) & data[0], (PULONG) & data[1]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned int) insn->unused[0], + (unsigned char *) &data[0], (unsigned int *) &data[1]); break; case APCI1710_CHRONO_CONVERTVALUE: i_ReturnValue = i_APCI1710_ConvertChronoValue(dev, - (BYTE) CR_AREF(insn->chanspec), - (ULONG) insn->unused[0], - (PULONG) & data[0], - (PBYTE) & data[1], - (PBYTE) & data[2], - (PUINT) & data[3], - (PUINT) & data[4], (PUINT) & data[5]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned int) insn->unused[0], + (unsigned int *) &data[0], + (unsigned char *) &data[1], + (unsigned char *) &data[2], + (unsigned int *) &data[3], + (unsigned int *) &data[4], (unsigned int *) &data[5]); break; case APCI1710_CHRONO_READINTERRUPT: @@ -1152,22 +1152,22 @@ INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevic if (i_ReturnValue >= 0) i_ReturnValue = insn->n; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetChronoProgressStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_ChronoStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_ChronoStatus) | +----------------------------------------------------------------------------+ | Task : Return the chronometer status (pb_ChronoStatus) from | | selected chronometer module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pb_ChronoStatus : Return the chronometer | | status. | @@ -1194,11 +1194,11 @@ INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_ChronoStatus) +int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_ChronoStatus) { - INT i_ReturnValue = 0; - DWORD dw_Status; + int i_ReturnValue = 0; + unsigned int dw_Status; /**************************/ /* Test the module number */ @@ -1233,7 +1233,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, /******************/ *pb_ChronoStatus = 3; - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 8) == 8) */ else { /*******************************/ /* Test if measurement stopped */ @@ -1245,7 +1245,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, /***********************/ *pb_ChronoStatus = 2; - } // if ((dw_Status & 2) == 2) + } /* if ((dw_Status & 2) == 2) */ else { /*******************************/ /* Test if measurement started */ @@ -1257,16 +1257,16 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, /************************/ *pb_ChronoStatus = 1; - } // if ((dw_Status & 1) == 1) + } /* if ((dw_Status & 1) == 1) */ else { /***************************/ /* Measurement not started */ /***************************/ *pb_ChronoStatus = 0; - } // if ((dw_Status & 1) == 1) - } // if ((dw_Status & 2) == 2) - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 1) == 1) */ + } /* if ((dw_Status & 2) == 2) */ + } /* if ((dw_Status & 8) == 8) */ } else { /*******************************/ /* Chronometer not initialised */ @@ -1289,16 +1289,16 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadChronoValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| UINT_ ui_TimeOut, | -| PBYTE_ pb_ChronoStatus, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned int_ ui_TimeOut, | +| unsigned char *_ pb_ChronoStatus, | | PULONG_ pul_ChronoValue) | +----------------------------------------------------------------------------+ | Task : Return the chronometer status (pb_ChronoStatus) and the| @@ -1323,8 +1323,8 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, | "i_APCI1710_InitChrono" function and the time unity is | | the b_TimingUnit from "i_APCI1710_InitChrono" function| +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pb_ChronoStatus : Return the chronometer | | status. | @@ -1341,7 +1341,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, | timing witch the | | function | | "i_APCI1710_InitChrono" | -| PULONG pul_ChronoValue : Chronometer timing value. | +| unsigned int * pul_ChronoValue : Chronometer timing value. | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -1355,13 +1355,13 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, - BYTE b_ModulNbr, - UINT ui_TimeOut, PBYTE pb_ChronoStatus, PULONG pul_ChronoValue) +int i_APCI1710_ReadChronoValue(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned int ui_TimeOut, unsigned char *pb_ChronoStatus, unsigned int *pul_ChronoValue) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_TimeOut = 0; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_TimeOut = 0; /**************************/ /* Test the module number */ @@ -1430,7 +1430,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, } break; - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 8) == 8) */ else { /*******************************/ /* Test if measurement stopped */ @@ -1464,7 +1464,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, outl(0, devpriv->s_BoardInfos.ui_Address + 36 + (64 * b_ModulNbr)); } break; - } // if ((dw_Status & 2) == 2) + } /* if ((dw_Status & 2) == 2) */ else { /*******************************/ /* Test if measurement started */ @@ -1478,7 +1478,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, *pb_ChronoStatus = 1; - } // if ((dw_Status & 1) == 1) + } /* if ((dw_Status & 1) == 1) */ else { /***************************/ /* Measurement not started */ @@ -1487,9 +1487,9 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, *pb_ChronoStatus = 0; - } // if ((dw_Status & 1) == 1) - } // if ((dw_Status & 2) == 2) - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 1) == 1) */ + } /* if ((dw_Status & 2) == 2) */ + } /* if ((dw_Status & 8) == 8) */ if (dw_TimeOut == ui_TimeOut) { /*****************/ @@ -1507,7 +1507,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, mdelay(1000); } - } // for (;;) + } /* for (;;) */ /*****************************/ /* Test if stop signal occur */ @@ -1575,39 +1575,39 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ConvertChronoValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | | ULONG_ ul_ChronoValue, | | PULONG_ pul_Hour, | -| PBYTE_ pb_Minute, | -| PBYTE_ pb_Second, | -| PUINT_ pui_MilliSecond, | -| PUINT_ pui_MicroSecond, | -| PUINT_ pui_NanoSecond) | +| unsigned char *_ pb_Minute, | +| unsigned char *_ pb_Second, | +| unsigned int *_ pui_MilliSecond, | +| unsigned int *_ pui_MicroSecond, | +| unsigned int *_ pui_NanoSecond) | +----------------------------------------------------------------------------+ | Task : Convert the chronometer measured timing | | (ul_ChronoValue) in to h, mn, s, ms, µs, ns. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| | ULONG_ ul_ChronoValue : Measured chronometer timing | | value. | | See"i_APCI1710_ReadChronoValue"| +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_Hour : Chronometer timing hour | -| PBYTE_ pb_Minute : Chronometer timing minute | -| PBYTE_ pb_Second : Chronometer timing second | -| PUINT_ pui_MilliSecond : Chronometer timing mini | +| unsigned char *_ pb_Minute : Chronometer timing minute | +| unsigned char *_ pb_Second : Chronometer timing second | +| unsigned int *_ pui_MilliSecond : Chronometer timing mini | | second | -| PUINT_ pui_MicroSecond : Chronometer timing micro | +| unsigned int *_ pui_MicroSecond : Chronometer timing micro | | second | -| PUINT_ pui_NanoSecond : Chronometer timing nano | +| unsigned int *_ pui_NanoSecond : Chronometer timing nano | | second | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -1619,15 +1619,15 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, - BYTE b_ModulNbr, - ULONG ul_ChronoValue, - PULONG pul_Hour, - PBYTE pb_Minute, - PBYTE pb_Second, - PUINT pui_MilliSecond, PUINT pui_MicroSecond, PUINT pui_NanoSecond) +int i_APCI1710_ConvertChronoValue(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned int ul_ChronoValue, + unsigned int *pul_Hour, + unsigned char *pb_Minute, + unsigned char *pb_Second, + unsigned int *pui_MilliSecond, unsigned int *pui_MicroSecond, unsigned int *pui_NanoSecond) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; double d_Hour; double d_Minute; double d_Second; @@ -1681,7 +1681,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /**********************/ d_Hour = d_Hour / (double)60.0; - *pul_Hour = (ULONG) d_Hour; + *pul_Hour = (unsigned int) d_Hour; /************************/ /* Calculate the minute */ @@ -1689,7 +1689,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_Minute = d_Hour - *pul_Hour; d_Minute = d_Minute * 60; - *pb_Minute = (BYTE) d_Minute; + *pb_Minute = (unsigned char) d_Minute; /************************/ /* Calculate the second */ @@ -1697,7 +1697,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_Second = d_Minute - *pb_Minute; d_Second = d_Second * 60; - *pb_Second = (BYTE) d_Second; + *pb_Second = (unsigned char) d_Second; /*****************************/ /* Calculate the mini second */ @@ -1705,7 +1705,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_MilliSecond = d_Second - *pb_Second; d_MilliSecond = d_MilliSecond * 1000; - *pui_MilliSecond = (UINT) d_MilliSecond; + *pui_MilliSecond = (unsigned int) d_MilliSecond; /******************************/ /* Calculate the micro second */ @@ -1715,7 +1715,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_MilliSecond - *pui_MilliSecond; d_MicroSecond = d_MicroSecond * 1000; - *pui_MicroSecond = (UINT) d_MicroSecond; + *pui_MicroSecond = (unsigned int) d_MicroSecond; /******************************/ /* Calculate the micro second */ @@ -1725,7 +1725,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_MicroSecond - *pui_MicroSecond; d_NanoSecond = d_NanoSecond * 1000; - *pui_NanoSecond = (UINT) d_NanoSecond; + *pui_NanoSecond = (unsigned int) d_NanoSecond; break; } @@ -1752,21 +1752,21 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,struct comedi_subdevice *s, +| Function Name : int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Sets the output witch has been passed with the | | parameter b_Channel. Setting an output means setting an| | output high. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| -| BYTE_ b_OutputChannel : Selection from digital output | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| +| unsigned char_ b_OutputChannel : Selection from digital output | | CR_CHAN() channel (0 to 2) | | 0 : Channel H | | 1 : Channel A | @@ -1787,19 +1787,19 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetChronoChlOff | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_OutputChannel) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_OutputChannel) | +----------------------------------------------------------------------------+ | Task : Resets the output witch has been passed with the | | parameter b_Channel. Resetting an output means setting | | an output low. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 data[0] : Chl ON, Chl OFF , Chl Read , Port Read -| BYTE_ b_ModulNbr CR_AREF : Selected module number (0 to 3)| -| BYTE_ b_OutputChannel CR_CHAN : Selection from digital output | +| unsigned char_ b_ModulNbr CR_AREF : Selected module number (0 to 3)| +| unsigned char_ b_OutputChannel CR_CHAN : Selection from digital output | | channel (0 to 2) | | 0 : Channel H | | 1 : Channel A | @@ -1820,24 +1820,24 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadChronoChlValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_InputChannel, | -| PBYTE_ pb_ChannelStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_InputChannel, | +| unsigned char *_ pb_ChannelStatus) | +----------------------------------------------------------------------------+ | Task : Return the status from selected digital input | | (b_InputChannel) from selected chronometer | | module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| -| BYTE_ b_InputChannel : Selection from digital input | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| +| unsigned char_ b_InputChannel : Selection from digital input | | channel (0 to 2) | | CR_CHAN() 0 : Channel E | | 1 : Channel F | | 2 : Channel G | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_ChannelStatus : Digital input channel status.| +| Output Parameters : unsigned char *_ pb_ChannelStatus : Digital input channel status.| | data[0] 0 : Channel is not active | | 1 : Channel is active | +----------------------------------------------------------------------------+ @@ -1854,17 +1854,17 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadChronoPortValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_PortValue) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_PortValue) | +----------------------------------------------------------------------------+ | Task : Return the status from digital inputs port from | | selected (b_ModulNbr) chronometer module. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_PortValue : Digital inputs port status. +| Output Parameters : unsigned char *_ pb_PortValue : Digital inputs port status. | data[0] +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -1876,18 +1876,18 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType; - DWORD dw_Status; - PBYTE pb_ChannelStatus; - PBYTE pb_PortValue; + int i_ReturnValue = 0; + unsigned char b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType; + unsigned int dw_Status; + unsigned char *pb_ChannelStatus; + unsigned char *pb_PortValue; b_ModulNbr = CR_AREF(insn->chanspec); i_ReturnValue = insn->n; - b_IOType = (BYTE) data[0]; + b_IOType = (unsigned char) data[0]; /**************************/ /* Test the module number */ @@ -1915,14 +1915,14 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, case APCI1710_CHRONO_SET_CHANNELOFF: b_OutputChannel = - (BYTE) CR_CHAN(insn->chanspec); + (unsigned char) CR_CHAN(insn->chanspec); if (b_OutputChannel <= 2) { outl(0, devpriv->s_BoardInfos. ui_Address + 20 + (b_OutputChannel * 4) + (64 * b_ModulNbr)); - } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) + } /* if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */ else { /****************************************/ /* The selected digital output is wrong */ @@ -1931,21 +1931,21 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, DPRINTK("The selected digital output is wrong\n"); i_ReturnValue = -4; - } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) + } /* if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */ break; case APCI1710_CHRONO_SET_CHANNELON: b_OutputChannel = - (BYTE) CR_CHAN(insn->chanspec); + (unsigned char) CR_CHAN(insn->chanspec); if (b_OutputChannel <= 2) { outl(1, devpriv->s_BoardInfos. ui_Address + 20 + (b_OutputChannel * 4) + (64 * b_ModulNbr)); - } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) + } /* if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */ else { /****************************************/ /* The selected digital output is wrong */ @@ -1954,7 +1954,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, DPRINTK("The selected digital output is wrong\n"); i_ReturnValue = -4; - } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) + } /* if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */ break; @@ -1962,9 +1962,9 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, /**********************************/ /* Test the digital input channel */ /**********************************/ - pb_ChannelStatus = (PBYTE) & data[0]; + pb_ChannelStatus = (unsigned char *) &data[0]; b_InputChannel = - (BYTE) CR_CHAN(insn->chanspec); + (unsigned char) CR_CHAN(insn->chanspec); if (b_InputChannel <= 2) { @@ -1975,10 +1975,10 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_ChannelStatus = - (BYTE) (((dw_Status >> + (unsigned char) (((dw_Status >> b_InputChannel) & 1) ^ 1); - } // if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) + } /* if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) */ else { /***************************************/ /* The selected digital input is wrong */ @@ -1986,13 +1986,13 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, DPRINTK("The selected digital input is wrong\n"); i_ReturnValue = -4; - } // if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) + } /* if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) */ break; case APCI1710_CHRONO_READ_PORT: - pb_PortValue = (PBYTE) & data[0]; + pb_PortValue = (unsigned char *) &data[0]; dw_Status = inl(devpriv->s_BoardInfos. @@ -2000,7 +2000,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_PortValue = - (BYTE) ((dw_Status & 0x7) ^ 7); + (unsigned char) ((dw_Status & 0x7) ^ 7); break; } } else { @@ -2028,5 +2028,5 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h index 26b50cefee5..29bad1d144a 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h @@ -35,10 +35,10 @@ /* * CHRONOMETER INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, +int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -46,29 +46,29 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, /* * CHRONOMETER READ FUNCTION */ -INT i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_ChronoStatus); +int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_ChronoStatus); -INT i_APCI1710_ReadChronoValue(struct comedi_device *dev, - BYTE b_ModulNbr, - UINT ui_TimeOut, PBYTE pb_ChronoStatus, - PULONG pul_ChronoValue); +int i_APCI1710_ReadChronoValue(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned int ui_TimeOut, unsigned char *pb_ChronoStatus, + unsigned int *pul_ChronoValue); -INT i_APCI1710_ConvertChronoValue(struct comedi_device *dev, - BYTE b_ModulNbr, - ULONG ul_ChronoValue, - PULONG pul_Hour, - PBYTE pb_Minute, - PBYTE pb_Second, - PUINT pui_MilliSecond, PUINT pui_MicroSecond, - PUINT pui_NanoSecond); +int i_APCI1710_ConvertChronoValue(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned int ul_ChronoValue, + unsigned int *pul_Hour, + unsigned char *pb_Minute, + unsigned char *pb_Second, + unsigned int *pui_MilliSecond, unsigned int *pui_MicroSecond, + unsigned int *pui_NanoSecond); /* * CHRONOMETER DIGITAL INPUT OUTPUT FUNCTION */ -INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev, +int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c index 8be27aedaaf..f3e47e5791d 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c @@ -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. @@ -61,7 +61,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, | +| Function Name : int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, | | struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)| +----------------------------------------------------------------------------+ | Task : Configure the digital I/O operating mode from selected | @@ -70,14 +70,14 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | I/O. | +----------------------------------------------------------------------------+ | Input Parameters : | -| BYTE_ b_ModulNbr data[0]: Module number to | +| unsigned char_ b_ModulNbr data[0]: Module number to | | configure (0 to 3) | -| BYTE_ b_ChannelAMode data[1] : Channel A mode selection | +| unsigned char_ b_ChannelAMode data[1] : Channel A mode selection | | 0 : Channel used for digital | | input | | 1 : Channel used for digital | | output | -| BYTE_ b_ChannelBMode data[2] : Channel B mode selection | +| unsigned char_ b_ChannelBMode data[2] : Channel B mode selection | | 0 : Channel used for digital | | input | | 1 : Channel used for digital | @@ -99,19 +99,19 @@ Activates and deactivates the digital output memory. +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - BYTE b_ModulNbr, b_ChannelAMode, b_ChannelBMode; - BYTE b_MemoryOnOff, b_ConfigType; - INT i_ReturnValue = 0; - DWORD dw_WriteConfig = 0; - - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_ConfigType = (BYTE) data[0]; // Memory or Init - b_ChannelAMode = (BYTE) data[1]; - b_ChannelBMode = (BYTE) data[2]; - b_MemoryOnOff = (BYTE) data[1]; // if memory operation + unsigned char b_ModulNbr, b_ChannelAMode, b_ChannelBMode; + unsigned char b_MemoryOnOff, b_ConfigType; + int i_ReturnValue = 0; + unsigned int dw_WriteConfig = 0; + + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_ConfigType = (unsigned char) data[0]; /* Memory or Init */ + b_ChannelAMode = (unsigned char) data[1]; + b_ChannelBMode = (unsigned char) data[2]; + b_MemoryOnOff = (unsigned char) data[1]; /* if memory operation */ i_ReturnValue = insn->n; /**************************/ @@ -126,7 +126,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub switch (b_ConfigType) { case APCI1710_DIGIO_MEMORYONOFF: - if (b_MemoryOnOff) // If Memory ON + if (b_MemoryOnOff) /* If Memory ON */ { /****************************/ /* Set the output memory on */ @@ -140,7 +140,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub /***************************/ devpriv->s_ModuleInfo[b_ModulNbr]. s_DigitalIOInfo.dw_OutputMemory = 0; - } else // If memory off + } else /* If memory off */ { /*****************************/ /* Set the output memory off */ @@ -197,7 +197,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub /*****************************************/ dw_WriteConfig = - (DWORD) (b_ChannelAMode | + (unsigned int) (b_ChannelAMode | (b_ChannelBMode * 2)); /***************************/ @@ -233,7 +233,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub DPRINTK("The module is not a digital I/O module\n"); i_ReturnValue = -3; } - } // end of Switch + } /* end of Switch */ printk("Return Value %d\n", i_ReturnValue); return i_ReturnValue; } @@ -257,9 +257,9 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub | -| BYTE_ b_ModulNbr CR_AREF(chanspec) : Selected module number | +| unsigned char_ b_ModulNbr CR_AREF(chanspec) : Selected module number | | (0 to 3) | -| BYTE_ b_InputChannel CR_CHAN(chanspec) : Selection from digital | +| unsigned char_ b_InputChannel CR_CHAN(chanspec) : Selection from digital | | input ( 0 to 6) | | 0 : Channel C | | 1 : Channel D | @@ -288,22 +288,22 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -//_INT_ i_APCI1710_ReadDigitalIOChlValue (BYTE_ b_BoardHandle, -// BYTE_ b_ModulNbr, -// BYTE_ b_InputChannel, -// -// PBYTE_ pb_ChannelStatus) -INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +/* _INT_ i_APCI1710_ReadDigitalIOChlValue (unsigned char_ b_BoardHandle, */ +/* +* unsigned char_ b_ModulNbr, unsigned char_ b_InputChannel, +* unsigned char *_ pb_ChannelStatus) +*/ +int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr, b_InputChannel; - PBYTE pb_ChannelStatus; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_InputChannel = (BYTE) CR_CHAN(insn->chanspec); + int i_ReturnValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr, b_InputChannel; + unsigned char *pb_ChannelStatus; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_InputChannel = (unsigned char) CR_CHAN(insn->chanspec); data[0] = 0; - pb_ChannelStatus = (PBYTE) & data[0]; + pb_ChannelStatus = (unsigned char *) &data[0]; i_ReturnValue = insn->n; /**************************/ @@ -356,7 +356,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, i_ReturnValue = -6; } - } // if (b_InputChannel == 5) + } /* if (b_InputChannel == 5) */ else { /***************************/ /* Test the channel B mode */ @@ -375,8 +375,8 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, i_ReturnValue = -7; } - } // if (b_InputChannel == 5) - } // if (b_InputChannel > 4) + } /* if (b_InputChannel == 5) */ + } /* if (b_InputChannel > 4) */ /***********************/ /* Test if error occur */ @@ -387,11 +387,10 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, /* Read all digital input */ /**************************/ - //INPDW (ps_APCI1710Variable-> - // s_Board [b_BoardHandle]. - // s_BoardInfos. - // ui_Address + (64 * b_ModulNbr), - // &dw_StatusReg); +/* +* INPDW (ps_APCI1710Variable-> s_Board [b_BoardHandle]. +* s_BoardInfos. ui_Address + (64 * b_ModulNbr), &dw_StatusReg); +*/ dw_StatusReg = inl(devpriv-> @@ -400,11 +399,11 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_ChannelStatus = - (BYTE) ((dw_StatusReg ^ + (unsigned char) ((dw_StatusReg ^ 0x1C) >> b_InputChannel) & 1; - } // if (i_ReturnValue == 0) + } /* if (i_ReturnValue == 0) */ } else { /*******************************/ /* Digital I/O not initialised */ @@ -434,7 +433,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -445,7 +444,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnWriteDigitalIOChlOnOff(comedi_device +| Function Name : int i_APCI1710_InsnWriteDigitalIOChlOnOff(comedi_device |*dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ @@ -453,9 +452,9 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, | parameter b_Channel. Setting an output means setting | | an ouput high. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr (aref ) : Selected module number (0 to 3)| -| BYTE_ b_OutputChannel (CR_CHAN) : Selection from digital output | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr (aref ) : Selected module number (0 to 3)| +| unsigned char_ b_OutputChannel (CR_CHAN) : Selection from digital output | | channel (0 to 2) | | 0 : Channel H | | 1 : Channel A | @@ -478,15 +477,16 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -//_INT_ i_APCI1710_SetDigitalIOChlOn (BYTE_ b_BoardHandle, -// BYTE_ b_ModulNbr, -// BYTE_ b_OutputChannel) -INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +/* +* _INT_ i_APCI1710_SetDigitalIOChlOn (unsigned char_ b_BoardHandle, +* unsigned char_ b_ModulNbr, unsigned char_ b_OutputChannel) +*/ +int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_WriteValue = 0; - BYTE b_ModulNbr, b_OutputChannel; + int i_ReturnValue = 0; + unsigned int dw_WriteValue = 0; + unsigned char b_ModulNbr, b_OutputChannel; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); b_OutputChannel = CR_CHAN(insn->chanspec); @@ -602,7 +602,7 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, 1 << b_OutputChannel; } - } // set channel off + } /* set channel off */ else { if (devpriv-> s_ModuleInfo @@ -627,23 +627,24 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, dw_OutputMemory = dw_WriteValue; } else { - /*****************************/ + /*****************************/ /* Digital Output Memory OFF */ - /*****************************/ - // +Use previously the function "i_APCI1710_SetDigitalIOMemoryOn" + /*****************************/ + /* +Use previously the function "i_APCI1710_SetDigitalIOMemoryOn" */ i_ReturnValue = -8; } } - /*******************/ + /*******************/ /* Write the value */ - /*******************/ + /*******************/ - //OUTPDW (ps_APCI1710Variable-> - // s_Board [b_BoardHandle]. - // s_BoardInfos. - // ui_Address + (64 * b_ModulNbr), - // dw_WriteValue); + /* OUTPDW (ps_APCI1710Variable-> + * s_Board [b_BoardHandle]. + * s_BoardInfos. ui_Address + (64 * b_ModulNbr), + * dw_WriteValue); + */ +*/ outl(dw_WriteValue, devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); @@ -670,7 +671,7 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -690,19 +691,19 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, | from selected digital I/O module (b_ModulNbr) +----------------------------------------------------------------------------+ | Input Parameters : - BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr CR_AREF(aref) : Selected module number (0 to 3)| -| BYTE_ b_PortValue CR_CHAN(chanspec) : Output Value ( 0 To 7 ) + unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr CR_AREF(aref) : Selected module number (0 to 3)| +| unsigned char_ b_PortValue CR_CHAN(chanspec) : Output Value ( 0 To 7 ) | data[0] read or write port - data[1] if write then indicate ON or OFF +| data[1] if write then indicate ON or OFF - if read : data[1] will return port status. +| if read : data[1] will return port status. +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ | Return Value : - INPUT : +| INPUT : 0: No error | | -1: The handle parameter of the board is wrong | @@ -725,75 +726,78 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -//_INT_ i_APCI1710_SetDigitalIOPortOn (BYTE_ b_BoardHandle, -// BYTE_ b_ModulNbr, -// BYTE_ b_PortValue) -INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +/* + * _INT_ i_APCI1710_SetDigitalIOPortOn (unsigned char_ + * b_BoardHandle, unsigned char_ b_ModulNbr, unsigned char_ + * b_PortValue) +*/ +int i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_WriteValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr, b_PortValue; - BYTE b_PortOperation, b_PortOnOFF; - - PBYTE pb_PortValue; - - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_PortOperation = (BYTE) data[0]; // Input or output - b_PortOnOFF = (BYTE) data[1]; // if output then On or Off - b_PortValue = (BYTE) data[2]; // if out put then Value + int i_ReturnValue = 0; + unsigned int dw_WriteValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr, b_PortValue; + unsigned char b_PortOperation, b_PortOnOFF; + + unsigned char *pb_PortValue; + + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_PortOperation = (unsigned char) data[0]; /* Input or output */ + b_PortOnOFF = (unsigned char) data[1]; /* if output then On or Off */ + b_PortValue = (unsigned char) data[2]; /* if out put then Value */ i_ReturnValue = insn->n; - pb_PortValue = (PBYTE) & data[0]; -// if input then read value + pb_PortValue = (unsigned char *) &data[0]; +/* if input then read value */ switch (b_PortOperation) { case APCI1710_INPUT: - /**************************/ + /**************************/ /* Test the module number */ - /**************************/ + /**************************/ if (b_ModulNbr < 4) { - /*******************************/ + /*******************************/ /* Test if digital I/O counter */ - /*******************************/ + /*******************************/ if ((devpriv->s_BoardInfos. dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF0000UL) == APCI1710_DIGITAL_IO) { - /**********************************************/ + /**********************************************/ /* Test if the digital I/O module initialised */ - /**********************************************/ + /**********************************************/ if (devpriv->s_ModuleInfo[b_ModulNbr]. s_DigitalIOInfo.b_DigitalInit == 1) { - /**************************/ + /**************************/ /* Read all digital input */ - /**************************/ + /**************************/ - //INPDW (ps_APCI1710Variable-> - // s_Board [b_BoardHandle]. - // s_BoardInfos. - // ui_Address + (64 * b_ModulNbr), - // &dw_StatusReg); + /* INPDW (ps_APCI1710Variable-> + * s_Board [b_BoardHandle]. + * s_BoardInfos. + * ui_Address + (64 * b_ModulNbr), + * &dw_StatusReg); + */ dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); *pb_PortValue = - (BYTE) (dw_StatusReg ^ 0x1C); + (unsigned char) (dw_StatusReg ^ 0x1C); } else { - /*******************************/ + /*******************************/ /* Digital I/O not initialised */ - /*******************************/ + /*******************************/ i_ReturnValue = -4; } } else { - /******************************************/ + /******************************************/ /* The module is not a digital I/O module */ - /******************************************/ + /******************************************/ i_ReturnValue = -3; } @@ -853,11 +857,11 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, i_ReturnValue = -6; } - } // if ((b_PortValue & 2) == 2) + } /* if ((b_PortValue & 2) == 2) */ - /**************************/ + /**************************/ /* Test if channel B used */ - /**************************/ + /**************************/ if ((b_PortValue & 4) == 4) { if (devpriv-> @@ -866,33 +870,33 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, s_DigitalIOInfo. b_ChannelBMode != 1) { - /*******************************************/ + /*******************************************/ /* The digital channel B is used for input */ - /*******************************************/ + /*******************************************/ i_ReturnValue = -7; } - } // if ((b_PortValue & 4) == 4) + } /* if ((b_PortValue & 4) == 4) */ - /***********************/ + /***********************/ /* Test if error occur */ - /***********************/ + /***********************/ if (i_ReturnValue >= 0) { - //if(data[1]) - //{ + /* if(data[1]) { */ + switch (b_PortOnOFF) { - /*********************************/ + /*********************************/ /* Test if set Port ON */ - /*********************************/ + /*********************************/ case APCI1710_ON: - /*********************************/ + /*********************************/ /* Test if output memory enabled */ - /*********************************/ + /*********************************/ if (devpriv-> s_ModuleInfo @@ -924,7 +928,7 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, } break; - // If Set PORT OFF + /* If Set PORT OFF */ case APCI1710_OFF: /*********************************/ @@ -957,25 +961,26 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, = dw_WriteValue; } else { - /*****************************/ + /*****************************/ /* Digital Output Memory OFF */ - /*****************************/ + /*****************************/ i_ReturnValue = -8; } - } // switch + } /* switch */ - /*******************/ + /*******************/ /* Write the value */ - /*******************/ + /*******************/ + + /* OUTPDW (ps_APCI1710Variable-> + * s_Board [b_BoardHandle]. + * s_BoardInfos. + * ui_Address + (64 * b_ModulNbr), + * dw_WriteValue); */ - // OUTPDW (ps_APCI1710Variable-> - // s_Board [b_BoardHandle]. - // s_BoardInfos. - // ui_Address + (64 * b_ModulNbr), - // dw_WriteValue); outl(dw_WriteValue, devpriv-> s_BoardInfos. @@ -983,16 +988,16 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, (64 * b_ModulNbr)); } } else { - /**********************/ + /**********************/ /* Output value wrong */ - /**********************/ + /**********************/ i_ReturnValue = -4; } } else { - /*******************************/ + /*******************************/ /* Digital I/O not initialised */ - /*******************************/ + /*******************************/ i_ReturnValue = -5; } @@ -1015,6 +1020,6 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, default: i_ReturnValue = -9; DPRINTK("NO INPUT/OUTPUT specified\n"); - } //switch INPUT / OUTPUT - return (i_ReturnValue); + } /* switch INPUT / OUTPUT */ + return i_ReturnValue; } diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h index 5ef157a55ca..af1b9cdecfb 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h @@ -27,20 +27,20 @@ /* * DIGITAL I/O INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * INPUT OUTPUT FUNCTIONS */ -INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev, +int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev, +int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev, +int i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c index 1062f2fdec3..6c092efee7b 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c @@ -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. @@ -61,7 +61,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ -| INT i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev,struct comedi_subdevice *s, +| int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ @@ -75,58 +75,58 @@ struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_ConfigType; - INT i_ReturnValue = 0; + 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 + 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), - (BYTE) data[0], - (BYTE) data[1], - (BYTE) data[2], (BYTE) data[3], (BYTE) data[4]); + (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, - (PBYTE) & data[0]); + (unsigned char *) &data[0]); break; case APCI1710_INCCPT_INITINDEX: i_ReturnValue = i_APCI1710_InitIndex(dev, CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], (BYTE) data[2], (BYTE) data[3]); + (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), (BYTE) data[0]); + CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_INCCPT_INITEXTERNALSTROBE: i_ReturnValue = i_APCI1710_InitExternalStrobe(dev, CR_AREF(insn->chanspec), - (BYTE) data[0], (BYTE) data[1]); + (unsigned char) data[0], (unsigned char) data[1]); break; case APCI1710_INCCPT_INITCOMPARELOGIC: i_ReturnValue = i_APCI1710_InitCompareLogic(dev, - CR_AREF(insn->chanspec), (UINT) data[0]); + CR_AREF(insn->chanspec), (unsigned int) data[0]); break; case APCI1710_INCCPT_INITFREQUENCYMEASUREMENT: i_ReturnValue = i_APCI1710_InitFrequencyMeasurement(dev, CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], (ULONG) data[2], (PULONG) & data[0]); + (unsigned char) data[0], + (unsigned char) data[1], (unsigned int) data[2], (unsigned int *) &data[0]); break; default: @@ -136,19 +136,19 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev if (i_ReturnValue >= 0) i_ReturnValue = insn->n; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitCounter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_CounterRange, | -| BYTE_ b_FirstCounterModus, | -| BYTE_ b_FirstCounterOption, | -| BYTE_ b_SecondCounterModus, | -| BYTE_ b_SecondCounterOption) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_CounterRange, | +| unsigned char_ b_FirstCounterModus, | +| unsigned char_ b_FirstCounterOption, | +| unsigned char_ b_SecondCounterModus, | +| unsigned char_ b_SecondCounterOption) | +----------------------------------------------------------------------------+ | Task : Configure the counter operating mode from selected | | module (b_ModulNbr). You must calling this function be | @@ -273,17 +273,17 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev | +----------------------+--------------------+----------------------------+ | | | +----------------------------------------------------------------------------+ -| 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_CounterRange : Selection form counter | +| unsigned char_ b_CounterRange : Selection form counter | | range. | -| BYTE_ b_FirstCounterModus : First counter operating | +| unsigned char_ b_FirstCounterModus : First counter operating | | mode. | -| BYTE_ b_FirstCounterOption : First counter option. | -| BYTE_ b_SecondCounterModus : Second counter operating | +| unsigned char_ b_FirstCounterOption : First counter option. | +| unsigned char_ b_SecondCounterModus : Second counter operating | | mode. | -| BYTE_ b_SecondCounterOption : Second counter option. | +| unsigned char_ b_SecondCounterOption : Second counter option. | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -299,14 +299,14 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitCounter(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_CounterRange, - BYTE b_FirstCounterModus, - BYTE b_FirstCounterOption, - BYTE b_SecondCounterModus, BYTE b_SecondCounterOption) +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_ReturnValue = 0; + int i_ReturnValue = 0; /*******************************/ /* Test if incremental counter */ @@ -502,14 +502,14 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_CounterAutoTest | -| (BYTE_ b_BoardHandle, | -| PBYTE_ pb_TestStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char *_ pb_TestStatus) | +----------------------------------------------------------------------------+ | Task : A test mode is intended for testing the component and | | the connected periphery. All the 8-bit counter chains | @@ -535,9 +535,9 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev, | | 1000 | Error detected of counter 3 | | | +-----------------+-----------------------------+ | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TestStatus : Auto test conclusion. See table| +| Output Parameters : unsigned char *_ pb_TestStatus : Auto test conclusion. See table| +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -545,11 +545,11 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) +int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char *pb_TestStatus) { - BYTE b_ModulCpt = 0; - INT i_ReturnValue = 0; - DWORD dw_LathchValue; + unsigned char b_ModulCpt = 0; + int i_ReturnValue = 0; + unsigned int dw_LathchValue; *pb_TestStatus = 0; @@ -627,17 +627,17 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_InitIndex (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_ReferenceAction, | -| BYTE_ b_IndexOperation, | -| BYTE_ b_AutoMode, | -| BYTE_ b_InterruptEnable) | +| Function Name : _INT_ i_APCI1710_InitIndex (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_ReferenceAction, | +| unsigned char_ b_IndexOperation, | +| unsigned char_ b_AutoMode, | +| unsigned char_ b_InterruptEnable) | +----------------------------------------------------------------------------+ | Task : Initialise the index corresponding to the selected | | module (b_ModulNbr). If a INDEX flag occur, you have | @@ -665,10 +665,10 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) | | | value is cleared (32-Bit) | | | +------------------------+------------------------------------+ | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_ReferenceAction : Determine if the reference | +| unsigned char_ b_ReferenceAction : Determine if the reference | | must set or no for the | | acceptance from index | | APCI1710_ENABLE : | @@ -677,15 +677,15 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) | APCI1710_DISABLE : | | Reference have not | | importance | -| BYTE_ b_IndexOperation : Index operating mode. | +| unsigned char_ b_IndexOperation : Index operating mode. | | See table. | -| BYTE_ b_AutoMode : Enable or disable the | +| unsigned char_ b_AutoMode : Enable or disable the | | automatic index reset. | | APCI1710_ENABLE : | | Enable the automatic mode | | APCI1710_DISABLE : | | Disable the automatic mode | -| BYTE_ b_InterruptEnable : Enable or disable the | +| unsigned char_ b_InterruptEnable : Enable or disable the | | interrupt. | | APCI1710_ENABLE : | | Enable the interrupt | @@ -708,12 +708,12 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitIndex(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_ReferenceAction, - BYTE b_IndexOperation, BYTE b_AutoMode, BYTE b_InterruptEnable) +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_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -902,7 +902,7 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, b_ModeRegister4 | APCI1710_ENABLE_LATCH_AND_CLEAR; - } // if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) + } /* if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) */ else { /*****************************************/ /* Clear the latch and clear flag (DQ27) */ @@ -975,7 +975,7 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, & (~APCI1710_INDEX_LATCH_COUNTER); } - } // // if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) + } /* // if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) */ if (b_AutoMode == APCI1710_DISABLE) @@ -1113,15 +1113,15 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitReference | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_ReferenceLevel) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_ReferenceLevel) | +----------------------------------------------------------------------------+ | Task : Initialise the reference corresponding to the selected | | module (b_ModulNbr). | @@ -1136,10 +1136,10 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, | | APCI1710_HIGH | Reference occur if "1" | | | +--------------------+-------------------------+ | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_ReferenceLevel : Reference level. | +| unsigned char_ b_ReferenceLevel : Reference level. | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -1152,10 +1152,10 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitReference(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_ReferenceLevel) +int i_APCI1710_InitReference(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_ReferenceLevel) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -1239,27 +1239,27 @@ INT i_APCI1710_InitReference(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitExternalStrobe | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_ExternalStrobe, | -| BYTE_ b_ExternalStrobeLevel) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_ExternalStrobe, | +| unsigned char_ b_ExternalStrobeLevel) | +----------------------------------------------------------------------------+ | Task : Initialises the external strobe level corresponding to | | the selected module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_ExternalStrobe : External strobe selection | +| unsigned char_ b_ExternalStrobe : External strobe selection | | 0 : External strobe A | | 1 : External strobe B | -| BYTE_ b_ExternalStrobeLevel : External strobe level | +| unsigned char_ b_ExternalStrobeLevel : External strobe level | | APCI1710_LOW : | | External latch occurs if "0" | | APCI1710_HIGH : | @@ -1277,10 +1277,10 @@ INT i_APCI1710_InitReference(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_ExternalStrobe, BYTE b_ExternalStrobeLevel) +int i_APCI1710_InitExternalStrobe(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_ExternalStrobe, unsigned char b_ExternalStrobeLevel) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -1335,7 +1335,7 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, DPRINTK("External strobe level parameter is wrong\n"); i_ReturnValue = -5; } - } // if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) + } /* if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) */ else { /**************************************/ /* External strobe selection is wrong */ @@ -1343,7 +1343,7 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, DPRINTK("External strobe selection is wrong\n"); i_ReturnValue = -4; - } // if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) + } /* if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) */ } else { /****************************************/ /* Counter not initialised see function */ @@ -1362,24 +1362,24 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitCompareLogic | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr, | - | UINT_ ui_CompareValue) | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr, | + | unsigned int_ ui_CompareValue) | +----------------------------------------------------------------------------+ | Task : Set the 32-Bit compare value. At that moment that the | | incremental counter arrive to the compare value | | (ui_CompareValue) a interrupt is generated. | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | - | BYTE_ b_ModulNbr : Module number to configure | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | + | unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | - | UINT_ ui_CompareValue : 32-Bit compare value | + | unsigned int_ ui_CompareValue : 32-Bit compare value | +----------------------------------------------------------------------------+ | Output Parameters : - +----------------------------------------------------------------------------+ @@ -1391,10 +1391,10 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, - BYTE b_ModulNbr, UINT ui_CompareValue) +int i_APCI1710_InitCompareLogic(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned int ui_CompareValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -1434,16 +1434,16 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitFrequencyMeasurement | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PCIInputClock, | -| BYTE_ b_TimingUnity, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PCIInputClock, | +| unsigned char_ b_TimingUnity, | | ULONG_ ul_TimingInterval, | | PULONG_ pul_RealTimingInterval) | +----------------------------------------------------------------------------+ @@ -1456,10 +1456,10 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, | you call up any other function which gives access to | | the frequency measurement. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Number of the module to be | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | -| BYTE_ b_PCIInputClock : Selection of the PCI bus | +| unsigned char_ b_PCIInputClock : Selection of the PCI bus | | clock | | - APCI1710_30MHZ : | | The PC has a PCI bus clock | @@ -1467,7 +1467,7 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, | - APCI1710_33MHZ : | | The PC has a PCI bus clock | | of 33 MHz | -| BYTE_ b_TimingUnity : Base time unit (0 to 2) | +| unsigned char_ b_TimingUnity : Base time unit (0 to 2) | | 0 : ns | | 1 : æs | | 2 : ms | @@ -1487,16 +1487,16 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_PCIInputClock, - BYTE b_TimingUnity, - ULONG ul_TimingInterval, PULONG pul_RealTimingInterval) +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) { - INT i_ReturnValue = 0; - ULONG ul_TimerValue = 0; + int i_ReturnValue = 0; + unsigned int ul_TimerValue = 0; double d_RealTimingInterval; - DWORD dw_Status = 0; + unsigned int dw_Status = 0; /**************************/ /* Test the module number */ @@ -1637,7 +1637,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, i_ReturnValue = -7; } - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ /***************************/ /* Test if not error occur */ @@ -1676,7 +1676,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, b_ModeRegister4 | APCI1710_ENABLE_40MHZ_FREQUENCY; - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ else { /**********************************/ /* Disable the 40MHz quarz (DQ30) */ @@ -1700,7 +1700,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, & APCI1710_DISABLE_40MHZ_FREQUENCY; - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ /********************************/ /* Calculate the division fator */ @@ -1720,7 +1720,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.00025 * b_PCIInputClock)); @@ -1743,7 +1743,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, *pul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.00025 * (double)b_PCIInputClock)); @@ -1790,7 +1790,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.25 * b_PCIInputClock)); @@ -1813,7 +1813,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, *pul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.25 * (double)b_PCIInputClock)); @@ -1886,7 +1886,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, *pul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (250.0 * (double)b_PCIInputClock)); @@ -1949,7 +1949,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, i_ReturnValue = -3; } - } // if (i_ReturnValue == 0) + } /* if (i_ReturnValue == 0) */ } else { /**********************************/ /* Base timing selection is wrong */ @@ -1992,12 +1992,12 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /*########################################################################### */ - //INSN BITS + /* INSN BITS */ /*########################################################################### */ /* @@ -2015,18 +2015,18 @@ 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_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_BitsType; - INT i_ReturnValue = 0; + unsigned int ui_BitsType; + int i_ReturnValue = 0; ui_BitsType = CR_CHAN(insn->chanspec); - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ switch (ui_BitsType) { case APCI1710_INCCPT_CLEARCOUNTERVALUE: i_ReturnValue = i_APCI1710_ClearCounterValue(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_CLEARALLCOUNTERVALUE: @@ -2035,28 +2035,28 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic case APCI1710_INCCPT_SETINPUTFILTER: i_ReturnValue = i_APCI1710_SetInputFilter(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0], (BYTE) data[1]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) data[0], (unsigned char) data[1]); break; case APCI1710_INCCPT_LATCHCOUNTER: i_ReturnValue = i_APCI1710_LatchCounter(dev, - (BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_INCCPT_SETINDEXANDREFERENCESOURCE: i_ReturnValue = i_APCI1710_SetIndexAndReferenceSource(dev, - (BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_INCCPT_SETDIGITALCHLON: i_ReturnValue = i_APCI1710_SetDigitalChlOn(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_SETDIGITALCHLOFF: i_ReturnValue = i_APCI1710_SetDigitalChlOff(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; default: @@ -2065,20 +2065,20 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic if (i_ReturnValue >= 0) i_ReturnValue = insn->n; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ClearCounterValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Clear the counter value from selected module | | (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -2091,9 +2091,9 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2131,17 +2131,17 @@ INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ClearAllCounterValue | -| (BYTE_ b_BoardHandle) | +| (unsigned char_ b_BoardHandle) | +----------------------------------------------------------------------------+ | Task : Clear all counter value. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -2151,10 +2151,10 @@ INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) +int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev) { - BYTE b_ModulCpt = 0; - INT i_ReturnValue = 0; + unsigned char b_ModulCpt = 0; + int i_ReturnValue = 0; /********************************/ /* Test if counter module found */ @@ -2198,24 +2198,24 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetInputFilter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_Module, | -| BYTE_ b_PCIInputClock, | -| BYTE_ b_Filter) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_Module, | +| unsigned char_ b_PCIInputClock, | +| unsigned char_ b_Filter) | +----------------------------------------------------------------------------+ | Task : Disable or enable the software filter from selected | | module (b_ModulNbr). b_Filter determine the filter time| +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Number of the module to be | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | -| BYTE_ b_PCIInputClock : Selection of the PCI bus | +| unsigned char_ b_PCIInputClock : Selection of the PCI bus | | clock | | - APCI1710_30MHZ : | | The PC has a PCI bus clock | @@ -2226,7 +2226,7 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) | - APCI1710_40MHZ : | | The APCI1710 has a 40MHz | | quartz | -| BYTE_ b_Filter : Filter selection | +| unsigned char_ b_Filter : Filter selection | | | | 30 MHz | | ------ | @@ -2297,11 +2297,11 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetInputFilter(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_PCIInputClock, BYTE b_Filter) +int i_APCI1710_SetInputFilter(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_PCIInputClock, unsigned char b_Filter) { - INT i_ReturnValue = 0; - DWORD dw_Status = 0; + int i_ReturnValue = 0; + unsigned int dw_Status = 0; /**************************/ /* Test the module number */ @@ -2365,7 +2365,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, i_ReturnValue = -6; } - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ /***************************/ /* Test if error not occur */ @@ -2401,7 +2401,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, | APCI1710_ENABLE_40MHZ_FILTER; - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ else { /**********************************/ /* Disable the 40MHz quarz (DQ31) */ @@ -2425,7 +2425,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, & APCI1710_DISABLE_40MHZ_FILTER; - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ /************************/ /* Set the filter value */ @@ -2486,8 +2486,8 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, ui_Address + 20 + (64 * b_ModulNbr)); - } // if (i_ReturnValue == 0) - } // if (b_Filter < 16) + } /* if (i_ReturnValue == 0) */ + } /* if (b_Filter < 16) */ else { /**************************************/ /* The selected filter value is wrong */ @@ -2495,8 +2495,8 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, DPRINTK("The selected filter value is wrong\n"); i_ReturnValue = -5; - } // if (b_Filter < 16) - } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) + } /* if (b_Filter < 16) */ + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) */ else { /*****************************************/ /* The selected PCI input clock is wrong */ @@ -2504,7 +2504,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, DPRINTK("The selected PCI input clock is wrong\n"); i_ReturnValue = 4; - } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) */ } else { /**************************************/ /* The module is not a counter module */ @@ -2530,23 +2530,23 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_LatchCounter (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_LatchReg) | +| Function Name : _INT_ i_APCI1710_LatchCounter (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_LatchReg) | +----------------------------------------------------------------------------+ | Task : Latch the courant value from selected module | | (b_ModulNbr) in to the selected latch register | | (b_LatchReg). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_LatchReg : Selected latch register | +| unsigned char_ b_LatchReg : Selected latch register | | 0 : for the first latch register | | 1 : for the second latch register | +----------------------------------------------------------------------------+ @@ -2561,10 +2561,10 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_LatchCounter(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_LatchReg) +int i_APCI1710_LatchCounter(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2616,25 +2616,25 @@ INT i_APCI1710_LatchCounter(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetIndexAndReferenceSource | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SourceSelection) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SourceSelection) | +----------------------------------------------------------------------------+ | Task : Determine the hardware source for the index and the | | reference logic. Per default the index logic is | | connected to the difference input C and the reference | | logic is connected to the 24V input E | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_SourceSelection : APCI1710_SOURCE_0 : | +| unsigned char_ b_SourceSelection : APCI1710_SOURCE_0 : | | The index logic is connected | | to the difference input C and| | the reference logic is | @@ -2658,10 +2658,10 @@ INT i_APCI1710_LatchCounter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_SourceSelection) +int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_SourceSelection) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2735,7 +2735,7 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, b_ModeRegister4 & APCI1710_DEFAULT_INDEX_RFERENCE; } - } // if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) + } /* if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) */ else { /*********************************/ /* The source selection is wrong */ @@ -2743,7 +2743,7 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, DPRINTK("The source selection is wrong\n"); i_ReturnValue = -4; - } // if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) + } /* if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) */ } else { /**************************************/ /* The module is not a counter module */ @@ -2769,20 +2769,20 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetDigitalChlOn | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Sets the digital output H Setting an output means | | setting an ouput high. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Number of the module to be | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -2795,9 +2795,9 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2849,20 +2849,20 @@ INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetDigitalChlOff | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Resets the digital output H. Resetting an output means | | setting an ouput low. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Number of the module to be | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -2875,9 +2875,9 @@ INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetDigitalChlOff(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2929,12 +2929,12 @@ INT i_APCI1710_SetDigitalChlOff(struct comedi_device * dev, BYTE b_ModulNbr) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /*########################################################################### */ - // INSN WRITE + /* INSN WRITE */ /*########################################################################### */ /* @@ -2951,65 +2951,65 @@ struct comedi_insn *insn,unsigned int *data) | | Return Value : +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteINCCPT(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) { - UINT ui_WriteType; - INT i_ReturnValue = 0; + unsigned int ui_WriteType; + int i_ReturnValue = 0; ui_WriteType = CR_CHAN(insn->chanspec); - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ switch (ui_WriteType) { case APCI1710_INCCPT_ENABLELATCHINTERRUPT: i_ReturnValue = i_APCI1710_EnableLatchInterrupt(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_DISABLELATCHINTERRUPT: i_ReturnValue = i_APCI1710_DisableLatchInterrupt(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_WRITE16BITCOUNTERVALUE: i_ReturnValue = i_APCI1710_Write16BitCounterValue(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0], (UINT) data[1]); + (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, - (BYTE) CR_AREF(insn->chanspec), (ULONG) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned int) data[0]); break; case APCI1710_INCCPT_ENABLEINDEX: - i_APCI1710_EnableIndex(dev, (BYTE) CR_AREF(insn->chanspec)); + i_APCI1710_EnableIndex(dev, (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_DISABLEINDEX: i_ReturnValue = i_APCI1710_DisableIndex(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_ENABLECOMPARELOGIC: i_ReturnValue = i_APCI1710_EnableCompareLogic(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_DISABLECOMPARELOGIC: i_ReturnValue = i_APCI1710_DisableCompareLogic(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT: i_ReturnValue = i_APCI1710_EnableFrequencyMeasurement(dev, - (BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT: i_ReturnValue = i_APCI1710_DisableFrequencyMeasurement(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; default: @@ -3018,21 +3018,21 @@ INT i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevi if (i_ReturnValue >= 0) i_ReturnValue = insn->n; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableLatchInterrupt | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Enable the latch interrupt from selected module | | (b_ModulNbr). Each software or hardware latch occur a | | interrupt. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3047,9 +3047,9 @@ INT i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevi +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3105,20 +3105,20 @@ INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_DisableLatchInterrupt | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Disable the latch interrupt from selected module | | (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3133,9 +3133,9 @@ INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3198,27 +3198,27 @@ INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Write16BitCounterValue | -| (BYTE_ b_BoardHandle | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SelectedCounter, | -| UINT_ ui_WriteValue) | +| (unsigned char_ b_BoardHandle | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SelectedCounter, | +| unsigned int_ ui_WriteValue) | +----------------------------------------------------------------------------+ | Task : Write a 16-Bit value (ui_WriteValue) in to the selected| | 16-Bit counter (b_SelectedCounter) from selected module| | (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_SelectedCounter : Selected 16-Bit counter | +| unsigned char_ b_SelectedCounter : Selected 16-Bit counter | | (0 or 1) | -| UINT_ ui_WriteValue : 16-Bit write value | +| unsigned int_ ui_WriteValue : 16-Bit write value | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -3231,10 +3231,10 @@ INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_SelectedCounter, UINT ui_WriteValue) +int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int ui_WriteValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3257,7 +3257,7 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, /* Write the value */ /*******************/ - outl((ULONG) ((ULONG) (ui_WriteValue) << (16 * + outl((unsigned int) ((unsigned int) (ui_WriteValue) << (16 * b_SelectedCounter)), devpriv->s_BoardInfos.ui_Address + 8 + (b_SelectedCounter * 4) + @@ -3288,21 +3288,21 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Write32BitCounterValue | -| (BYTE_ b_BoardHandle | -| BYTE_ b_ModulNbr, | +| (unsigned char_ b_BoardHandle | +| unsigned char_ b_ModulNbr, | | ULONG_ ul_WriteValue) | +----------------------------------------------------------------------------+ | Task : Write a 32-Bit value (ui_WriteValue) in to the selected| | module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | | ULONG_ ul_WriteValue : 32-Bit write value | +----------------------------------------------------------------------------+ @@ -3316,10 +3316,10 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev, - BYTE b_ModulNbr, ULONG ul_WriteValue) +int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned int ul_WriteValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3357,18 +3357,18 @@ INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_EnableIndex (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| Function Name : _INT_ i_APCI1710_EnableIndex (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Enable the INDEX actions | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3383,10 +3383,10 @@ INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; - ULONG ul_InterruptLatchReg; + int i_ReturnValue = 0; + unsigned int ul_InterruptLatchReg; /**************************/ /* Test the module number */ @@ -3455,18 +3455,18 @@ INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_DisableIndex (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| Function Name : _INT_ i_APCI1710_DisableIndex (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Disable the INDEX actions | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3481,9 +3481,9 @@ INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3549,21 +3549,21 @@ INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableCompareLogic | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Enable the 32-Bit compare logic. At that moment that | | the incremental counter arrive to the compare value a | | interrupt is generated. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - @@ -3580,9 +3580,9 @@ INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3653,19 +3653,19 @@ INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_DisableCompareLogic | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Disable the 32-Bit compare logic. +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - @@ -3680,9 +3680,9 @@ INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3753,22 +3753,22 @@ INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableFrequencyMeasurement | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr, | - | BYTE_ b_InterruptEnable) | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr, | + | unsigned char_ b_InterruptEnable) | +----------------------------------------------------------------------------+ | Task : Enables the frequency measurement function | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | - | BYTE_ b_ModulNbr : Number of the module to be | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | + | unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | - | BYTE_ b_InterruptEnable: Enable or disable the | + | unsigned char_ b_InterruptEnable: Enable or disable the | | interrupt. | | APCI1710_ENABLE: | | Enable the interrupt | @@ -3789,10 +3789,10 @@ INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_InterruptEnable) +int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_InterruptEnable) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3909,19 +3909,19 @@ INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_DisableFrequencyMeasurement | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr) | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Disables the frequency measurement function | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | - | BYTE_ b_ModulNbr : Number of the module to be | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | + | unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3936,9 +3936,9 @@ INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3976,9 +3976,9 @@ INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_Mo s_ByteModeRegister. b_ModeRegister3 & APCI1710_DISABLE_FREQUENCY - // Begin CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared + /* Begin CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared */ & APCI1710_DISABLE_FREQUENCY_INT; - // End CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared + /* End CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared */ /***************************/ /* Write the configuration */ @@ -4026,12 +4026,12 @@ INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_Mo i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /*########################################################################### */ - // INSN READ + /* INSN READ */ /*########################################################################### */ @@ -4049,82 +4049,82 @@ struct comedi_insn *insn,unsigned int *data) | | Return Value : +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadINCCPT(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) { - UINT ui_ReadType; - INT i_ReturnValue = 0; + unsigned int ui_ReadType; + int i_ReturnValue = 0; ui_ReadType = CR_CHAN(insn->chanspec); - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ switch (ui_ReadType) { case APCI1710_INCCPT_READLATCHREGISTERSTATUS: i_ReturnValue = i_APCI1710_ReadLatchRegisterStatus(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) CR_RANGE(insn->chanspec), (PBYTE) & data[0]); + (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, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) CR_RANGE(insn->chanspec), (PULONG) & data[0]); + (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, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) CR_RANGE(insn->chanspec), (PUINT) & data[0]); + (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, - (BYTE) CR_AREF(insn->chanspec), (PULONG) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned int *) &data[0]); break; case APCI1710_INCCPT_GETINDEXSTATUS: i_ReturnValue = i_APCI1710_GetIndexStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); break; case APCI1710_INCCPT_GETREFERENCESTATUS: i_ReturnValue = i_APCI1710_GetReferenceStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); break; case APCI1710_INCCPT_GETUASSTATUS: i_ReturnValue = i_APCI1710_GetUASStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); break; case APCI1710_INCCPT_GETCBSTATUS: i_ReturnValue = i_APCI1710_GetCBStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); break; case APCI1710_INCCPT_GET16BITCBSTATUS: i_ReturnValue = i_APCI1710_Get16BitCBStatus(dev, - (BYTE) CR_AREF(insn->chanspec), - (PBYTE) & data[0], (PBYTE) & data[1]); + (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, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); break; case APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS: i_ReturnValue = i_APCI1710_GetInterruptUDLatchedStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]); break; case APCI1710_INCCPT_READFREQUENCYMEASUREMENT: i_ReturnValue = i_APCI1710_ReadFrequencyMeasurement(dev, - (BYTE) CR_AREF(insn->chanspec), - (PBYTE) & data[0], - (PBYTE) & data[1], (PULONG) & data[2]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char *) &data[0], + (unsigned char *) &data[1], (unsigned int *) &data[2]); break; case APCI1710_INCCPT_READINTERRUPT: @@ -4155,29 +4155,29 @@ INT i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevic if (i_ReturnValue >= 0) i_ReturnValue = insn->n; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadLatchRegisterStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_LatchReg, | -| PBYTE_ pb_LatchStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_LatchReg, | +| unsigned char *_ pb_LatchStatus) | +----------------------------------------------------------------------------+ | Task : Read the latch register status from selected module | | (b_ModulNbr) and selected latch register (b_LatchReg). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_LatchReg : Selected latch register | +| unsigned char_ b_LatchReg : Selected latch register | | 0 : for the first latch register | | 1 : for the second latch register | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_LatchStatus : Latch register status. | +| Output Parameters : unsigned char *_ pb_LatchStatus : Latch register status. | | 0 : No latch occur | | 1 : A software latch occur | | 2 : A hardware latch occur | @@ -4193,11 +4193,11 @@ INT i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_LatchReg, PBYTE pb_LatchStatus) +int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned char *pb_LatchStatus) { - INT i_ReturnValue = 0; - DWORD dw_LatchReg; + int i_ReturnValue = 0; + unsigned int dw_LatchReg; /**************************/ /* Test the module number */ @@ -4220,7 +4220,7 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, ui_Address + (64 * b_ModulNbr)); *pb_LatchStatus = - (BYTE) ((dw_LatchReg >> (b_LatchReg * + (unsigned char) ((dw_LatchReg >> (b_LatchReg * 4)) & 0x3); } else { /**************************************************/ @@ -4248,24 +4248,24 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadLatchRegisterValue | -| (BYTE_ b_BoardHandle,| -| BYTE_ b_ModulNbr, | -| BYTE_ b_LatchReg, | +| (unsigned char_ b_BoardHandle,| +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_LatchReg, | | PULONG_ pul_LatchValue) | +----------------------------------------------------------------------------+ | Task : Read the latch register value from selected module | | (b_ModulNbr) and selected latch register (b_LatchReg). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_LatchReg : Selected latch register | +| unsigned char_ b_LatchReg : Selected latch register | | 0 : for the first latch register | | 1 : for the second latch register | +----------------------------------------------------------------------------+ @@ -4280,10 +4280,10 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_LatchReg, PULONG pul_LatchValue) +int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned int *pul_LatchValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -4332,28 +4332,28 @@ INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Read16BitCounterValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SelectedCounter, | -| PUINT_ pui_CounterValue) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SelectedCounter, | +| unsigned int *_ pui_CounterValue) | +----------------------------------------------------------------------------+ | Task : Latch the selected 16-Bit counter (b_SelectedCounter) | | from selected module (b_ModulNbr) in to the first | | latch register and return the latched value. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_SelectedCounter : Selected 16-Bit counter | +| unsigned char_ b_SelectedCounter : Selected 16-Bit counter | | (0 or 1) | +----------------------------------------------------------------------------+ -| Output Parameters : PUINT_ pui_CounterValue : 16-Bit counter value | +| Output Parameters : unsigned int *_ pui_CounterValue : 16-Bit counter value | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -4364,11 +4364,11 @@ INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_SelectedCounter, PUINT pui_CounterValue) +int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int *pui_CounterValue) { - INT i_ReturnValue = 0; - DWORD dw_LathchValue = 0; + int i_ReturnValue = 0; + unsigned int dw_LathchValue = 0; /**************************/ /* Test the module number */ @@ -4402,7 +4402,7 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, ui_Address + 4 + (64 * b_ModulNbr)); *pui_CounterValue = - (UINT) ((dw_LathchValue >> (16 * + (unsigned int) ((dw_LathchValue >> (16 * b_SelectedCounter)) & 0xFFFFU); } else { @@ -4431,22 +4431,22 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Read32BitCounterValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | | PULONG_ pul_CounterValue) | +----------------------------------------------------------------------------+ | Task : Latch the 32-Bit counter from selected module | | (b_ModulNbr) in to the first latch register and return | | the latched value. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_CounterValue : 32-Bit counter value | @@ -4459,10 +4459,10 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev, - BYTE b_ModulNbr, PULONG pul_CounterValue) +int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned int *pul_CounterValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -4507,22 +4507,22 @@ INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_GetIndexStatus (BYTE_ b_BoardHandle,| -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_IndexStatus)| +| Function Name : _INT_ i_APCI1710_GetIndexStatus (unsigned char_ b_BoardHandle,| +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_IndexStatus)| +----------------------------------------------------------------------------+ | Task : Return the index status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_IndexStatus : 0 : No INDEX occur | +| Output Parameters : unsigned char *_ pb_IndexStatus : 0 : No INDEX occur | | 1 : A INDEX occur | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -4535,11 +4535,11 @@ INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetIndexStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_IndexStatus) +int i_APCI1710_GetIndexStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_IndexStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4563,7 +4563,7 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 12 + (64 * b_ModulNbr)); - *pb_IndexStatus = (BYTE) (dw_StatusReg & 1); + *pb_IndexStatus = (unsigned char) (dw_StatusReg & 1); } else { /*************************************************************/ /* Index not initialised see function "i_APCI1710_InitIndex" */ @@ -4590,23 +4590,23 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetReferenceStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_ReferenceStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_ReferenceStatus) | +----------------------------------------------------------------------------+ | Task : Return the reference status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_ReferenceStatus : 0 : No REFERENCE occur | +| Output Parameters : unsigned char *_ pb_ReferenceStatus : 0 : No REFERENCE occur | | 1 : A REFERENCE occur | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -4619,11 +4619,11 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_ReferenceStatus) +int i_APCI1710_GetReferenceStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_ReferenceStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4649,7 +4649,7 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev, ui_Address + 24 + (64 * b_ModulNbr)); *pb_ReferenceStatus = - (BYTE) (~dw_StatusReg & 1); + (unsigned char) (~dw_StatusReg & 1); } else { /*********************************************************************/ /* Reference not initialised see function "i_APCI1710_InitReference" */ @@ -4676,23 +4676,23 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetUASStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_UASStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_UASStatus) | +----------------------------------------------------------------------------+ | Task : Return the error signal (UAS) status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_UASStatus : 0 : UAS is low "0" | +| Output Parameters : unsigned char *_ pb_UASStatus : 0 : UAS is low "0" | | 1 : UAS is high "1" | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -4703,11 +4703,11 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetUASStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_UASStatus) +int i_APCI1710_GetUASStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_UASStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4724,7 +4724,7 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 24 + (64 * b_ModulNbr)); - *pb_UASStatus = (BYTE) ((dw_StatusReg >> 1) & 1); + *pb_UASStatus = (unsigned char) ((dw_StatusReg >> 1) & 1); } else { /****************************************/ /* Counter not initialised see function */ @@ -4744,23 +4744,23 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev, } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetCBStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_CBStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_CBStatus) | +----------------------------------------------------------------------------+ | Task : Return the counter overflow status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_CBStatus : 0 : Counter no overflow | +| Output Parameters : unsigned char *_ pb_CBStatus : 0 : Counter no overflow | | 1 : Counter overflow | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -4771,11 +4771,11 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetCBStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_CBStatus) +int i_APCI1710_GetCBStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_CBStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4792,7 +4792,7 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 16 + (64 * b_ModulNbr)); - *pb_CBStatus = (BYTE) (dw_StatusReg & 1); + *pb_CBStatus = (unsigned char) (dw_StatusReg & 1); } else { /****************************************/ @@ -4812,31 +4812,31 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Get16BitCBStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_CBStatusCounter0, | -| PBYTE_ pb_CBStatusCounter1) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_CBStatusCounter0, | +| unsigned char *_ pb_CBStatusCounter1) | +----------------------------------------------------------------------------+ | Task : Returns the counter overflow (counter initialised to | | 2*16-bit) status from selected incremental counter | | module | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_CBStatusCounter0 : 0 : No overflow occur for | +| Output Parameters : unsigned char *_ pb_CBStatusCounter0 : 0 : No overflow occur for | | the first 16-bit | | counter | | 1 : Overflow occur for the| | first 16-bit counter | -| PBYTE_ pb_CBStatusCounter1 : 0 : No overflow occur for | +| unsigned char *_ pb_CBStatusCounter1 : 0 : No overflow occur for | | the second 16-bit | | counter | | 1 : Overflow occur for the| @@ -4853,11 +4853,11 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_CBStatusCounter0, PBYTE pb_CBStatusCounter1) +int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_CBStatusCounter0, unsigned char *pb_CBStatusCounter1) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4894,20 +4894,20 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_CBStatusCounter1 = - (BYTE) ((dw_StatusReg >> 0) & + (unsigned char) ((dw_StatusReg >> 0) & 1); *pb_CBStatusCounter0 = - (BYTE) ((dw_StatusReg >> 1) & + (unsigned char) ((dw_StatusReg >> 1) & 1); - } // if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) + } /* if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) */ else { /****************************/ /* Firmware revision error */ /****************************/ i_ReturnValue = -5; - } // if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) - } // if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10) + } /* if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) */ + } /* if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10) */ else { /********************************************/ /* Counter not initialised to 2*16-bit mode */ @@ -4916,8 +4916,8 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, DPRINTK("Counter not initialised\n"); i_ReturnValue = -4; - } // if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10) - } // if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) + } /* if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10) */ + } /* if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) */ else { /****************************************/ /* Counter not initialised see function */ @@ -4926,8 +4926,8 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; - } // if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) - } // if (b_ModulNbr < 4) + } /* if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) */ + } /* if (b_ModulNbr < 4) */ else { /*************************************************/ /* The selected module number parameter is wrong */ @@ -4935,25 +4935,25 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; - } // if (b_ModulNbr < 4) + } /* if (b_ModulNbr < 4) */ - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetUDStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_UDStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_UDStatus) | +----------------------------------------------------------------------------+ | Task : Return the counter progress status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_UDStatus : 0 : Counter progress in the | +| Output Parameters : unsigned char *_ pb_UDStatus : 0 : Counter progress in the | | selected mode down | | 1 : Counter progress in the | | selected mode up | @@ -4966,11 +4966,11 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetUDStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_UDStatus) +int i_APCI1710_GetUDStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_UDStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4987,7 +4987,7 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 24 + (64 * b_ModulNbr)); - *pb_UDStatus = (BYTE) ((dw_StatusReg >> 2) & 1); + *pb_UDStatus = (unsigned char) ((dw_StatusReg >> 2) & 1); } else { /****************************************/ @@ -5007,24 +5007,24 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetInterruptUDLatchedStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_UDStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_UDStatus) | +----------------------------------------------------------------------------+ | Task : Return the counter progress latched status after a | | index interrupt occur. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_UDStatus : 0 : Counter progress in the | +| Output Parameters : unsigned char *_ pb_UDStatus : 0 : Counter progress in the | | selected mode down | | 1 : Counter progress in the | | selected mode up | @@ -5040,11 +5040,11 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_UDStatus) +int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_UDStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -5074,7 +5074,7 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 12 + (64 * b_ModulNbr)); - *pb_UDStatus = (BYTE) ((dw_StatusReg >> 1) & 1); + *pb_UDStatus = (unsigned char) ((dw_StatusReg >> 1) & 1); } else { /****************************/ /* No index interrupt occur */ @@ -5100,26 +5100,26 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadFrequencyMeasurement | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr, | - | PBYTE_ pb_Status, | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr, | + | unsigned char *_ pb_Status, | | PULONG_ pul_ReadValue) | +----------------------------------------------------------------------------+ | Task : Returns the status (pb_Status) and the number of | | increments in the set time. | | See function " i_APCI1710_InitFrequencyMeasurement " | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | - | BYTE_ b_ModulNbr : Number of the module to be | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | + | unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | +----------------------------------------------------------------------------+ - | Output Parameters : PBYTE_ pb_Status : Returns the frequency | + | Output Parameters : unsigned char *_ pb_Status : Returns the frequency | | measurement status | | 0 : Counting cycle not | | started. | @@ -5127,7 +5127,7 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, | 2 : Counting cycle stopped. | | The measurement cycle is | | completed. | - | PBYTE_ pb_UDStatus : 0 : Counter progress in the | + | unsigned char *_ pb_UDStatus : 0 : Counter progress in the | | selected mode down | | 1 : Counter progress in the | | selected mode up | @@ -5145,13 +5145,13 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, - BYTE b_ModulNbr, - PBYTE pb_Status, PBYTE pb_UDStatus, PULONG pul_ReadValue) +int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char *pb_Status, unsigned char *pb_UDStatus, unsigned int *pul_ReadValue) { - INT i_ReturnValue = 0; - UINT ui_16BitValue; - DWORD dw_StatusReg; + int i_ReturnValue = 0; + unsigned int ui_16BitValue; + unsigned int dw_StatusReg; /**************************/ /* Test the module number */ @@ -5198,7 +5198,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if (dw_StatusReg & 1) { *pb_Status = 2; *pb_UDStatus = - (BYTE) ((dw_StatusReg >> + (unsigned char) ((dw_StatusReg >> 1) & 3); /******************/ @@ -5224,7 +5224,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if ((*pul_ReadValue & 0xFFFFU) != 0) { ui_16BitValue = - (UINT) + (unsigned int) * pul_ReadValue & @@ -5247,7 +5247,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if ((*pul_ReadValue & 0xFFFF0000UL) != 0) { ui_16BitValue = - (UINT) + (unsigned int) ( (*pul_ReadValue >> @@ -5281,7 +5281,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if ((*pul_ReadValue & 0xFFFF0000UL) != 0) { ui_16BitValue = - (UINT) + (unsigned int) ( (*pul_ReadValue >> @@ -5307,7 +5307,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if ((*pul_ReadValue & 0xFFFFU) != 0) { ui_16BitValue = - (UINT) + (unsigned int) * pul_ReadValue & @@ -5359,5 +5359,5 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h index 5153cf68665..7b481107fe1 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h @@ -132,140 +132,140 @@ #define APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT 409 /************ Main Functions *************/ -INT i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s, +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, +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, +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, +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, - BYTE b_ModulNbr, - BYTE b_CounterRange, - BYTE b_FirstCounterModus, - BYTE b_FirstCounterOption, - BYTE b_SecondCounterModus, - BYTE b_SecondCounterOption); - -INT i_APCI1710_CounterAutoTest(struct comedi_device *dev, PBYTE pb_TestStatus); - -INT i_APCI1710_InitIndex(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_ReferenceAction, - BYTE b_IndexOperation, BYTE b_AutoMode, - BYTE b_InterruptEnable); - -INT i_APCI1710_InitReference(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_ReferenceLevel); - -INT i_APCI1710_InitExternalStrobe(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_ExternalStrobe, - BYTE b_ExternalStrobeLevel); - -INT i_APCI1710_InitCompareLogic(struct comedi_device *dev, - BYTE b_ModulNbr, UINT ui_CompareValue); - -INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PCIInputClock, - BYTE b_TimingUnity, - ULONG ul_TimingInterval, - PULONG pul_RealTimingInterval); +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, BYTE b_ModulNbr); +int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_ClearAllCounterValue(struct comedi_device *dev); +int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev); -INT i_APCI1710_SetInputFilter(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_PCIInputClock, - BYTE b_Filter); +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, - BYTE b_ModulNbr, BYTE b_LatchReg); +int i_APCI1710_LatchCounter(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg); -INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_SourceSelection); +int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_SourceSelection); -INT i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr); /* INSN WRITE */ -INT i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_Write16BitCounterValue(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_SelectedCounter, - UINT ui_WriteValue); +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, - BYTE b_ModulNbr, ULONG ul_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, BYTE b_ModulNbr); +int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_DisableIndex(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_EnableCompareLogic(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_DisableCompareLogic(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_InterruptEnable); +int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_InterruptEnable); -INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, - BYTE b_ModulNbr); +int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr); /* INSN READ */ -INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_LatchReg, - PBYTE pb_LatchStatus); +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, - BYTE b_ModulNbr, BYTE b_LatchReg, - PULONG pul_LatchValue); +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, - BYTE b_ModulNbr, BYTE b_SelectedCounter, - PUINT pui_CounterValue); +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, - BYTE b_ModulNbr, PULONG pul_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, - BYTE b_ModulNbr, PBYTE pb_IndexStatus); +int i_APCI1710_GetIndexStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_IndexStatus); -INT i_APCI1710_GetReferenceStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_ReferenceStatus); +int i_APCI1710_GetReferenceStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_ReferenceStatus); -INT i_APCI1710_GetUASStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_UASStatus); +int i_APCI1710_GetUASStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_UASStatus); -INT i_APCI1710_GetCBStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_CBStatus); +int i_APCI1710_GetCBStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_CBStatus); -INT i_APCI1710_Get16BitCBStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_CBStatusCounter0, - PBYTE pb_CBStatusCounter1); +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, - BYTE b_ModulNbr, PBYTE pb_UDStatus); +int i_APCI1710_GetUDStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char *pb_UDStatus); -INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE 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, - BYTE b_ModulNbr, - PBYTE pb_Status, PBYTE pb_UDStatus, - PULONG pul_ReadValue); +int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char *pb_Status, unsigned char *pb_UDStatus, + unsigned int *pul_ReadValue); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c index 3ac6a264ef5..0fc2285c9ef 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c @@ -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. diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h index 28252873e86..61a21cc9406 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h @@ -21,11 +21,11 @@ #define APCI1710_PULSEENCODER_READ 0 #define APCI1710_PULSEENCODER_WRITE 1 -INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev, +int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev, +int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -33,7 +33,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev, /* * READ PULSE ENCODER FUNCTIONS */ -INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev, +int i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -41,7 +41,7 @@ INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev, /* * WRITE PULSE ENCODER FUNCTIONS */ -INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev, +int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c index 5ddd092a656..138a84f572c 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c @@ -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. @@ -70,38 +70,38 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnConfigPWM(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - BYTE b_ConfigType; - INT i_ReturnValue = 0; + unsigned char b_ConfigType; + int i_ReturnValue = 0; b_ConfigType = CR_CHAN(insn->chanspec); switch (b_ConfigType) { case APCI1710_PWM_INIT: - i_ReturnValue = i_APCI1710_InitPWM(dev, (BYTE) CR_AREF(insn->chanspec), // b_ModulNbr - (BYTE) data[0], //b_PWM - (BYTE) data[1], // b_ClockSelection - (BYTE) data[2], // b_TimingUnit - (ULONG) data[3], //ul_LowTiming - (ULONG) data[4], //ul_HighTiming - (PULONG) & data[0], //pul_RealLowTiming - (PULONG) & data[1] //pul_RealHighTiming + i_ReturnValue = i_APCI1710_InitPWM(dev, (unsigned char) CR_AREF(insn->chanspec), /* b_ModulNbr */ + (unsigned char) data[0], /* b_PWM */ + (unsigned char) data[1], /* b_ClockSelection */ + (unsigned char) data[2], /* b_TimingUnit */ + (unsigned int) data[3], /* ul_LowTiming */ + (unsigned int) data[4], /* ul_HighTiming */ + (unsigned int *) &data[0], /* pul_RealLowTiming */ + (unsigned int *) &data[1] /* pul_RealHighTiming */ ); break; case APCI1710_PWM_GETINITDATA: - i_ReturnValue = i_APCI1710_GetPWMInitialisation(dev, (BYTE) CR_AREF(insn->chanspec), // b_ModulNbr - (BYTE) data[0], //b_PWM - (PBYTE) & data[0], //pb_TimingUnit - (PULONG) & data[1], //pul_LowTiming - (PULONG) & data[2], //pul_HighTiming - (PBYTE) & data[3], // pb_StartLevel - (PBYTE) & data[4], // pb_StopMode - (PBYTE) & data[5], // pb_StopLevel - (PBYTE) & data[6], // pb_ExternGate - (PBYTE) & data[7], // pb_InterruptEnable - (PBYTE) & data[8] // pb_Enable + i_ReturnValue = i_APCI1710_GetPWMInitialisation(dev, (unsigned char) CR_AREF(insn->chanspec), /* b_ModulNbr */ + (unsigned char) data[0], /* b_PWM */ + (unsigned char *) &data[0], /* pb_TimingUnit */ + (unsigned int *) &data[1], /* pul_LowTiming */ + (unsigned int *) &data[2], /* pul_HighTiming */ + (unsigned char *) &data[3], /* pb_StartLevel */ + (unsigned char *) &data[4], /* pb_StopMode */ + (unsigned char *) &data[5], /* pb_StopLevel */ + (unsigned char *) &data[6], /* pb_ExternGate */ + (unsigned char *) &data[7], /* pb_InterruptEnable */ + (unsigned char *) &data[8] /* pb_Enable */ ); break; @@ -111,17 +111,17 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice if (i_ReturnValue >= 0) i_ReturnValue = insn->n; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitPWM | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| BYTE_ b_ClockSelection, | -| BYTE_ b_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char_ b_ClockSelection, | +| unsigned char_ b_TimingUnit, | | ULONG_ ul_LowTiming, | | ULONG_ ul_HighTiming, | | PULONG_ pul_RealLowTiming, | @@ -135,11 +135,11 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice | You must calling this function be for you call any | | other function witch access of the PWM. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure| +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure| | (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1). | -| BYTE_ b_ClockSelection : Selection from PCI bus | +| unsigned char_ b_PWM : Selected PWM (0 or 1). | +| unsigned char_ b_ClockSelection : Selection from PCI bus | | clock | | - APCI1710_30MHZ : | | The PC have a 30 MHz | @@ -151,7 +151,7 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice | The APCI-1710 have a | | integrated 40Mhz | | quartz. | -| BYTE_ b_TimingUnit : Base timing Unit (0 to 4) | +| unsigned char_ b_TimingUnit : Base timing Unit (0 to 4) | | 0 : ns | | 1 : æs | | 2 : ms | @@ -179,19 +179,19 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitPWM(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_ClockSelection, - BYTE b_TimingUnit, - ULONG ul_LowTiming, - ULONG ul_HighTiming, - PULONG pul_RealLowTiming, PULONG pul_RealHighTiming) +int i_APCI1710_InitPWM(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char b_ClockSelection, + unsigned char b_TimingUnit, + unsigned int ul_LowTiming, + unsigned int ul_HighTiming, + unsigned int *pul_RealLowTiming, unsigned int *pul_RealHighTiming) { - INT i_ReturnValue = 0; - ULONG ul_LowTimerValue = 0; - ULONG ul_HighTimerValue = 0; - DWORD dw_Command; + int i_ReturnValue = 0; + unsigned int ul_LowTimerValue = 0; + unsigned int ul_HighTimerValue = 0; + unsigned int dw_Command; double d_RealLowTiming = 0; double d_RealHighTiming = 0; @@ -200,33 +200,33 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, /**************************/ if (b_ModulNbr < 4) { - /***************/ + /***************/ /* Test if PWM */ - /***************/ + /***************/ if ((devpriv->s_BoardInfos. dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) { - /**************************/ + /**************************/ /* Test the PWM selection */ - /**************************/ + /**************************/ if (b_PWM <= 1) { - /******************/ + /******************/ /* Test the clock */ - /******************/ + /******************/ if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) { - /************************/ + /************************/ /* Test the timing unit */ - /************************/ + /************************/ if (b_TimingUnit <= 4) { - /*********************************/ + /*********************************/ /* Test the low timing selection */ - /*********************************/ + /*********************************/ if (((b_ClockSelection == APCI1710_30MHZ) @@ -361,45 +361,45 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, && (ul_LowTiming <= 7UL))) { - /**********************************/ + /**********************************/ /* Test the High timing selection */ - /**********************************/ + /**********************************/ if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) { - /**************************/ + /**************************/ /* Test the board version */ - /**************************/ + /**************************/ if (((b_ClockSelection == APCI1710_40MHZ) && (devpriv->s_BoardInfos.b_BoardVersion > 0)) || (b_ClockSelection != APCI1710_40MHZ)) { - /************************************/ + /************************************/ /* Calculate the low division fator */ - /************************************/ + /************************************/ fpu_begin (); switch (b_TimingUnit) { - /******/ + /******/ /* ns */ - /******/ + /******/ case 0: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (ul_LowTiming * (0.00025 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -409,13 +409,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (0.00025 * (double)b_ClockSelection)); @@ -451,7 +451,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -461,26 +461,26 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* æs */ - /******/ + /******/ case 1: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (ul_LowTiming * (0.25 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -490,13 +490,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (0.25 * (double)b_ClockSelection)); @@ -534,7 +534,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -544,15 +544,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* ms */ - /******/ + /******/ case 2: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = @@ -562,9 +562,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, * b_ClockSelection); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -574,13 +574,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250.0 * (double)b_ClockSelection)); @@ -616,7 +616,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -626,27 +626,27 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /*****/ + /*****/ /* s */ - /*****/ + /*****/ case 3: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (ul_LowTiming * (250000.0 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -656,13 +656,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250000.0 @@ -701,7 +701,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -711,19 +711,19 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* mn */ - /******/ + /******/ case 4: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) ( (ul_LowTiming * @@ -733,9 +733,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)(ul_LowTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -745,13 +745,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250000.0 @@ -795,7 +795,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -806,31 +806,31 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; } - /*************************************/ + /*************************************/ /* Calculate the high division fator */ - /*************************************/ + /*************************************/ switch (b_TimingUnit) { - /******/ + /******/ /* ns */ - /******/ + /******/ case 0: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (ul_HighTiming * (0.00025 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -840,13 +840,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (0.00025 * (double)b_ClockSelection)); @@ -882,7 +882,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -892,26 +892,26 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* æs */ - /******/ + /******/ case 1: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (ul_HighTiming * (0.25 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -921,13 +921,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (0.25 * (double)b_ClockSelection)); @@ -965,7 +965,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -975,15 +975,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* ms */ - /******/ + /******/ case 2: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = @@ -993,9 +993,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, * b_ClockSelection); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -1005,13 +1005,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250.0 * (double)b_ClockSelection)); @@ -1047,7 +1047,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -1057,28 +1057,28 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /*****/ + /*****/ /* s */ - /*****/ + /*****/ case 3: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (ul_HighTiming * (250000.0 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -1088,13 +1088,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250000.0 @@ -1133,7 +1133,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -1143,19 +1143,19 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* mn */ - /******/ + /******/ case 4: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) ( (ul_HighTiming * @@ -1165,9 +1165,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)(ul_HighTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -1177,13 +1177,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250000.0 @@ -1227,7 +1227,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -1239,9 +1239,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, } fpu_end(); - /****************************/ + /****************************/ /* Save the clock selection */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -1251,9 +1251,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = b_ClockSelection; - /************************/ + /************************/ /* Save the timing unit */ - /************************/ + /************************/ devpriv-> s_ModuleInfo @@ -1265,9 +1265,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = b_TimingUnit; - /****************************/ + /****************************/ /* Save the low base timing */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -1289,9 +1289,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = *pul_RealLowTiming; - /****************************/ + /****************************/ /* Save the high base timing */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -1313,21 +1313,21 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = *pul_RealHighTiming; - /************************/ + /************************/ /* Write the low timing */ - /************************/ + /************************/ outl(ul_LowTimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); - /*************************/ + /*************************/ /* Write the high timing */ - /*************************/ + /*************************/ outl(ul_HighTimerValue, devpriv->s_BoardInfos.ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); - /***************************/ + /***************************/ /* Set the clock selection */ - /***************************/ + /***************************/ dw_Command = @@ -1354,15 +1354,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 0x80; } - /***************************/ + /***************************/ /* Set the clock selection */ - /***************************/ + /***************************/ outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - /*************/ + /*************/ /* PWM init. */ - /*************/ + /*************/ devpriv-> s_ModuleInfo [b_ModulNbr]. @@ -1373,98 +1373,98 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = 1; } else { - /***************************************************/ + /***************************************************/ /* You can not used the 40MHz clock selection with */ /* this board */ - /***************************************************/ + /***************************************************/ DPRINTK("You can not used the 40MHz clock selection with this board\n"); i_ReturnValue = -9; } } else { - /***************************************/ + /***************************************/ /* High base timing selection is wrong */ - /***************************************/ + /***************************************/ DPRINTK("High base timing selection is wrong\n"); i_ReturnValue = -8; } } else { - /**************************************/ + /**************************************/ /* Low base timing selection is wrong */ - /**************************************/ + /**************************************/ DPRINTK("Low base timing selection is wrong\n"); i_ReturnValue = -7; } - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ else { - /**********************************/ + /**********************************/ /* Timing unit selection is wrong */ - /**********************************/ + /**********************************/ DPRINTK("Timing unit selection is wrong\n"); i_ReturnValue = -6; - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - } // if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ + } /* if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) */ else { - /*******************************/ + /*******************************/ /* The selected clock is wrong */ - /*******************************/ + /*******************************/ DPRINTK("The selected clock is wrong\n"); i_ReturnValue = -5; - } // if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) */ + } /* if (b_PWM >= 0 && b_PWM <= 1) */ else { - /******************************/ + /******************************/ /* Tor PWM selection is wrong */ - /******************************/ + /******************************/ DPRINTK("Tor PWM selection is wrong\n"); i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (b_PWM >= 0 && b_PWM <= 1) */ } else { - /**********************************/ + /**********************************/ /* The module is not a PWM module */ - /**********************************/ + /**********************************/ DPRINTK("The module is not a PWM module\n"); i_ReturnValue = -3; } } else { - /***********************/ + /***********************/ /* Module number error */ - /***********************/ + /***********************/ DPRINTK("Module number error\n"); i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetPWMInitialisation | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| PBYTE_ pb_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char *_ pb_TimingUnit, | | PULONG_ pul_LowTiming, | | PULONG_ pul_HighTiming, | -| PBYTE_ pb_StartLevel, | -| PBYTE_ pb_StopMode, | -| PBYTE_ pb_StopLevel, | -| PBYTE_ pb_ExternGate, | -| PBYTE_ pb_InterruptEnable, | -| PBYTE_ pb_Enable) | +| unsigned char *_ pb_StartLevel, | +| unsigned char *_ pb_StopMode, | +| unsigned char *_ pb_StopLevel, | +| unsigned char *_ pb_ExternGate, | +| unsigned char *_ pb_InterruptEnable, | +| unsigned char *_ pb_Enable) | +----------------------------------------------------------------------------+ | Task : Return the PWM (b_PWM) initialisation from selected | | module (b_ModulNbr). You must calling the | | "i_APCI1710_InitPWM" function be for you call this | | function. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1) | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_PWM : Selected PWM (0 or 1) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TimingUnit : Base timing Unit (0 to 4) | +| Output Parameters : unsigned char *_ pb_TimingUnit : Base timing Unit (0 to 4) | | 0 : ns | | 1 : æs | | 2 : ms | @@ -1472,13 +1472,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, | 4 : mn | | PULONG_ pul_LowTiming : Low base timing value. | | PULONG_ pul_HighTiming : High base timing value. | -| PBYTE_ pb_StartLevel : Start period level | +| unsigned char *_ pb_StartLevel : Start period level | | selection | | 0 : The period start | | with a low level | | 1 : The period start | | with a high level| -| PBYTE_ pb_StopMode : Stop mode selection | +| unsigned char *_ pb_StopMode : Stop mode selection | | 0 : The PWM is stopped | | directly after the | | "i_APCI1710_DisablePWM"| @@ -1489,7 +1489,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, | function the PWM is | | stopped at the end | | from last period cycle| -| PBYTE_ pb_StopLevel : Stop PWM level selection | +| unsigned char *_ pb_StopLevel : Stop PWM level selection | | 0 : The output signal | | keep the level after| | the | @@ -1504,13 +1504,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, | the | | "i_APCI1710_DisablePWM"| | function | -| PBYTE_ pb_ExternGate : Extern gate action | +| unsigned char *_ pb_ExternGate : Extern gate action | | selection | | 0 : Extern gate signal | | not used. | | 1 : Extern gate signal | | used. | -| PBYTE_ pb_InterruptEnable : Enable or disable the PWM | +| unsigned char *_ pb_InterruptEnable : Enable or disable the PWM | | interrupt. | | - APCI1710_ENABLE : | | Enable the PWM interrupt| @@ -1519,7 +1519,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, | - APCI1710_DISABLE : | | Disable the PWM | | interrupt | -| PBYTE_ pb_Enable : Indicate if the PWM is | +| unsigned char *_ pb_Enable : Indicate if the PWM is | | enabled or no | | 0 : PWM not enabled | | 1 : PWM enabled | @@ -1534,138 +1534,138 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetPWMInitialisation(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_PWM, - PBYTE pb_TimingUnit, - PULONG pul_LowTiming, - PULONG pul_HighTiming, - PBYTE pb_StartLevel, - PBYTE pb_StopMode, - PBYTE pb_StopLevel, - PBYTE pb_ExternGate, PBYTE pb_InterruptEnable, PBYTE pb_Enable) +int i_APCI1710_GetPWMInitialisation(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char *pb_TimingUnit, + unsigned int *pul_LowTiming, + unsigned int *pul_HighTiming, + unsigned char *pb_StartLevel, + unsigned char *pb_StopMode, + unsigned char *pb_StopLevel, + unsigned char *pb_ExternGate, unsigned char *pb_InterruptEnable, unsigned char *pb_Enable) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_Command; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_Command; /**************************/ /* Test the module number */ /**************************/ if (b_ModulNbr < 4) { - /***************/ + /***************/ /* Test if PWM */ - /***************/ + /***************/ if ((devpriv->s_BoardInfos. dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) { - /**************************/ + /**************************/ /* Test the PWM selection */ - /**************************/ + /**************************/ if (b_PWM <= 1) { - /***************************/ + /***************************/ /* Test if PWM initialised */ - /***************************/ + /***************************/ dw_Status = inl(devpriv->s_BoardInfos. ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); if (dw_Status & 0x10) { - /***********************/ + /***********************/ /* Read the low timing */ - /***********************/ + /***********************/ *pul_LowTiming = inl(devpriv->s_BoardInfos. ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); - /************************/ + /************************/ /* Read the high timing */ - /************************/ + /************************/ *pul_HighTiming = inl(devpriv->s_BoardInfos. ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); - /********************/ + /********************/ /* Read the command */ - /********************/ + /********************/ dw_Command = inl(devpriv->s_BoardInfos. ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); *pb_StartLevel = - (BYTE) ((dw_Command >> 5) & 1); + (unsigned char) ((dw_Command >> 5) & 1); *pb_StopMode = - (BYTE) ((dw_Command >> 0) & 1); + (unsigned char) ((dw_Command >> 0) & 1); *pb_StopLevel = - (BYTE) ((dw_Command >> 1) & 1); + (unsigned char) ((dw_Command >> 1) & 1); *pb_ExternGate = - (BYTE) ((dw_Command >> 4) & 1); + (unsigned char) ((dw_Command >> 4) & 1); *pb_InterruptEnable = - (BYTE) ((dw_Command >> 3) & 1); + (unsigned char) ((dw_Command >> 3) & 1); if (*pb_StopLevel) { *pb_StopLevel = *pb_StopLevel + - (BYTE) ((dw_Command >> + (unsigned char) ((dw_Command >> 2) & 1); } - /********************/ + /********************/ /* Read the command */ - /********************/ + /********************/ dw_Command = inl(devpriv->s_BoardInfos. ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); *pb_Enable = - (BYTE) ((dw_Command >> 0) & 1); + (unsigned char) ((dw_Command >> 0) & 1); *pb_TimingUnit = devpriv-> s_ModuleInfo[b_ModulNbr]. s_PWMModuleInfo. s_PWMInfo[b_PWM].b_TimingUnit; - } // if (dw_Status & 0x10) + } /* if (dw_Status & 0x10) */ else { - /***********************/ + /***********************/ /* PWM not initialised */ - /***********************/ + /***********************/ DPRINTK("PWM not initialised\n"); i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (dw_Status & 0x10) */ + } /* if (b_PWM >= 0 && b_PWM <= 1) */ else { - /******************************/ + /******************************/ /* Tor PWM selection is wrong */ - /******************************/ + /******************************/ DPRINTK("Tor PWM selection is wrong\n"); i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (b_PWM >= 0 && b_PWM <= 1) */ } else { - /**********************************/ + /**********************************/ /* The module is not a PWM module */ - /**********************************/ + /**********************************/ DPRINTK("The module is not a PWM module\n"); i_ReturnValue = -3; } } else { - /***********************/ + /***********************/ /* Module number error */ - /***********************/ + /***********************/ DPRINTK("Module number error\n"); i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1683,33 +1683,33 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnWritePWM(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - BYTE b_WriteType; - INT i_ReturnValue = 0; + unsigned char b_WriteType; + int i_ReturnValue = 0; b_WriteType = CR_CHAN(insn->chanspec); switch (b_WriteType) { case APCI1710_PWM_ENABLE: i_ReturnValue = i_APCI1710_EnablePWM(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], - (BYTE) data[2], - (BYTE) data[3], (BYTE) data[4], (BYTE) data[5]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) data[0], + (unsigned char) data[1], + (unsigned char) data[2], + (unsigned char) data[3], (unsigned char) data[4], (unsigned char) data[5]); break; case APCI1710_PWM_DISABLE: i_ReturnValue = i_APCI1710_DisablePWM(dev, - (BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_PWM_NEWTIMING: i_ReturnValue = i_APCI1710_SetNewPWMTiming(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], (ULONG) data[2], (ULONG) data[3]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) data[0], + (unsigned char) data[1], (unsigned int) data[2], (unsigned int) data[3]); break; default: @@ -1718,20 +1718,20 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice if (i_ReturnValue >= 0) i_ReturnValue = insn->n; - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnablePWM | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| BYTE_ b_StartLevel, | -| BYTE_ b_StopMode, | -| BYTE_ b_StopLevel, | -| BYTE_ b_ExternGate, | -| BYTE_ b_InterruptEnable) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char_ b_StartLevel, | +| unsigned char_ b_StopMode, | +| unsigned char_ b_StopLevel, | +| unsigned char_ b_ExternGate, | +| unsigned char_ b_InterruptEnable) | +----------------------------------------------------------------------------+ | Task : Enable the selected PWM (b_PWM) from selected module | | (b_ModulNbr). You must calling the "i_APCI1710_InitPWM"| @@ -1741,16 +1741,16 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice | See function "i_APCI1710_SetBoardIntRoutineX" and the | | Interrupt mask description chapter. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1) | -| BYTE_ b_StartLevel : Start period level selection | +| unsigned char_ b_PWM : Selected PWM (0 or 1) | +| unsigned char_ b_StartLevel : Start period level selection | | 0 : The period start with a | | low level | | 1 : The period start with a | | high level | -| BYTE_ b_StopMode : Stop mode selection | +| unsigned char_ b_StopMode : Stop mode selection | | 0 : The PWM is stopped | | directly after the | | "i_APCI1710_DisablePWM" | @@ -1761,7 +1761,7 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice | function the PWM is | | stopped at the end from| | last period cycle. | -| BYTE_ b_StopLevel : Stop PWM level selection | +| unsigned char_ b_StopLevel : Stop PWM level selection | | 0 : The output signal keep | | the level after the | | "i_APCI1710_DisablePWM" | @@ -1774,11 +1774,11 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice | to high after the | | "i_APCI1710_DisablePWM" | | function | -| BYTE_ b_ExternGate : Extern gate action selection | +| unsigned char_ b_ExternGate : Extern gate action selection | | 0 : Extern gate signal not | | used. | | 1 : Extern gate signal used.| -| BYTE_ b_InterruptEnable : Enable or disable the PWM | +| unsigned char_ b_InterruptEnable : Enable or disable the PWM | | interrupt. | | - APCI1710_ENABLE : | | Enable the PWM interrupt | @@ -1806,77 +1806,77 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnablePWM(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_StartLevel, - BYTE b_StopMode, - BYTE b_StopLevel, BYTE b_ExternGate, BYTE b_InterruptEnable) +int i_APCI1710_EnablePWM(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char b_StartLevel, + unsigned char b_StopMode, + unsigned char b_StopLevel, unsigned char b_ExternGate, unsigned char b_InterruptEnable) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_Command; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_Command; - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ /**************************/ /* Test the module number */ /**************************/ if (b_ModulNbr < 4) { - /***************/ + /***************/ /* Test if PWM */ - /***************/ + /***************/ if ((devpriv->s_BoardInfos. dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) { - /**************************/ + /**************************/ /* Test the PWM selection */ - /**************************/ + /**************************/ if (b_PWM <= 1) { - /***************************/ + /***************************/ /* Test if PWM initialised */ - /***************************/ + /***************************/ dw_Status = inl(devpriv->s_BoardInfos. ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); if (dw_Status & 0x10) { - /**********************************/ + /**********************************/ /* Test the start level selection */ - /**********************************/ + /**********************************/ if (b_StartLevel <= 1) { - /**********************/ + /**********************/ /* Test the stop mode */ - /**********************/ + /**********************/ if (b_StopMode <= 1) { - /***********************/ + /***********************/ /* Test the stop level */ - /***********************/ + /***********************/ if (b_StopLevel <= 2) { - /*****************************/ + /*****************************/ /* Test the extern gate mode */ - /*****************************/ + /*****************************/ if (b_ExternGate <= 1) { - /*****************************/ + /*****************************/ /* Test the interrupt action */ - /*****************************/ + /*****************************/ if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) { - /******************************************/ + /******************************************/ /* Test if interrupt function initialised */ - /******************************************/ + /******************************************/ - /********************/ + /********************/ /* Read the command */ - /********************/ + /********************/ dw_Command = @@ -1895,9 +1895,9 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, & 0x80; - /********************/ + /********************/ /* Make the command */ - /********************/ + /********************/ dw_Command = @@ -1943,100 +1943,100 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, = b_InterruptEnable; - /*******************/ + /*******************/ /* Set the command */ - /*******************/ + /*******************/ outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - /******************/ + /******************/ /* Enable the PWM */ - /******************/ + /******************/ outl(1, devpriv->s_BoardInfos.ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); - } // if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) + } /* if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) */ else { - /********************************/ + /********************************/ /* Interrupt parameter is wrong */ - /********************************/ + /********************************/ DPRINTK("Interrupt parameter is wrong\n"); i_ReturnValue = -10; - } // if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) - } // if (b_ExternGate >= 0 && b_ExternGate <= 1) + } /* if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) */ + } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */ else { - /*****************************************/ + /*****************************************/ /* Extern gate signal selection is wrong */ - /*****************************************/ + /*****************************************/ DPRINTK("Extern gate signal selection is wrong\n"); i_ReturnValue = -9; - } // if (b_ExternGate >= 0 && b_ExternGate <= 1) - } // if (b_StopLevel >= 0 && b_StopLevel <= 2) + } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */ + } /* if (b_StopLevel >= 0 && b_StopLevel <= 2) */ else { - /*************************************/ + /*************************************/ /* PWM stop level selection is wrong */ - /*************************************/ + /*************************************/ DPRINTK("PWM stop level selection is wrong\n"); i_ReturnValue = -8; - } // if (b_StopLevel >= 0 && b_StopLevel <= 2) - } // if (b_StopMode >= 0 && b_StopMode <= 1) + } /* if (b_StopLevel >= 0 && b_StopLevel <= 2) */ + } /* if (b_StopMode >= 0 && b_StopMode <= 1) */ else { - /************************************/ + /************************************/ /* PWM stop mode selection is wrong */ - /************************************/ + /************************************/ DPRINTK("PWM stop mode selection is wrong\n"); i_ReturnValue = -7; - } // if (b_StopMode >= 0 && b_StopMode <= 1) - } // if (b_StartLevel >= 0 && b_StartLevel <= 1) + } /* if (b_StopMode >= 0 && b_StopMode <= 1) */ + } /* if (b_StartLevel >= 0 && b_StartLevel <= 1) */ else { - /**************************************/ + /**************************************/ /* PWM start level selection is wrong */ - /**************************************/ + /**************************************/ DPRINTK("PWM start level selection is wrong\n"); i_ReturnValue = -6; - } // if (b_StartLevel >= 0 && b_StartLevel <= 1) - } // if (dw_Status & 0x10) + } /* if (b_StartLevel >= 0 && b_StartLevel <= 1) */ + } /* if (dw_Status & 0x10) */ else { - /***********************/ + /***********************/ /* PWM not initialised */ - /***********************/ + /***********************/ DPRINTK("PWM not initialised\n"); i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (dw_Status & 0x10) */ + } /* if (b_PWM >= 0 && b_PWM <= 1) */ else { - /******************************/ + /******************************/ /* Tor PWM selection is wrong */ - /******************************/ + /******************************/ DPRINTK("Tor PWM selection is wrong\n"); i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (b_PWM >= 0 && b_PWM <= 1) */ } else { - /**********************************/ + /**********************************/ /* The module is not a PWM module */ - /**********************************/ + /**********************************/ DPRINTK("The module is not a PWM module\n"); i_ReturnValue = -3; } } else { - /***********************/ + /***********************/ /* Module number error */ - /***********************/ + /***********************/ DPRINTK("Module number error\n"); i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_DisablePWM (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM) | +| Function Name : _INT_ i_APCI1710_DisablePWM (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM) | +----------------------------------------------------------------------------+ | Task : Disable the selected PWM (b_PWM) from selected module | | (b_ModulNbr). The output signal level depend of the | @@ -2045,8 +2045,8 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, | parameters from this function. | +----------------------------------------------------------------------------+ | Input Parameters :BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1) | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_PWM : Selected PWM (0 or 1) | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -2062,99 +2062,99 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PWM) +int i_APCI1710_DisablePWM(struct comedi_device *dev, unsigned char b_ModulNbr, unsigned char b_PWM) { - INT i_ReturnValue = 0; - DWORD dw_Status; + int i_ReturnValue = 0; + unsigned int dw_Status; /**************************/ /* Test the module number */ /**************************/ if (b_ModulNbr < 4) { - /***************/ + /***************/ /* Test if PWM */ - /***************/ + /***************/ if ((devpriv->s_BoardInfos. dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) { - /**************************/ + /**************************/ /* Test the PWM selection */ - /**************************/ + /**************************/ if (b_PWM <= 1) { - /***************************/ + /***************************/ /* Test if PWM initialised */ - /***************************/ + /***************************/ dw_Status = inl(devpriv->s_BoardInfos. ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); if (dw_Status & 0x10) { - /***********************/ + /***********************/ /* Test if PWM enabled */ - /***********************/ + /***********************/ if (dw_Status & 0x1) { - /*******************/ + /*******************/ /* Disable the PWM */ - /*******************/ + /*******************/ outl(0, devpriv->s_BoardInfos. ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); - } // if (dw_Status & 0x1) + } /* if (dw_Status & 0x1) */ else { - /*******************/ + /*******************/ /* PWM not enabled */ - /*******************/ + /*******************/ DPRINTK("PWM not enabled\n"); i_ReturnValue = -6; - } // if (dw_Status & 0x1) - } // if (dw_Status & 0x10) + } /* if (dw_Status & 0x1) */ + } /* if (dw_Status & 0x10) */ else { - /***********************/ + /***********************/ /* PWM not initialised */ - /***********************/ + /***********************/ DPRINTK(" PWM not initialised\n"); i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (dw_Status & 0x10) */ + } /* if (b_PWM >= 0 && b_PWM <= 1) */ else { - /******************************/ + /******************************/ /* Tor PWM selection is wrong */ - /******************************/ + /******************************/ DPRINTK("Tor PWM selection is wrong\n"); i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (b_PWM >= 0 && b_PWM <= 1) */ } else { - /**********************************/ + /**********************************/ /* The module is not a PWM module */ - /**********************************/ + /**********************************/ DPRINTK("The module is not a PWM module\n"); i_ReturnValue = -3; } } else { - /***********************/ + /***********************/ /* Module number error */ - /***********************/ + /***********************/ DPRINTK("Module number error\n"); i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetNewPWMTiming | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| BYTE_ b_ClockSelection, | -| BYTE_ b_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char_ b_ClockSelection, | +| unsigned char_ b_TimingUnit, | | ULONG_ ul_LowTiming, | | ULONG_ ul_HighTiming) | +----------------------------------------------------------------------------+ @@ -2162,11 +2162,11 @@ INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PW | ul_TimingUnit determine the low/high timing base for | | the period. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure| +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure| | (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1). | -| BYTE_ b_TimingUnit : Base timing Unit (0 to 4) | +| unsigned char_ b_PWM : Selected PWM (0 or 1). | +| unsigned char_ b_TimingUnit : Base timing Unit (0 to 4) | | 0 : ns | | 1 : æs | | 2 : ms | @@ -2189,18 +2189,18 @@ INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PW +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_PWM, BYTE b_TimingUnit, ULONG ul_LowTiming, ULONG ul_HighTiming) +int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, unsigned char b_TimingUnit, unsigned int ul_LowTiming, unsigned int ul_HighTiming) { - BYTE b_ClockSelection; - INT i_ReturnValue = 0; - ULONG ul_LowTimerValue = 0; - ULONG ul_HighTimerValue = 0; - ULONG ul_RealLowTiming = 0; - ULONG ul_RealHighTiming = 0; - DWORD dw_Status; - DWORD dw_Command; + unsigned char b_ClockSelection; + int i_ReturnValue = 0; + unsigned int ul_LowTimerValue = 0; + unsigned int ul_HighTimerValue = 0; + unsigned int ul_RealLowTiming = 0; + unsigned int ul_RealHighTiming = 0; + unsigned int dw_Status; + unsigned int dw_Command; double d_RealLowTiming = 0; double d_RealHighTiming = 0; @@ -2209,21 +2209,21 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, /**************************/ if (b_ModulNbr < 4) { - /***************/ + /***************/ /* Test if PWM */ - /***************/ + /***************/ if ((devpriv->s_BoardInfos. dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) { - /**************************/ + /**************************/ /* Test the PWM selection */ - /**************************/ + /**************************/ if (b_PWM <= 1) { - /***************************/ + /***************************/ /* Test if PWM initialised */ - /***************************/ + /***************************/ dw_Status = inl(devpriv->s_BoardInfos. ui_Address + 12 + (20 * b_PWM) + @@ -2235,14 +2235,14 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, s_PWMModuleInfo. b_ClockSelection; - /************************/ + /************************/ /* Test the timing unit */ - /************************/ + /************************/ if (b_TimingUnit <= 4) { - /*********************************/ + /*********************************/ /* Test the low timing selection */ - /*********************************/ + /*********************************/ if (((b_ClockSelection == APCI1710_30MHZ) @@ -2377,37 +2377,37 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, && (ul_LowTiming <= 7UL))) { - /**********************************/ + /**********************************/ /* Test the High timing selection */ - /**********************************/ + /**********************************/ if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) { - /************************************/ + /************************************/ /* Calculate the low division fator */ - /************************************/ + /************************************/ fpu_begin(); switch (b_TimingUnit) { - /******/ + /******/ /* ns */ - /******/ + /******/ case 0: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (ul_LowTiming * (0.00025 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -2417,13 +2417,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (0.00025 * (double)b_ClockSelection)); @@ -2459,7 +2459,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2469,26 +2469,26 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* æs */ - /******/ + /******/ case 1: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (ul_LowTiming * (0.25 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -2498,13 +2498,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (0.25 * (double)b_ClockSelection)); @@ -2542,7 +2542,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2552,15 +2552,15 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* ms */ - /******/ + /******/ case 2: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = @@ -2570,9 +2570,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, * b_ClockSelection); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -2582,13 +2582,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250.0 * (double)b_ClockSelection)); @@ -2624,7 +2624,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2634,28 +2634,28 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /*****/ + /*****/ /* s */ - /*****/ + /*****/ case 3: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (ul_LowTiming * (250000.0 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -2665,13 +2665,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250000.0 @@ -2710,7 +2710,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2720,19 +2720,19 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* mn */ - /******/ + /******/ case 4: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) ( (ul_LowTiming * @@ -2742,9 +2742,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)(ul_LowTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -2754,13 +2754,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250000.0 @@ -2804,7 +2804,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2815,31 +2815,31 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; } - /*************************************/ + /*************************************/ /* Calculate the high division fator */ - /*************************************/ + /*************************************/ switch (b_TimingUnit) { - /******/ + /******/ /* ns */ - /******/ + /******/ case 0: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (ul_HighTiming * (0.00025 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -2849,13 +2849,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (0.00025 * (double)b_ClockSelection)); @@ -2891,7 +2891,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -2901,26 +2901,26 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* æs */ - /******/ + /******/ case 1: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (ul_HighTiming * (0.25 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -2930,13 +2930,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (0.25 * (double)b_ClockSelection)); @@ -2974,7 +2974,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -2984,15 +2984,15 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* ms */ - /******/ + /******/ case 2: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = @@ -3002,9 +3002,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, * b_ClockSelection); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -3014,13 +3014,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250.0 * (double)b_ClockSelection)); @@ -3056,7 +3056,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -3066,28 +3066,28 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /*****/ + /*****/ /* s */ - /*****/ + /*****/ case 3: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (ul_HighTiming * (250000.0 * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -3097,13 +3097,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250000.0 @@ -3142,7 +3142,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -3152,19 +3152,19 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* mn */ - /******/ + /******/ case 4: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) ( (ul_HighTiming * @@ -3174,9 +3174,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, * b_ClockSelection)); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)(ul_HighTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -3186,13 +3186,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250000.0 @@ -3236,7 +3236,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -3249,9 +3249,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, fpu_end(); - /************************/ + /************************/ /* Save the timing unit */ - /************************/ + /************************/ devpriv-> s_ModuleInfo @@ -3263,9 +3263,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, = b_TimingUnit; - /****************************/ + /****************************/ /* Save the low base timing */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -3287,9 +3287,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, = ul_RealLowTiming; - /****************************/ + /****************************/ /* Save the high base timing */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -3311,21 +3311,21 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, = ul_RealHighTiming; - /************************/ + /************************/ /* Write the low timing */ - /************************/ + /************************/ outl(ul_LowTimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); - /*************************/ + /*************************/ /* Write the high timing */ - /*************************/ + /*************************/ outl(ul_HighTimerValue, devpriv->s_BoardInfos.ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); - /***************************/ + /***************************/ /* Set the clock selection */ - /***************************/ + /***************************/ dw_Command = inl @@ -3347,9 +3347,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 0x80; } - /***************************/ + /***************************/ /* Set the clock selection */ - /***************************/ + /***************************/ outl(dw_Command, devpriv-> @@ -3358,96 +3358,96 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); } else { - /***************************************/ + /***************************************/ /* High base timing selection is wrong */ - /***************************************/ + /***************************************/ DPRINTK("High base timing selection is wrong\n"); i_ReturnValue = -8; } } else { - /**************************************/ + /**************************************/ /* Low base timing selection is wrong */ - /**************************************/ + /**************************************/ DPRINTK("Low base timing selection is wrong\n"); i_ReturnValue = -7; } - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ else { - /**********************************/ + /**********************************/ /* Timing unit selection is wrong */ - /**********************************/ + /**********************************/ DPRINTK("Timing unit selection is wrong\n"); i_ReturnValue = -6; - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - } // if (dw_Status & 0x10) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ + } /* if (dw_Status & 0x10) */ else { - /***********************/ + /***********************/ /* PWM not initialised */ - /***********************/ + /***********************/ DPRINTK("PWM not initialised\n"); i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (dw_Status & 0x10) */ + } /* if (b_PWM >= 0 && b_PWM <= 1) */ else { - /******************************/ + /******************************/ /* Tor PWM selection is wrong */ - /******************************/ + /******************************/ DPRINTK("Tor PWM selection is wrong\n"); i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (b_PWM >= 0 && b_PWM <= 1) */ } else { - /**********************************/ + /**********************************/ /* The module is not a PWM module */ - /**********************************/ + /**********************************/ DPRINTK("The module is not a PWM module\n"); i_ReturnValue = -3; } } else { - /***********************/ + /***********************/ /* Module number error */ - /***********************/ + /***********************/ DPRINTK("Module number error\n"); i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetPWMStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| PBYTE_ pb_PWMOutputStatus, | -| PBYTE_ pb_ExternGateStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char *_ pb_PWMOutputStatus, | +| unsigned char *_ pb_ExternGateStatus) | +----------------------------------------------------------------------------+ | Task : Return the status from selected PWM (b_PWM) from | | selected module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_PWM : Selected PWM (0 or 1) | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) - b_ModulNbr =(BYTE) CR_AREF(insn->chanspec); - b_PWM =(BYTE) data[0]; +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_PWM : Selected PWM (0 or 1) | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) + b_ModulNbr =(unsigned char) CR_AREF(insn->chanspec); + b_PWM =(unsigned char) data[0]; | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_PWMOutputStatus : Return the PWM output | +| Output Parameters : unsigned char *_ pb_PWMOutputStatus : Return the PWM output | | level status. | | 0 : The PWM output level| | is low. | | 1 : The PWM output level| | is high. | -| PBYTE_ pb_ExternGateStatus : Return the extern gate | +| unsigned char *_ pb_ExternGateStatus : Return the extern gate | | level status. | | 0 : The extern gate is | | low. | | 1 : The extern gate is | | high. - pb_PWMOutputStatus =(PBYTE) data[0]; - pb_ExternGateStatus =(PBYTE) data[1]; | + pb_PWMOutputStatus =(unsigned char *) data[0]; + pb_ExternGateStatus =(unsigned char *) data[1]; | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -3460,109 +3460,109 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_Status; + int i_ReturnValue = 0; + unsigned int dw_Status; - BYTE b_ModulNbr; - BYTE b_PWM; - PBYTE pb_PWMOutputStatus; - PBYTE pb_ExternGateStatus; + unsigned char b_ModulNbr; + unsigned char b_PWM; + unsigned char *pb_PWMOutputStatus; + unsigned char *pb_ExternGateStatus; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_PWM = (BYTE) CR_CHAN(insn->chanspec); - pb_PWMOutputStatus = (PBYTE) & data[0]; - pb_ExternGateStatus = (PBYTE) & data[1]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_PWM = (unsigned char) CR_CHAN(insn->chanspec); + pb_PWMOutputStatus = (unsigned char *) &data[0]; + pb_ExternGateStatus = (unsigned char *) &data[1]; /**************************/ /* Test the module number */ /**************************/ if (b_ModulNbr < 4) { - /***************/ + /***************/ /* Test if PWM */ - /***************/ + /***************/ if ((devpriv->s_BoardInfos. dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) { - /**************************/ + /**************************/ /* Test the PWM selection */ - /**************************/ + /**************************/ if (b_PWM <= 1) { - /***************************/ + /***************************/ /* Test if PWM initialised */ - /***************************/ + /***************************/ dw_Status = inl(devpriv->s_BoardInfos. ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); if (dw_Status & 0x10) { - /***********************/ + /***********************/ /* Test if PWM enabled */ - /***********************/ + /***********************/ if (dw_Status & 0x1) { *pb_PWMOutputStatus = - (BYTE) ((dw_Status >> 7) + (unsigned char) ((dw_Status >> 7) & 1); *pb_ExternGateStatus = - (BYTE) ((dw_Status >> 6) + (unsigned char) ((dw_Status >> 6) & 1); - } // if (dw_Status & 0x1) + } /* if (dw_Status & 0x1) */ else { - /*******************/ + /*******************/ /* PWM not enabled */ - /*******************/ + /*******************/ DPRINTK("PWM not enabled \n"); i_ReturnValue = -6; - } // if (dw_Status & 0x1) - } // if (dw_Status & 0x10) + } /* if (dw_Status & 0x1) */ + } /* if (dw_Status & 0x10) */ else { - /***********************/ + /***********************/ /* PWM not initialised */ - /***********************/ + /***********************/ DPRINTK("PWM not initialised\n"); i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (dw_Status & 0x10) */ + } /* if (b_PWM >= 0 && b_PWM <= 1) */ else { - /******************************/ + /******************************/ /* Tor PWM selection is wrong */ - /******************************/ + /******************************/ DPRINTK("Tor PWM selection is wrong\n"); i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) + } /* if (b_PWM >= 0 && b_PWM <= 1) */ } else { - /**********************************/ + /**********************************/ /* The module is not a PWM module */ - /**********************************/ + /**********************************/ DPRINTK("The module is not a PWM module\n"); i_ReturnValue = -3; } } else { - /***********************/ + /***********************/ /* Module number error */ - /***********************/ + /***********************/ DPRINTK("Module number error\n"); i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } -INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { data[0] = devpriv->s_InterruptParameters. s_FIFOInterruptParameters[devpriv-> @@ -3574,9 +3574,9 @@ INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev, s_FIFOInterruptParameters[devpriv-> s_InterruptParameters.ui_Read].ul_OldCounterLatchValue; - /**************************/ + /**************************/ /* Increment the read FIFO */ - /***************************/ + /***************************/ devpriv-> s_InterruptParameters. diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h index c1b7f4ca47c..bf1b4c39a1c 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h @@ -26,51 +26,51 @@ #define APCI1710_PWM_ENABLE 1 #define APCI1710_PWM_NEWTIMING 2 -INT i_APCI1710_InsnConfigPWM(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigPWM(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InitPWM(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_ClockSelection, - BYTE b_TimingUnit, - ULONG ul_LowTiming, - ULONG ul_HighTiming, - PULONG pul_RealLowTiming, PULONG pul_RealHighTiming); +int i_APCI1710_InitPWM(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char b_ClockSelection, + unsigned char b_TimingUnit, + unsigned int ul_LowTiming, + unsigned int ul_HighTiming, + unsigned int *pul_RealLowTiming, unsigned int *pul_RealHighTiming); -INT i_APCI1710_GetPWMInitialisation(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - PBYTE pb_TimingUnit, - PULONG pul_LowTiming, - PULONG pul_HighTiming, - PBYTE pb_StartLevel, - PBYTE pb_StopMode, - PBYTE pb_StopLevel, - PBYTE pb_ExternGate, - PBYTE pb_InterruptEnable, PBYTE pb_Enable); +int i_APCI1710_GetPWMInitialisation(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char *pb_TimingUnit, + unsigned int *pul_LowTiming, + unsigned int *pul_HighTiming, + unsigned char *pb_StartLevel, + unsigned char *pb_StopMode, + unsigned char *pb_StopLevel, + unsigned char *pb_ExternGate, + unsigned char *pb_InterruptEnable, unsigned char *pb_Enable); -INT i_APCI1710_InsnWritePWM(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnWritePWM(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_EnablePWM(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_StartLevel, - BYTE b_StopMode, - BYTE b_StopLevel, BYTE b_ExternGate, - BYTE b_InterruptEnable); +int i_APCI1710_EnablePWM(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char b_StartLevel, + unsigned char b_StopMode, + unsigned char b_StopLevel, unsigned char b_ExternGate, + unsigned char b_InterruptEnable); -INT i_APCI1710_SetNewPWMTiming(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, BYTE b_TimingUnit, - ULONG ul_LowTiming, ULONG ul_HighTiming); +int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, unsigned char b_TimingUnit, + unsigned int ul_LowTiming, unsigned int ul_HighTiming); -INT i_APCI1710_DisablePWM(struct comedi_device *dev, BYTE b_ModulNbr, BYTE b_PWM); +int i_APCI1710_DisablePWM(struct comedi_device *dev, unsigned char b_ModulNbr, unsigned char b_PWM); -INT i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev, +int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c index bb6e1622e37..a445dab50ea 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c @@ -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. @@ -65,31 +65,31 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitSSI | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SSIProfile, | -| BYTE_ b_PositionTurnLength, | -| BYTE_ b_TurnCptLength, | -| BYTE_ b_PCIInputClock, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SSIProfile, | +| unsigned char_ b_PositionTurnLength, | +| unsigned char_ b_TurnCptLength, | +| unsigned char_ b_PCIInputClock, | | ULONG_ ul_SSIOutputClock, | -| BYTE_ b_SSICountingMode) | +| unsigned char_ b_SSICountingMode) | +----------------------------------------------------------------------------+ | Task : Configure the SSI operating mode from selected module | | (b_ModulNbr). You must calling this function be for you| | call any other function witch access of SSI. | +----------------------------------------------------------------------------+ -| 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_SSIProfile : Selection from SSI | +| unsigned char_ b_SSIProfile : Selection from SSI | | profile length (2 to 32).| -| BYTE_ b_PositionTurnLength : Selection from SSI | +| unsigned char_ b_PositionTurnLength : Selection from SSI | | position data length | | (1 to 31). | -| BYTE_ b_TurnCptLength : Selection from SSI turn | +| unsigned char_ b_TurnCptLength : Selection from SSI turn | | counter data length | | (1 to 31). | -| BYTE b_PCIInputClock : Selection from PCI bus | +| unsigned char b_PCIInputClock : Selection from PCI bus | | clock | | - APCI1710_30MHZ : | | The PC have a PCI bus | @@ -103,7 +103,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | for 30 MHz selection. | | From 252 to 5 000 000 Hz| | for 33 MHz selection. | -| BYTE b_SSICountingMode : SSI counting mode | +| unsigned char b_SSICountingMode : SSI counting mode | | selection | | - APCI1710_BINARY_MODE : | | Binary counting mode. | @@ -111,12 +111,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | Gray counting mode. b_ModulNbr = CR_AREF(insn->chanspec); - b_SSIProfile = (BYTE) data[0]; - b_PositionTurnLength= (BYTE) data[1]; - b_TurnCptLength = (BYTE) data[2]; - b_PCIInputClock = (BYTE) data[3]; - ul_SSIOutputClock = (ULONG) data[4]; - b_SSICountingMode = (BYTE) data[5]; | + b_SSIProfile = (unsigned char) data[0]; + b_PositionTurnLength= (unsigned char) data[1]; + b_TurnCptLength = (unsigned char) data[2]; + b_PCIInputClock = (unsigned char) data[3]; + ul_SSIOutputClock = (unsigned int) data[4]; + b_SSICountingMode = (unsigned char) data[5]; | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -133,22 +133,22 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - UINT ui_TimerValue; - BYTE b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength, + int i_ReturnValue = 0; + unsigned int ui_TimerValue; + unsigned char b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength, b_PCIInputClock, b_SSICountingMode; - ULONG ul_SSIOutputClock; + unsigned int ul_SSIOutputClock; b_ModulNbr = CR_AREF(insn->chanspec); - b_SSIProfile = (BYTE) data[0]; - b_PositionTurnLength = (BYTE) data[1]; - b_TurnCptLength = (BYTE) data[2]; - b_PCIInputClock = (BYTE) data[3]; - ul_SSIOutputClock = (ULONG) data[4]; - b_SSICountingMode = (BYTE) data[5]; + b_SSIProfile = (unsigned char) data[0]; + b_PositionTurnLength = (unsigned char) data[1]; + b_TurnCptLength = (unsigned char) data[2]; + b_PCIInputClock = (unsigned char) data[3]; + ul_SSIOutputClock = (unsigned int) data[4]; + b_SSICountingMode = (unsigned char) data[5]; i_ReturnValue = insn->n; /**************************/ @@ -167,7 +167,7 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde /* Test the SSI profile length */ /*******************************/ - // CG 22/03/00 b_SSIProfile >= 2 anstatt b_SSIProfile > 2 + /* CG 22/03/00 b_SSIProfile >= 2 anstatt b_SSIProfile > 2 */ if (b_SSIProfile >= 2 && b_SSIProfile < 33) { /*************************************/ /* Test the SSI position data length */ @@ -250,9 +250,9 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde ui_TimerValue = - (UINT) + (unsigned int) ( - ((ULONG) (b_PCIInputClock) * 500000UL) / ul_SSIOutputClock); + ((unsigned int) (b_PCIInputClock) * 500000UL) / ul_SSIOutputClock); /************************/ /* Initialise the timer */ @@ -351,18 +351,18 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Read1SSIValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SelectedSSI, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SelectedSSI, | | PULONG_ pul_Position, | | PULONG_ pul_TurnCpt) - INT i_APCI1710_ReadSSIValue(struct comedi_device *dev,struct comedi_subdevice *s, + int i_APCI1710_ReadSSIValue(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : @@ -373,22 +373,22 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde or Read all SSI counter (b_SelectedSSI) from | | selected module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| 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_SelectedSSI : Selection from SSI | +| unsigned char_ b_SelectedSSI : Selection from SSI | | counter (0 to 2) - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_SelectedSSI = (BYTE) CR_CHAN(insn->chanspec); (in case of single ssi) - b_ReadType = (BYTE) CR_RANGE(insn->chanspec); + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_SelectedSSI = (unsigned char) CR_CHAN(insn->chanspec); (in case of single ssi) + b_ReadType = (unsigned char) CR_RANGE(insn->chanspec); | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_Position : SSI position in the turn | | PULONG_ pul_TurnCpt : Number of turns -pul_Position = (PULONG) &data[0]; - pul_TurnCpt = (PULONG) &data[1]; | +pul_Position = (unsigned int *) &data[0]; + pul_TurnCpt = (unsigned int *) &data[1]; | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -400,37 +400,37 @@ pul_Position = (PULONG) &data[0]; +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - BYTE b_Cpt; - BYTE b_Length; - BYTE b_Schift; - BYTE b_SSICpt; - DWORD dw_And; - DWORD dw_And1; - DWORD dw_And2; - DWORD dw_StatusReg; - DWORD dw_CounterValue; - BYTE b_ModulNbr; - BYTE b_SelectedSSI; - BYTE b_ReadType; - PULONG pul_Position; - PULONG pul_TurnCpt; - PULONG pul_Position1; - PULONG pul_TurnCpt1; + int i_ReturnValue = 0; + unsigned char b_Cpt; + unsigned char b_Length; + unsigned char b_Schift; + unsigned char b_SSICpt; + unsigned int dw_And; + unsigned int dw_And1; + unsigned int dw_And2; + unsigned int dw_StatusReg; + unsigned int dw_CounterValue; + unsigned char b_ModulNbr; + unsigned char b_SelectedSSI; + unsigned char b_ReadType; + unsigned int *pul_Position; + unsigned int *pul_TurnCpt; + unsigned int *pul_Position1; + unsigned int *pul_TurnCpt1; i_ReturnValue = insn->n; - pul_Position1 = (PULONG) & data[0]; -// For Read1 - pul_TurnCpt1 = (PULONG) & data[1]; -// For Read all - pul_Position = (PULONG) & data[0]; //0-2 - pul_TurnCpt = (PULONG) & data[3]; //3-5 - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_SelectedSSI = (BYTE) CR_CHAN(insn->chanspec); - b_ReadType = (BYTE) CR_RANGE(insn->chanspec); + pul_Position1 = (unsigned int *) &data[0]; +/* For Read1 */ + pul_TurnCpt1 = (unsigned int *) &data[1]; +/* For Read all */ + pul_Position = (unsigned int *) &data[0]; /* 0-2 */ + pul_TurnCpt = (unsigned int *) &data[3]; /* 3-5 */ + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_SelectedSSI = (unsigned char) CR_CHAN(insn->chanspec); + b_ReadType = (unsigned char) CR_RANGE(insn->chanspec); /**************************/ /* Test the module number */ @@ -477,9 +477,8 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev s_BoardInfos. ui_Address + (64 * b_ModulNbr)); - } - while ((dw_StatusReg & 0x1) != - 0); + } while ((dw_StatusReg & 0x1) + != 0); /******************************/ /* Read the SSI counter value */ @@ -608,8 +607,7 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev s_BoardInfos. ui_Address + (64 * b_ModulNbr)); - } - while ((dw_StatusReg & 0x1) != 0); + } while ((dw_StatusReg & 0x1) != 0); for (b_SSICpt = 0; b_SSICpt < 3; b_SSICpt++) { @@ -667,7 +665,7 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev default: printk("Read Type Inputs Wrong\n"); - } // switch ending + } /* switch ending */ } else { /***********************/ @@ -695,16 +693,16 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadSSI1DigitalInput | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_InputChannel, | -| PBYTE_ pb_ChannelStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_InputChannel, | +| unsigned char *_ pb_ChannelStatus) | +----------------------------------------------------------------------------+ | Task : (0) Set the digital output from selected SSI moule | @@ -716,13 +714,13 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev (3)Read the status from all SSI digital inputs from | | selected SSI module (b_ModulNbr) | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr CR_AREF : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr CR_AREF : Module number to | | configure (0 to 3) | -| BYTE_ b_InputChannel CR_CHAN : Selection from digital | +| unsigned char_ b_InputChannel CR_CHAN : Selection from digital | | data[0] which IOTYPE input ( 0 to 2) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_ChannelStatus : Digital input channel | +| Output Parameters : unsigned char *_ pb_ChannelStatus : Digital input channel | | data[0] status | | 0 : Channle is not active| | 1 : Channle is active | @@ -735,19 +733,19 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr; - BYTE b_InputChannel; - PBYTE pb_ChannelStatus; - PBYTE pb_InputStatus; - BYTE b_IOType; + int i_ReturnValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr; + unsigned char b_InputChannel; + unsigned char *pb_ChannelStatus; + unsigned char *pb_InputStatus; + unsigned char b_IOType; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_IOType = (BYTE) data[0]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_IOType = (unsigned char) data[0]; /**************************/ /* Test the module number */ @@ -785,8 +783,8 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su /* Test the digital imnput channel number */ /******************************************/ - b_InputChannel = (BYTE) CR_CHAN(insn->chanspec); - pb_ChannelStatus = (PBYTE) & data[0]; + b_InputChannel = (unsigned char) CR_CHAN(insn->chanspec); + pb_ChannelStatus = (unsigned char *) &data[0]; if (b_InputChannel <= 2) { /**************************/ @@ -797,7 +795,7 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su inl(devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); *pb_ChannelStatus = - (BYTE) (((~dw_StatusReg) >> (4 + + (unsigned char) (((~dw_StatusReg) >> (4 + b_InputChannel)) & 1); } else { @@ -814,19 +812,19 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su /**************************/ /* Read all digital input */ /**************************/ - pb_InputStatus = (PBYTE) & data[0]; + pb_InputStatus = (unsigned char *) &data[0]; dw_StatusReg = inl(devpriv->s_BoardInfos.ui_Address + (64 * b_ModulNbr)); *pb_InputStatus = - (BYTE) (((~dw_StatusReg) >> 4) & 7); + (unsigned char) (((~dw_StatusReg) >> 4) & 7); break; default: printk("IO type wrong\n"); - } //switch end + } /* switch end */ } else { /**********************************/ /* The module is not a SSI module */ @@ -844,5 +842,5 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h index 88daad1a391..eb7f101d2d6 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h @@ -33,11 +33,11 @@ /* * SSI INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c index 90316e10a3b..43198aafb2d 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c @@ -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. @@ -63,11 +63,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitTorCounter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter, | -| BYTE_ b_PCIInputClock, | -| BYTE_ b_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter, | +| unsigned char_ b_PCIInputClock, | +| unsigned char_ b_TimingUnit, | | ULONG_ ul_TimingInterval, | | PULONG_ pul_RealTimingInterval) | +----------------------------------------------------------------------------+ @@ -82,11 +82,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ | Input Parameters : | | - CR_AREF BYTE_ b_ModulNbr : Module number to configure | + CR_AREF unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| data[0] BYTE_ b_TorCounter : Tor counter selection | +| data[0] unsigned char_ b_TorCounter : Tor counter selection | | (0 or 1). | -| data[1] BYTE_ b_PCIInputClock : Selection from PCI bus clock| +| data[1] unsigned char_ b_PCIInputClock : Selection from PCI bus clock| | - APCI1710_30MHZ : | | The PC have a PCI bus | | clock from 30 MHz | @@ -104,7 +104,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | than it is not possibl to | | used the gate input for | | enabled the acquisition | -| data[2] BYTE_ b_TimingUnit : Base timing unit (0 to 4) | +| data[2] unsigned char_ b_TimingUnit : Base timing unit (0 to 4) | | 0 : ns | | 1 : µs | | 2 : ms | @@ -130,27 +130,27 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - ULONG ul_TimerValue = 0; - DWORD dw_Command; + int i_ReturnValue = 0; + unsigned int ul_TimerValue = 0; + unsigned int dw_Command; double d_RealTimingInterval = 0; - BYTE b_ModulNbr; - BYTE b_TorCounter; - BYTE b_PCIInputClock; - BYTE b_TimingUnit; - ULONG ul_TimingInterval; - ULONG ul_RealTimingInterval = 0; + unsigned char b_ModulNbr; + unsigned char b_TorCounter; + unsigned char b_PCIInputClock; + unsigned char b_TimingUnit; + unsigned int ul_TimingInterval; + unsigned int ul_RealTimingInterval = 0; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); - b_TorCounter = (BYTE) data[0]; - b_PCIInputClock = (BYTE) data[1]; - b_TimingUnit = (BYTE) data[2]; - ul_TimingInterval = (ULONG) data[3]; + b_TorCounter = (unsigned char) data[0]; + b_PCIInputClock = (unsigned char) data[1]; + b_TimingUnit = (unsigned char) data[2]; + ul_TimingInterval = (unsigned int) data[3]; printk("INPUT clock %d\n", b_PCIInputClock); /**************************/ @@ -225,7 +225,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.00025 * b_PCIInputClock)); @@ -248,7 +248,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.00025 * (double)b_PCIInputClock)); @@ -284,7 +284,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -306,7 +306,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.25 * b_PCIInputClock)); @@ -329,7 +329,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.25 * (double)b_PCIInputClock)); @@ -367,7 +367,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -413,7 +413,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (250.0 * (double)b_PCIInputClock)); @@ -449,7 +449,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -471,7 +471,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (250000.0 @@ -496,7 +496,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (250000.0 @@ -535,7 +535,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -557,7 +557,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) ( (ul_TimingInterval * @@ -585,7 +585,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (250000.0 @@ -629,7 +629,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -641,7 +641,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, } fpu_end(); - } // if (b_PCIInputClock != APCI1710_GATE_INPUT) + } /* if (b_PCIInputClock != APCI1710_GATE_INPUT) */ else { /*************************************************************/ /* 2 Clock used for the overflow and the reload from counter */ @@ -652,7 +652,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimingInterval - 2; - } // if (b_PCIInputClock != APCI1710_GATE_INPUT) + } /* if (b_PCIInputClock != APCI1710_GATE_INPUT) */ /****************************/ /* Save the PCI input clock */ @@ -814,7 +814,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, DPRINTK("Base timing selection is wrong\n"); i_ReturnValue = -7; } - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ else { /**********************************/ /* Timing unit selection is wrong */ @@ -822,8 +822,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, DPRINTK("Timing unit selection is wrong\n"); i_ReturnValue = -6; - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */ else { /*****************************************/ /* The selected PCI input clock is wrong */ @@ -831,8 +831,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, DPRINTK("The selected PCI input clock is wrong\n"); i_ReturnValue = -5; - } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) - } // if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */ + } /* if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */ else { /**********************************/ /* Tor Counter selection is wrong */ @@ -840,7 +840,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, DPRINTK("Tor Counter selection is wrong\n"); i_ReturnValue = -4; - } // if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) + } /* if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */ } else { /******************************************/ /* The module is not a tor counter module */ @@ -857,20 +857,20 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, DPRINTK("Module number error\n"); i_ReturnValue = -2; } - data[0] = (UINT) ul_RealTimingInterval; - return (i_ReturnValue); + data[0] = (unsigned int) ul_RealTimingInterval; + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableTorCounter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter, | -| BYTE_ b_InputMode, | -| BYTE_ b_ExternGate, | -| BYTE_ b_CycleMode, | -| BYTE_ b_InterruptEnable) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter, | +| unsigned char_ b_InputMode, | +| unsigned char_ b_ExternGate, | +| unsigned char_ b_CycleMode, | +| unsigned char_ b_InterruptEnable) | +----------------------------------------------------------------------------+ | Task : Enable the tor counter (b_TorCounter) from selected | | module (b_ModulNbr). You must calling the | @@ -883,13 +883,13 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, | The b_CycleMode parameter determine if you will | | measured a single or more cycle. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_TorCounter : Tor counter selection (0 or 1). | -| BYTE_ b_InputMode : Input signal level selection | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_TorCounter : Tor counter selection (0 or 1). | +| unsigned char_ b_InputMode : Input signal level selection | | 0 : Tor count each low level | | 1 : Tor count each high level| -| BYTE_ b_ExternGate : Extern gate action selection | +| unsigned char_ b_ExternGate : Extern gate action selection | | 0 : Extern gate signal not | | used | | 1 : Extern gate signal used. | @@ -928,9 +928,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, | The gate input is used for the | | signal B | | | -| BYTE_ b_CycleMode : Selected the tor counter | +| unsigned char_ b_CycleMode : Selected the tor counter | | acquisition mode | -| BYTE_ b_InterruptEnable : Enable or disable the | +| unsigned char_ b_InterruptEnable : Enable or disable the | | tor counter interrupt. | | APCI1710_ENABLE: | | Enable the tor counter | @@ -959,9 +959,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_DisableTorCounter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter) | +----------------------------------------------------------------------------+ | Task : Disable the tor counter (b_TorCounter) from selected | | module (b_ModulNbr). If you disable the tor counter | @@ -969,9 +969,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, | counter witch the " i_APCI1710_EnableTorCounter" | | function, the status register is cleared | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_TorCounter : Tor counter selection (0 or 1). | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_TorCounter : Tor counter selection (0 or 1). | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -987,29 +987,29 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_DummyRead; - DWORD dw_ConfigReg; - BYTE b_ModulNbr, b_Action; - BYTE b_TorCounter; - BYTE b_InputMode; - BYTE b_ExternGate; - BYTE b_CycleMode; - BYTE b_InterruptEnable; - - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_Action = (BYTE) data[0]; // enable or disable - b_TorCounter = (BYTE) data[1]; - b_InputMode = (BYTE) data[2]; - b_ExternGate = (BYTE) data[3]; - b_CycleMode = (BYTE) data[4]; - b_InterruptEnable = (BYTE) data[5]; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_DummyRead; + unsigned int dw_ConfigReg; + unsigned char b_ModulNbr, b_Action; + unsigned char b_TorCounter; + unsigned char b_InputMode; + unsigned char b_ExternGate; + unsigned char b_CycleMode; + unsigned char b_InterruptEnable; + + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_Action = (unsigned char) data[0]; /* enable or disable */ + b_TorCounter = (unsigned char) data[1]; + b_InputMode = (unsigned char) data[2]; + b_ExternGate = (unsigned char) data[3]; + b_CycleMode = (unsigned char) data[4]; + b_InterruptEnable = (unsigned char) data[5]; i_ReturnValue = insn->n;; - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ /**************************/ /* Test the module number */ /**************************/ @@ -1027,7 +1027,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, /**********************************/ if (b_TorCounter <= 1) { - switch (b_Action) // Enable or Disable + switch (b_Action) /* Enable or Disable */ { case APCI1710_ENABLE: /***********************************/ @@ -1149,7 +1149,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, | 0x780; - } // if (b_InputMode == APCI1710_TOR_SIMPLE_MODE) + } /* if (b_InputMode == APCI1710_TOR_SIMPLE_MODE) */ /***********************/ /* Test if double mode */ @@ -1166,12 +1166,12 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, | 0x180; - } // if (b_InputMode == APCI1710_TOR_DOUBLE_MODE) + } /* if (b_InputMode == APCI1710_TOR_DOUBLE_MODE) */ b_InputMode = 0; - } // if (b_InputMode > 1) + } /* if (b_InputMode > 1) */ /*******************/ /* Set the command */ @@ -1237,7 +1237,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, outl(1, devpriv->s_BoardInfos.ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); - } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) + } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */ else { /********************************/ /* Interrupt parameter is wrong */ @@ -1247,8 +1247,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, i_ReturnValue = -9; - } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) - } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) + } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */ + } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */ else { /***********************************************/ /* Tor counter acquisition mode cycle is wrong */ @@ -1258,8 +1258,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, i_ReturnValue = -8; - } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) - } // if (b_ExternGate >= 0 && b_ExternGate <= 1) + } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */ + } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */ else { /***********************************/ /* Extern gate input mode is wrong */ @@ -1268,8 +1268,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, DPRINTK("Extern gate input mode is wrong\n"); i_ReturnValue = -7; - } // if (b_ExternGate >= 0 && b_ExternGate <= 1) - } // if (b_InputMode >= 0 && b_InputMode <= 1) + } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */ + } /* if (b_InputMode >= 0 && b_InputMode <= 1) */ else { /***************************************/ /* Tor input signal selection is wrong */ @@ -1329,7 +1329,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, s_BoardInfos. ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); - } // if (dw_Status & 0x1) + } /* if (dw_Status & 0x1) */ else { /***************************/ /* Tor counter not enabled */ @@ -1337,8 +1337,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, DPRINTK("Tor counter not enabled \n"); i_ReturnValue = -6; - } // if (dw_Status & 0x1) - } // if (dw_Status & 0x10) + } /* if (dw_Status & 0x1) */ + } /* if (dw_Status & 0x10) */ else { /*******************************/ /* Tor counter not initialised */ @@ -1346,10 +1346,10 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, DPRINTK("Tor counter not initialised\n"); i_ReturnValue = -5; - } // // if (dw_Status & 0x10) + } /* // if (dw_Status & 0x10) */ - } // switch - } // if (b_TorCounter <= 1) + } /* switch */ + } /* if (b_TorCounter <= 1) */ else { /**********************************/ /* Tor counter selection is wrong */ @@ -1357,7 +1357,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, DPRINTK("Tor counter selection is wrong\n"); i_ReturnValue = -4; - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ } else { /******************************************/ /* The module is not a tor counter module */ @@ -1375,22 +1375,22 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetTorCounterInitialisation | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter, | -| PBYTE_ pb_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter, | +| unsigned char *_ pb_TimingUnit, | | PULONG_ pul_TimingInterval, | -| PBYTE_ pb_InputMode, | -| PBYTE_ pb_ExternGate, | -| PBYTE_ pb_CycleMode, | -| PBYTE_ pb_Enable, | -| PBYTE_ pb_InterruptEnable)| +| unsigned char *_ pb_InputMode, | +| unsigned char *_ pb_ExternGate, | +| unsigned char *_ pb_CycleMode, | +| unsigned char *_ pb_Enable, | +| unsigned char *_ pb_InterruptEnable)| +----------------------------------------------------------------------------+ | Task : Enable the tor counter (b_TorCounter) from selected | | module (b_ModulNbr). You must calling the | @@ -1403,37 +1403,37 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, | The b_CycleMode parameter determine if you will | | measured a single or more cycle. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_TorCounter : Tor counter selection (0 or 1) +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_TorCounter : Tor counter selection (0 or 1) b_ModulNbr = CR_AREF(insn->chanspec); b_TorCounter = CR_CHAN(insn->chanspec); . | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TimingUnit : Base timing unit (0 to 4) | +| Output Parameters : unsigned char *_ pb_TimingUnit : Base timing unit (0 to 4) | | 0 : ns | | 1 : µs | | 2 : ms | | 3 : s | | 4 : mn | | PULONG_ pul_TimingInterval : Base timing value. | -| PBYTE_ pb_InputMode : Input signal level | +| unsigned char *_ pb_InputMode : Input signal level | | selection | | 0 : Tor count each low level | | 1 : Tor count each high level| -| PBYTE_ pb_ExternGate : Extern gate action | +| unsigned char *_ pb_ExternGate : Extern gate action | | selection | | 0 : Extern gate signal not | | used | | 1 : Extern gate signal used| -| PBYTE_ pb_CycleMode : Tor counter acquisition | +| unsigned char *_ pb_CycleMode : Tor counter acquisition | | mode | -| PBYTE_ pb_Enable : Indicate if the tor counter| +| unsigned char *_ pb_Enable : Indicate if the tor counter| | is enabled or no | | 0 : Tor counter disabled | | 1 : Tor counter enabled | -| PBYTE_ pb_InterruptEnable : Enable or disable the | +| unsigned char *_ pb_InterruptEnable : Enable or disable the | | tor counter interrupt. | | APCI1710_ENABLE: | | Enable the tor counter | @@ -1441,13 +1441,13 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, | APCI1710_DISABLE: | | Disable the tor counter | | interrupt - pb_TimingUnit = (PBYTE) &data[0]; - pul_TimingInterval = (PULONG) &data[1]; - pb_InputMode = (PBYTE) &data[2]; - pb_ExternGate = (PBYTE) &data[3]; - pb_CycleMode = (PBYTE) &data[4]; - pb_Enable = (PBYTE) &data[5]; - pb_InterruptEnable = (PBYTE) &data[6]; + pb_TimingUnit = (unsigned char *) &data[0]; + pul_TimingInterval = (unsigned int *) &data[1]; + pb_InputMode = (unsigned char *) &data[2]; + pb_ExternGate = (unsigned char *) &data[3]; + pb_CycleMode = (unsigned char *) &data[4]; + pb_Enable = (unsigned char *) &data[5]; + pb_InterruptEnable = (unsigned char *) &data[6]; | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -1460,32 +1460,32 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_Status; - BYTE b_ModulNbr; - BYTE b_TorCounter; - PBYTE pb_TimingUnit; - PULONG pul_TimingInterval; - PBYTE pb_InputMode; - PBYTE pb_ExternGate; - PBYTE pb_CycleMode; - PBYTE pb_Enable; - PBYTE pb_InterruptEnable; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned char b_ModulNbr; + unsigned char b_TorCounter; + unsigned char *pb_TimingUnit; + unsigned int *pul_TimingInterval; + unsigned char *pb_InputMode; + unsigned char *pb_ExternGate; + unsigned char *pb_CycleMode; + unsigned char *pb_Enable; + unsigned char *pb_InterruptEnable; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); b_TorCounter = CR_CHAN(insn->chanspec); - pb_TimingUnit = (PBYTE) & data[0]; - pul_TimingInterval = (PULONG) & data[1]; - pb_InputMode = (PBYTE) & data[2]; - pb_ExternGate = (PBYTE) & data[3]; - pb_CycleMode = (PBYTE) & data[4]; - pb_Enable = (PBYTE) & data[5]; - pb_InterruptEnable = (PBYTE) & data[6]; + pb_TimingUnit = (unsigned char *) &data[0]; + pul_TimingInterval = (unsigned int *) &data[1]; + pb_InputMode = (unsigned char *) &data[2]; + pb_ExternGate = (unsigned char *) &data[3]; + pb_CycleMode = (unsigned char *) &data[4]; + pb_Enable = (unsigned char *) &data[5]; + pb_InterruptEnable = (unsigned char *) &data[6]; /**************************/ /* Test the module number */ @@ -1526,9 +1526,9 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_CycleMode = - (BYTE) ((dw_Status >> 4) & 1); + (unsigned char) ((dw_Status >> 4) & 1); *pb_InterruptEnable = - (BYTE) ((dw_Status >> 5) & 1); + (unsigned char) ((dw_Status >> 5) & 1); /******************************************************/ /* Test if extern gate used for clock or for signal B */ @@ -1569,25 +1569,25 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, *pb_InputMode = APCI1710_TOR_QUADRUPLE_MODE; } - } // if (dw_Status & 0x400) + } /* if (dw_Status & 0x400) */ else { *pb_InputMode = 1; - } // // if (dw_Status & 0x400) + } /* // if (dw_Status & 0x400) */ /************************/ /* Extern gate not used */ /************************/ *pb_ExternGate = 0; - } // if (dw_Status & 0x600) + } /* if (dw_Status & 0x600) */ else { *pb_InputMode = - (BYTE) ((dw_Status >> 6) + (unsigned char) ((dw_Status >> 6) & 1); *pb_ExternGate = - (BYTE) ((dw_Status >> 7) + (unsigned char) ((dw_Status >> 7) & 1); - } // if (dw_Status & 0x600) + } /* if (dw_Status & 0x600) */ *pb_TimingUnit = devpriv-> @@ -1611,7 +1611,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, i_ReturnValue = -5; } - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ else { /**********************************/ /* Tor counter selection is wrong */ @@ -1619,7 +1619,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, DPRINTK("Tor counter selection is wrong \n"); i_ReturnValue = -4; - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ } else { /******************************************/ /* The module is not a tor counter module */ @@ -1637,17 +1637,17 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadTorCounterValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter, | -| UINT_ ui_TimeOut, | -| PBYTE_ pb_TorCounterStatus, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter, | +| unsigned int_ ui_TimeOut, | +| unsigned char *_ pb_TorCounterStatus, | | PULONG_ pul_TorCounterValue) | +----------------------------------------------------------------------------+ | Task case APCI1710_TOR_GETPROGRESSSTATUS: Return the tor counter @@ -1660,15 +1660,15 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, | (pul_TorCounterValue) after a conting cycle stop | | from selected tor counter module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_TorCounter : Tor counter selection (0 or 1). +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_TorCounter : Tor counter selection (0 or 1). b_ModulNbr = CR_AREF(insn->chanspec); - b_ReadType = (BYTE) data[0]; - b_TorCounter = (BYTE) data[1]; - ui_TimeOut = (UINT) data[2]; | + b_ReadType = (unsigned char) data[0]; + b_TorCounter = (unsigned char) data[1]; + ui_TimeOut = (unsigned int) data[2]; | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TorCounterStatus : Return the tor counter | +| Output Parameters : unsigned char *_ pb_TorCounterStatus : Return the tor counter | | status. | | 0 : Conting cycle not started| | Software gate not set. | @@ -1683,9 +1683,9 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, | function | | "i_APCI1710_InitTorCounter"| | 4 : Timeeout occur | -| PULONG pul_TorCounterValue : Tor counter value. - pb_TorCounterStatus=(PBYTE) &data[0]; - pul_TorCounterValue=(PULONG) &data[1]; | +| unsigned int * pul_TorCounterValue : Tor counter value. + pb_TorCounterStatus=(unsigned char *) &data[0]; + pul_TorCounterValue=(unsigned int *) &data[1]; | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -1700,27 +1700,27 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_TimeOut = 0; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_TimeOut = 0; - BYTE b_ModulNbr; - BYTE b_TorCounter; - BYTE b_ReadType; - UINT ui_TimeOut; - PBYTE pb_TorCounterStatus; - PULONG pul_TorCounterValue; + unsigned char b_ModulNbr; + unsigned char b_TorCounter; + unsigned char b_ReadType; + unsigned int ui_TimeOut; + unsigned char *pb_TorCounterStatus; + unsigned int *pul_TorCounterValue; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); - b_ReadType = (BYTE) data[0]; - b_TorCounter = (BYTE) data[1]; - ui_TimeOut = (UINT) data[2]; - pb_TorCounterStatus = (PBYTE) & data[0]; - pul_TorCounterValue = (PULONG) & data[1]; + b_ReadType = (unsigned char) data[0]; + b_TorCounter = (unsigned char) data[1]; + ui_TimeOut = (unsigned int) data[2]; + pb_TorCounterStatus = (unsigned char *) &data[0]; + pul_TorCounterValue = (unsigned int *) &data[1]; /**************************/ /* Test the module number */ @@ -1896,7 +1896,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device + (16 * b_TorCounter) + (64 * b_ModulNbr)); break; - } // if ((dw_Status & 4) == 4) + } /* if ((dw_Status & 4) == 4) */ else { /*******************************/ /* Test if measurement stopped */ @@ -1927,7 +1927,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device (16 * b_TorCounter) + (64 * b_ModulNbr)); break; - } // if ((dw_Status & 2) == 2) + } /* if ((dw_Status & 2) == 2) */ else { /*******************************/ /* Test if measurement started */ @@ -1941,7 +1941,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *pb_TorCounterStatus = 1; - } // if ((dw_Status & 1) == 1) + } /* if ((dw_Status & 1) == 1) */ else { /***************************/ /* Measurement not started */ @@ -1950,9 +1950,9 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *pb_TorCounterStatus = 0; - } // if ((dw_Status & 1) == 1) - } // if ((dw_Status & 2) == 2) - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 1) == 1) */ + } /* if ((dw_Status & 2) == 2) */ + } /* if ((dw_Status & 8) == 8) */ if (dw_TimeOut == ui_TimeOut) { /*****************/ @@ -1973,7 +1973,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device mdelay(1000); } - } // for (;;) + } /* for (;;) */ /*************************/ /* Test if timeout occur */ @@ -2001,8 +2001,8 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device default: printk("Inputs wrong\n"); - } // switch end - } // if (dw_Status & 0x1) + } /* switch end */ + } /* if (dw_Status & 0x1) */ else { /***************************/ /* Tor counter not enabled */ @@ -2010,7 +2010,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device DPRINTK("Tor counter not enabled\n"); i_ReturnValue = -6; - } // if (dw_Status & 0x1) + } /* if (dw_Status & 0x1) */ } else { /*******************************/ /* Tor counter not initialised */ @@ -2019,7 +2019,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device DPRINTK("Tor counter not initialised\n"); i_ReturnValue = -5; } - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ else { /**********************************/ /* Tor counter selection is wrong */ @@ -2027,7 +2027,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device DPRINTK("Tor counter selection is wrong\n"); i_ReturnValue = -4; - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ } else { /******************************************/ /* The module is not a tor counter module */ @@ -2045,5 +2045,5 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h index c245d16207b..03a93cb26d7 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h @@ -35,23 +35,23 @@ /* * TOR_COUNTER INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev, +int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev, +int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev, +int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * TOR_COUNTER READ FUNCTION */ -INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev, +int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c index 68b1d26bae1..d3d78d37de5 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c @@ -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. @@ -63,12 +63,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitTTLIODirection | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PortAMode, | -| BYTE_ b_PortBMode, | -| BYTE_ b_PortCMode, | -| BYTE_ b_PortDMode) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PortAMode, | +| unsigned char_ b_PortBMode, | +| unsigned char_ b_PortCMode, | +| unsigned char_ b_PortDMode) | +----------------------------------------------------------------------------+ | Task APCI1710_TTL_INIT (using defaults) : Configure the TTL I/O operating mode from selected | | module (b_ModulNbr). You must calling this function be| @@ -76,15 +76,15 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc APCI1710_TTL_INITDIRECTION(user inputs for direction) +----------------------------------------------------------------------------+ -| 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) - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_InitType = (BYTE) data[0]; - b_PortAMode = (BYTE) data[1]; - b_PortBMode = (BYTE) data[2]; - b_PortCMode = (BYTE) data[3]; - b_PortDMode = (BYTE) data[4];| + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_InitType = (unsigned char) data[0]; + b_PortAMode = (unsigned char) data[1]; + b_PortBMode = (unsigned char) data[2]; + b_PortCMode = (unsigned char) data[3]; + b_PortDMode = (unsigned char) data[4];| +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -100,19 +100,19 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr; - BYTE b_InitType; - BYTE b_PortAMode; - BYTE b_PortBMode; - BYTE b_PortCMode; - BYTE b_PortDMode; - - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_InitType = (BYTE) data[0]; + int i_ReturnValue = 0; + unsigned char b_ModulNbr; + unsigned char b_InitType; + unsigned char b_PortAMode; + unsigned char b_PortBMode; + unsigned char b_PortCMode; + unsigned char b_PortDMode; + + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_InitType = (unsigned char) data[0]; i_ReturnValue = insn->n; /**************************/ @@ -172,10 +172,10 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub case APCI1710_TTL_INITDIRECTION: - b_PortAMode = (BYTE) data[1]; - b_PortBMode = (BYTE) data[2]; - b_PortCMode = (BYTE) data[3]; - b_PortDMode = (BYTE) data[4]; + b_PortAMode = (unsigned char) data[1]; + b_PortBMode = (unsigned char) data[2]; + b_PortCMode = (unsigned char) data[3]; + b_PortDMode = (unsigned char) data[4]; /********************/ /* Test the version */ @@ -322,7 +322,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub DPRINTK("\n"); default: printk("Bad Config Type\n"); - } // switch end + } /* switch end */ } else { /**********************************/ /* The module is not a TTL module */ @@ -340,7 +340,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -352,11 +352,11 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadTTLIOChannelValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SelectedPort, | -| BYTE_ b_InputChannel, | -| PBYTE_ pb_ChannelStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SelectedPort, | +| unsigned char_ b_InputChannel, | +| unsigned char *_ pb_ChannelStatus) | +----------------------------------------------------------------------------+ | Task : Read the status from selected TTL digital input | | (b_InputChannel) @@ -366,32 +366,32 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+ -| 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 7) | -| BYTE_ b_SelectedPort, : Selection from TTL I/O | +| unsigned char_ b_SelectedPort, : Selection from TTL I/O | | port (0 to 2) | | 0 : Port A selection | | 1 : Port B selection | | 2 : Port C selection | | 3 : Port D selection | -| BYTE_ b_InputChannel : Selection from digital | +| unsigned char_ b_InputChannel : Selection from digital | | input ( 0 to 2) APCI1710_TTL_READCHANNEL b_ModulNbr = CR_AREF(insn->chanspec); b_SelectedPort= CR_RANGE(insn->chanspec); b_InputChannel= CR_CHAN(insn->chanspec); - b_ReadType = (BYTE) data[0]; + b_ReadType = (unsigned char) data[0]; APCI1710_TTL_READPORT| b_ModulNbr = CR_AREF(insn->chanspec); b_SelectedPort= CR_RANGE(insn->chanspec); - b_ReadType = (BYTE) data[0]; + b_ReadType = (unsigned char) data[0]; +----------------------------------------------------------------------------+ | Output Parameters : data[0] - PBYTE_ pb_ChannelStatus : Digital input channel | + unsigned char *_ pb_ChannelStatus : Digital input channel | | status | | 0 : Channle is not active| | 1 : Channle is active | @@ -406,20 +406,20 @@ APCI1710_TTL_READCHANNEL +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr; - BYTE b_SelectedPort; - BYTE b_InputChannel; - BYTE b_ReadType; - PBYTE pb_ChannelStatus; - PBYTE pb_PortValue; + int i_ReturnValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr; + unsigned char b_SelectedPort; + unsigned char b_InputChannel; + unsigned char b_ReadType; + unsigned char *pb_ChannelStatus; + unsigned char *pb_PortValue; i_ReturnValue = insn->n; - b_ReadType = (BYTE) data[0]; + b_ReadType = (unsigned char) data[0]; b_ModulNbr = CR_AREF(insn->chanspec); b_SelectedPort = CR_RANGE(insn->chanspec); b_InputChannel = CR_CHAN(insn->chanspec); @@ -439,7 +439,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde switch (b_ReadType) { case APCI1710_TTL_READCHANNEL: - pb_ChannelStatus = (PBYTE) & data[0]; + pb_ChannelStatus = (unsigned char *) &data[0]; /********************************/ /* Test the TTL I/O port number */ /********************************/ @@ -493,7 +493,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde *pb_ChannelStatus = - (BYTE) ( + (unsigned char) ( (dw_StatusReg >> (8 * b_SelectedPort)) >> b_InputChannel) & 1; @@ -533,7 +533,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde break; case APCI1710_TTL_READPORT: - pb_PortValue = (PBYTE) & data[0]; + pb_PortValue = (unsigned char *) &data[0]; /********************************/ /* Test the TTL I/O port number */ /********************************/ @@ -578,7 +578,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde (64 * b_ModulNbr)); *pb_PortValue = - (BYTE) ( + (unsigned char) ( (dw_StatusReg >> (8 * b_SelectedPort)) & 0xFF); } else { @@ -610,7 +610,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde default: printk("Bad ReadType\n"); - } //End Switch + } /* End Switch */ } else { /**********************************/ /* The module is not a TTL module */ @@ -628,20 +628,20 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device +| Function Name : int i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Read the status from all digital input ports | | (port A, port B and port C) from selected TTL | | module (b_ModulNbr) | +----------------------------------------------------------------------------+ -| 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) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_PortValue : Digital TTL inputs port | @@ -655,17 +655,17 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr; - PULONG pul_PortValue; + int i_ReturnValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr; + unsigned int *pul_PortValue; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); i_ReturnValue = insn->n; - pul_PortValue = (PULONG) & data[0]; + pul_PortValue = (unsigned int *) &data[0]; /**************************/ /* Test the module number */ @@ -777,7 +777,7 @@ INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -789,19 +789,19 @@ INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetTTLIOChlOn | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_OutputChannel) -INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi_subdevice *s, +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_OutputChannel) +int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Sets or resets the output witch has been passed with the | | parameter b_Channel. Setting an output means setting | | an ouput high. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| -| BYTE_ b_OutputChannel : Selection from digital output | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| +| unsigned char_ b_OutputChannel : Selection from digital output | | channel (0 or 1) | | 0 : PD0 | | 1 : PD1 | @@ -811,7 +811,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi b_ModulNbr = CR_AREF(insn->chanspec); b_OutputChannel= CR_CHAN(insn->chanspec); - ui_State = data[0]; // ON or OFF + ui_State = data[0]; /* ON or OFF */ +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -825,19 +825,19 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; - BYTE b_ModulNbr; - BYTE b_OutputChannel; - UINT ui_State; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; + unsigned char b_ModulNbr; + unsigned char b_OutputChannel; + unsigned int ui_State; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); b_OutputChannel = CR_CHAN(insn->chanspec); - ui_State = data[0]; // ON or OFF + ui_State = data[0]; /* ON or OFF */ /**************************/ /* Test the module number */ @@ -953,7 +953,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev, ui_Address + (64 * b_ModulNbr)); - if (ui_State) // ON + if (ui_State) /* ON */ { dw_StatusReg = @@ -969,7 +969,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev, (b_OutputChannel % 8)); - } else // Off + } else /* Off */ { dw_StatusReg = @@ -1034,5 +1034,5 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev, i_ReturnValue = -2; } - return (i_ReturnValue); + return i_ReturnValue; } diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h index 00915ddf921..c4f11347f24 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h @@ -24,21 +24,21 @@ /* * TTL INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * TTL INPUT FUNCTION */ -INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev, +int i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * TTL OUTPUT FUNCTIONS */ -INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev, +int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c index b0907ec1466..6e9e7ed4dba 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c @@ -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. @@ -49,37 +49,37 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #include "addi_amcc_S5920.h" /*+----------------------------------------------------------------------------+*/ -/*| Function Name : INT i_AddiHeaderRW_ReadEeprom |*/ -/*| (INT i_NbOfWordsToRead, |*/ -/*| DWORD dw_PCIBoardEepromAddress, |*/ -/*| WORD w_EepromStartAddress, |*/ -/*| PWORD pw_DataRead) |*/ +/*| Function Name : int i_AddiHeaderRW_ReadEeprom |*/ +/*| (int i_NbOfWordsToRead, |*/ +/*| unsigned int dw_PCIBoardEepromAddress, |*/ +/*| unsigned short w_EepromStartAddress, |*/ +/*| unsigned short * pw_DataRead) |*/ /*+----------------------------------------------------------------------------+*/ /*| Task : Read word from the 5920 eeprom. |*/ /*+----------------------------------------------------------------------------+*/ -/*| Input Parameters : INT i_NbOfWordsToRead : Nbr. of word to read |*/ -/*| DWORD dw_PCIBoardEepromAddress : Address of the eeprom |*/ -/*| WORD w_EepromStartAddress : Eeprom strat address |*/ +/*| Input Parameters : int i_NbOfWordsToRead : Nbr. of word to read |*/ +/*| unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/ +/*| unsigned short w_EepromStartAddress : Eeprom strat address |*/ /*+----------------------------------------------------------------------------+*/ -/*| Output Parameters : PWORD pw_DataRead : Read data |*/ +/*| Output Parameters : unsigned short * pw_DataRead : Read data |*/ /*+----------------------------------------------------------------------------+*/ /*| Return Value : - |*/ /*+----------------------------------------------------------------------------+*/ -INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, - DWORD dw_PCIBoardEepromAddress, - WORD w_EepromStartAddress, PWORD pw_DataRead) +int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead, + unsigned int dw_PCIBoardEepromAddress, + unsigned short w_EepromStartAddress, unsigned short *pw_DataRead) { - DWORD dw_eeprom_busy = 0; - INT i_Counter = 0; - INT i_WordCounter; - INT i; - BYTE pb_ReadByte[1]; - BYTE b_ReadLowByte = 0; - BYTE b_ReadHighByte = 0; - BYTE b_SelectedAddressLow = 0; - BYTE b_SelectedAddressHigh = 0; - WORD w_ReadWord = 0; + unsigned int dw_eeprom_busy = 0; + int i_Counter = 0; + int i_WordCounter; + int i; + unsigned char pb_ReadByte[1]; + unsigned char b_ReadLowByte = 0; + unsigned char b_ReadHighByte = 0; + unsigned char b_SelectedAddressLow = 0; + unsigned char b_SelectedAddressHigh = 0; + unsigned short w_ReadWord = 0; for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead; i_WordCounter++) { @@ -88,106 +88,99 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); for (i_Counter = 0; i_Counter < 2; i_Counter++) { - b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; //Read the low 8 bit part - b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; //Read the high 8 bit part + b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; /* Read the low 8 bit part */ + b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; /* Read the high 8 bit part */ - //Select the load low address mode + /* Select the load low address mode */ outb(NVCMD_LOAD_LOW, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Load the low address + /* Load the low address */ outb(b_SelectedAddressLow, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the load high address mode + /* Select the load high address mode */ outb(NVCMD_LOAD_HIGH, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Load the high address + /* Load the high address */ outb(b_SelectedAddressHigh, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the READ mode + /* Select the READ mode */ outb(NVCMD_BEGIN_READ, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Read data into the EEPROM + /* Read data into the EEPROM */ *pb_ReadByte = inb(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the upper address part + /* Select the upper address part */ if (i_Counter == 0) { b_ReadLowByte = pb_ReadByte[0]; } else { b_ReadHighByte = pb_ReadByte[0]; } - //Sleep - for (i = 0; i < 10000; i++) ; + /* Sleep */ + msleep(1); } w_ReadWord = @@ -196,8 +189,8 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, pw_DataRead[i_WordCounter] = w_ReadWord; - w_EepromStartAddress += 2; // to read the next word + w_EepromStartAddress += 2; /* to read the next word */ - } // for (...) i_NbOfWordsToRead - return (0); + } /* for (...) i_NbOfWordsToRead */ + return 0; } diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h index 9ae56bc3ada..622a4ac2b79 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h @@ -22,6 +22,6 @@ #define NVCMD_BEGIN_READ (0x7 << 5) /* nvRam begin read command */ #define NVCMD_BEGIN_WRITE (0x6 << 5) /* EEPROM begin write command */ -INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, - DWORD dw_PCIBoardEepromAddress, - WORD w_EepromStartAddress, PWORD pw_DataRead); +int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead, + unsigned int dw_PCIBoardEepromAddress, + unsigned short w_EepromStartAddress, unsigned short *pw_DataRead); diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h index b50774cdcf7..d288289143e 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h @@ -85,7 +85,7 @@ #define AMCC_OP_REG_MRTC 0x30 #define AMCC_OP_REG_MBEF 0x34 #define AMCC_OP_REG_INTCSR 0x38 -/* INT source */ +/* int source */ #define AMCC_OP_REG_INTCSR_SRC (AMCC_OP_REG_INTCSR + 2) /* FIFO ctrl */ #define AMCC_OP_REG_INTCSR_FEC (AMCC_OP_REG_INTCSR + 3) @@ -343,7 +343,7 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id, *card = amcc; return 0; /* ok, card is found */ } else { - rt_printk(" - \nCard on requested position is used b:s %d:%d!\n", + printk(" - \nCard on requested position is used b:s %d:%d!\n", pci_bus, pci_slot); return 2; /* card exist but is used */ } @@ -447,7 +447,7 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, /* use autodetection */ card = ptr_find_free_pci_card_by_device(vendor_id, device_id); if (card == NULL) { - rt_printk(" - Unused card not found in system!\n"); + printk(" - Unused card not found in system!\n"); return NULL; } } else { @@ -455,18 +455,18 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, pci_bus, pci_slot, &card)) { case 1: - rt_printk(" - Card not found on requested position b:s %d:%d!\n", + printk(" - Card not found on requested position b:s %d:%d!\n", pci_bus, pci_slot); return NULL; case 2: - rt_printk(" - Card on requested position is used b:s %d:%d!\n", + printk(" - Card on requested position is used b:s %d:%d!\n", pci_bus, pci_slot); return NULL; } } if (pci_card_alloc(card, i_Master) != 0) { - rt_printk(" - Can't allocate card!\n"); + printk(" - Can't allocate card!\n"); return NULL; } diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 618c69b6838..a56535fbcd3 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -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. @@ -68,25 +68,25 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #include "addi_common.h" #include "addi_amcc_s5933.h" -//Update-0.7.57->0.7.68MODULE_AUTHOR("ADDI-DATA GmbH <info@addi-data.com>"); -//Update-0.7.57->0.7.68MODULE_DESCRIPTION("Comedi ADDI-DATA module"); -//Update-0.7.57->0.7.68MODULE_LICENSE("GPL"); +/* Update-0.7.57->0.7.68MODULE_AUTHOR("ADDI-DATA GmbH <info@addi-data.com>"); */ +/* Update-0.7.57->0.7.68MODULE_DESCRIPTION("Comedi ADDI-DATA module"); */ +/* Update-0.7.57->0.7.68MODULE_LICENSE("GPL"); */ -#define devpriv ((addi_private *)dev->private) -#define this_board ((boardtype *)dev->board_ptr) +#define devpriv ((struct addi_private *)dev->private) +#define this_board ((struct addi_board *)dev->board_ptr) #if defined(CONFIG_APCI_1710) || defined(CONFIG_APCI_3200) || defined(CONFIG_APCI_3300) -//BYTE b_SaveFPUReg [94]; +/* BYTE b_SaveFPUReg [94]; */ void fpu_begin(void) { - //asm ("fstenv b_SaveFPUReg"); + /* asm ("fstenv b_SaveFPUReg"); */ kernel_fpu_begin(); } void fpu_end(void) { - // asm ("frstor b_SaveFPUReg"); + /* asm ("frstor b_SaveFPUReg"); */ kernel_fpu_end(); } #endif @@ -219,7 +219,7 @@ static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { MODULE_DEVICE_TABLE(pci, addi_apci_tbl); -static const boardtype boardtypes[] = { +static const struct addi_board boardtypes[] = { #ifdef CONFIG_APCI_3120 {"apci3120", APCI3120_BOARD_VENDOR_ID, @@ -901,7 +901,7 @@ static const boardtype boardtypes[] = { NULL}, #endif #ifdef CONFIG_APCI_3300 - //Begin JK 20.10.2004: APCI-3300 integration + /* Begin JK .20.10.2004 = APCI-3300 integration */ {"apci3300", APCI3200_BOARD_VENDOR_ID, 0x3007, @@ -2525,16 +2525,16 @@ static const boardtype boardtypes[] = { #endif }; -#define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) +#define n_boardtypes (sizeof(boardtypes)/sizeof(struct addi_board)) struct comedi_driver driver_addi = { - driver_name:"addi_common", - module:THIS_MODULE, - attach:i_ADDI_Attach, - detach:i_ADDI_Detach, - num_names:n_boardtypes, - board_name:&boardtypes[0].pc_DriverName, - offset:sizeof(boardtype), + .driver_name = "addi_common", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = n_boardtypes, + .board_name = &boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), }; COMEDI_PCI_INITCLEANUP(driver_addi, addi_apci_tbl); @@ -2559,11 +2559,11 @@ COMEDI_PCI_INITCLEANUP(driver_addi, addi_apci_tbl); +----------------------------------------------------------------------------+ */ -static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * it) +static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; int ret, pages, i, n_subdevices; - DWORD dw_Dummy; + unsigned int dw_Dummy; resource_size_t io_addr[5]; unsigned int irq; resource_size_t iobase_a, iobase_main, iobase_addon, iobase_reserved; @@ -2575,26 +2575,28 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i sprintf(c_Identifier, "Addi-Data GmbH Comedi %s", this_board->pc_DriverName); - if ((ret = alloc_private(dev, sizeof(addi_private))) < 0) { - return -ENOMEM; - } + ret = alloc_private(dev, sizeof(struct addi_private)); + if (ret < 0) + return -ENOMEM; if (!pci_list_builded) { - v_pci_card_list_init(this_board->i_VendorId, 1); //1 for displaying the list.. + v_pci_card_list_init(this_board->i_VendorId, 1); /* 1 for displaying the list.. */ pci_list_builded = 1; } - //rt_printk("comedi%d: addi_common: board=%s",dev->minor,this_board->pc_DriverName); + /* printk("comedi%d: addi_common: board=%s",dev->minor,this_board->pc_DriverName); */ if ((this_board->i_Dma) && (it->options[2] == 0)) { i_Dma = 1; } - if ((card = ptr_select_and_alloc_pci_card(this_board->i_VendorId, - this_board->i_DeviceId, - it->options[0], - it->options[1], i_Dma)) == NULL) { + card = ptr_select_and_alloc_pci_card(this_board->i_VendorId, + this_board->i_DeviceId, + it->options[0], + it->options[1], i_Dma); + + if (card == NULL) return -EIO; - } + devpriv->allocated = 1; if ((i_pci_card_data(card, &pci_bus, &pci_slot, &pci_func, &io_addr[0], @@ -2617,63 +2619,63 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i /************************************/ if (this_board->i_IorangeBase1 != 0) { - dev->iobase = (unsigned long)iobase_main; // DAQ base address... + dev->iobase = (unsigned long)iobase_main; /* DAQ base address... */ } else { - dev->iobase = (unsigned long)iobase_a; // DAQ base address... + dev->iobase = (unsigned long)iobase_a; /* DAQ base address... */ } dev->board_name = this_board->pc_DriverName; devpriv->amcc = card; - devpriv->iobase = (INT) dev->iobase; - devpriv->i_IobaseAmcc = (INT) iobase_a; //AMCC base address... - devpriv->i_IobaseAddon = (INT) iobase_addon; //ADD ON base address.... - devpriv->i_IobaseReserved = (INT) iobase_reserved; + devpriv->iobase = (int) dev->iobase; + devpriv->i_IobaseAmcc = (int) iobase_a; /* AMCC base address... */ + devpriv->i_IobaseAddon = (int) iobase_addon; /* ADD ON base address.... */ + devpriv->i_IobaseReserved = (int) iobase_reserved; devpriv->ps_BoardInfo = this_board; } else { dev->board_name = this_board->pc_DriverName; dev->iobase = (unsigned long)io_addr[2]; devpriv->amcc = card; - devpriv->iobase = (INT) io_addr[2]; + devpriv->iobase = (int) io_addr[2]; devpriv->ps_BoardInfo = this_board; - devpriv->i_IobaseReserved = (INT) io_addr[3]; + devpriv->i_IobaseReserved = (int) io_addr[3]; printk("\nioremap begin"); devpriv->dw_AiBase = - (ULONG_PTR) ioremap(io_addr[3], + (unsigned long) ioremap(io_addr[3], this_board->i_IorangeBase3); printk("\nioremap end"); } - //## + /* ## */ if (irq > 0) { - if (comedi_request_irq(irq, v_ADDI_Interrupt, IRQF_SHARED, + if (request_irq(irq, v_ADDI_Interrupt, IRQF_SHARED, c_Identifier, dev) < 0) { printk(", unable to allocate IRQ %u, DISABLING IT", irq); irq = 0; /* Can't use IRQ */ } else { - rt_printk("\nirq=%u", irq); + printk("\nirq=%u", irq); } } else { - rt_printk(", IRQ disabled"); + printk(", IRQ disabled"); } printk("\nOption %d %d %d\n", it->options[0], it->options[1], it->options[2]); dev->irq = irq; - // Read eepeom and fill boardtype Structure + /* Read eepeom and fill addi_board Structure */ if (this_board->i_PCIEeprom) { printk("\nPCI Eeprom used"); if (!(strcmp(this_board->pc_EepromChip, "S5920"))) { - // Set 3 wait stait + /* Set 3 wait stait */ if (!(strcmp(this_board->pc_DriverName, "apci035"))) { outl(0x80808082, devpriv->i_IobaseAmcc + 0x60); } else { outl(0x83838383, devpriv->i_IobaseAmcc + 0x60); } - // Enable the interrupt for the controler + /* Enable the interrupt for the controler */ dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38); outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38); printk("\nEnable the interrupt for the controler"); @@ -2694,16 +2696,15 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i if (this_board->i_Dma) { printk("\nDMA used"); if (devpriv->us_UseDma == ADDI_ENABLE) { - // alloc DMA buffers + /* alloc DMA buffers */ devpriv->b_DmaDoubleBuffer = 0; for (i = 0; i < 2; i++) { for (pages = 4; pages >= 0; pages--) { - if ((devpriv->ul_DmaBufferVirtual[i] = - (void *) - __get_free_pages - (GFP_KERNEL, pages))) { + devpriv->ul_DmaBufferVirtual[i] = + (void *) __get_free_pages(GFP_KERNEL, pages); + + if (devpriv->ul_DmaBufferVirtual[i]) break; - } } if (devpriv->ul_DmaBufferVirtual[i]) { devpriv->ui_DmaBufferPages[i] = pages; @@ -2718,7 +2719,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i } } if (!devpriv->ul_DmaBufferVirtual[0]) { - rt_printk + printk (", Can't allocate DMA buffer, DMA disabled!"); devpriv->us_UseDma = ADDI_DISABLE; } @@ -2729,7 +2730,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i } if ((devpriv->us_UseDma == ADDI_ENABLE)) { - rt_printk("\nDMA ENABLED\n"); + printk("\nDMA ENABLED\n"); } else { printk("\nDMA DISABLED\n"); } @@ -2739,23 +2740,24 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i #ifdef CONFIG_APCI_1710 i_ADDI_AttachPCI1710(dev); - // save base address + /* save base address */ devpriv->s_BoardInfos.ui_Address = io_addr[2]; #endif } else { - //Update-0.7.57->0.7.68dev->n_subdevices = 7; + /* Update-0.7.57->0.7.68dev->n_subdevices = 7; */ n_subdevices = 7; - if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) + ret = alloc_subdevices(dev, n_subdevices); + if (ret < 0) return ret; - // Allocate and Initialise AI Subdevice Structures + /* Allocate and Initialise AI Subdevice Structures */ s = dev->subdevices + 0; if ((this_board->i_NbrAiChannel) || (this_board->i_NbrAiChannelDiff)) { dev->read_subdev = s; s->type = COMEDI_SUBD_AI; s->subdev_flags = - SDF_READABLE | SDF_RT | SDF_COMMON | SDF_GROUND + SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; if (this_board->i_NbrAiChannel) { s->n_chan = this_board->i_NbrAiChannel; @@ -2786,13 +2788,11 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise AO Subdevice Structures + /* Allocate and Initialise AO Subdevice Structures */ s = dev->subdevices + 1; if (this_board->i_NbrAoChannel) { s->type = COMEDI_SUBD_AO; - s->subdev_flags = - SDF_WRITEABLE | SDF_GROUND | SDF_COMMON | - SDF_RT; + s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; s->n_chan = this_board->i_NbrAoChannel; s->maxdata = this_board->i_AoMaxdata; s->len_chanlist = this_board->i_NbrAoChannel; @@ -2804,12 +2804,11 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i } else { s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise DI Subdevice Structures + /* Allocate and Initialise DI Subdevice Structures */ s = dev->subdevices + 2; if (this_board->i_NbrDiChannel) { s->type = COMEDI_SUBD_DI; - s->subdev_flags = - SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = this_board->i_NbrDiChannel; s->maxdata = 1; s->len_chanlist = this_board->i_NbrDiChannel; @@ -2824,20 +2823,19 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i } else { s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise DO Subdevice Structures + /* Allocate and Initialise DO Subdevice Structures */ s = dev->subdevices + 3; if (this_board->i_NbrDoChannel) { s->type = COMEDI_SUBD_DO; s->subdev_flags = - SDF_READABLE | SDF_WRITEABLE | SDF_RT | - SDF_GROUND | SDF_COMMON; + SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; s->n_chan = this_board->i_NbrDoChannel; s->maxdata = this_board->i_DoMaxdata; s->len_chanlist = this_board->i_NbrDoChannel; s->range_table = &range_digital; s->io_bits = 0xf; /* all bits output */ - s->insn_config = this_board->i_hwdrv_InsnConfigDigitalOutput; //for digital output memory.. + s->insn_config = this_board->i_hwdrv_InsnConfigDigitalOutput; /* for digital output memory.. */ s->insn_write = this_board->i_hwdrv_InsnWriteDigitalOutput; s->insn_bits = @@ -2848,13 +2846,11 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise Timer Subdevice Structures + /* Allocate and Initialise Timer Subdevice Structures */ s = dev->subdevices + 4; if (this_board->i_Timer) { s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = - SDF_WRITEABLE | SDF_RT | SDF_GROUND | - SDF_COMMON; + s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 1; s->maxdata = 0; s->len_chanlist = 1; @@ -2868,13 +2864,12 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise TTL + /* Allocate and Initialise TTL */ s = dev->subdevices + 5; if (this_board->i_NbrTTLChannel) { s->type = COMEDI_SUBD_TTLIO; s->subdev_flags = - SDF_WRITEABLE | SDF_READABLE | SDF_RT | - SDF_GROUND | SDF_COMMON; + SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = this_board->i_NbrTTLChannel; s->maxdata = 1; s->io_bits = 0; /* all bits input */ @@ -2926,7 +2921,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i +----------------------------------------------------------------------------+ */ -static int i_ADDI_Detach(struct comedi_device * dev) +static int i_ADDI_Detach(struct comedi_device *dev) { if (dev->private) { @@ -2935,7 +2930,7 @@ static int i_ADDI_Detach(struct comedi_device * dev) } if (dev->irq) { - comedi_free_irq(dev->irq, dev); + free_irq(dev->irq, dev); } if ((devpriv->ps_BoardInfo->pc_EepromChip == NULL) @@ -2965,7 +2960,7 @@ static int i_ADDI_Detach(struct comedi_device * dev) } if (pci_list_builded) { - //v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC); + /* v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC); */ v_pci_card_list_cleanup(this_board->i_VendorId); pci_list_builded = 0; } @@ -2992,18 +2987,18 @@ static int i_ADDI_Detach(struct comedi_device * dev) +----------------------------------------------------------------------------+ */ -static int i_ADDI_Reset(struct comedi_device * dev) +static int i_ADDI_Reset(struct comedi_device *dev) { this_board->i_hwdrv_Reset(dev); return 0; } -// Interrupt function +/* Interrupt function */ /* +----------------------------------------------------------------------------+ | Function name : | -|static void v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG) | +|static void v_ADDI_Interrupt(int irq, void *d) | | | +----------------------------------------------------------------------------+ | Task : Registerd interrupt routine | @@ -3018,14 +3013,14 @@ static int i_ADDI_Reset(struct comedi_device * dev) +----------------------------------------------------------------------------+ */ -static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t v_ADDI_Interrupt(int irq, void *d) { struct comedi_device *dev = d; this_board->v_hwdrv_Interrupt(irq, d); return IRQ_RETVAL(1); } -// EEPROM Read Function +/* EEPROM Read Function */ /* +----------------------------------------------------------------------------+ | Function name : | @@ -3046,17 +3041,17 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG) +----------------------------------------------------------------------------+ */ -static int i_ADDIDATA_InsnReadEeprom(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - WORD w_Data; - WORD w_Address; - w_Address = CR_CHAN(insn->chanspec); // address to be read as 0,1,2,3...255 + unsigned short w_Data; + unsigned short w_Address; + w_Address = CR_CHAN(insn->chanspec); /* address to be read as 0,1,2,3...255 */ w_Data = w_EepromReadWord(devpriv->i_IobaseAmcc, this_board->pc_EepromChip, 0x100 + (2 * w_Address)); data[0] = w_Data; - //multiplied by 2 bcozinput will be like 0,1,2...255 + /* multiplied by 2 bcozinput will be like 0,1,2...255 */ return insn->n; } diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index 19df5c1444a..edd657b902a 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -36,26 +36,12 @@ #define ERROR -1 #define SUCCESS 1 -/* variable type definition */ -typedef unsigned char BYTE, *PBYTE; -typedef short SHORT, *PSHORT; -typedef unsigned short USHORT, *PUSHORT; -typedef unsigned short WORD, *PWORD; -typedef int INT, *PINT;; -typedef unsigned int UINT, *PUINT; -typedef int LONG, *PLONG; /* 32-bit */ -typedef unsigned int ULONG, *PULONG; /* 32-bit */ -typedef unsigned int DWORD, *PDWORD; /* 32-bit */ -typedef unsigned long ULONG_PTR; - -typedef const struct comedi_lrange *PCRANGE; - -#define LOBYTE(W) (BYTE)((W) & 0xFF) -#define HIBYTE(W) (BYTE)(((W) >> 8) & 0xFF) -#define MAKEWORD(H, L) (USHORT)((L) | ((H) << 8)) -#define LOWORD(W) (USHORT)((W) & 0xFFFF) -#define HIWORD(W) (USHORT)(((W) >> 16) & 0xFFFF) -#define MAKEDWORD(H, L) (UINT)((L) | ((H) << 16)) +#define LOBYTE(W) (unsigned char)((W) & 0xFF) +#define HIBYTE(W) (unsigned char)(((W) >> 8) & 0xFF) +#define MAKEWORD(H, L) (unsigned short)((L) | ((H) << 8)) +#define LOWORD(W) (unsigned short)((W) & 0xFFFF) +#define HIWORD(W) (unsigned short)(((W) >> 16) & 0xFFFF) +#define MAKEDWORD(H, L) (unsigned int)((L) | ((H) << 16)) #define ADDI_ENABLE 1 #define ADDI_DISABLE 0 @@ -75,37 +61,37 @@ typedef const struct comedi_lrange *PCRANGE; /* Structures */ /* structure for the boardtype */ -typedef struct { - const char *pc_DriverName; // driver name - INT i_VendorId; //PCI vendor a device ID of card - INT i_DeviceId; - INT i_IorangeBase0; - INT i_IorangeBase1; - INT i_IorangeBase2; // base 2 range - INT i_IorangeBase3; // base 3 range - INT i_PCIEeprom; // eeprom present or not - char *pc_EepromChip; // type of chip - INT i_NbrAiChannel; // num of A/D chans - INT i_NbrAiChannelDiff; // num of A/D chans in diff mode - INT i_AiChannelList; // len of chanlist - INT i_NbrAoChannel; // num of D/A chans - INT i_AiMaxdata; // resolution of A/D - INT i_AoMaxdata; // resolution of D/A - PCRANGE pr_AiRangelist; // rangelist for A/D - PCRANGE pr_AoRangelist; // rangelist for D/A - - INT i_NbrDiChannel; // Number of DI channels - INT i_NbrDoChannel; // Number of DO channels - INT i_DoMaxdata; // data to set all chanels high - - INT i_NbrTTLChannel; // Number of TTL channels - PCRANGE pr_TTLRangelist; // rangelist for TTL - - INT i_Dma; // dma present or not - INT i_Timer; // timer subdevice present or not - BYTE b_AvailableConvertUnit; - UINT ui_MinAcquisitiontimeNs; // Minimum Acquisition in Nano secs - UINT ui_MinDelaytimeNs; // Minimum Delay in Nano secs +struct addi_board { + const char *pc_DriverName; /* driver name */ + int i_VendorId; /* PCI vendor a device ID of card */ + int i_DeviceId; + int i_IorangeBase0; + int i_IorangeBase1; + int i_IorangeBase2; /* base 2 range */ + int i_IorangeBase3; /* base 3 range */ + int i_PCIEeprom; /* eeprom present or not */ + char *pc_EepromChip; /* type of chip */ + int i_NbrAiChannel; /* num of A/D chans */ + int i_NbrAiChannelDiff; /* num of A/D chans in diff mode */ + int i_AiChannelList; /* len of chanlist */ + int i_NbrAoChannel; /* num of D/A chans */ + int i_AiMaxdata; /* resolution of A/D */ + int i_AoMaxdata; /* resolution of D/A */ + const struct comedi_lrange *pr_AiRangelist; /* rangelist for A/D */ + const struct comedi_lrange *pr_AoRangelist; /* rangelist for D/A */ + + int i_NbrDiChannel; /* Number of DI channels */ + int i_NbrDoChannel; /* Number of DO channels */ + int i_DoMaxdata; /* data to set all chanels high */ + + int i_NbrTTLChannel; /* Number of TTL channels */ + const struct comedi_lrange *pr_TTLRangelist; /* rangelist for TTL */ + + int i_Dma; /* dma present or not */ + int i_Timer; /* timer subdevice present or not */ + unsigned char b_AvailableConvertUnit; + unsigned int ui_MinAcquisitiontimeNs; /* Minimum Acquisition in Nano secs */ + unsigned int ui_MinDelaytimeNs; /* Minimum Delay in Nano secs */ /* interrupt and reset */ void (*v_hwdrv_Interrupt)(int irq, void *d); @@ -213,21 +199,21 @@ typedef struct { int (*i_hwdr_WriteTTLIOChlOnOff)(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -} boardtype; +}; -//MODULE INFO STRUCTURE +/* MODULE INFO STRUCTURE */ -typedef union { +union str_ModuleInfo { /* Incremental counter infos */ struct { union { struct { - BYTE b_ModeRegister1; - BYTE b_ModeRegister2; - BYTE b_ModeRegister3; - BYTE b_ModeRegister4; + unsigned char b_ModeRegister1; + unsigned char b_ModeRegister2; + unsigned char b_ModeRegister3; + unsigned char b_ModeRegister4; } s_ByteModeRegister; - DWORD dw_ModeRegister1_2_3_4; + unsigned int dw_ModeRegister1_2_3_4; } s_ModeRegister; struct { @@ -244,25 +230,25 @@ typedef union { /* SSI infos */ struct { - BYTE b_SSIProfile; - BYTE b_PositionTurnLength; - BYTE b_TurnCptLength; - BYTE b_SSIInit; + unsigned char b_SSIProfile; + unsigned char b_PositionTurnLength; + unsigned char b_TurnCptLength; + unsigned char b_SSIInit; } s_SSICounterInfo; /* TTL I/O infos */ struct { - BYTE b_TTLInit; - BYTE b_PortConfiguration[4]; + unsigned char b_TTLInit; + unsigned char b_PortConfiguration[4]; } s_TTLIOInfo; /* Digital I/O infos */ struct { - BYTE b_DigitalInit; - BYTE b_ChannelAMode; - BYTE b_ChannelBMode; - BYTE b_OutputMemoryEnabled; - DWORD dw_OutputMemory; + unsigned char b_DigitalInit; + unsigned char b_ChannelAMode; + unsigned char b_ChannelBMode; + unsigned char b_OutputMemoryEnabled; + unsigned int dw_OutputMemory; } s_DigitalIOInfo; /*********************/ @@ -271,14 +257,14 @@ typedef union { struct { struct { - BYTE b_82X54Init; - BYTE b_InputClockSelection; - BYTE b_InputClockLevel; - BYTE b_OutputLevel; - BYTE b_HardwareGateLevel; - DWORD dw_ConfigurationWord; + unsigned char b_82X54Init; + unsigned char b_InputClockSelection; + unsigned char b_InputClockLevel; + unsigned char b_OutputLevel; + unsigned char b_HardwareGateLevel; + unsigned int dw_ConfigurationWord; } s_82X54TimerInfo[3]; - BYTE b_InterruptMask; + unsigned char b_InterruptMask; } s_82X54ModuleInfo; /*********************/ @@ -286,13 +272,13 @@ typedef union { /*********************/ struct { - BYTE b_ChronoInit; - BYTE b_InterruptMask; - BYTE b_PCIInputClock; - BYTE b_TimingUnit; - BYTE b_CycleMode; + unsigned char b_ChronoInit; + unsigned char b_InterruptMask; + unsigned char b_PCIInputClock; + unsigned char b_TimingUnit; + unsigned char b_CycleMode; double d_TimingInterval; - DWORD dw_ConfigReg; + unsigned int dw_ConfigReg; } s_ChronoModuleInfo; /***********************/ @@ -301,154 +287,154 @@ typedef union { struct { struct { - BYTE b_PulseEncoderInit; + unsigned char b_PulseEncoderInit; } s_PulseEncoderInfo[4]; - DWORD dw_SetRegister; - DWORD dw_ControlRegister; - DWORD dw_StatusRegister; + unsigned int dw_SetRegister; + unsigned int dw_ControlRegister; + unsigned int dw_StatusRegister; } s_PulseEncoderModuleInfo; /* Tor conter infos */ struct { struct { - BYTE b_TorCounterInit; - BYTE b_TimingUnit; - BYTE b_InterruptEnable; + unsigned char b_TorCounterInit; + unsigned char b_TimingUnit; + unsigned char b_InterruptEnable; double d_TimingInterval; - ULONG ul_RealTimingInterval; + unsigned int ul_RealTimingInterval; } s_TorCounterInfo[2]; - BYTE b_PCIInputClock; + unsigned char b_PCIInputClock; } s_TorCounterModuleInfo; /* PWM infos */ struct { struct { - BYTE b_PWMInit; - BYTE b_TimingUnit; - BYTE b_InterruptEnable; + unsigned char b_PWMInit; + unsigned char b_TimingUnit; + unsigned char b_InterruptEnable; double d_LowTiming; double d_HighTiming; - ULONG ul_RealLowTiming; - ULONG ul_RealHighTiming; + unsigned int ul_RealLowTiming; + unsigned int ul_RealHighTiming; } s_PWMInfo[2]; - BYTE b_ClockSelection; + unsigned char b_ClockSelection; } s_PWMModuleInfo; /* ETM infos */ struct { struct { - BYTE b_ETMEnable; - BYTE b_ETMInterrupt; + unsigned char b_ETMEnable; + unsigned char b_ETMInterrupt; } s_ETMInfo[2]; - BYTE b_ETMInit; - BYTE b_TimingUnit; - BYTE b_ClockSelection; + unsigned char b_ETMInit; + unsigned char b_TimingUnit; + unsigned char b_ClockSelection; double d_TimingInterval; - ULONG ul_Timing; + unsigned int ul_Timing; } s_ETMModuleInfo; /* CDA infos */ struct { - BYTE b_CDAEnable; - BYTE b_CDAInterrupt; - BYTE b_CDAInit; - BYTE b_FctSelection; - BYTE b_CDAReadFIFOOverflow; + unsigned char b_CDAEnable; + unsigned char b_CDAInterrupt; + unsigned char b_CDAInit; + unsigned char b_FctSelection; + unsigned char b_CDAReadFIFOOverflow; } s_CDAModuleInfo; -} str_ModuleInfo; +}; /* Private structure for the addi_apci3120 driver */ -typedef struct { - - INT iobase; - INT i_IobaseAmcc; // base+size for AMCC chip - INT i_IobaseAddon; //addon base address - INT i_IobaseReserved; - ULONG_PTR dw_AiBase; - struct pcilst_struct *amcc; // ptr too AMCC data - BYTE allocated; // we have blocked card - BYTE b_ValidDriver; // driver is ok - BYTE b_AiContinuous; // we do unlimited AI - BYTE b_AiInitialisation; - UINT ui_AiActualScan; //how many scans we finished - UINT ui_AiBufferPtr; // data buffer ptr in samples - UINT ui_AiNbrofChannels; // how many channels is measured - UINT ui_AiScanLength; // Length of actual scanlist - UINT ui_AiActualScanPosition; // position in actual scan - PUINT pui_AiChannelList; // actual chanlist - UINT ui_AiChannelList[32]; // actual chanlist - BYTE b_AiChannelConfiguration[32]; // actual chanlist - UINT ui_AiReadData[32]; - DWORD dw_AiInitialised; - UINT ui_AiTimer0; //Timer Constant for Timer0 - UINT ui_AiTimer1; //Timer constant for Timer1 - UINT ui_AiFlags; - UINT ui_AiDataLength; - short *AiData; // Pointer to sample data - UINT ui_AiNbrofScans; // number of scans to do - USHORT us_UseDma; // To use Dma or not - BYTE b_DmaDoubleBuffer; // we can use double buffering - UINT ui_DmaActualBuffer; // which buffer is used now - //*UPDATE-0.7.57->0.7.68 - //ULONG ul_DmaBufferVirtual[2];// pointers to begin of DMA buffer - short *ul_DmaBufferVirtual[2]; // pointers to begin of DMA buffer - ULONG ul_DmaBufferHw[2]; // hw address of DMA buff - UINT ui_DmaBufferSize[2]; // size of dma buffer in bytes - UINT ui_DmaBufferUsesize[2]; // which size we may now used for transfer - UINT ui_DmaBufferSamples[2]; // size in samples - UINT ui_DmaBufferPages[2]; // number of pages in buffer - BYTE b_DigitalOutputRegister; // Digital Output Register - BYTE b_OutputMemoryStatus; - BYTE b_AnalogInputChannelNbr; // Analog input channel Nbr - BYTE b_AnalogOutputChannelNbr; // Analog input Output Nbr - BYTE b_TimerSelectMode; // Contain data written at iobase + 0C - BYTE b_ModeSelectRegister; // Contain data written at iobase + 0E - USHORT us_OutputRegister; // Contain data written at iobase + 0 - BYTE b_InterruptState; - BYTE b_TimerInit; // Specify if InitTimerWatchdog was load - BYTE b_TimerStarted; // Specify if timer 2 is running or not - BYTE b_Timer2Mode; // Specify the timer 2 mode - BYTE b_Timer2Interrupt; //Timer2 interrupt enable or disable - BYTE b_AiCyclicAcquisition; // indicate cyclic acquisition - BYTE b_InterruptMode; // eoc eos or dma - BYTE b_EocEosInterrupt; // Enable disable eoc eos interrupt - UINT ui_EocEosConversionTime; - BYTE b_EocEosConversionTimeBase; - BYTE b_SingelDiff; - BYTE b_ExttrigEnable; /* To enable or disable external trigger */ +struct addi_private { + + int iobase; + int i_IobaseAmcc; /* base+size for AMCC chip */ + int i_IobaseAddon; /* addon base address */ + int i_IobaseReserved; + unsigned long dw_AiBase; + struct pcilst_struct *amcc; /* ptr too AMCC data */ + unsigned char allocated; /* we have blocked card */ + unsigned char b_ValidDriver; /* driver is ok */ + unsigned char b_AiContinuous; /* we do unlimited AI */ + unsigned char b_AiInitialisation; + unsigned int ui_AiActualScan; /* how many scans we finished */ + unsigned int ui_AiBufferPtr; /* data buffer ptr in samples */ + unsigned int ui_AiNbrofChannels; /* how many channels is measured */ + unsigned int ui_AiScanLength; /* Length of actual scanlist */ + unsigned int ui_AiActualScanPosition; /* position in actual scan */ + unsigned int *pui_AiChannelList; /* actual chanlist */ + unsigned int ui_AiChannelList[32]; /* actual chanlist */ + unsigned char b_AiChannelConfiguration[32]; /* actual chanlist */ + unsigned int ui_AiReadData[32]; + unsigned int dw_AiInitialised; + unsigned int ui_AiTimer0; /* Timer Constant for Timer0 */ + unsigned int ui_AiTimer1; /* Timer constant for Timer1 */ + unsigned int ui_AiFlags; + unsigned int ui_AiDataLength; + short *AiData; /* Pointer to sample data */ + unsigned int ui_AiNbrofScans; /* number of scans to do */ + unsigned short us_UseDma; /* To use Dma or not */ + unsigned char b_DmaDoubleBuffer; /* we can use double buffering */ + unsigned int ui_DmaActualBuffer; /* which buffer is used now */ + /* UPDATE-0.7.57->0.7.68 */ + /* unsigned int ul_DmaBufferVirtual[2]; pointers to begin of DMA buffer */ + short *ul_DmaBufferVirtual[2]; /* pointers to begin of DMA buffer */ + unsigned int ul_DmaBufferHw[2]; /* hw address of DMA buff */ + unsigned int ui_DmaBufferSize[2]; /* size of dma buffer in bytes */ + unsigned int ui_DmaBufferUsesize[2]; /* which size we may now used for transfer */ + unsigned int ui_DmaBufferSamples[2]; /* size in samples */ + unsigned int ui_DmaBufferPages[2]; /* number of pages in buffer */ + unsigned char b_DigitalOutputRegister; /* Digital Output Register */ + unsigned char b_OutputMemoryStatus; + unsigned char b_AnalogInputChannelNbr; /* Analog input channel Nbr */ + unsigned char b_AnalogOutputChannelNbr; /* Analog input Output Nbr */ + unsigned char b_TimerSelectMode; /* Contain data written at iobase + 0C */ + unsigned char b_ModeSelectRegister; /* Contain data written at iobase + 0E */ + unsigned short us_OutputRegister; /* Contain data written at iobase + 0 */ + unsigned char b_InterruptState; + unsigned char b_TimerInit; /* Specify if InitTimerWatchdog was load */ + unsigned char b_TimerStarted; /* Specify if timer 2 is running or not */ + unsigned char b_Timer2Mode; /* Specify the timer 2 mode */ + unsigned char b_Timer2Interrupt; /* Timer2 interrupt enable or disable */ + unsigned char b_AiCyclicAcquisition; /* indicate cyclic acquisition */ + unsigned char b_InterruptMode; /* eoc eos or dma */ + unsigned char b_EocEosInterrupt; /* Enable disable eoc eos interrupt */ + unsigned int ui_EocEosConversionTime; + unsigned char b_EocEosConversionTimeBase; + unsigned char b_SingelDiff; + unsigned char b_ExttrigEnable; /* To enable or disable external trigger */ /* Pointer to the current process */ struct task_struct *tsk_Current; - boardtype *ps_BoardInfo; + struct addi_board *ps_BoardInfo; /* Hardware board infos for 1710 */ struct { - UINT ui_Address; /* Board address */ - UINT ui_FlashAddress; - BYTE b_InterruptNbr; /* Board interrupt number */ - BYTE b_SlotNumber; /* PCI slot number */ - BYTE b_BoardVersion; - DWORD dw_MolduleConfiguration[4]; /* Module config */ + unsigned int ui_Address; /* Board address */ + unsigned int ui_FlashAddress; + unsigned char b_InterruptNbr; /* Board interrupt number */ + unsigned char b_SlotNumber; /* PCI slot number */ + unsigned char b_BoardVersion; + unsigned int dw_MolduleConfiguration[4]; /* Module config */ } s_BoardInfos; /* Interrupt infos */ struct { - ULONG ul_InterruptOccur; /* 0 : No interrupt occur */ + unsigned int ul_InterruptOccur; /* 0 : No interrupt occur */ /* > 0 : Interrupt occur */ - UINT ui_Read; /* Read FIFO */ - UINT ui_Write; /* Write FIFO */ + unsigned int ui_Read; /* Read FIFO */ + unsigned int ui_Write; /* Write FIFO */ struct { - BYTE b_OldModuleMask; - ULONG ul_OldInterruptMask; /* Interrupt mask */ - ULONG ul_OldCounterLatchValue; /* Interrupt counter value */ + unsigned char b_OldModuleMask; + unsigned int ul_OldInterruptMask; /* Interrupt mask */ + unsigned int ul_OldCounterLatchValue; /* Interrupt counter value */ } s_FIFOInterruptParameters[APCI1710_SAVE_INTERRUPT]; } s_InterruptParameters; - str_ModuleInfo s_ModuleInfo[4]; - ULONG ul_TTLPortConfiguration[10]; + union str_ModuleInfo s_ModuleInfo[4]; + unsigned int ul_TTLPortConfiguration[10]; -} addi_private; +}; static unsigned short pci_list_builded; /* set to 1 when list of card is known */ @@ -457,6 +443,6 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) static int i_ADDI_Detach(struct comedi_device *dev); static int i_ADDI_Reset(struct comedi_device *dev); -static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t v_ADDI_Interrupt(int irq, void *d); static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c b/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c index a8a1bb2e8fa..69b427390e5 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c @@ -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. @@ -45,19 +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 WORD unsigned short -#define PWORD unsigned short * -#define PDWORD unsigned int * - -#ifndef DWORD -#define DWORD unsigned int -#endif +#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 @@ -68,107 +60,114 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #define EEPROM_TIMER_WATCHDOG_COUNTER 10 struct str_Functionality { - BYTE b_Type; - WORD w_Address; + unsigned char b_Type; + unsigned short w_Address; }; -typedef struct { - WORD w_HeaderSize; - BYTE b_Nfunctions; +struct str_MainHeader { + unsigned short w_HeaderSize; + unsigned char b_Nfunctions; struct str_Functionality s_Functions[7]; -} str_MainHeader; +}; -typedef struct { - WORD w_Nchannel; - BYTE b_Interruptible; - WORD w_NinterruptLogic; -} str_DigitalInputHeader; +struct str_DigitalInputHeader { + unsigned short w_Nchannel; + unsigned char b_Interruptible; + unsigned short w_NinterruptLogic; +}; -typedef struct { - WORD w_Nchannel; -} str_DigitalOutputHeader; +struct str_DigitalOutputHeader { -// used for timer as well as watchdog + unsigned short w_Nchannel; +}; -typedef struct { - WORD w_HeaderSize; - BYTE b_Resolution; - BYTE b_Mode; // in case of Watchdog it is functionality - WORD w_MinTiming; - BYTE b_TimeBase; -} str_TimerDetails; -typedef struct { - WORD w_Ntimer; - str_TimerDetails s_TimerDetails[4]; // supports 4 timers -} str_TimerMainHeader; +/* 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 short w_MinTiming; + unsigned char b_TimeBase; +}; + +struct str_TimerMainHeader { + + + unsigned short w_Ntimer; + struct str_TimerDetails s_TimerDetails[4]; /* supports 4 timers */ +}; + typedef struct { - WORD w_Nchannel; - BYTE b_Resolution; + unsigned short w_Nchannel; + unsigned char b_Resolution; } str_AnalogOutputHeader; -typedef struct { - WORD w_Nchannel; - WORD w_MinConvertTiming; - WORD w_MinDelayTiming; - BYTE b_HasDma; - BYTE b_Resolution; -} str_AnalogInputHeader; +struct str_AnalogInputHeader { + unsigned short w_Nchannel; + unsigned short w_MinConvertTiming; + unsigned short w_MinDelayTiming; + unsigned char b_HasDma; + unsigned char b_Resolution; +}; + /*****************************************/ /* Read Header Functions */ /*****************************************/ -INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, +int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation, struct comedi_device *dev); -INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_DigitalInputHeader * s_Header); +int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_DigitalInputHeader *s_Header); -INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_DigitalOutputHeader * s_Header); +int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_DigitalOutputHeader *s_Header); -INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_TimerMainHeader * s_Header); +int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_TimerMainHeader *s_Header); -INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_AnalogOutputHeader * s_Header); +int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + str_AnalogOutputHeader *s_Header); -INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_AnalogInputHeader * s_Header); +int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_AnalogInputHeader *s_Header); /******************************************/ /* Eeprom Specific Functions */ /******************************************/ -WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, - WORD w_EepromStartAddress); -void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress); -void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue); -void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress); -void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, - BYTE b_DataLengthInBits); -void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value); +unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation, + unsigned short w_EepromStartAddress); +void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress); +void v_EepromClock76(unsigned int dw_Address, unsigned int dw_RegisterValue); +void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress); +void v_EepromSendCommand76(unsigned int dw_Address, unsigned int dw_EepromCommand, + unsigned char b_DataLengthInBits); +void v_EepromCs76Read(unsigned int dw_Address, unsigned short w_offset, unsigned short *pw_Value); /* +----------------------------------------------------------------------------+ -| Function Name : WORD w_EepromReadWord | -| (WORD w_PCIBoardEepromAddress, | +| Function Name : unsigned short w_EepromReadWord | +| (unsigned short w_PCIBoardEepromAddress, | | char * pc_PCIChipInformation, | -| WORD w_EepromStartAddress) | +| unsigned short w_EepromStartAddress) | +----------------------------------------------------------------------------+ | Task : Read from eepromn a word | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| WORD w_EepromStartAddress : Selected eeprom address | +| unsigned short w_EepromStartAddress : Selected eeprom address | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -176,23 +175,23 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value); +----------------------------------------------------------------------------+ */ -WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, - WORD w_EepromStartAddress) +unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation, + unsigned short w_EepromStartAddress) { - BYTE b_Counter = 0; + unsigned char b_Counter = 0; - BYTE b_ReadByte = 0; + unsigned char b_ReadByte = 0; - BYTE b_ReadLowByte = 0; + unsigned char b_ReadLowByte = 0; - BYTE b_ReadHighByte = 0; + unsigned char b_ReadHighByte = 0; - BYTE b_SelectedAddressLow = 0; + unsigned char b_SelectedAddressLow = 0; - BYTE b_SelectedAddressHigh = 0; + unsigned char b_SelectedAddressHigh = 0; - WORD w_ReadWord = 0; + unsigned short w_ReadWord = 0; /**************************/ @@ -207,9 +206,9 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, 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 */ /************************************/ @@ -320,20 +319,20 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, 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 | (((WORD) b_ReadHighByte) * 256)); + 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")) { @@ -349,7 +348,7 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, } - return (w_ReadWord); + return w_ReadWord; } @@ -359,7 +358,7 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, | Function Name : void v_EepromWaitBusy | -| (WORD w_PCIBoardEepromAddress) | +| (unsigned short w_PCIBoardEepromAddress) | +----------------------------------------------------------------------------+ @@ -367,7 +366,7 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom base address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom base address | +----------------------------------------------------------------------------+ @@ -381,10 +380,10 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, */ -void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) +void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress) { - BYTE b_EepromBusy = 0; + unsigned char b_EepromBusy = 0; do { @@ -403,17 +402,16 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) /* the operator register is AMCC_OP_REG_MCSR+3 */ - /* WORD read EEPROM=0x8000 andAMCC_OP_REG_MCSR+2 */ + /* unsigned short read EEPROM=0x8000 andAMCC_OP_REG_MCSR+2 */ - /* DWORD read EEPROM=0x80000000 and AMCC_OP_REG_MCSR */ + /* unsigned int read EEPROM=0x80000000 and AMCC_OP_REG_MCSR */ /************************************************************************/ b_EepromBusy = inb(w_PCIBoardEepromAddress + 0x3F); b_EepromBusy = b_EepromBusy & 0x80; - } - while (b_EepromBusy == 0x80); + } while (b_EepromBusy == 0x80); } @@ -421,9 +419,9 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) +---------------------------------------------------------------------------------+ -| Function Name : void v_EepromClock76(DWORD dw_Address, | +| Function Name : void v_EepromClock76(unsigned int dw_Address, | -| DWORD dw_RegisterValue) | +| unsigned int dw_RegisterValue) | +---------------------------------------------------------------------------------+ @@ -431,9 +429,9 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) +---------------------------------------------------------------------------------+ -| Input Parameters : DWORD dw_Address : PCI eeprom base address | +| Input Parameters : unsigned int dw_Address : PCI eeprom base address | -| DWORD dw_RegisterValue : PCI eeprom register value to write.| +| unsigned int dw_RegisterValue : PCI eeprom register value to write.| +---------------------------------------------------------------------------------+ @@ -447,7 +445,7 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) */ -void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue) +void v_EepromClock76(unsigned int dw_Address, unsigned int dw_RegisterValue) { /************************/ @@ -488,11 +486,11 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue) +---------------------------------------------------------------------------------+ -| Function Name : void v_EepromSendCommand76(DWORD dw_Address, | +| Function Name : void v_EepromSendCommand76(unsigned int dw_Address, | -| DWORD dw_EepromCommand, | +| unsigned int dw_EepromCommand, | -| BYTE b_DataLengthInBits) | +| unsigned char b_DataLengthInBits) | +---------------------------------------------------------------------------------+ @@ -500,11 +498,11 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue) +---------------------------------------------------------------------------------+ -| Input Parameters : DWORD dw_Address : PCI eeprom base address | +| Input Parameters : unsigned int dw_Address : PCI eeprom base address | -| DWORD dw_EepromCommand : PCI eeprom command to write. | +| unsigned int dw_EepromCommand : PCI eeprom command to write. | -| BYTE b_DataLengthInBits : PCI eeprom command data length. | +| unsigned char b_DataLengthInBits : PCI eeprom command data length. | +---------------------------------------------------------------------------------+ @@ -518,13 +516,13 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue) */ -void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, - BYTE b_DataLengthInBits) +void v_EepromSendCommand76(unsigned int dw_Address, unsigned int dw_EepromCommand, + unsigned char b_DataLengthInBits) { char c_BitPos = 0; - DWORD dw_RegisterValue = 0; + unsigned int dw_RegisterValue = 0; /*****************************/ @@ -623,11 +621,11 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, +---------------------------------------------------------------------------------+ -| Function Name : void v_EepromCs76Read(DWORD dw_Address, | +| Function Name : void v_EepromCs76Read(unsigned int dw_Address, | -| WORD w_offset, | +| unsigned short w_offset, | -| PWORD pw_Value) | +| unsigned short * pw_Value) | +---------------------------------------------------------------------------------+ @@ -635,11 +633,11 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, +---------------------------------------------------------------------------------+ -| Input Parameters : DWORD dw_Address : PCI eeprom base address | +| Input Parameters : unsigned int dw_Address : PCI eeprom base address | -| WORD w_offset : Offset of the adress to read | +| unsigned short w_offset : Offset of the adress to read | -| PWORD pw_Value : PCI eeprom 16 bit read value. | +| unsigned short * pw_Value : PCI eeprom 16 bit read value. | +---------------------------------------------------------------------------------+ @@ -653,14 +651,14 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, */ -void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value) +void v_EepromCs76Read(unsigned int dw_Address, unsigned short w_offset, unsigned short *pw_Value) { char c_BitPos = 0; - DWORD dw_RegisterValue = 0; + unsigned int dw_RegisterValue = 0; - DWORD dw_RegisterValueRead = 0; + unsigned int dw_RegisterValueRead = 0; /*************************************************/ @@ -786,12 +784,12 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value) /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, | +| Function Name : int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress, | | char * pc_PCIChipInformation,struct comedi_device *dev) | +----------------------------------------------------------------------------+ | Task : Read from eeprom Main Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | @@ -804,43 +802,43 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value) +----------------------------------------------------------------------------+ */ -INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, +int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation, struct comedi_device *dev) { - WORD w_Temp, i, w_Count = 0; - UINT ui_Temp; - str_MainHeader s_MainHeader; - str_DigitalInputHeader s_DigitalInputHeader; - str_DigitalOutputHeader s_DigitalOutputHeader; - //str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; + unsigned short w_Temp, i, w_Count = 0; + unsigned int ui_Temp; + struct str_MainHeader s_MainHeader; + 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 + /* Read size */ s_MainHeader.w_HeaderSize = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + 8); - // Read nbr of functionality + /* Read nbr of functionality */ w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + 10); - s_MainHeader.b_Nfunctions = (BYTE) w_Temp & 0x00FF; + s_MainHeader.b_Nfunctions = (unsigned char) w_Temp & 0x00FF; - // Read functionality details + /* Read functionality details */ for (i = 0; i < s_MainHeader.b_Nfunctions; i++) { - // Read Type + /* Read Type */ w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + 12 + w_Count); - s_MainHeader.s_Functions[i].b_Type = (BYTE) w_Temp & 0x3F; + s_MainHeader.s_Functions[i].b_Type = (unsigned char) w_Temp & 0x3F; w_Count = w_Count + 2; - //Read Address + /* Read Address */ s_MainHeader.s_Functions[i].w_Address = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + 12 + w_Count); w_Count = w_Count + 2; } - // Display main header info + /* Display main header info */ for (i = 0; i < s_MainHeader.b_Nfunctions; i++) { switch (s_MainHeader.s_Functions[i].b_Type) { @@ -878,10 +876,10 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, s_AnalogInputHeader.w_Nchannel; this_board->i_Dma = s_AnalogInputHeader.b_HasDma; this_board->ui_MinAcquisitiontimeNs = - (UINT) s_AnalogInputHeader.w_MinConvertTiming * + (unsigned int) s_AnalogInputHeader.w_MinConvertTiming * 1000; this_board->ui_MinDelaytimeNs = - (UINT) s_AnalogInputHeader.w_MinDelayTiming * + (unsigned int) s_AnalogInputHeader.w_MinDelayTiming * 1000; ui_Temp = 0xffff; this_board->i_AiMaxdata = @@ -903,15 +901,15 @@ INT i_EepromReadMainHeader(WORD 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 */ } } @@ -920,18 +918,18 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadDigitalInputHeader(WORD | +| Function Name : int i_EepromReadDigitalInputHeader(unsigned short | | w_PCIBoardEepromAddress,char *pc_PCIChipInformation, | -| WORD w_Address,str_DigitalInputHeader *s_Header) | +| unsigned short w_Address,struct str_DigitalInputHeader *s_Header) | | | +----------------------------------------------------------------------------+ | Task : Read Digital Input Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| str_DigitalInputHeader *s_Header: Digita Input Header | +| struct str_DigitalInputHeader *s_Header: Digita Input Header | | Pointer | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -939,23 +937,23 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, | Return Value : 0 | +----------------------------------------------------------------------------+ */ -INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_DigitalInputHeader * s_Header) +int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_DigitalInputHeader *s_Header) { - WORD w_Temp; + 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 = (BYTE) (w_Temp >> 7) & 0x01; + 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); @@ -965,18 +963,18 @@ INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadDigitalOutputHeader(WORD | +| Function Name : int i_EepromReadDigitalOutputHeader(unsigned short | | w_PCIBoardEepromAddress,char *pc_PCIChipInformation, | -| WORD w_Address,str_DigitalOutputHeader *s_Header) | +| unsigned short w_Address,struct str_DigitalOutputHeader *s_Header) | | | +----------------------------------------------------------------------------+ | Task : Read Digital Output Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| str_DigitalOutputHeader *s_Header: Digital Output Header| +| struct str_DigitalOutputHeader *s_Header: Digital Output Header| | Pointer | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -984,11 +982,11 @@ INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress, | Return Value : 0 | +----------------------------------------------------------------------------+ */ -INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_DigitalOutputHeader * s_Header) +int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + 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); @@ -997,17 +995,17 @@ INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadTimerHeader(WORD 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 | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| str_TimerMainHeader *s_Header: Timer Header | +| struct str_TimerMainHeader *s_Header: Timer Header | | Pointer | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -1015,18 +1013,18 @@ INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress, | Return Value : 0 | +----------------------------------------------------------------------------+ */ -INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_TimerMainHeader * s_Header) +int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_TimerMainHeader *s_Header) { - WORD i, w_Size = 0, w_Temp; + 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 = @@ -1037,23 +1035,23 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 8 + w_Size + 2); - //Read Resolution + /* Read Resolution */ s_Header->s_TimerDetails[i].b_Resolution = - (BYTE) (w_Temp >> 10) & 0x3F; + (unsigned char) (w_Temp >> 10) & 0x3F; - //Read Mode + /* Read Mode */ s_Header->s_TimerDetails[i].b_Mode = - (BYTE) (w_Temp >> 4) & 0x3F; + (unsigned char) (w_Temp >> 4) & 0x3F; w_Temp = w_EepromReadWord(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 - s_Header->s_TimerDetails[i].b_TimeBase = (BYTE) (w_Temp) & 0x3F; + /* Read Timebase */ + s_Header->s_TimerDetails[i].b_TimeBase = (unsigned char) (w_Temp) & 0x3F; w_Size += s_Header->s_TimerDetails[i].w_HeaderSize; } @@ -1062,13 +1060,13 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadAnlogOutputHeader(WORD | +| Function Name : int i_EepromReadAnlogOutputHeader(unsigned short | | w_PCIBoardEepromAddress,char *pc_PCIChipInformation, | -| WORD w_Address,str_AnalogOutputHeader *s_Header) | +| unsigned short w_Address,str_AnalogOutputHeader *s_Header) | +----------------------------------------------------------------------------+ | Task : Read Nalog Output Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | @@ -1081,35 +1079,35 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, +----------------------------------------------------------------------------+ */ -INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_AnalogOutputHeader * s_Header) +int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + str_AnalogOutputHeader *s_Header) { - WORD w_Temp; - // No of channels for 1st hard component + unsigned short w_Temp; + /* 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 = (BYTE) (w_Temp >> 8) & 0xFF; + s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF; return 0; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadAnlogInputHeader(WORD | +| Function Name : int i_EepromReadAnlogInputHeader(unsigned short | | w_PCIBoardEepromAddress,char *pc_PCIChipInformation, | -| WORD w_Address,str_AnalogInputHeader *s_Header) | +| unsigned short w_Address,struct str_AnalogInputHeader *s_Header) | +----------------------------------------------------------------------------+ | Task : Read Nalog Output Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| str_AnalogInputHeader *s_Header:Anlog Input Header | +| struct str_AnalogInputHeader *s_Header:Anlog Input Header | | Pointer | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -1118,12 +1116,12 @@ INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress, +----------------------------------------------------------------------------+ */ -// Reads only for ONE hardware component -INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_AnalogInputHeader * s_Header) +/* Reads only for ONE hardware component */ +int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_AnalogInputHeader *s_Header) { - WORD w_Temp, w_Offset; + unsigned short w_Temp, w_Offset; w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 10); s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF; @@ -1135,24 +1133,24 @@ INT i_EepromReadAnlogInputHeader(WORD 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; } diff --git a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h index 617dc087dcb..b76f877f250 100644 --- a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h +++ b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h @@ -31,15 +31,15 @@ *************************/ -#define FIFO_ADVANCE_ON_BYTE_2 0x20000000 // written on base0 +#define FIFO_ADVANCE_ON_BYTE_2 0x20000000 /* written on base0 */ -#define AMWEN_ENABLE 0x02 // added for step 6 dma written on base2 +#define AMWEN_ENABLE 0x02 /* added for step 6 dma written on base2 */ #define A2P_FIFO_WRITE_ENABLE 0x01 -#define AGCSTS_TC_ENABLE 0x10000000 // Added for transfer count enable bit +#define AGCSTS_TC_ENABLE 0x10000000 /* Added for transfer count enable bit */ -// ADDON RELATED ADDITIONS -// Constant +/* ADDON RELATED ADDITIONS */ +/* Constant */ #define APCI3120_ENABLE_TRANSFER_ADD_ON_LOW 0x00 #define APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH 0x1200 #define APCI3120_A2P_FIFO_MANAGEMENT 0x04000400L @@ -52,7 +52,7 @@ #define APCI3120_DISABLE_BUS_MASTER_ADD_ON 0x0 #define APCI3120_DISABLE_BUS_MASTER_PCI 0x0 - // ADD_ON ::: this needed since apci supports 16 bit interface to add on + /* ADD_ON ::: this needed since apci supports 16 bit interface to add on */ #define APCI3120_ADD_ON_AGCSTS_LOW 0x3C #define APCI3120_ADD_ON_AGCSTS_HIGH APCI3120_ADD_ON_AGCSTS_LOW + 2 #define APCI3120_ADD_ON_MWAR_LOW 0x24 @@ -60,7 +60,7 @@ #define APCI3120_ADD_ON_MWTC_LOW 0x058 #define APCI3120_ADD_ON_MWTC_HIGH APCI3120_ADD_ON_MWTC_LOW + 2 -// AMCC +/* AMCC */ #define APCI3120_AMCC_OP_MCSR 0x3C #define APCI3120_AMCC_OP_REG_INTCSR 0x38 @@ -85,7 +85,7 @@ #define AMCC_OP_REG_MRTC 0x30 #define AMCC_OP_REG_MBEF 0x34 #define AMCC_OP_REG_INTCSR 0x38 -#define AMCC_OP_REG_INTCSR_SRC (AMCC_OP_REG_INTCSR + 2) /* INT source */ +#define AMCC_OP_REG_INTCSR_SRC (AMCC_OP_REG_INTCSR + 2) /* int source */ #define AMCC_OP_REG_INTCSR_FEC (AMCC_OP_REG_INTCSR + 3) /* FIFO ctrl */ #define AMCC_OP_REG_MCSR 0x3c #define AMCC_OP_REG_MCSR_NVDATA (AMCC_OP_REG_MCSR + 2) /* Data in byte 2 */ @@ -212,7 +212,7 @@ struct pcilst_struct { unsigned int irq; }; -struct pcilst_struct *amcc_devices; // ptr to root list of all amcc devices +struct pcilst_struct *amcc_devices; /* ptr to root list of all amcc devices */ /****************************************************************************/ @@ -267,7 +267,7 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) amcc->vendor = pcidev->vendor; amcc->device = pcidev->device; #if 0 - amcc->master = pcidev->master; // how get this information under 2.4 kernels? + amcc->master = pcidev->master; /* how get this information under 2.4 kernels? */ #endif amcc->pci_bus = pcidev->bus->number; amcc->pci_slot = PCI_SLOT(pcidev->devfn); @@ -333,17 +333,17 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id, && (amcc->pci_slot == pci_slot)) { if (!(amcc->used)) { *card = amcc; - return 0; // ok, card is found + return 0; /* ok, card is found */ } else { - rt_printk + printk (" - \nCard on requested position is used b:s %d:%d!\n", pci_bus, pci_slot); - return 2; // card exist but is used + return 2; /* card exist but is used */ } } } - return 1; // no card found + return 1; /* no card found */ } /****************************************************************************/ @@ -422,11 +422,10 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, { struct pcilst_struct *card; - if ((pci_bus < 1) & (pci_slot < 1)) { // use autodetection - if ((card = ptr_find_free_pci_card_by_device(vendor_id, - device_id)) == - NULL) { - rt_printk(" - Unused card not found in system!\n"); + if ((pci_bus < 1) & (pci_slot < 1)) { /* use autodetection */ + card = ptr_find_free_pci_card_by_device(vendor_id, device_id); + if (card == NULL) { + printk(" - Unused card not found in system!\n"); return NULL; } } else { @@ -434,12 +433,12 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, pci_bus, pci_slot, &card)) { case 1: - rt_printk + printk (" - Card not found on requested position b:s %d:%d!\n", pci_bus, pci_slot); return NULL; case 2: - rt_printk + printk (" - Card on requested position is used b:s %d:%d!\n", pci_bus, pci_slot); return NULL; @@ -447,7 +446,7 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, } if (i_pci_card_alloc(card) != 0) { - rt_printk(" - Can't allocate card!\n"); + printk(" - Can't allocate card!\n"); return NULL; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c index 3f8929c0907..47517a938ec 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c @@ -1,15 +1,15 @@ -/** +//** @verbatim 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. @@ -56,21 +56,22 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #include "APCI1710_Pwm.c" #include "APCI1710_INCCPT.c" -void i_ADDI_AttachPCI1710(struct comedi_device * dev) +void i_ADDI_AttachPCI1710(struct comedi_device *dev) { struct comedi_subdevice *s; int ret = 0; int n_subdevices = 9; - //Update-0.7.57->0.7.68dev->n_subdevices = 9; - if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) + /* Update-0.7.57->0.7.68dev->n_subdevices = 9; */ + ret = alloc_subdevices(dev, n_subdevices); + if (ret < 0) return; - // Allocate and Initialise Timer Subdevice Structures + /* Allocate and Initialise Timer Subdevice Structures */ s = dev->subdevices + 0; s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_WRITEABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 3; s->maxdata = 0; s->len_chanlist = 3; @@ -80,12 +81,12 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_config = i_APCI1710_InsnConfigInitTimer; s->insn_bits = i_APCI1710_InsnBitsTimer; - // Allocate and Initialise DIO Subdevice Structures + /* Allocate and Initialise DIO Subdevice Structures */ s = dev->subdevices + 1; s->type = COMEDI_SUBD_DIO; s->subdev_flags = - SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 7; s->maxdata = 1; s->len_chanlist = 7; @@ -95,11 +96,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_bits = i_APCI1710_InsnBitsDigitalIOPortOnOff; s->insn_write = i_APCI1710_InsnWriteDigitalIOChlOnOff; - // Allocate and Initialise Chrono Subdevice Structures + /* Allocate and Initialise Chrono Subdevice Structures */ s = dev->subdevices + 2; s->type = COMEDI_SUBD_CHRONO; - s->subdev_flags = SDF_WRITEABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 4; s->maxdata = 0; s->len_chanlist = 4; @@ -109,55 +110,55 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_config = i_APCI1710_InsnConfigInitChrono; s->insn_bits = i_APCI1710_InsnBitsChronoDigitalIO; - // Allocate and Initialise PWM Subdevice Structures + /* Allocate and Initialise PWM Subdevice Structures */ s = dev->subdevices + 3; s->type = COMEDI_SUBD_PWM; s->subdev_flags = - SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 3; s->maxdata = 1; s->len_chanlist = 3; s->range_table = &range_digital; - s->io_bits = 0; //all bits input + s->io_bits = 0; /* all bits input */ s->insn_config = i_APCI1710_InsnConfigPWM; s->insn_read = i_APCI1710_InsnReadGetPWMStatus; s->insn_write = i_APCI1710_InsnWritePWM; s->insn_bits = i_APCI1710_InsnBitsReadPWMInterrupt; - // Allocate and Initialise TTLIO Subdevice Structures + /* Allocate and Initialise TTLIO Subdevice Structures */ s = dev->subdevices + 4; s->type = COMEDI_SUBD_TTLIO; s->subdev_flags = - SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 8; s->maxdata = 1; s->len_chanlist = 8; - s->range_table = &range_apci1710_ttl; // to pass arguments in range + s->range_table = &range_apci1710_ttl; /* to pass arguments in range */ s->insn_config = i_APCI1710_InsnConfigInitTTLIO; s->insn_bits = i_APCI1710_InsnBitsReadTTLIO; s->insn_write = i_APCI1710_InsnWriteSetTTLIOChlOnOff; s->insn_read = i_APCI1710_InsnReadTTLIOAllPortValue; - // Allocate and Initialise TOR Subdevice Structures + /* Allocate and Initialise TOR Subdevice Structures */ s = dev->subdevices + 5; s->type = COMEDI_SUBD_TOR; s->subdev_flags = - SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 8; s->maxdata = 1; s->len_chanlist = 8; s->range_table = &range_digital; - s->io_bits = 0; //all bits input + s->io_bits = 0; /* all bits input */ s->insn_config = i_APCI1710_InsnConfigInitTorCounter; s->insn_read = i_APCI1710_InsnReadGetTorCounterInitialisation; s->insn_write = i_APCI1710_InsnWriteEnableDisableTorCounter; s->insn_bits = i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue; - // Allocate and Initialise SSI Subdevice Structures + /* Allocate and Initialise SSI Subdevice Structures */ s = dev->subdevices + 6; s->type = COMEDI_SUBD_SSI; s->subdev_flags = - SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 4; s->maxdata = 1; s->len_chanlist = 4; @@ -166,11 +167,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_read = i_APCI1710_InsnReadSSIValue; s->insn_bits = i_APCI1710_InsnBitsSSIDigitalIO; - // Allocate and Initialise PULSEENCODER Subdevice Structures + /* Allocate and Initialise PULSEENCODER Subdevice Structures */ s = dev->subdevices + 7; s->type = COMEDI_SUBD_PULSEENCODER; s->subdev_flags = - SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 4; s->maxdata = 1; s->len_chanlist = 4; @@ -180,11 +181,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_bits = i_APCI1710_InsnBitsReadWritePulseEncoder; s->insn_read = i_APCI1710_InsnReadInterruptPulseEncoder; - // Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures + /* Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures */ s = dev->subdevices + 8; s->type = COMEDI_SUBD_INCREMENTALCOUNTER; s->subdev_flags = - SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON; + SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON; s->n_chan = 500; s->maxdata = 1; s->len_chanlist = 500; @@ -195,14 +196,14 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_bits = i_APCI1710_InsnBitsINCCPT; } -int i_APCI1710_Reset(struct comedi_device * dev); +int i_APCI1710_Reset(struct comedi_device *dev); void v_APCI1710_Interrupt(int irq, void *d); -//for 1710 +/* for 1710 */ -int i_APCI1710_Reset(struct comedi_device * dev) +int i_APCI1710_Reset(struct comedi_device *dev) { int ret; - DWORD dw_Dummy; + unsigned int dw_Dummy; /*********************************/ /* Read all module configuration */ @@ -219,12 +220,12 @@ int i_APCI1710_Reset(struct comedi_device * dev) ret = inl(devpriv->s_BoardInfos.ui_Address + 252); devpriv->s_BoardInfos.dw_MolduleConfiguration[3] = ret; - // outl(0x80808082,devpriv->s_BoardInfos.ui_Address+0x60); + /* outl(0x80808082,devpriv->s_BoardInfos.ui_Address+0x60); */ outl(0x83838383, devpriv->s_BoardInfos.ui_Address + 0x60); devpriv->s_BoardInfos.b_BoardVersion = 1; - // Enable the interrupt for the controler + /* Enable the interrupt for the controler */ dw_Dummy = inl(devpriv->s_BoardInfos.ui_Address + 0x38); outl(dw_Dummy | 0x2000, devpriv->s_BoardInfos.ui_Address + 0x38); @@ -234,11 +235,11 @@ int i_APCI1710_Reset(struct comedi_device * dev) /* +----------------------------------------------------------------------------+ | Function's Name : __void__ v_APCI1710_InterruptFunction | -| (BYTE b_Interrupt, __CPPARGS) | +| (unsigned char b_Interrupt, __CPPARGS) | +----------------------------------------------------------------------------+ | Task : APCI-1710 interrupt function | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE b_Interrupt : Interrupt number | +| Input Parameters : unsigned char b_Interrupt : Interrupt number | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -250,18 +251,18 @@ int i_APCI1710_Reset(struct comedi_device * dev) void v_APCI1710_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - BYTE b_ModuleCpt = 0; - BYTE b_InterruptFlag = 0; - BYTE b_PWMCpt = 0; - BYTE b_TorCounterCpt = 0; - BYTE b_PulseIncoderCpt = 0; - UINT ui_16BitValue; - ULONG ul_InterruptLatchReg = 0; - ULONG ul_LatchRegisterValue = 0; - ULONG ul_82X54InterruptStatus; - ULONG ul_StatusRegister; - - str_ModuleInfo *ps_ModuleInfo; + unsigned char b_ModuleCpt = 0; + unsigned char b_InterruptFlag = 0; + unsigned char b_PWMCpt = 0; + unsigned char b_TorCounterCpt = 0; + unsigned char b_PulseIncoderCpt = 0; + unsigned int ui_16BitValue; + unsigned int ul_InterruptLatchReg = 0; + unsigned int ul_LatchRegisterValue = 0; + unsigned int ul_82X54InterruptStatus; + unsigned int ul_StatusRegister; + + union str_ModuleInfo *ps_ModuleInfo; printk("APCI1710 Interrupt\n"); for (b_ModuleCpt = 0; b_ModuleCpt < 4; b_ModuleCpt++, ps_ModuleInfo++) { @@ -279,7 +280,7 @@ void v_APCI1710_Interrupt(int irq, void *d) dw_MolduleConfiguration[b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) { - //printk("TIMER Interrupt Occurred\n"); + /* printk("TIMER Interrupt Occurred\n"); */ ul_82X54InterruptStatus = inl(devpriv->s_BoardInfos. ui_Address + 12 + (64 * b_ModuleCpt)); @@ -332,11 +333,11 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if ((ul_82X54InterruptStatus & 0x7) != 0) - } // 82X54 timer + } /* if ((ul_82X54InterruptStatus & 0x7) != 0) */ + } /* 82X54 timer */ /***************************/ /* Test if increm. counter */ @@ -412,7 +413,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -473,7 +474,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -562,7 +563,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -628,7 +629,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -675,7 +676,7 @@ void v_APCI1710_Interrupt(int irq, void *d) if ((ul_LatchRegisterValue & 0xFFFFU) != 0) { ui_16BitValue = - (UINT) + (unsigned int) ul_LatchRegisterValue & 0xFFFFU; ul_LatchRegisterValue = @@ -693,7 +694,7 @@ void v_APCI1710_Interrupt(int irq, void *d) 0xFFFF0000UL) != 0) { ui_16BitValue = - (UINT) ( + (unsigned int) ( (ul_LatchRegisterValue >> 16) & 0xFFFFU); @@ -721,7 +722,7 @@ void v_APCI1710_Interrupt(int irq, void *d) if ((ul_LatchRegisterValue & 0xFFFF0000UL) != 0) { ui_16BitValue = - (UINT) ( + (unsigned int) ( (ul_LatchRegisterValue >> 16) & 0xFFFFU); @@ -741,7 +742,7 @@ void v_APCI1710_Interrupt(int irq, void *d) if ((ul_LatchRegisterValue & 0xFFFFU) != 0) { ui_16BitValue = - (UINT) + (unsigned int) ul_LatchRegisterValue & 0xFFFFU; ul_LatchRegisterValue = @@ -795,11 +796,11 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); } - } // Incremental counter + } /* Incremental counter */ /***************/ /* Test if CDA */ @@ -870,14 +871,14 @@ void v_APCI1710_Interrupt(int irq, void *d) /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if (ul_StatusRegister & 1) + } /* if (ul_StatusRegister & 1) */ } - } // CDA + } /* CDA */ /***********************/ /* Test if PWM counter */ @@ -950,15 +951,15 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if (ul_StatusRegister & 0x1) - } // if (APCI1710_ENABLE) - } // for (b_PWMCpt == 0; b_PWMCpt < 0; b_PWMCpt ++) - } // PWM counter + } /* if (ul_StatusRegister & 0x1) */ + } /* if (APCI1710_ENABLE) */ + } /* for (b_PWMCpt == 0; b_PWMCpt < 0; b_PWMCpt ++) */ + } /* PWM counter */ /***********************/ /* Test if tor counter */ @@ -1054,14 +1055,14 @@ void v_APCI1710_Interrupt(int irq, void *d) /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if (ul_StatusRegister & 0x1) - } // if (APCI1710_ENABLE) - } // for (b_TorCounterCpt == 0; b_TorCounterCpt < 0; b_TorCounterCpt ++) - } // Tor counter + } /* if (ul_StatusRegister & 0x1) */ + } /* if (APCI1710_ENABLE) */ + } /* for (b_TorCounterCpt == 0; b_TorCounterCpt < 0; b_TorCounterCpt ++) */ + } /* Tor counter */ /***********************/ /* Test if chronometer */ @@ -1071,7 +1072,7 @@ void v_APCI1710_Interrupt(int irq, void *d) dw_MolduleConfiguration[b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) { - //printk("APCI1710 Chrono Interrupt\n"); + /* printk("APCI1710 Chrono Interrupt\n"); */ /*****************************/ /* Read the interrupt status */ /*****************************/ @@ -1163,13 +1164,13 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); } } - } // Chronometer + } /* Chronometer */ /*************************/ /* Test if pulse encoder */ @@ -1249,7 +1250,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -1257,7 +1258,7 @@ void v_APCI1710_Interrupt(int irq, void *d) } } } - } //pulse encoder + } /* pulse encoder */ } return; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h index 998cbba8afe..22b3e569ecd 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h @@ -44,7 +44,7 @@ #define APCI1710_SYNCHRONOUS_MODE 1 #define APCI1710_ASYNCHRONOUS_MODE 0 -//MODULE INFO STRUCTURE +/* MODULE INFO STRUCTURE */ static const struct comedi_lrange range_apci1710_ttl = { 4, { BIP_RANGE(10), diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c index e4527926c2d..016721efdbf 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c @@ -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. @@ -52,9 +52,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ #include "hwdrv_apci035.h" -INT i_WatchdogNbr = 0; -INT i_Temp = 0; -INT i_Flag = 1; +int i_WatchdogNbr = 0; +int i_Temp = 0; +int i_Flag = 1; /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI035_ConfigTimerWatchdog | @@ -64,42 +64,42 @@ INT i_Flag = 1; | Task : Configures The Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Configure As Timer | | 1 Configure As Watchdog | - data[1] : Watchdog number +| data[1] : Watchdog number | data[2] : Time base Unit | | data[3] : Reload Value | - data[4] : External Trigger | - 1:Enable - 0:Disable - data[5] :External Trigger Level - 00 Trigger Disabled - 01 Trigger Enabled (Low level) - 10 Trigger Enabled (High Level) - 11 Trigger Enabled (High/Low level) - data[6] : External Gate | - 1:Enable - 0:Disable - data[7] : External Gate level - 00 Gate Disabled - 01 Gate Enabled (Low level) - 10 Gate Enabled (High Level) - data[8] :Warning Relay - 1: ENABLE - 0: DISABLE - data[9] :Warning Delay available - data[10] :Warning Relay Time unit - data[11] :Warning Relay Time Reload value - data[12] :Reset Relay - 1 : ENABLE - 0 : DISABLE - data[13] :Interrupt - 1 : ENABLE - 0 : DISABLE - +| data[4] : External Trigger | +| 1:Enable +| 0:Disable +| data[5] :External Trigger Level +| 00 Trigger Disabled +| 01 Trigger Enabled (Low level) +| 10 Trigger Enabled (High Level) +| 11 Trigger Enabled (High/Low level) +| data[6] : External Gate | +| 1:Enable +| 0:Disable +| data[7] : External Gate level +| 00 Gate Disabled +| 01 Gate Enabled (Low level) +| 10 Gate Enabled (High Level) +| data[8] :Warning Relay +| 1: ENABLE +| 0: DISABLE +| data[9] :Warning Delay available +| data[10] :Warning Relay Time unit +| data[11] :Warning Relay Time Reload value +| data[12] :Reset Relay +| 1 : ENABLE +| 0 : DISABLE +| data[13] :Interrupt +| 1 : ENABLE +| 0 : DISABLE +| | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -109,12 +109,12 @@ INT i_Flag = 1; | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Status = 0; - UINT ui_Command = 0; - UINT ui_Mode = 0; + unsigned int ui_Status = 0; + unsigned int ui_Command = 0; + unsigned int ui_Mode = 0; i_Temp = 0; devpriv->tsk_Current = current; devpriv->b_TimerSelectMode = data[0]; @@ -124,9 +124,9 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd } else { ui_Mode = 0; } -//ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +/* ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); */ ui_Command = 0; -//ui_Command = ui_Command & 0xFFFFF9FEUL; +/* ui_Command = ui_Command & 0xFFFFF9FEUL; */ outl(ui_Command, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); ui_Command = 0; ui_Command = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); @@ -153,7 +153,7 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd ui_Command = (ui_Command & 0xFFF719E2UL) | ui_Mode << 13UL | 0x10UL; - } //if (data[0] == ADDIDATA_TIMER) + } /* if (data[0] == ADDIDATA_TIMER) */ else { if (data[0] == ADDIDATA_WATCHDOG) { @@ -260,7 +260,7 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd | Task : Start / Stop The Selected Timer , or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 - Stop Selected Timer/Watchdog | @@ -278,11 +278,11 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - UINT ui_Command = 0; - INT i_Count = 0; + unsigned int ui_Command = 0; + int i_Count = 0; if (data[0] == 1) { ui_Command = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); @@ -292,7 +292,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, ui_Command = (ui_Command & 0xFFFFF9FFUL) | 0x1UL; outl(ui_Command, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); - } // if (data[0]==1) + } /* if (data[0]==1) */ if (data[0] == 2) { ui_Command = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); @@ -304,16 +304,18 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); } - if (data[0] == 0) //Stop The Watchdog + if (data[0] == 0) /* Stop The Watchdog */ { - //Stop The Watchdog + /* Stop The Watchdog */ ui_Command = 0; - //ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - //ui_Command = ui_Command & 0xFFFFF9FEUL; +/* +* ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +* ui_Command = ui_Command & 0xFFFFF9FEUL; +*/ outl(ui_Command, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); - } // if (data[1]==0) - if (data[0] == 3) //stop all Watchdogs + } /* if (data[1]==0) */ + if (data[0] == 3) /* stop all Watchdogs */ { ui_Command = 0; for (i_Count = 1; i_Count <= 4; i_Count++) { @@ -329,7 +331,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, } } - if (data[0] == 4) //start all Watchdogs + if (data[0] == 4) /* start all Watchdogs */ { ui_Command = 0; for (i_Count = 1; i_Count <= 4; i_Count++) { @@ -344,7 +346,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, 0); } } - if (data[0] == 5) //trigger all Watchdogs + if (data[0] == 5) /* trigger all Watchdogs */ { ui_Command = 0; for (i_Count = 1; i_Count <= 4; i_Count++) { @@ -373,17 +375,17 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, | Task : Read The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | | +----------------------------------------------------------------------------+ | Output Parameters : data[0] : software trigger status - data[1] : hardware trigger status -| data[2] : Software clear status - data[3] : Overflow status - data[4] : Timer actual value - +| data[1] : hardware trigger status +| data[2] : Software clear status +| data[3] : Overflow status +| data[4] : Timer actual value +| +----------------------------------------------------------------------------+ | Return Value : TRUE : No error occur | @@ -391,42 +393,46 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_ReadTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Status = 0; // Status register + unsigned int ui_Status = 0; /* Status register */ i_WatchdogNbr = insn->unused[0]; - /******************/ + + /******************/ /* Get the status */ - /******************/ + /******************/ + ui_Status = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 16); - /***********************************/ + + /***********************************/ /* Get the software trigger status */ - /***********************************/ + /***********************************/ + data[0] = ((ui_Status >> 1) & 1); - /***********************************/ + /***********************************/ /* Get the hardware trigger status */ - /***********************************/ + /***********************************/ data[1] = ((ui_Status >> 2) & 1); - /*********************************/ + /*********************************/ /* Get the software clear status */ - /*********************************/ + /*********************************/ data[2] = ((ui_Status >> 3) & 1); - /***************************/ + /***************************/ /* Get the overflow status */ - /***************************/ + /***************************/ data[3] = ((ui_Status >> 0) & 1); if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { data[4] = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0); - } // if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */ return insn->n; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI035_ConfigAnalogInput | +| Function Name : int i_APCI035_ConfigAnalogInput | | (struct comedi_device *dev,struct comedi_subdevice *s, | | struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ @@ -447,8 +453,8 @@ INT i_APCI035_ReadTimerWatchdog(struct comedi_device * dev, struct comedi_subdev | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { devpriv->tsk_Current = current; outl(0x200 | 0, devpriv->iobase + 128 + 0x4); @@ -472,8 +478,8 @@ INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdev | Task : Read value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Digital Value Of Input | @@ -484,10 +490,10 @@ INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdev | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_CommandRegister = 0; + unsigned int ui_CommandRegister = 0; /******************/ /* Set the start */ /******************/ @@ -519,14 +525,14 @@ INT i_APCI035_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevic | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_Reset(struct comedi_device * dev) +int i_APCI035_Reset(struct comedi_device *dev) { - INT i_Count = 0; + int i_Count = 0; for (i_Count = 1; i_Count <= 4; i_Count++) { i_WatchdogNbr = i_Count; - outl(0x0, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0); //stop all timers + outl(0x0, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0); /* stop all timers */ } - outl(0x0, devpriv->iobase + 128 + 12); //Disable the warning delay + outl(0x0, devpriv->iobase + 128 + 12); /* Disable the warning delay */ return 0; } @@ -551,11 +557,11 @@ INT i_APCI035_Reset(struct comedi_device * dev) static void v_APCI035_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - UINT ui_StatusRegister1 = 0; - UINT ui_StatusRegister2 = 0; - UINT ui_ReadCommand = 0; - UINT ui_ChannelNumber = 0; - UINT ui_DigitalTemperature = 0; + unsigned int ui_StatusRegister1 = 0; + unsigned int ui_StatusRegister2 = 0; + unsigned int ui_ReadCommand = 0; + unsigned int ui_ChannelNumber = 0; + unsigned int ui_DigitalTemperature = 0; if (i_Temp == 1) { i_WatchdogNbr = i_Flag; i_Flag = i_Flag + 1; @@ -571,7 +577,7 @@ static void v_APCI035_Interrupt(int irq, void *d) ui_StatusRegister2 = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 20); - if ((((ui_StatusRegister1) & 0x8) == 0x8)) //Test if warning relay interrupt + if ((((ui_StatusRegister1) & 0x8) == 0x8)) /* Test if warning relay interrupt */ { /**********************************/ /* Disable the temperature warning */ @@ -587,14 +593,14 @@ static void v_APCI035_Interrupt(int irq, void *d) /* Read the digital temperature value */ /**************************************/ ui_DigitalTemperature = inl(devpriv->iobase + 128 + 60); - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample - } //if (((ui_StatusRegister1 & 0x8) == 0x8)) + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ + } /* if (((ui_StatusRegister1 & 0x8) == 0x8)) */ else { if ((ui_StatusRegister2 & 0x1) == 0x1) { - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ } - } //else if (((ui_StatusRegister1 & 0x8) == 0x8)) + } /* else if (((ui_StatusRegister1 & 0x8) == 0x8)) */ return; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h index 80d7c0d39aa..e0023c8cb62 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h @@ -19,18 +19,18 @@ #define APCI035_BOARD_VENDOR_ID 0x15B8 #define APCI035_ADDRESS_RANGE 255 -INT i_TW_Number; +int i_TW_Number; struct { - INT i_Gain; - INT i_Polarity; - INT i_OffsetRange; - INT i_Coupling; - INT i_SingleDiff; - INT i_AutoCalibration; - UINT ui_ReloadValue; - UINT ui_TimeUnitReloadVal; - INT i_Interrupt; - INT i_ModuleSelection; + int i_Gain; + int i_Polarity; + int i_OffsetRange; + int i_Coupling; + int i_SingleDiff; + int i_AutoCalibration; + unsigned int ui_ReloadValue; + unsigned int ui_TimeUnitReloadVal; + int i_Interrupt; + int i_ModuleSelection; } Config_Parameters_Main; /* ANALOG INPUT RANGE */ @@ -101,23 +101,23 @@ struct comedi_lrange range_apci035_ai = { 8, { /* TIMER */ /* timer value is passed as u seconds */ -INT i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev, +int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* Temperature Related Defines (Analog Input Subdevice) */ -INT i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* Interrupt */ static void v_APCI035_Interrupt(int irq, void *d); /* Reset functions */ -INT i_APCI035_Reset(struct comedi_device *dev); +int i_APCI035_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c index 32796ceb946..e9021cd4d34 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c @@ -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. @@ -53,8 +53,8 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc */ #include "hwdrv_apci1032.h" #include <linux/delay.h> -//Global variables -UINT ui_InterruptStatus = 0; +/* Global variables */ +unsigned int ui_InterruptStatus = 0; /* +----------------------------------------------------------------------------+ @@ -84,13 +84,13 @@ UINT ui_InterruptStatus = 0; +----------------------------------------------------------------------------+ */ -INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_TmpValue; + unsigned int ui_TmpValue; - ULONG ul_Command1 = 0; - ULONG ul_Command2 = 0; + unsigned int ul_Command1 = 0; + unsigned int ul_Command2 = 0; devpriv->tsk_Current = current; /*******************************/ @@ -107,11 +107,11 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd outl(0x4, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); ui_TmpValue = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); - } //if (data[1] == ADDIDATA_OR) + } /* if (data[1] == ADDIDATA_OR) */ else { outl(0x6, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); - } //else if(data[1] == ADDIDATA_OR) - } // if( data[0] == ADDIDATA_ENABLE) + } /* else if(data[1] == ADDIDATA_OR) */ + } /* if( data[0] == ADDIDATA_ENABLE) */ else { ul_Command1 = ul_Command1 & 0xFFFF0000; ul_Command2 = ul_Command2 & 0xFFFF0000; @@ -120,7 +120,7 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd outl(ul_Command2, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2); outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); - } //else if ( data[0] == ADDIDATA_ENABLE) + } /* else if ( data[0] == ADDIDATA_ENABLE) */ return insn->n; } @@ -134,7 +134,7 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd | Task : Return the status of the digital input | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | +| unsigned int ui_Channel : Channel number to read | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -144,22 +144,24 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_TmpValue = 0; - UINT ui_Channel; + unsigned int ui_TmpValue = 0; + unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); if (ui_Channel >= 0 && ui_Channel <= 31) { - ui_TmpValue = (UINT) inl(devpriv->iobase + APCI1032_DIGITAL_IP); - // since only 1 channel reqd to bring it to last bit it is rotated - // 8 +(chan - 1) times then ANDed with 1 for last bit. + ui_TmpValue = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP); +/* +* since only 1 channel reqd to bring it to last bit it is rotated 8 +* +(chan - 1) times then ANDed with 1 for last bit. +*/ *data = (ui_TmpValue >> ui_Channel) & 0x1; - } //if(ui_Channel >= 0 && ui_Channel <=31) + } /* if(ui_Channel >= 0 && ui_Channel <=31) */ else { - //comedi_error(dev," \n chan spec wrong\n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if(ui_Channel >= 0 && ui_Channel <=31) + /* comedi_error(dev," \n chan spec wrong\n"); */ + return -EINVAL; /* "sorry channel spec wrong " */ + } /* else if(ui_Channel >= 0 && ui_Channel <=31) */ return insn->n; } @@ -172,8 +174,8 @@ INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde | Task : Return the status of the Requested digital inputs | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To be Read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To be Read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -183,16 +185,16 @@ INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_PortValue = data[0]; - UINT ui_Mask = 0; - UINT ui_NoOfChannels; + unsigned int ui_PortValue = data[0]; + unsigned int ui_Mask = 0; + unsigned int ui_NoOfChannels; ui_NoOfChannels = CR_CHAN(insn->chanspec); if (data[1] == 0) { - *data = (UINT) inl(devpriv->iobase + APCI1032_DIGITAL_IP); + *data = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP); switch (ui_NoOfChannels) { case 2: ui_Mask = 3; @@ -213,16 +215,16 @@ INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su case 31: break; default: - //comedi_error(dev," \nchan spec wrong\n"); - return -EINVAL; // "sorry channel spec wrong " + /* comedi_error(dev," \nchan spec wrong\n"); */ + return -EINVAL; /* "sorry channel spec wrong " */ break; - } //switch(ui_NoOfChannels) - } //if(data[1]==0) + } /* switch(ui_NoOfChannels) */ + } /* if(data[1]==0) */ else { if (data[1] == 1) { *data = ui_InterruptStatus; - } //if(data[1]==1) - } //else if(data[1]==0) + } /* if(data[1]==1) */ + } /* else if(data[1]==0) */ return insn->n; } @@ -247,16 +249,16 @@ static void v_APCI1032_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - UINT ui_Temp; - //disable the interrupt + unsigned int ui_Temp; + /* disable the interrupt */ ui_Temp = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); outl(ui_Temp & APCI1032_DIGITAL_IP_INTERRUPT_DISABLE, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); ui_InterruptStatus = inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS); ui_InterruptStatus = ui_InterruptStatus & 0X0000FFFF; - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample - outl(ui_Temp, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); //enable the interrupt + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ + outl(ui_Temp, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); /* enable the interrupt */ return; } @@ -275,11 +277,11 @@ static void v_APCI1032_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -INT i_APCI1032_Reset(struct comedi_device * dev) +int i_APCI1032_Reset(struct comedi_device *dev) { - outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); //disable the interrupts - inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS); //Reset the interrupt status register - outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE1); //Disable the and/or interrupt + outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); /* disable the interrupts */ + inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS); /* Reset the interrupt status register */ + outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE1); /* Disable the and/or interrupt */ outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2); return 0; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h index 659ef85088c..e29a72a568f 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h @@ -19,45 +19,46 @@ #define APCI1032_BOARD_VENDOR_ID 0x15B8 #define APCI1032_ADDRESS_RANGE 20 -//DIGITAL INPUT DEFINE +/* DIGITAL INPUT DEFINE */ #define APCI1032_DIGITAL_IP 0 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE1 4 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE2 8 #define APCI1032_DIGITAL_IP_IRQ 16 -//Digital Input IRQ Function Selection +/* Digital Input IRQ Function Selection */ #define ADDIDATA_OR 0 #define ADDIDATA_AND 1 -//Digital Input Interrupt Status +/* Digital Input Interrupt Status */ #define APCI1032_DIGITAL_IP_INTERRUPT_STATUS 12 -//Digital Input Interrupt Enable Disable. +/* Digital Input Interrupt Enable Disable. */ #define APCI1032_DIGITAL_IP_INTERRUPT_ENABLE 0x4 #define APCI1032_DIGITAL_IP_INTERRUPT_DISABLE 0xFFFFFFFB -//ADDIDATA Enable Disable +/* ADDIDATA Enable Disable */ #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 -// Hardware Layer functions for Apci1032 +/* Hardware Layer functions for Apci1032 */ -//DI -// for di read +/* +* DI for di read +*/ -INT i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// Interrupt functions..... +/* Interrupt functions..... */ static void v_APCI1032_Interrupt(int irq, void *d); -//Reset -INT i_APCI1032_Reset(struct comedi_device *dev); +/* Reset */ +int i_APCI1032_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index 2d6adcff41e..236b8a31c82 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -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. @@ -77,7 +77,7 @@ int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = | data[0] :Number of the input port on | | which the event will take place | | (1 or 2) - data[1] : The event logic for port 1 has | +| data[1] : The event logic for port 1 has | | three possibilities | | :0 APCI1500_AND :This logic | | links | @@ -137,8 +137,8 @@ int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = +----------------------------------------------------------------------------+ */ -INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0; int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0; @@ -157,16 +157,16 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, if (data[0] == 1) { i_MaxChannel = 8; - } // if (data[0] == 1) + } /* if (data[0] == 1) */ else { if (data[0] == 2) { i_MaxChannel = 6; - } // if(data[0]==2) + } /* if(data[0]==2) */ else { printk("\nThe specified port event does not exist\n"); return -EINVAL; - } //else if(data[0]==2) - } //else if (data[0] == 1) + } /* else if(data[0]==2) */ + } /* else if (data[0] == 1) */ switch (data[1]) { case 0: data[1] = APCI1500_AND; @@ -180,7 +180,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, default: printk("\nThe specified interrupt logic does not exist\n"); return -EINVAL; - } //switch(data[1]); + } /* switch(data[1]); */ i_Logic = data[1]; for (i_Count = i_MaxChannel, i = 0; i_Count > 0; i_Count--, i++) { @@ -224,8 +224,8 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, default: printk("\nThe option indicated in the event mask does not exist\n"); return -EINVAL; - } // switch(i_EventMask) - } //for (i_Count = i_MaxChannel; i_Count >0;i_Count --) + } /* switch(i_EventMask) */ + } /* for (i_Count = i_MaxChannel; i_Count >0;i_Count --) */ if (data[0] == 1) { /****************************/ @@ -247,7 +247,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, /********************************************/ printk("\nTransition error on an OR PRIORITY logic\n"); return -EINVAL; - } // if (data[1]== APCI1500_OR_PRIORITY && i_PatternTransition != 0) + } /* if (data[1]== APCI1500_OR_PRIORITY && i_PatternTransition != 0) */ /*************************************/ /* Tests if more than one transition */ @@ -261,7 +261,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, ((i_PatternTransition >> i_Count) & 0x1); - } //for (i_Count = 0; i_Count < 8; i_Count++) + } /* for (i_Count = 0; i_Count < 8; i_Count++) */ if (i_PatternTransitionCount > 1) { /****************************************/ @@ -269,8 +269,8 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, /****************************************/ printk("\n Transition error on an AND logic\n"); return -EINVAL; - } // if (i_PatternTransitionCount > 1) - } // if (data[1]== APCI1500_AND) + } /* if (i_PatternTransitionCount > 1) */ + } /* if (data[1]== APCI1500_AND) */ /*****************************************************************/ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ @@ -359,12 +359,12 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) + } /* if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) */ else { printk("\nThe choice for interrupt logic does not exist\n"); return -EINVAL; - } // else }// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) - } // if (data[0]== 1) + } /* else }// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) */ + } /* if (data[0]== 1) */ /************************************/ /* Test if event setting for port 2 */ @@ -487,12 +487,12 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, outb(0xF4, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if (data[1] == APCI1500_OR) + } /* if (data[1] == APCI1500_OR) */ else { printk("\nThe choice for interrupt logic does not exist\n"); return -EINVAL; - } //elseif (data[1] == APCI1500_OR) - } //if(data[0]==2) + } /* elseif (data[1] == APCI1500_OR) */ + } /* if(data[0]==2) */ return insn->n; } @@ -506,11 +506,11 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, | Task : Allows or disallows a port event | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | +| unsigned int ui_Channel : Channel number to read | | unsigned int *data : Data Pointer to read status | - data[0] :0 Start input event - 1 Stop input event - data[1] :No of port (1 or 2) +| data[0] :0 Start input event +| 1 Stop input event +| data[1] :No of port (1 or 2) +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -519,8 +519,8 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { int i_Event1InterruptStatus = 0, i_Event2InterruptStatus = 0, i_RegValue; @@ -589,12 +589,12 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if(i_Event1Status==1) + } /* if(i_Event1Status==1) */ else { printk("\nEvent 1 not initialised\n"); return -EINVAL; - } //else if(i_Event1Status==1) - } //if (data[1]==1) + } /* else if(i_Event1Status==1) */ + } /* if (data[1]==1) */ if (data[1] == 2) { if (i_Event2Status == 1) { @@ -640,17 +640,17 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_Event2InterruptStatus = 1; - } // if(i_Event2Status==1) + } /* if(i_Event2Status==1) */ else { printk("\nEvent 2 not initialised\n"); return -EINVAL; - } //else if(i_Event2Status==1) - } // if(data[1]==2) - } // if (data[1] == 1 || data[0] == 2) + } /* else if(i_Event2Status==1) */ + } /* if(data[1]==2) */ + } /* if (data[1] == 1 || data[0] == 2) */ else { printk("\nThe port parameter is in error\n"); return -EINVAL; - } //else if (data[1] == 1 || data[0] == 2) + } /* else if (data[1] == 1 || data[0] == 2) */ break; @@ -701,12 +701,12 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_Event1InterruptStatus = 0; - } // if(i_Event1Status==1) + } /* if(i_Event1Status==1) */ else { printk("\nEvent 1 not initialised\n"); return -EINVAL; - } //else if(i_Event1Status==1) - } //if (data[1]==1) + } /* else if(i_Event1Status==1) */ + } /* if (data[1]==1) */ if (data[1] == 2) { /*****************************/ /* Test if event initialised */ @@ -744,23 +744,23 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_Event2InterruptStatus = 0; - } // if(i_Event2Status==1) + } /* if(i_Event2Status==1) */ else { printk("\nEvent 2 not initialised\n"); return -EINVAL; - } //else if(i_Event2Status==1) - } //if(data[1]==2) + } /* else if(i_Event2Status==1) */ + } /* if(data[1]==2) */ - } // if (data[1] == 1 || data[1] == 2) + } /* if (data[1] == 1 || data[1] == 2) */ else { printk("\nThe port parameter is in error\n"); return -EINVAL; - } //else if (data[1] == 1 || data[1] == 2) + } /* else if (data[1] == 1 || data[1] == 2) */ break; default: printk("\nThe option of START/STOP logic does not exist\n"); return -EINVAL; - } //switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -774,7 +774,7 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub | Task : Return the status of the digital input | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | +| unsigned int ui_Channel : Channel number to read | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -784,8 +784,8 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_Initialisation(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { int i_DummyRead = 0; /******************/ @@ -943,11 +943,11 @@ INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevic | Task : Return the status of the Requested digital inputs | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To be Read | -| UINT *data : Data Pointer - data[0] : 0 Read a single channel - 1 read a port value - data[1] : port value +| unsigned int ui_NoOfChannels : No Of Channels To be Read | +| unsigned int *data : Data Pointer +| data[0] : 0 Read a single channel +| 1 read a port value +| data[1] : port value +----------------------------------------------------------------------------+ | Output Parameters : -- data[0] :The read status value +----------------------------------------------------------------------------+ @@ -957,31 +957,31 @@ INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -INT i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_PortValue = data[1]; - UINT ui_Mask = 0; - UINT ui_Channel; - UINT ui_TmpValue = 0; + unsigned int ui_PortValue = data[1]; + unsigned int ui_Mask = 0; + unsigned int ui_Channel; + unsigned int ui_TmpValue = 0; ui_Channel = CR_CHAN(insn->chanspec); switch (data[0]) { case 0: if (ui_Channel >= 0 && ui_Channel <= 15) { ui_TmpValue = - (UINT) inw(devpriv->i_IobaseAddon + + (unsigned int) inw(devpriv->i_IobaseAddon + APCI1500_DIGITAL_IP); *data = (ui_TmpValue >> ui_Channel) & 0x1; - } //if(ui_Channel >= 0 && ui_Channel <=15) + } /* if(ui_Channel >= 0 && ui_Channel <=15) */ else { printk("\nThe channel specification are in error\n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if(ui_Channel >= 0 && ui_Channel <=15) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* else if(ui_Channel >= 0 && ui_Channel <=15) */ break; case 1: - *data = (UINT) inw(devpriv->i_IobaseAddon + + *data = (unsigned int) inw(devpriv->i_IobaseAddon + APCI1500_DIGITAL_IP); switch (ui_Channel) { case 2: @@ -1001,35 +1001,35 @@ INT i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su default: printk("\nSpecified channel cannot be read \n"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } //switch(ui_Channel) + } /* switch(ui_Channel) */ break; default: printk("\nThe specified functionality does not exist\n"); return -EINVAL; - } //switch(data[0]) + } /* switch(data[0]) */ return insn->n; } /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI1500_ConfigDigitalOutputErrorInterrupt - (struct comedi_device *dev,struct comedi_subdevice *s struct comedi_insn - *insn,unsigned int *data) | +| (struct comedi_device *dev,struct comedi_subdevice *s struct comedi_insn +| *insn,unsigned int *data) | | | +----------------------------------------------------------------------------+ | Task : Configures the digital output memory and the digital - output error interrupt | +| output error interrupt | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | unsigned int *data : Data Pointer contains | | configuration parameters as below | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | data[0] :1:Memory on | | 0:Memory off | - data[1] :1 Enable the voltage error interrupt +| data[1] :1 Enable the voltage error interrupt | :0 Disable the voltage error interrupt | | | +----------------------------------------------------------------------------+ @@ -1040,8 +1040,8 @@ INT i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { devpriv->b_OutputMemoryStatus = data[0]; return insn->n; @@ -1056,8 +1056,8 @@ int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device * dev, | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To Write | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -1067,24 +1067,24 @@ int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - static UINT ui_Temp = 0; - UINT ui_Temp1; + static unsigned int ui_Temp = 0; + unsigned int ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (!devpriv->b_OutputMemoryStatus) { ui_Temp = 0; - } //if(!devpriv->b_OutputMemoryStatus ) + } /* if(!devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outw(data[0], devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -1113,19 +1113,19 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==0) + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -1140,7 +1140,7 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd outw(data[0], devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -1190,48 +1190,48 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==1); + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==1); */ else { printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } //if else data[3]==1) - } //if else data[3]==0) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ ui_Temp = data[0]; - return (insn->n);; + return insn->n; } /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI1500_ConfigCounterTimerWatchdog(comedi_device - *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)| +| *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)| | | +----------------------------------------------------------------------------+ | Task : Configures The Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status data[0] : 2 APCI1500_1_8_KHZ | 1 APCI1500_3_6_KHZ | | 0 APCI1500_115_KHZ - data[1] : 0 Counter1/Timer1 - 1 Counter2/Timer2 - 2 Counter3/Watchdog - data[2] : 0 Counter - 1 Timer/Watchdog - data[3] : This parameter has | +| data[1] : 0 Counter1/Timer1 +| 1 Counter2/Timer2 +| 2 Counter3/Watchdog +| data[2] : 0 Counter +| 1 Timer/Watchdog +| data[3] : This parameter has | | two meanings. | | - If the counter/timer | | is used as a counter | @@ -1243,15 +1243,15 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | the divider factor | | for the output is | | given. - data[4] : 0 APCI1500_CONTINUOUS - 1 APCI1500_SINGLE - data[5] : 0 Software Trigger - 1 Hardware Trigger - - data[6] :0 Software gate - 1 Hardware gate - data[7] :0 Interrupt Disable - 1 Interrupt Enable +| data[4] : 0 APCI1500_CONTINUOUS +| 1 APCI1500_SINGLE +| data[5] : 0 Software Trigger +| 1 Hardware Trigger +| +| data[6] :0 Software gate +| 1 Hardware gate +| data[7] :0 Interrupt Disable +| 1 Interrupt Enable +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -1261,27 +1261,27 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { int i_TimerCounterMode, i_MasterConfiguration; devpriv->tsk_Current = current; -//Selection of the input clock +/* Selection of the input clock */ if (data[0] == 0 || data[0] == 1 || data[0] == 2) { outw(data[0], devpriv->i_IobaseAddon + APCI1500_CLK_SELECT); - } // if(data[0]==0||data[0]==1||data[0]==2) + } /* if(data[0]==0||data[0]==1||data[0]==2) */ else { if (data[0] != 3) { printk("\nThe option for input clock selection does not exist\n"); return -EINVAL; - } // if(data[0]!=3) - } //elseif(data[0]==0||data[0]==1||data[0]==2) - //Select the counter/timer + } /* if(data[0]!=3) */ + } /* elseif(data[0]==0||data[0]==1||data[0]==2) */ + /* Select the counter/timer */ switch (data[1]) { case COUNTER1: - //selecting counter or timer + /* selecting counter or timer */ switch (data[2]) { case 0: data[2] = APCI1500_COUNTER; @@ -1292,9 +1292,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice is not a timer nor a counter\n"); return -EINVAL; - } // switch(data[2]) + } /* switch(data[2]) */ - //Selecting single or continuous mode + /* Selecting single or continuous mode */ switch (data[4]) { case 0: data[4] = APCI1500_CONTINUOUS; @@ -1305,7 +1305,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis option for single/continuous mode does not exist\n"); return -EINVAL; - } // switch(data[4]) + } /* switch(data[4]) */ i_TimerCounterMode = data[2] | data[4] | 7; /*************************/ @@ -1428,21 +1428,21 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, outb(0x2, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) + } /* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ else { printk("\nError in selection of interrupt enable or disable\n"); return -EINVAL; - } //elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) - } // if ((data[3]>= 0) && (data[3] <= 65535)) + } /* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ + } /* if ((data[3]>= 0) && (data[3] <= 65535)) */ else { printk("\nError in selection of reload value\n"); return -EINVAL; - } //else if ((data[3]>= 0) && (data[3] <= 65535)) + } /* else if ((data[3]>= 0) && (data[3] <= 65535)) */ i_TimerCounterWatchdogInterrupt = data[7]; i_TimerCounter1Init = 1; break; - case COUNTER2: //selecting counter or timer + case COUNTER2: /* selecting counter or timer */ switch (data[2]) { case 0: data[2] = APCI1500_COUNTER; @@ -1453,9 +1453,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice is not a timer nor a counter\n"); return -EINVAL; - } // switch(data[2]) + } /* switch(data[2]) */ - //Selecting single or continuous mode + /* Selecting single or continuous mode */ switch (data[4]) { case 0: data[4] = APCI1500_CONTINUOUS; @@ -1466,9 +1466,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis option for single/continuous mode does not exist\n"); return -EINVAL; - } // switch(data[4]) + } /* switch(data[4]) */ - //Selecting software or hardware trigger + /* Selecting software or hardware trigger */ switch (data[5]) { case 0: data[5] = APCI1500_SOFTWARE_TRIGGER; @@ -1479,9 +1479,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice for software or hardware trigger does not exist\n"); return -EINVAL; - } // switch(data[5]) + } /* switch(data[5]) */ - //Selecting software or hardware gate + /* Selecting software or hardware gate */ switch (data[6]) { case 0: data[6] = APCI1500_SOFTWARE_GATE; @@ -1492,7 +1492,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice for software or hardware gate does not exist\n"); return -EINVAL; - } // switch(data[6]) + } /* switch(data[6]) */ i_TimerCounterMode = data[2] | data[4] | data[5] | data[6] | 7; @@ -1616,21 +1616,21 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, outb(0x2, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) + } /* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ else { printk("\nError in selection of interrupt enable or disable\n"); return -EINVAL; - } //elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) - } // if ((data[3]>= 0) && (data[3] <= 65535)) + } /* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ + } /* if ((data[3]>= 0) && (data[3] <= 65535)) */ else { printk("\nError in selection of reload value\n"); return -EINVAL; - } //else if ((data[3]>= 0) && (data[3] <= 65535)) + } /* else if ((data[3]>= 0) && (data[3] <= 65535)) */ i_TimerCounterWatchdogInterrupt = data[7]; i_TimerCounter2Init = 1; break; - case COUNTER3: //selecting counter or watchdog + case COUNTER3: /* selecting counter or watchdog */ switch (data[2]) { case 0: data[2] = APCI1500_COUNTER; @@ -1641,9 +1641,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice is not a watchdog nor a counter\n"); return -EINVAL; - } // switch(data[2]) + } /* switch(data[2]) */ - //Selecting single or continuous mode + /* Selecting single or continuous mode */ switch (data[4]) { case 0: data[4] = APCI1500_CONTINUOUS; @@ -1654,9 +1654,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis option for single/continuous mode does not exist\n"); return -EINVAL; - } // switch(data[4]) + } /* switch(data[4]) */ - //Selecting software or hardware gate + /* Selecting software or hardware gate */ switch (data[6]) { case 0: data[6] = APCI1500_SOFTWARE_GATE; @@ -1667,7 +1667,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice for software or hardware gate does not exist\n"); return -EINVAL; - } // switch(data[6]) + } /* switch(data[6]) */ /*****************************/ /* Test if used for watchdog */ @@ -1680,10 +1680,10 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, /* - Pulses output */ /*****************************/ i_TimerCounterMode = data[2] | data[4] | 0x54; - } //if (data[2] == APCI1500_WATCHDOG) + } /* if (data[2] == APCI1500_WATCHDOG) */ else { i_TimerCounterMode = data[2] | data[4] | data[6] | 7; - } //elseif (data[2] == APCI1500_WATCHDOG) + } /* elseif (data[2] == APCI1500_WATCHDOG) */ /*************************/ /* Test the reload value */ /*************************/ @@ -1809,25 +1809,25 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //elseif(data[2]==APCI1500_COUNTER) + } /* elseif(data[2]==APCI1500_COUNTER) */ - } //if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) + } /* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ else { printk("\nError in selection of interrupt enable or disable\n"); return -EINVAL; - } //elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) - } // if ((data[3]>= 0) && (data[3] <= 65535)) + } /* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ + } /* if ((data[3]>= 0) && (data[3] <= 65535)) */ else { printk("\nError in selection of reload value\n"); return -EINVAL; - } //else if ((data[3]>= 0) && (data[3] <= 65535)) + } /* else if ((data[3]>= 0) && (data[3] <= 65535)) */ i_TimerCounterWatchdogInterrupt = data[7]; i_WatchdogCounter3Init = 1; break; default: printk("\nThe specified counter\timer option does not exist\n"); - } //switch(data[1]) + } /* switch(data[1]) */ i_CounterLogic = data[2]; return insn->n; } @@ -1836,22 +1836,22 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, +----------------------------------------------------------------------------+ | Function Name : int i_APCI1500_StartStopTriggerTimerCounterWatchdog | | (struct comedi_device *dev,struct comedi_subdevice *s, - struct comedi_insn *insn,unsigned int *data); | +| struct comedi_insn *insn,unsigned int *data); | +----------------------------------------------------------------------------+ | Task : Start / Stop or trigger the timer counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | - data[0] : 0 Counter1/Timer1 - 1 Counter2/Timer2 - 2 Counter3/Watchdog - data[1] : 0 start - 1 stop - 2 Trigger - data[2] : 0 Counter - 1 Timer/Watchdog +| data[0] : 0 Counter1/Timer1 +| 1 Counter2/Timer2 +| 2 Counter3/Watchdog +| data[1] : 0 start +| 1 stop +| 2 Trigger +| data[2] : 0 Counter +| 1 Timer/Watchdog +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -1860,8 +1860,8 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { int i_CommandAndStatusValue; @@ -1871,11 +1871,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, case START: if (i_TimerCounter1Init == 1) { if (i_TimerCounterWatchdogInterrupt == 1) { - i_CommandAndStatusValue = 0xC4; //Enable the interrupt - } // if(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xC4; /* Enable the interrupt */ + } /* if(i_TimerCounterWatchdogInterrupt==1) */ else { - i_CommandAndStatusValue = 0xE4; //disable the interrupt - } //elseif(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ + } /* elseif(i_TimerCounterWatchdogInterrupt==1) */ /**************************/ /* Starts timer/counter 1 */ /**************************/ @@ -1889,7 +1889,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter1Init==1) + } /* if( i_TimerCounter1Init==1) */ else { printk("\nCounter/Timer1 not configured\n"); return -EINVAL; @@ -1922,14 +1922,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0x6; - } //if( i_TimerCounter1Enabled==1) + } /* if( i_TimerCounter1Enabled==1) */ else { /***************/ /* Set Trigger */ /***************/ i_CommandAndStatusValue = 0x2; - } //elseif(i_TimerCounter1Enabled==1) + } /* elseif(i_TimerCounter1Enabled==1) */ /********************************************/ /* Selects the commands and status register */ @@ -1940,7 +1940,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter1Init==1) + } /* if( i_TimerCounter1Init==1) */ else { printk("\nCounter/Timer1 not configured\n"); return -EINVAL; @@ -1950,7 +1950,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, default: printk("\nThe specified option for start/stop/trigger does not exist\n"); return -EINVAL; - } //switch(data[1]) + } /* switch(data[1]) */ break; case COUNTER2: @@ -1958,11 +1958,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, case START: if (i_TimerCounter2Init == 1) { if (i_TimerCounterWatchdogInterrupt == 1) { - i_CommandAndStatusValue = 0xC4; //Enable the interrupt - } // if(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xC4; /* Enable the interrupt */ + } /* if(i_TimerCounterWatchdogInterrupt==1) */ else { - i_CommandAndStatusValue = 0xE4; //disable the interrupt - } //elseif(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ + } /* elseif(i_TimerCounterWatchdogInterrupt==1) */ /**************************/ /* Starts timer/counter 2 */ /**************************/ @@ -1976,7 +1976,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { printk("\nCounter/Timer2 not configured\n"); return -EINVAL; @@ -2008,14 +2008,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0x6; - } //if( i_TimerCounter2Enabled==1) + } /* if( i_TimerCounter2Enabled==1) */ else { /***************/ /* Set Trigger */ /***************/ i_CommandAndStatusValue = 0x2; - } //elseif(i_TimerCounter2Enabled==1) + } /* elseif(i_TimerCounter2Enabled==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2026,7 +2026,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { printk("\nCounter/Timer2 not configured\n"); return -EINVAL; @@ -2035,7 +2035,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, default: printk("\nThe specified option for start/stop/trigger does not exist\n"); return -EINVAL; - } //switch(data[1]) + } /* switch(data[1]) */ break; case COUNTER3: switch (data[1]) { @@ -2043,11 +2043,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, if (i_WatchdogCounter3Init == 1) { if (i_TimerCounterWatchdogInterrupt == 1) { - i_CommandAndStatusValue = 0xC4; //Enable the interrupt - } // if(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xC4; /* Enable the interrupt */ + } /* if(i_TimerCounterWatchdogInterrupt==1) */ else { - i_CommandAndStatusValue = 0xE4; //disable the interrupt - } //elseif(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ + } /* elseif(i_TimerCounterWatchdogInterrupt==1) */ /**************************/ /* Starts Watchdog/counter 3 */ /**************************/ @@ -2062,7 +2062,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if( i_WatchdogCounter3init==1) + } /* if( i_WatchdogCounter3init==1) */ else { printk("\nWatchdog/Counter3 not configured\n"); return -EINVAL; @@ -2089,7 +2089,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, case TRIGGER: switch (data[2]) { - case 0: //triggering counter 3 + case 0: /* triggering counter 3 */ if (i_WatchdogCounter3Init == 1) { if (i_WatchdogCounter3Enabled == 1) { /************************/ @@ -2097,14 +2097,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0x6; - } //if( i_WatchdogCounter3Enabled==1) + } /* if( i_WatchdogCounter3Enabled==1) */ else { /***************/ /* Set Trigger */ /***************/ i_CommandAndStatusValue = 0x2; - } //elseif(i_WatchdogCounter3Enabled==1) + } /* elseif(i_WatchdogCounter3Enabled==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2115,14 +2115,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_WatchdogCounter3Init==1) + } /* if( i_WatchdogCounter3Init==1) */ else { printk("\nCounter3 not configured\n"); return -EINVAL; } break; case 1: - //triggering Watchdog 3 + /* triggering Watchdog 3 */ if (i_WatchdogCounter3Init == 1) { /********************************************/ @@ -2134,7 +2134,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(0x6, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_WatchdogCounter3Init==1) + } /* if( i_WatchdogCounter3Init==1) */ else { printk("\nWatchdog 3 not configured\n"); return -EINVAL; @@ -2143,17 +2143,17 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, default: printk("\nWrong choice of watchdog/counter3\n"); return -EINVAL; - } //switch(data[2]) + } /* switch(data[2]) */ break; default: printk("\nThe specified option for start/stop/trigger does not exist\n"); return -EINVAL; - } //switch(data[1]) + } /* switch(data[1]) */ break; default: printk("\nThe specified choice for counter/watchdog/timer does not exist\n"); return -EINVAL; - } //switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -2161,18 +2161,18 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, +----------------------------------------------------------------------------+ | Function Name : int i_APCI1500_ReadCounterTimerWatchdog | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data); | +| unsigned int *data); | +----------------------------------------------------------------------------+ | Task : Read The Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | - data[0] : 0 Counter1/Timer1 - 1 Counter2/Timer2 - 2 Counter3/Watchdog - +| data[0] : 0 Counter1/Timer1 +| 1 Counter2/Timer2 +| 2 Counter3/Watchdog +| +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -2182,13 +2182,13 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { int i_CommandAndStatusValue; switch (data[0]) { case COUNTER1: - //Read counter/timer1 + /* Read counter/timer1 */ if (i_TimerCounter1Init == 1) { if (i_TimerCounter1Enabled == 1) { /************************/ @@ -2196,14 +2196,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0xC; - } //if( i_TimerCounter1Init==1) + } /* if( i_TimerCounter1Init==1) */ else { /***************/ /* Set RCC */ /***************/ i_CommandAndStatusValue = 0x8; - } //elseif(i_TimerCounter1Init==1) + } /* elseif(i_TimerCounter1Init==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2232,14 +2232,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, data[0] = data[0] | inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter1Init==1) + } /* if( i_TimerCounter1Init==1) */ else { printk("\nTimer/Counter1 not configured\n"); return -EINVAL; - } //elseif( i_TimerCounter1Init==1) + } /* elseif( i_TimerCounter1Init==1) */ break; case COUNTER2: - //Read counter/timer2 + /* Read counter/timer2 */ if (i_TimerCounter2Init == 1) { if (i_TimerCounter2Enabled == 1) { /************************/ @@ -2247,14 +2247,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0xC; - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { /***************/ /* Set RCC */ /***************/ i_CommandAndStatusValue = 0x8; - } //elseif(i_TimerCounter2Init==1) + } /* elseif(i_TimerCounter2Init==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2283,14 +2283,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, data[0] = data[0] | inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { printk("\nTimer/Counter2 not configured\n"); return -EINVAL; - } //elseif( i_TimerCounter2Init==1) + } /* elseif( i_TimerCounter2Init==1) */ break; case COUNTER3: - //Read counter/watchdog2 + /* Read counter/watchdog2 */ if (i_WatchdogCounter3Init == 1) { if (i_WatchdogCounter3Enabled == 1) { /************************/ @@ -2298,14 +2298,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0xC; - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { /***************/ /* Set RCC */ /***************/ i_CommandAndStatusValue = 0x8; - } //elseif(i_WatchdogCounter3Init==1) + } /* elseif(i_WatchdogCounter3Init==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2334,16 +2334,16 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, data[0] = data[0] | inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_WatchdogCounter3Init==1) + } /* if( i_WatchdogCounter3Init==1) */ else { printk("\nWatchdogCounter3 not configured\n"); return -EINVAL; - } //elseif( i_WatchdogCounter3Init==1) + } /* elseif( i_WatchdogCounter3Init==1) */ break; default: printk("\nThe choice of timer/counter/watchdog does not exist\n"); return -EINVAL; - } //switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -2352,13 +2352,13 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, +----------------------------------------------------------------------------+ | Function Name : int i_APCI1500_ReadInterruptMask | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data); | +| unsigned int *data); | +----------------------------------------------------------------------------+ | Task : Read the interrupt mask | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | @@ -2370,8 +2370,8 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ReadInterruptMask(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_ReadInterruptMask(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { data[0] = i_InterruptMask; data[1] = i_InputChannel; @@ -2383,15 +2383,15 @@ int i_APCI1500_ReadInterruptMask(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ | Function Name : int i_APCI1500_ConfigureInterrupt | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data); | +| unsigned int *data); | +----------------------------------------------------------------------------+ | Task : Configures the interrupt registers | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer | - +| +----------------------------------------------------------------------------+ | Output Parameters : -- @@ -2401,26 +2401,26 @@ int i_APCI1500_ReadInterruptMask(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ConfigureInterrupt(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Status; + unsigned int ui_Status; int i_RegValue; int i_Constant; devpriv->tsk_Current = current; outl(0x0, devpriv->i_IobaseAmcc + 0x38); if (data[0] == 1) { i_Constant = 0xC0; - } //if(data[0]==1) + } /* if(data[0]==1) */ else { if (data[0] == 0) { i_Constant = 0x00; - } //if{data[0]==0) + } /* if{data[0]==0) */ else { printk("\nThe parameter passed to driver is in error for enabling the voltage interrupt\n"); return -EINVAL; - } //else if(data[0]==0) - } //elseif(data[0]==1) + } /* else if(data[0]==0) */ + } /* elseif(data[0]==1) */ /*****************************************************/ /* Selects the mode specification register of port B */ @@ -2580,7 +2580,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - UINT ui_InterruptStatus = 0; + unsigned int ui_InterruptStatus = 0; int i_RegValue = 0; i_InterruptMask = 0; @@ -2599,11 +2599,11 @@ static void v_APCI1500_Interrupt(int irq, void *d) /*************************************************/ /* Selects the master interrupt control register */ /*************************************************/ - //outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); + /* outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */ /**********************************************/ /* Disables the main interrupt on the board */ /**********************************************/ - //outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); + /* outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */ /*****************************************************/ /* Selects the command and status register of port A */ @@ -2647,11 +2647,11 @@ static void v_APCI1500_Interrupt(int irq, void *d) i_InputChannel = 1 + (i_RegValue >> 1); - } // if(i_Logic==APCI1500_OR_PRIORITY) + } /* if(i_Logic==APCI1500_OR_PRIORITY) */ else { i_InputChannel = 0; - } //elseif(i_Logic==APCI1500_OR_PRIORITY) - } // if ((i_RegValue & 0x60) == 0x60) + } /* elseif(i_Logic==APCI1500_OR_PRIORITY) */ + } /* if ((i_RegValue & 0x60) == 0x60) */ /*****************************************************/ /* Selects the command and status register of port B */ @@ -2679,7 +2679,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) /* Reads port B */ /****************/ i_RegValue = - inb((UINT) devpriv->iobase + + inb((unsigned int) devpriv->iobase + APCI1500_Z8536_PORT_B); i_RegValue = i_RegValue & 0xC0; @@ -2688,7 +2688,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) /**************************************/ if (i_RegValue) { - //Disable the interrupt + /* Disable the interrupt */ /*****************************************************/ /* Selects the command and status register of port B */ /*****************************************************/ @@ -2697,17 +2697,17 @@ static void v_APCI1500_Interrupt(int irq, void *d) if (i_RegValue & 0x80) { i_InterruptMask = i_InterruptMask | 0x40; - } //if (i_RegValue & 0x80) + } /* if (i_RegValue & 0x80) */ if (i_RegValue & 0x40) { i_InterruptMask = i_InterruptMask | 0x80; - } //if (i_RegValue & 0x40) - } // if (i_RegValue) + } /* if (i_RegValue & 0x40) */ + } /* if (i_RegValue) */ else { i_InterruptMask = i_InterruptMask | 2; - } // if (i_RegValue) - } //if ((i_RegValue & 0x60) == 0x60) + } /* if (i_RegValue) */ + } /* if ((i_RegValue & 0x60) == 0x60) */ /*****************************************************/ /* Selects the command and status register of timer 1 */ @@ -2731,7 +2731,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_InterruptMask = i_InterruptMask | 4; - } // if ((i_RegValue & 0x60) == 0x60) + } /* if ((i_RegValue & 0x60) == 0x60) */ /*****************************************************/ /* Selects the command and status register of timer 2 */ /*****************************************************/ @@ -2754,7 +2754,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_InterruptMask = i_InterruptMask | 8; - } // if ((i_RegValue & 0x60) == 0x60) + } /* if ((i_RegValue & 0x60) == 0x60) */ /*****************************************************/ /* Selects the command and status register of timer 3 */ @@ -2779,13 +2779,13 @@ static void v_APCI1500_Interrupt(int irq, void *d) APCI1500_Z8536_CONTROL_REGISTER); if (i_CounterLogic == APCI1500_COUNTER) { i_InterruptMask = i_InterruptMask | 0x10; - } //if(i_CounterLogic==APCI1500_COUNTER) + } /* if(i_CounterLogic==APCI1500_COUNTER) */ else { i_InterruptMask = i_InterruptMask | 0x20; } - } // if ((i_RegValue & 0x60) == 0x60) + } /* if ((i_RegValue & 0x60) == 0x60) */ - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ /***********************/ /* Enable all Interrupts */ /***********************/ @@ -2799,11 +2799,11 @@ static void v_APCI1500_Interrupt(int irq, void *d) /* Authorizes the main interrupt on the board */ /**********************************************/ outb(0xD0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if ((ui_InterruptStatus & 0x800000) == 0x800000) + } /* if ((ui_InterruptStatus & 0x800000) == 0x800000) */ else { printk("\nInterrupt from unknown source\n"); - } //else if ((ui_InterruptStatus & 0x800000) == 0x800000) + } /* else if ((ui_InterruptStatus & 0x800000) == 0x800000) */ return; } @@ -2822,7 +2822,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -INT i_APCI1500_Reset(struct comedi_device * dev) +int i_APCI1500_Reset(struct comedi_device *dev) { int i_DummyRead = 0; i_TimerCounter1Init = 0; @@ -2982,7 +2982,7 @@ INT i_APCI1500_Reset(struct comedi_device * dev) devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); /* Deletes all interrupts */ outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - //reset all the digital outputs + /* reset all the digital outputs */ outw(0x0, devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); /*******************************/ /* Disable the board interrupt */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h index 5d960b40a6a..057903366a8 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h @@ -17,11 +17,11 @@ /********* Definitions for APCI-1500 card *****/ -// Card Specific information +/* Card Specific information */ #define APCI1500_BOARD_VENDOR_ID 0x10e8 #define APCI1500_ADDRESS_RANGE 4 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI1500_DIGITAL_OP 2 #define APCI1500_DIGITAL_IP 0 diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c index 5ae9a93844e..38416356628 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c @@ -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. @@ -63,7 +63,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -73,22 +73,22 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | | +----------------------------------------------------------------------------+ */ -INT i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_TmpValue = 0; - UINT ui_Channel; + unsigned int ui_TmpValue = 0; + unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); if (ui_Channel >= 0 && ui_Channel <= 7) { - ui_TmpValue = (UINT) inw(devpriv->iobase + APCI1516_DIGITAL_IP); - // since only 1 channel reqd to bring it to last bit it is rotated - // 8 +(chan - 1) times then ANDed with 1 for last bit. + ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP); + /* since only 1 channel reqd to bring it to last bit it is rotated */ + /* 8 +(chan - 1) times then ANDed with 1 for last bit. */ *data = (ui_TmpValue >> ui_Channel) & 0x1; - } //if(ui_Channel >= 0 && ui_Channel <=7) + } /* if(ui_Channel >= 0 && ui_Channel <=7) */ else { - //comedi_error(dev," \n chan spec wrong\n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if(ui_Channel >= 0 && ui_Channel <=7) + /* comedi_error(dev," \n chan spec wrong\n"); */ + return -EINVAL; /* "sorry channel spec wrong " */ + } /* else if(ui_Channel >= 0 && ui_Channel <=7) */ return insn->n; } @@ -103,7 +103,7 @@ INT i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -114,17 +114,17 @@ INT i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_PortValue = data[0]; - UINT ui_Mask = 0; - UINT ui_NoOfChannels; + unsigned int ui_PortValue = data[0]; + unsigned int ui_Mask = 0; + unsigned int ui_NoOfChannels; ui_NoOfChannels = CR_CHAN(insn->chanspec); - *data = (UINT) inw(devpriv->iobase + APCI1516_DIGITAL_IP); + *data = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP); switch (ui_NoOfChannels) { case 2: ui_Mask = 3; @@ -139,9 +139,9 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su default: printk("\nWrong parameters\n"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ return insn->n; } @@ -149,7 +149,7 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI1516_ConfigDigitalOutput (struct comedi_device *dev, - struct comedi_subdevice *s struct comedi_insn *insn,unsigned int *data) | +| struct comedi_subdevice *s struct comedi_insn *insn,unsigned int *data) | | | +----------------------------------------------------------------------------+ | Task : Configures The Digital Output Subdevice. | @@ -158,7 +158,7 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | unsigned int *data : Data Pointer contains | | configuration parameters as below | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | data[0] :1:Memory on | | 0:Memory off | | | @@ -171,8 +171,8 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | | +----------------------------------------------------------------------------+ */ -int i_APCI1516_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { devpriv->b_OutputMemoryStatus = data[0]; return insn->n; @@ -182,13 +182,13 @@ int i_APCI1516_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ | Function Name : int i_APCI1516_WriteDigitalOutput | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data) | +| unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -199,21 +199,21 @@ int i_APCI1516_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ printk("EL311003 : @=%x\n", devpriv->iobase + APCI1516_DIGITAL_OP); if (devpriv->b_OutputMemoryStatus) { ui_Temp = inw(devpriv->iobase + APCI1516_DIGITAL_OP); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; @@ -222,7 +222,7 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd printk("EL311003 : d=%d @=%x\n", data[0], devpriv->iobase + APCI1516_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -245,21 +245,21 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI1516_DIGITAL_OP); printk("EL311003 : d=%d @=%x\n", data[0], devpriv->iobase + APCI1516_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==0) + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -275,7 +275,7 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd printk("EL311003 : d=%d @=%x\n", data[0], devpriv->iobase + APCI1516_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -312,9 +312,9 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + @@ -324,17 +324,17 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0], devpriv->iobase + APCI1516_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==1); + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==1); */ else { printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } //if else data[3]==1) - } //if else data[3]==0) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return (insn->n);; } @@ -342,13 +342,13 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ | Function Name : int i_APCI1516_ReadDigitalOutput | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data) | +| unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -359,17 +359,17 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ ui_Temp = data[0]; *data = inw(devpriv->iobase + APCI1516_DIGITAL_OP_RW); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } //if(ui_Temp==0) + } /* if(ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -387,28 +387,28 @@ INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) - } //if(ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if(ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif(ui_Temp==1) - } //elseif(ui_Temp==0) + } /* elseif(ui_Temp==1) */ + } /* elseif(ui_Temp==0) */ return insn->n; } /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, - struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | +| struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | | | +----------------------------------------------------------------------------+ | Task : Configures The Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -419,15 +419,15 @@ INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { if (data[0] == 0) { - //Disable the watchdog + /* Disable the watchdog */ outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); - //Loading the Reload value + /* Loading the Reload value */ outw(data[1], devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE); @@ -435,11 +435,11 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic outw(data[1], devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE + 2); - } //if(data[0]==0) + } /* if(data[0]==0) */ else { printk("\nThe input parameters are wrong\n"); return -EINVAL; - } //elseif(data[0]==0) + } /* elseif(data[0]==0) */ return insn->n; } @@ -465,19 +465,19 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { switch (data[0]) { - case 0: //stop the watchdog - outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); //disable the watchdog + case 0: /* stop the watchdog */ + outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outw(0x0001, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); break; - case 2: //Software trigger + case 2: /* Software trigger */ outw(0x0201, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); @@ -485,7 +485,7 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ default: printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -510,8 +510,8 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ +----------------------------------------------------------------------------+ */ -int i_APCI1516_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WATCHDOG_STATUS) & 0x1; return insn->n; @@ -532,9 +532,9 @@ int i_APCI1516_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI1516_Reset(struct comedi_device * dev) +int i_APCI1516_Reset(struct comedi_device *dev) { - outw(0x0, devpriv->iobase + APCI1516_DIGITAL_OP); //RESETS THE DIGITAL OUTPUTS + outw(0x0, devpriv->iobase + APCI1516_DIGITAL_OP); /* RESETS THE DIGITAL OUTPUTS */ outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE); outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE + 2); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h index 398baa04a16..21c09ed01b1 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h @@ -17,17 +17,17 @@ /********* Definitions for APCI-1516 card *****/ -// Card Specific information +/* Card Specific information */ #define APCI1516_BOARD_VENDOR_ID 0x15B8 #define APCI1516_ADDRESS_RANGE 8 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI1516_DIGITAL_OP 4 #define APCI1516_DIGITAL_OP_RW 4 #define APCI1516_DIGITAL_IP 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define ADDIDATA_WATCHDOG 2 #define APCI1516_DIGITAL_OP_WATCHDOG 0 @@ -35,24 +35,25 @@ #define APCI1516_WATCHDOG_RELOAD_VALUE 4 #define APCI1516_WATCHDOG_STATUS 16 -// Hardware Layer functions for Apci1516 +/* Hardware Layer functions for Apci1516 */ -//Digital Input -INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +/* Digital Input */ +int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//Digital Output +/* Digital Output */ int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds +/* +* TIMER timer value is passed as u seconds +*/ int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, @@ -60,5 +61,5 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//reset -INT i_APCI1516_Reset(struct comedi_device *dev); +/* reset */ +int i_APCI1516_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index a6b504c3d39..3a47c303422 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -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. @@ -55,9 +55,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #include <linux/delay.h> #include "hwdrv_apci1564.h" -//Global variables -UINT ui_InterruptStatus_1564 = 0; -UINT ui_InterruptData, ui_Type; +/* Global variables */ +unsigned int ui_InterruptStatus_1564 = 0; +unsigned int ui_InterruptData, ui_Type; /* +----------------------------------------------------------------------------+ @@ -86,8 +86,8 @@ UINT ui_InterruptData, ui_Type; | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { devpriv->tsk_Current = current; /*******************************/ @@ -106,13 +106,13 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd outl(0x4, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - } // if (data[1] == ADDIDATA_OR) + } /* if (data[1] == ADDIDATA_OR) */ else { outl(0x6, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - } // else if (data[1] == ADDIDATA_OR) - } // if (data[0] == ADDIDATA_ENABLE) + } /* else if (data[1] == ADDIDATA_OR) */ + } /* if (data[0] == ADDIDATA_ENABLE) */ else { outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + @@ -123,7 +123,7 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - } // else if (data[0] == ADDIDATA_ENABLE) + } /* else if (data[0] == ADDIDATA_ENABLE) */ return insn->n; } @@ -137,7 +137,7 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd | Task : Return the status of the digital input | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | +| unsigned int ui_Channel : Channel number to read | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -147,24 +147,26 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_TmpValue = 0; - UINT ui_Channel; + unsigned int ui_TmpValue = 0; + unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); if (ui_Channel >= 0 && ui_Channel <= 31) { ui_TmpValue = - (UINT) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP); - // since only 1 channel reqd to bring it to last bit it is rotated - // 8 +(chan - 1) times then ANDed with 1 for last bit. + (unsigned int) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP); +/* +* since only 1 channel reqd to bring it to last bit it is rotated 8 +* +(chan - 1) times then ANDed with 1 for last bit. +*/ *data = (ui_TmpValue >> ui_Channel) & 0x1; - } // if (ui_Channel >= 0 && ui_Channel <=31) + } /* if (ui_Channel >= 0 && ui_Channel <=31) */ else { comedi_error(dev, "Not a valid channel number !!! \n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if (ui_Channel >= 0 && ui_Channel <=31) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* else if (ui_Channel >= 0 && ui_Channel <=31) */ return insn->n; } @@ -177,8 +179,8 @@ INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde | Task : Return the status of the Requested digital inputs | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To be Read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To be Read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -187,16 +189,16 @@ INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_PortValue = data[0]; - UINT ui_Mask = 0; - UINT ui_NoOfChannels; + unsigned int ui_PortValue = data[0]; + unsigned int ui_Mask = 0; + unsigned int ui_NoOfChannels; ui_NoOfChannels = CR_CHAN(insn->chanspec); if (data[1] == 0) { - *data = (UINT) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP); + *data = (unsigned int) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP); switch (ui_NoOfChannels) { case 2: ui_Mask = 3; @@ -218,15 +220,15 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su break; default: comedi_error(dev, "Not a valid Channel number !!!\n"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } // switch (ui_NoOfChannels) - } // if (data[1]==0) + } /* switch (ui_NoOfChannels) */ + } /* if (data[1]==0) */ else { if (data[1] == 1) { *data = ui_InterruptStatus_1564; - } // if (data[1]==1) - } // else if (data[1]==0) + } /* if (data[1]==1) */ + } /* else if (data[1]==0) */ return insn->n; } @@ -239,7 +241,7 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[1] : 1 Enable VCC Interrupt | @@ -255,34 +257,34 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - ULONG ul_Command = 0; + unsigned int ul_Command = 0; if ((data[0] != 0) && (data[0] != 1)) { comedi_error(dev, "Not a valid Data !!! ,Data should be 1 or 0\n"); return -EINVAL; - } // if ((data[0]!=0) && (data[0]!=1)) + } /* if ((data[0]!=0) && (data[0]!=1)) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0]) + } /* if (data[0]) */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } // else if (data[0]) + } /* else if (data[0]) */ if (data[1] == ADDIDATA_ENABLE) { ul_Command = ul_Command | 0x1; - } // if (data[1] == ADDIDATA_ENABLE) + } /* if (data[1] == ADDIDATA_ENABLE) */ else { ul_Command = ul_Command & 0xFFFFFFFE; - } // else if (data[1] == ADDIDATA_ENABLE) + } /* else if (data[1] == ADDIDATA_ENABLE) */ if (data[2] == ADDIDATA_ENABLE) { ul_Command = ul_Command | 0x2; - } // if (data[2] == ADDIDATA_ENABLE) + } /* if (data[2] == ADDIDATA_ENABLE) */ else { ul_Command = ul_Command & 0xFFFFFFFD; - } // else if (data[2] == ADDIDATA_ENABLE) + } /* else if (data[2] == ADDIDATA_ENABLE) */ outl(ul_Command, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT); @@ -302,8 +304,8 @@ INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To Write | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -312,28 +314,28 @@ INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel; + unsigned int ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); if (devpriv->b_OutputMemoryStatus) { ui_Temp = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (devpriv->b_OutputMemoryStatus ) + } /* if (devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } // else if (devpriv->b_OutputMemoryStatus ) + } /* else if (devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outl(data[0], devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==0) + } /* if (data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -362,18 +364,18 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd break; default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } // switch (ui_NoOfChannels) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch (ui_NoOfChannels) */ outl(data[0], devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==1) + } /* if (data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } // else if (data[1]==1) - } // else if (data[1]==0) - } //if(data[3]==0) + } /* else if (data[1]==1) */ + } /* else if (data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -389,7 +391,7 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==0) + } /* if (data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -447,23 +449,23 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannels) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==1) + } /* if (data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } // else if (data[1]==1) - } // else if (data[1]==0) - } // if (data[3]==1); + } /* else if (data[1]==1) */ + } /* else if (data[1]==0) */ + } /* if (data[3]==1); */ else { printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // else if (data[3]==1) - } // else if (data[3]==0) + } /* else if (data[3]==1) */ + } /* else if (data[3]==0) */ return insn->n; } @@ -476,8 +478,8 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -486,11 +488,11 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; @@ -498,7 +500,7 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde APCI1564_DIGITAL_OP_RW); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } // if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -523,14 +525,14 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } // switch(ui_NoOfChannels) - } // if (ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // else if (ui_Temp==0) + } /* else if (ui_Temp==1) */ + } /* else if (ui_Temp==0) */ return insn->n; } @@ -543,7 +545,7 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | Task : Configures The Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Configure As Timer | @@ -564,34 +566,34 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; devpriv->tsk_Current = current; if (data[0] == ADDIDATA_WATCHDOG) { devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG; - //Disable the watchdog + /* Disable the watchdog */ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG); - //Loading the Reload value + /* Loading the Reload value */ outl(data[3], devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_RELOAD_VALUE); - } // if (data[0]==ADDIDATA_WATCHDOG) + } /* if (data[0]==ADDIDATA_WATCHDOG) */ else if (data[0] == ADDIDATA_TIMER) { - //First Stop The Timer + /* First Stop The Timer */ ul_Command1 = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); ul_Command1 = ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); //Stop The Timer + outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); /* Stop The Timer */ devpriv->b_TimerSelectMode = ADDIDATA_TIMER; if (data[1] == 1) { - outl(0x02, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); //Enable TIMER int & DISABLE ALL THE OTHER int SOURCES + outl(0x02, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); @@ -614,18 +616,18 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, outl(0x0, devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_IRQ); - } // if (data[1]==1) + } /* if (data[1]==1) */ else { - outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); //disable Timer interrupt - } // else if (data[1]==1) + outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); /* disable Timer interrupt */ + } /* else if (data[1]==1) */ - // Loading Timebase + /* Loading Timebase */ outl(data[2], devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_TIMEBASE); - //Loading the Reload value + /* Loading the Reload value */ outl(data[3], devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_RELOAD_VALUE); @@ -635,18 +637,18 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, APCI1564_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL; - outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); //mode 2 - } // else if (data[0]==ADDIDATA_TIMER) + outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); /* mode 2 */ + } /* else if (data[0]==ADDIDATA_TIMER) */ else if (data[0] == ADDIDATA_COUNTER) { devpriv->b_TimerSelectMode = ADDIDATA_COUNTER; devpriv->b_ModeSelectRegister = data[5]; - //First Stop The Counter + /* First Stop The Counter */ ul_Command1 = inl(devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG); ul_Command1 = ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG); //Stop The Timer + outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG); /* Stop The Timer */ /************************/ /* Set the reload value */ @@ -666,12 +668,12 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, /******************************/ ul_Command1 = (ul_Command1 & 0xFFFC19E2UL) | 0x80000UL | - (ULONG) ((ULONG) data[4] << 16UL); + (unsigned int) ((unsigned int) data[4] << 16UL); outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG); - // Enable or Disable Interrupt + /* Enable or Disable Interrupt */ ul_Command1 = (ul_Command1 & 0xFFFFF9FD) | (data[1] << 1); outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + @@ -684,10 +686,10 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG); - } // else if (data[0]==ADDIDATA_COUNTER) + } /* else if (data[0]==ADDIDATA_COUNTER) */ else { printk(" Invalid subdevice."); - } // else if (data[0]==ADDIDATA_WATCHDOG) + } /* else if (data[0]==ADDIDATA_WATCHDOG) */ return insn->n; } @@ -701,7 +703,7 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, | Task : Start / Stop The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Timer | @@ -718,22 +720,22 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { switch (data[1]) { - case 0: //stop the watchdog - outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG); //disable the watchdog + case 0: /* stop the watchdog */ + outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outl(0x0001, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG); break; - case 2: //Software trigger + case 2: /* Software trigger */ outl(0x0201, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + @@ -742,8 +744,8 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, default: printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // switch (data[1]) - } // if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + } /* switch (data[1]) */ + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */ if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { if (data[1] == 1) { ul_Command1 = @@ -751,13 +753,13 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, APCI1564_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - //Enable the Timer + /* Enable the Timer */ outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - } // if (data[1]==1) + } /* if (data[1]==1) */ else if (data[1] == 0) { - //Stop The Timer + /* Stop The Timer */ ul_Command1 = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + @@ -766,29 +768,29 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - } // else if(data[1]==0) - } // if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* else if(data[1]==0) */ + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */ if (devpriv->b_TimerSelectMode == ADDIDATA_COUNTER) { ul_Command1 = inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister - 1) * 0x20) + APCI1564_TCW_PROG); if (data[1] == 1) { - //Start the Counter subdevice + /* Start the Counter subdevice */ ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - } // if (data[1] == 1) + } /* if (data[1] == 1) */ else if (data[1] == 0) { - // Stops the Counter subdevice + /* Stops the Counter subdevice */ ul_Command1 = 0; - } // else if (data[1] == 0) + } /* else if (data[1] == 0) */ else if (data[1] == 2) { - // Clears the Counter subdevice + /* Clears the Counter subdevice */ ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x400; - } // else if (data[1] == 3) + } /* else if (data[1] == 3) */ outl(ul_Command1, devpriv->iobase + ((devpriv->b_ModeSelectRegister - 1) * 0x20) + APCI1564_TCW_PROG); - } // if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) */ return insn->n; } @@ -801,7 +803,7 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, | Task : Read The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | @@ -813,13 +815,13 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { - // Stores the status of the Watchdog + /* Stores the status of the Watchdog */ data[0] = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + @@ -827,18 +829,18 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev, data[1] = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG); - } // if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */ else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { - // Stores the status of the Timer + /* Stores the status of the Timer */ data[0] = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_TRIG_STATUS) & 0x1; - // Stores the Actual value of the Timer + /* Stores the Actual value of the Timer */ data[1] = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER); - } // else if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* else if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */ else if (devpriv->b_TimerSelectMode == ADDIDATA_COUNTER) { - // Read the Counter Actual Value. + /* Read the Counter Actual Value. */ data[0] = inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister - 1) * 0x20) + @@ -850,28 +852,28 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev, /***********************************/ /* Get the software trigger status */ /***********************************/ - data[1] = (BYTE) ((ul_Command1 >> 1) & 1); + data[1] = (unsigned char) ((ul_Command1 >> 1) & 1); /***********************************/ /* Get the hardware trigger status */ /***********************************/ - data[2] = (BYTE) ((ul_Command1 >> 2) & 1); + data[2] = (unsigned char) ((ul_Command1 >> 2) & 1); /*********************************/ /* Get the software clear status */ /*********************************/ - data[3] = (BYTE) ((ul_Command1 >> 3) & 1); + data[3] = (unsigned char) ((ul_Command1 >> 3) & 1); /***************************/ /* Get the overflow status */ /***************************/ - data[4] = (BYTE) ((ul_Command1 >> 0) & 1); - } // else if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) + data[4] = (unsigned char) ((ul_Command1 >> 0) & 1); + } /* else if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) */ else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG) && (devpriv->b_TimerSelectMode != ADDIDATA_COUNTER)) { printk("\n Invalid Subdevice !!!\n"); - } // else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER)) + } /* else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER)) */ return insn->n; } @@ -892,8 +894,8 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI1564_ReadInterruptStatus(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { *data = ui_Type; return insn->n; @@ -919,10 +921,10 @@ int i_APCI1564_ReadInterruptStatus(struct comedi_device * dev, struct comedi_sub static void v_APCI1564_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - UINT ui_DO, ui_DI; - UINT ui_Timer; - UINT ui_C1, ui_C2, ui_C3, ui_C4; - ULONG ul_Command2 = 0; + unsigned int ui_DO, ui_DI; + unsigned int ui_Timer; + unsigned int ui_C1, ui_C2, ui_C3, ui_C4; + unsigned int ul_Command2 = 0; ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ) & 0x01; ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + @@ -941,7 +943,7 @@ static void v_APCI1564_Interrupt(int irq, void *d) if (ui_DI == 0 && ui_DO == 0 && ui_Timer == 0 && ui_C1 == 0 && ui_C2 == 0 && ui_C3 == 0 && ui_C4 == 0) { printk("\nInterrupt from unknown source\n"); - } // if(ui_DI==0 && ui_DO==0 && ui_Timer==0 && ui_C1==0 && ui_C2==0 && ui_C3==0 && ui_C4==0) + } /* if(ui_DI==0 && ui_DO==0 && ui_Timer==0 && ui_C1==0 && ui_C2==0 && ui_C3==0 && ui_C4==0) */ if (ui_DI == 1) { ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + @@ -953,116 +955,137 @@ static void v_APCI1564_Interrupt(int irq, void *d) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_INTERRUPT_STATUS); ui_InterruptStatus_1564 = ui_InterruptStatus_1564 & 0X000FFFF0; - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample - outl(ui_DI, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); //enable the interrupt + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ + outl(ui_DI, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); /* enable the interrupt */ return; } if (ui_DO == 1) { - // Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. + /* Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. */ ui_Type = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT_STATUS) & 0x3; - //Disable the Interrupt + /* Disable the Interrupt */ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT); - //Sends signal to user space + /* Sends signal to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if (ui_DO) + } /* if (ui_DO) */ - if ((ui_Timer == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_TIMER)) { - // Disable Timer Interrupt - ul_Command2 = - inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + - APCI1564_TCW_PROG); - outl(0x0, - devpriv->i_IobaseAmcc + APCI1564_TIMER + - APCI1564_TCW_PROG); + if (ui_Timer == 1) { + devpriv->b_TimerSelectMode = ADDIDATA_TIMER; + if (devpriv->b_TimerSelectMode) { - //Send a signal to from kernel to user space - send_sig(SIGIO, devpriv->tsk_Current, 0); + /* Disable Timer Interrupt */ + ul_Command2 = + inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + + APCI1564_TCW_PROG); + outl(0x0, + devpriv->i_IobaseAmcc + APCI1564_TIMER + + APCI1564_TCW_PROG); - // Enable Timer Interrupt + /* Send a signal to from kernel to user space */ + send_sig(SIGIO, devpriv->tsk_Current, 0); - outl(ul_Command2, - devpriv->i_IobaseAmcc + APCI1564_TIMER + - APCI1564_TCW_PROG); - } // if ((ui_Timer == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_TIMER)) + /* Enable Timer Interrupt */ - if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) { - // Disable Counter Interrupt - ul_Command2 = - inl(devpriv->iobase + APCI1564_COUNTER1 + - APCI1564_TCW_PROG); - outl(0x0, - devpriv->iobase + APCI1564_COUNTER1 + - APCI1564_TCW_PROG); + outl(ul_Command2, + devpriv->i_IobaseAmcc + APCI1564_TIMER + + APCI1564_TCW_PROG); + } + }/* if (ui_Timer == 1) */ - //Send a signal to from kernel to user space - send_sig(SIGIO, devpriv->tsk_Current, 0); - // Enable Counter Interrupt - outl(ul_Command2, - devpriv->iobase + APCI1564_COUNTER1 + - APCI1564_TCW_PROG); - } // if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) + if (ui_C1 == 1) { + devpriv->b_TimerSelectMode = ADDIDATA_COUNTER; + if (devpriv->b_TimerSelectMode) { - if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) { - // Disable Counter Interrupt - ul_Command2 = - inl(devpriv->iobase + APCI1564_COUNTER2 + - APCI1564_TCW_PROG); - outl(0x0, - devpriv->iobase + APCI1564_COUNTER2 + - APCI1564_TCW_PROG); + /* Disable Counter Interrupt */ + ul_Command2 = + inl(devpriv->iobase + APCI1564_COUNTER1 + + APCI1564_TCW_PROG); + outl(0x0, + devpriv->iobase + APCI1564_COUNTER1 + + APCI1564_TCW_PROG); - //Send a signal to from kernel to user space - send_sig(SIGIO, devpriv->tsk_Current, 0); + /* Send a signal to from kernel to user space */ + send_sig(SIGIO, devpriv->tsk_Current, 0); - // Enable Counter Interrupt - outl(ul_Command2, - devpriv->iobase + APCI1564_COUNTER2 + - APCI1564_TCW_PROG); - } // if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + /* Enable Counter Interrupt */ + outl(ul_Command2, + devpriv->iobase + APCI1564_COUNTER1 + + APCI1564_TCW_PROG); + } + } /* if (ui_C1 == 1) */ - if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) { - // Disable Counter Interrupt - ul_Command2 = - inl(devpriv->iobase + APCI1564_COUNTER3 + - APCI1564_TCW_PROG); - outl(0x0, - devpriv->iobase + APCI1564_COUNTER3 + - APCI1564_TCW_PROG); + if (ui_C2 == 1) { + devpriv->b_TimerSelectMode = ADDIDATA_COUNTER; + if (devpriv->b_TimerSelectMode) { - //Send a signal to from kernel to user space - send_sig(SIGIO, devpriv->tsk_Current, 0); + /* Disable Counter Interrupt */ + ul_Command2 = + inl(devpriv->iobase + APCI1564_COUNTER2 + + APCI1564_TCW_PROG); + outl(0x0, + devpriv->iobase + APCI1564_COUNTER2 + + APCI1564_TCW_PROG); - // Enable Counter Interrupt - outl(ul_Command2, - devpriv->iobase + APCI1564_COUNTER3 + - APCI1564_TCW_PROG); - } // if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + /* Send a signal to from kernel to user space */ + send_sig(SIGIO, devpriv->tsk_Current, 0); - if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) { - // Disable Counter Interrupt - ul_Command2 = - inl(devpriv->iobase + APCI1564_COUNTER4 + - APCI1564_TCW_PROG); - outl(0x0, - devpriv->iobase + APCI1564_COUNTER4 + - APCI1564_TCW_PROG); + /* Enable Counter Interrupt */ + outl(ul_Command2, + devpriv->iobase + APCI1564_COUNTER2 + + APCI1564_TCW_PROG); + } + } /* if ((ui_C2 == 1) */ - //Send a signal to from kernel to user space - send_sig(SIGIO, devpriv->tsk_Current, 0); + if (ui_C3 == 1) { + devpriv->b_TimerSelectMode = ADDIDATA_COUNTER; + if (devpriv->b_TimerSelectMode) { - // Enable Counter Interrupt - outl(ul_Command2, - devpriv->iobase + APCI1564_COUNTER4 + - APCI1564_TCW_PROG); - } // if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + /* Disable Counter Interrupt */ + ul_Command2 = + inl(devpriv->iobase + APCI1564_COUNTER3 + + APCI1564_TCW_PROG); + outl(0x0, + devpriv->iobase + APCI1564_COUNTER3 + + APCI1564_TCW_PROG); + + /* Send a signal to from kernel to user space */ + send_sig(SIGIO, devpriv->tsk_Current, 0); + + /* Enable Counter Interrupt */ + outl(ul_Command2, + devpriv->iobase + APCI1564_COUNTER3 + + APCI1564_TCW_PROG); + } + } /* if ((ui_C3 == 1) */ + + if (ui_C4 == 1) { + devpriv->b_TimerSelectMode = ADDIDATA_COUNTER; + if (devpriv->b_TimerSelectMode) { + + /* Disable Counter Interrupt */ + ul_Command2 = + inl(devpriv->iobase + APCI1564_COUNTER4 + + APCI1564_TCW_PROG); + outl(0x0, + devpriv->iobase + APCI1564_COUNTER4 + + APCI1564_TCW_PROG); + + /* Send a signal to from kernel to user space */ + send_sig(SIGIO, devpriv->tsk_Current, 0); + + /* Enable Counter Interrupt */ + outl(ul_Command2, + devpriv->iobase + APCI1564_COUNTER4 + + APCI1564_TCW_PROG); + } + } /* if (ui_C4 == 1) */ return; } @@ -1081,16 +1104,16 @@ static void v_APCI1564_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -INT i_APCI1564_Reset(struct comedi_device * dev) +int i_APCI1564_Reset(struct comedi_device *dev) { - outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_IRQ); //disable the interrupts - inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_STATUS); //Reset the interrupt status register - outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_MODE1); //Disable the and/or interrupt + outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_IRQ); /* disable the interrupts */ + inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_STATUS); /* Reset the interrupt status register */ + outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_MODE1); /* Disable the and/or interrupt */ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_MODE2); devpriv->b_DigitalOutputRegister = 0; ui_Type = 0; - outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP); //Resets the output channels - outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_INTERRUPT); //Disables the interrupt. + outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP); /* Resets the output channels */ + outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_INTERRUPT); /* Disables the interrupt. */ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_RELOAD_VALUE); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h index f0c461ca539..0780c440c44 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h @@ -20,45 +20,45 @@ #define APCI1564_BOARD_VENDOR_ID 0x15B8 #define APCI1564_ADDRESS_RANGE 128 -//DIGITAL INPUT-OUTPUT DEFINE -// Input defines +/* DIGITAL INPUT-OUTPUT DEFINE */ +/* Input defines */ #define APCI1564_DIGITAL_IP 0x04 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE1 4 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE2 8 #define APCI1564_DIGITAL_IP_IRQ 16 -// Output defines +/* Output defines */ #define APCI1564_DIGITAL_OP 0x18 #define APCI1564_DIGITAL_OP_RW 0 #define APCI1564_DIGITAL_OP_INTERRUPT 4 #define APCI1564_DIGITAL_OP_IRQ 12 -//Digital Input IRQ Function Selection +/* Digital Input IRQ Function Selection */ #define ADDIDATA_OR 0 #define ADDIDATA_AND 1 -//Digital Input Interrupt Status +/* Digital Input Interrupt Status */ #define APCI1564_DIGITAL_IP_INTERRUPT_STATUS 12 -//Digital Output Interrupt Status +/* Digital Output Interrupt Status */ #define APCI1564_DIGITAL_OP_INTERRUPT_STATUS 8 -//Digital Input Interrupt Enable Disable. +/* Digital Input Interrupt Enable Disable. */ #define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE 0x4 #define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE 0xFFFFFFFB -//Digital Output Interrupt Enable Disable. +/* Digital Output Interrupt Enable Disable. */ #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE 0x1 #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE 0xFFFFFFFE #define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE 0x2 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE 0xFFFFFFFD -//ADDIDATA Enable Disable +/* ADDIDATA Enable Disable */ #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define ADDIDATA_TIMER 0 #define ADDIDATA_COUNTER 1 @@ -78,30 +78,32 @@ #define APCI1564_TCW_WARN_TIMEVAL 24 #define APCI1564_TCW_WARN_TIMEBASE 28 -// Hardware Layer functions for Apci1564 +/* Hardware Layer functions for Apci1564 */ -//DI -// for di read -INT i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +/* +* DI for di read +*/ +int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DO +/* DO */ int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds -INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev, +/* +* TIMER timer value is passed as u seconds +*/ +int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, @@ -112,8 +114,8 @@ int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// INTERRUPT +/* intERRUPT */ static void v_APCI1564_Interrupt(int irq, void *d); -// RESET -INT i_APCI1564_Reset(struct comedi_device *dev); +/* RESET */ +int i_APCI1564_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c index 906d635da6b..988e3fc2b85 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c @@ -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,7 +57,7 @@ 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, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -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, - struct comedi_subdevice * s, struct 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,7 +250,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI16XX_InsnBitsReadTTLIO | +| Function Name : int i_APCI16XX_InsnBitsReadTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -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, - struct comedi_subdevice * s, struct 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,12 +405,12 @@ 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, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -430,13 +430,13 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev, - struct comedi_subdevice * s, struct 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,7 +535,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI16XX_InsnBitsWriteTTLIO | +| Function Name : int i_APCI16XX_InsnBitsWriteTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -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, - struct comedi_subdevice * s, struct 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; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c index 31f55da39ea..457917f292b 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c @@ -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. @@ -62,7 +62,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 1 Digital Memory On | @@ -75,20 +75,20 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | | +----------------------------------------------------------------------------+ */ -int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { if ((data[0] != 0) && (data[0] != 1)) { comedi_error(dev, "Not a valid Data !!! ,Data should be 1 or 0\n"); return -EINVAL; - } // if ((data[0]!=0) && (data[0]!=1)) + } /* if ((data[0]!=0) && (data[0]!=1)) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0] + } /* if (data[0] */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } // else if (data[0] + } /* else if (data[0] */ return insn->n; } @@ -101,8 +101,8 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To Write | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -111,34 +111,34 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_NoOfChannel; - UINT ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel; + unsigned int ui_Temp, ui_Temp1; ui_NoOfChannel = CR_CHAN(insn->chanspec); if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) { comedi_error(dev, "Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n"); return -EINVAL; - } // if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) + } /* if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inw(devpriv->iobase + APCI2016_DIGITAL_OP); - } // if (devpriv->b_OutputMemoryStatus ) + } /* if (devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } // else if (devpriv->b_OutputMemoryStatus ) + } /* else if (devpriv->b_OutputMemoryStatus ) */ if ((data[1] != 0) && (data[1] != 1)) { comedi_error(dev, "Invalid Data[1] value !!!, Data[1] should be 0 or 1\n"); return -EINVAL; - } // if ((data[1]!=0) && (data[1]!=1)) + } /* if ((data[1]!=0) && (data[1]!=1)) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP); - } // if (data[1]==0) + } /* if (data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -162,16 +162,16 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd break; default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannels) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP); - } // if (data[1]==1) + } /* if (data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } // else if (data[1]==1) - } // else if (data[1]==0) - } // if (data[3]==0) + } /* else if (data[1]==1) */ + } /* else if (data[1]==0) */ + } /* if (data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -183,7 +183,7 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = data[0] & ui_Temp; outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP); - } // if (data[1]==0) + } /* if (data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -228,22 +228,22 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannels) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==1); + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==1); */ else { printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } //if else data[3]==1) - } //if else data[3]==0) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return insn->n; } @@ -256,8 +256,8 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -266,27 +266,27 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) { comedi_error(dev, "Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n"); return -EINVAL; - } // if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) + } /* if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) */ if ((data[0] != 0) && (data[0] != 1)) { comedi_error(dev, "Invalid Data[0] value !!!, Data[0] should be 0 or 1\n"); return -EINVAL; - } // if ((data[0]!=0) && (data[0]!=1)) + } /* if ((data[0]!=0) && (data[0]!=1)) */ ui_Temp = data[0]; *data = inw(devpriv->iobase + APCI2016_DIGITAL_OP_RW); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } // if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -307,13 +307,13 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannel) - } // if (ui_Temp==1) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch(ui_NoOfChannel) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // if (ui_Temp==0) + } /* else if (ui_Temp==1) */ + } /* if (ui_Temp==0) */ return insn->n; } @@ -337,16 +337,16 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -int i_APCI2016_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { if (data[0] == 0) { - //Disable the watchdog + /* Disable the watchdog */ outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); - //Loading the Reload value + /* Loading the Reload value */ outw(data[1], devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE); @@ -380,20 +380,20 @@ int i_APCI2016_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic | | +----------------------------------------------------------------------------+ */ -int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { switch (data[0]) { - case 0: //stop the watchdog - outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); //disable the watchdog + case 0: /* stop the watchdog */ + outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outw(0x0001, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); break; - case 2: //Software trigger + case 2: /* Software trigger */ outw(0x0201, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); @@ -401,7 +401,7 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ default: printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -427,8 +427,8 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ +----------------------------------------------------------------------------+ */ -int i_APCI2016_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { udelay(5); data[0] = inw(devpriv->i_IobaseAddon + APCI2016_WATCHDOG_STATUS) & 0x1; @@ -450,9 +450,9 @@ int i_APCI2016_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI2016_Reset(struct comedi_device * dev) +int i_APCI2016_Reset(struct comedi_device *dev) { - outw(0x0, devpriv->iobase + APCI2016_DIGITAL_OP); // Resets the digital output channels + outw(0x0, devpriv->iobase + APCI2016_DIGITAL_OP); /* Resets the digital output channels */ outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE); outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE + 2); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h index 9261aacd25f..639944c4446 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h @@ -19,17 +19,17 @@ #define APCI2016_BOARD_VENDOR_ID 0x15B8 #define APCI2016_ADDRESS_RANGE 8 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI2016_DIGITAL_OP 0x04 #define APCI2016_DIGITAL_OP_RW 4 -//ADDIDATA Enable Disable +/* ADDIDATA Enable Disable */ #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define ADDIDATA_WATCHDOG 2 #define APCI2016_DIGITAL_OP_WATCHDOG 0 @@ -37,9 +37,9 @@ #define APCI2016_WATCHDOG_RELOAD_VALUE 4 #define APCI2016_WATCHDOG_STATUS 16 -// Hardware Layer functions for Apci2016 +/* Hardware Layer functions for Apci2016 */ -//DO +/* DO */ int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -49,8 +49,10 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds +/* +* TIMER +* timer value is passed as u seconds +*/ int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -61,10 +63,10 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// Interrupt functions..... +/* Interrupt functions..... */ -// void v_APCI2016_Interrupt(int irq, void *d) ; +/* void v_APCI2016_Interrupt(int irq, void *d); */ - //void v_APCI2016_Interrupt(int irq, void *d); -// RESET -INT i_APCI2016_Reset(struct comedi_device *dev); +/* void v_APCI2016_Interrupt(int irq, void *d); */ +/* RESET */ +int i_APCI2016_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c index 1347bc388f3..ec817082d17 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c @@ -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. @@ -53,7 +53,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc */ #include "hwdrv_apci2032.h" -UINT ui_InterruptData, ui_Type; +unsigned int ui_InterruptData, ui_Type; /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2032_ConfigDigitalOutput | @@ -63,7 +63,7 @@ UINT ui_InterruptData, ui_Type; | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[1] : 1 Enable VCC Interrupt | @@ -79,36 +79,36 @@ UINT ui_InterruptData, ui_Type; | | +----------------------------------------------------------------------------+ */ -int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - ULONG ul_Command = 0; + unsigned int ul_Command = 0; devpriv->tsk_Current = current; if ((data[0] != 0) && (data[0] != 1)) { comedi_error(dev, "Not a valid Data !!! ,Data should be 1 or 0\n"); return -EINVAL; - } //if ( (data[0]!=0) && (data[0]!=1) ) + } /* if ( (data[0]!=0) && (data[0]!=1) ) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0]) + } /* if (data[0]) */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } //else if (data[0]) + } /* else if (data[0]) */ if (data[1] == ADDIDATA_ENABLE) { ul_Command = ul_Command | 0x1; - } //if (data[1] == ADDIDATA_ENABLE) + } /* if (data[1] == ADDIDATA_ENABLE) */ else { ul_Command = ul_Command & 0xFFFFFFFE; - } //elseif (data[1] == ADDIDATA_ENABLE) + } /* elseif (data[1] == ADDIDATA_ENABLE) */ if (data[2] == ADDIDATA_ENABLE) { ul_Command = ul_Command | 0x2; - } //if (data[2] == ADDIDATA_ENABLE) + } /* if (data[2] == ADDIDATA_ENABLE) */ else { ul_Command = ul_Command & 0xFFFFFFFD; - } //elseif (data[2] == ADDIDATA_ENABLE) + } /* elseif (data[2] == ADDIDATA_ENABLE) */ outl(ul_Command, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT); ui_InterruptData = inl(devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT); return insn->n; @@ -123,8 +123,8 @@ int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To Write | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -134,23 +134,23 @@ int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inl(devpriv->iobase + APCI2032_DIGITAL_OP); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -184,18 +184,18 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==0) + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -209,7 +209,7 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = data[0] & ui_Temp; outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -272,25 +272,25 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==1); + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==1); */ else { printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } //if else data[3]==1) - } //if else data[3]==0) - return (insn->n);; + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ + return insn->n; } /* @@ -302,8 +302,8 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -313,17 +313,17 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->iobase + APCI2032_DIGITAL_OP_RW); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } //if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -349,28 +349,28 @@ INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) - } //if (ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif (ui_Temp==1) + } /* elseif (ui_Temp==1) */ } return insn->n; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI2032_ConfigWatchdog(comedi_device - *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)| +| Function Name : int i_APCI2032_ConfigWatchdog(comedi_device +| *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)| | | +----------------------------------------------------------------------------+ | Task : Configures The Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -380,15 +380,15 @@ INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI2032_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { if (data[0] == 0) { - //Disable the watchdog + /* Disable the watchdog */ outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); - //Loading the Reload value + /* Loading the Reload value */ outl(data[1], devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_RELOAD_VALUE); @@ -421,19 +421,19 @@ INT i_APCI2032_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -int i_APCI2032_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { switch (data[0]) { - case 0: //stop the watchdog - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); //disable the watchdog + case 0: /* stop the watchdog */ + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outl(0x0001, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); break; - case 2: //Software trigger + case 2: /* Software trigger */ outl(0x0201, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); @@ -449,13 +449,13 @@ int i_APCI2032_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ +----------------------------------------------------------------------------+ | Function Name : int i_APCI2032_ReadWatchdog | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data); | +| unsigned int *data); | +----------------------------------------------------------------------------+ | Task : Read The Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -466,8 +466,8 @@ int i_APCI2032_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ +----------------------------------------------------------------------------+ */ -int i_APCI2032_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { data[0] = @@ -498,13 +498,13 @@ void v_APCI2032_Interrupt(int irq, void *d) struct comedi_device *dev = d; unsigned int ui_DO; - ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; //Check if VCC OR CC interrupt has occured. + ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; /* Check if VCC OR CC interrupt has occured. */ if (ui_DO == 0) { printk("\nInterrupt from unKnown source\n"); - } // if(ui_DO==0) + } /* if(ui_DO==0) */ if (ui_DO) { - // Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. + /* Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. */ ui_Type = inl(devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT_STATUS) & 0x3; @@ -512,16 +512,16 @@ void v_APCI2032_Interrupt(int irq, void *d) devpriv->iobase + APCI2032_DIGITAL_OP + APCI2032_DIGITAL_OP_INTERRUPT); if (ui_Type == 1) { - //Sends signal to user space + /* Sends signal to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if (ui_Type==1) + } /* if (ui_Type==1) */ else { if (ui_Type == 2) { - // Sends signal to user space + /* Sends signal to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } //if (ui_Type==2) - } //else if (ui_Type==1) - } //if(ui_DO) + } /* if (ui_Type==2) */ + } /* else if (ui_Type==1) */ + } /* if(ui_DO) */ return; @@ -544,8 +544,8 @@ void v_APCI2032_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -int i_APCI2032_ReadInterruptStatus(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { *data = ui_Type; return insn->n; @@ -567,13 +567,13 @@ int i_APCI2032_ReadInterruptStatus(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -int i_APCI2032_Reset(struct comedi_device * dev) +int i_APCI2032_Reset(struct comedi_device *dev) { devpriv->b_DigitalOutputRegister = 0; ui_Type = 0; - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP); //Resets the output channels - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT); //Disables the interrupt. - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); //disable the watchdog - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_RELOAD_VALUE); //reload=0 + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP); /* Resets the output channels */ + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT); /* Disables the interrupt. */ + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); /* disable the watchdog */ + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_RELOAD_VALUE); /* reload=0 */ return 0; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h index 55002e0288b..c971d143c24 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h @@ -17,32 +17,32 @@ /********* Definitions for APCI-2032 card *****/ -// Card Specific information +/* Card Specific information */ #define APCI2032_BOARD_VENDOR_ID 0x15B8 #define APCI2032_ADDRESS_RANGE 63 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI2032_DIGITAL_OP 0 #define APCI2032_DIGITAL_OP_RW 0 #define APCI2032_DIGITAL_OP_INTERRUPT 4 #define APCI2032_DIGITAL_OP_IRQ 12 -//Digital Output Interrupt Status +/* Digital Output Interrupt Status */ #define APCI2032_DIGITAL_OP_INTERRUPT_STATUS 8 -//Digital Output Interrupt Enable Disable. +/* Digital Output Interrupt Enable Disable. */ #define APCI2032_DIGITAL_OP_VCC_INTERRUPT_ENABLE 0x1 #define APCI2032_DIGITAL_OP_VCC_INTERRUPT_DISABLE 0xFFFFFFFE #define APCI2032_DIGITAL_OP_CC_INTERRUPT_ENABLE 0x2 #define APCI2032_DIGITAL_OP_CC_INTERRUPT_DISABLE 0xFFFFFFFD -//ADDIDATA Enable Disable +/* ADDIDATA Enable Disable */ #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define ADDIDATA_WATCHDOG 2 #define APCI2032_DIGITAL_OP_WATCHDOG 16 @@ -52,30 +52,32 @@ #define APCI2032_TCW_TRIG_STATUS 16 #define APCI2032_TCW_IRQ 20 -// Hardware Layer functions for Apci2032 +/* Hardware Layer functions for Apci2032 */ -//DO +/* DO */ int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds -INT i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, +/* TIMER + * timer value is passed as u seconds +*/ + +int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// Interrupt functions..... +/* Interrupt functions..... */ void v_APCI2032_Interrupt(int irq, void *d); -//Reset functions +/* Reset functions */ int i_APCI2032_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c index 947e18ef3ab..a853c62a4fd 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c @@ -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. @@ -63,7 +63,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -73,20 +73,20 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | | +----------------------------------------------------------------------------+ */ -INT i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_TmpValue = 0; - UINT ui_Channel; + unsigned int ui_TmpValue = 0; + unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); if (ui_Channel >= 0 && ui_Channel <= 7) { - ui_TmpValue = (UINT) inw(devpriv->iobase + APCI2200_DIGITAL_IP); + ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP); *data = (ui_TmpValue >> ui_Channel) & 0x1; - } //if(ui_Channel >= 0 && ui_Channel <=7) + } /* if(ui_Channel >= 0 && ui_Channel <=7) */ else { printk("\nThe specified channel does not exist\n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if(ui_Channel >= 0 && ui_Channel <=7) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* else if(ui_Channel >= 0 && ui_Channel <=7) */ return insn->n; } @@ -101,7 +101,7 @@ INT i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -112,17 +112,17 @@ INT i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_PortValue = data[0]; - UINT ui_Mask = 0; - UINT ui_NoOfChannels; + unsigned int ui_PortValue = data[0]; + unsigned int ui_Mask = 0; + unsigned int ui_NoOfChannels; ui_NoOfChannels = CR_CHAN(insn->chanspec); - *data = (UINT) inw(devpriv->iobase + APCI2200_DIGITAL_IP); + *data = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP); switch (ui_NoOfChannels) { case 2: ui_Mask = 3; @@ -137,9 +137,9 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su default: printk("\nWrong parameters\n"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ return insn->n; } @@ -147,7 +147,7 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2200_ConfigDigitalOutput (struct comedi_device *dev, - struct comedi_subdevice *s struct comedi_insn *insn,unsigned int *data) | +| struct comedi_subdevice *s struct comedi_insn *insn,unsigned int *data) | | | +----------------------------------------------------------------------------+ | Task : Configures The Digital Output Subdevice. | @@ -156,7 +156,7 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | unsigned int *data : Data Pointer contains | | configuration parameters as below | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | data[0] :1:Memory on | | 0:Memory off | | | @@ -169,8 +169,8 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | | +----------------------------------------------------------------------------+ */ -int i_APCI2200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { devpriv->b_OutputMemoryStatus = data[0]; return insn->n; @@ -180,13 +180,13 @@ int i_APCI2200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ | Function Name : int i_APCI2200_WriteDigitalOutput | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data) | +| unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -197,23 +197,23 @@ int i_APCI2200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inw(devpriv->iobase + APCI2200_DIGITAL_OP); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -240,18 +240,18 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd break; default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==0) + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -263,7 +263,7 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = data[0] & ui_Temp; outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -312,38 +312,38 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==1); + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==1); */ else { printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } //if else data[3]==1) - } //if else data[3]==0) - return (insn->n);; + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ + return insn->n; } /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2200_ReadDigitalOutput | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data) | +| unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -354,17 +354,17 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ ui_Temp = data[0]; *data = inw(devpriv->iobase + APCI2200_DIGITAL_OP); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } //if(ui_Temp==0) + } /* if(ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -386,28 +386,28 @@ INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) - } //if(ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if(ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif(ui_Temp==1) - } //elseif(ui_Temp==0) + } /* elseif(ui_Temp==1) */ + } /* elseif(ui_Temp==0) */ return insn->n; } /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, - struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | +| struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | | | +----------------------------------------------------------------------------+ | Task : Configures The Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -418,15 +418,15 @@ INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { if (data[0] == 0) { - //Disable the watchdog + /* Disable the watchdog */ outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); - //Loading the Reload value + /* Loading the Reload value */ outw(data[1], devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_RELOAD_VALUE); @@ -434,11 +434,11 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic outw(data[1], devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_RELOAD_VALUE + 2); - } //if(data[0]==0) + } /* if(data[0]==0) */ else { printk("\nThe input parameters are wrong\n"); return -EINVAL; - } //elseif(data[0]==0) + } /* elseif(data[0]==0) */ return insn->n; } @@ -464,19 +464,19 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { switch (data[0]) { - case 0: //stop the watchdog - outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); //disable the watchdog + case 0: /* stop the watchdog */ + outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outw(0x0001, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); break; - case 2: //Software trigger + case 2: /* Software trigger */ outw(0x0201, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); @@ -484,7 +484,7 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ default: printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -492,13 +492,13 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ +----------------------------------------------------------------------------+ | Function Name : int i_APCI2200_ReadWatchdog | | (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn, - unsigned int *data); | +| unsigned int *data); | +----------------------------------------------------------------------------+ | Task : Read The Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | | struct comedi_subdevice *s, :pointer to subdevice structure - struct comedi_insn *insn :pointer to insn structure | +| struct comedi_insn *insn :pointer to insn structure | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -509,8 +509,8 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ +----------------------------------------------------------------------------+ */ -int i_APCI2200_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { data[0] = inw(devpriv->iobase + APCI2200_WATCHDOG + @@ -533,9 +533,9 @@ int i_APCI2200_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI2200_Reset(struct comedi_device * dev) +int i_APCI2200_Reset(struct comedi_device *dev) { - outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP); //RESETS THE DIGITAL OUTPUTS + outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP); /* RESETS THE DIGITAL OUTPUTS */ outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h index 0a115b4c44c..63e5f1fcecc 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h @@ -17,39 +17,39 @@ /********* Definitions for APCI-2200 card *****/ -// Card Specific information +/* Card Specific information */ #define APCI2200_BOARD_VENDOR_ID 0x15b8 #define APCI2200_ADDRESS_RANGE 64 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI2200_DIGITAL_OP 4 #define APCI2200_DIGITAL_IP 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define APCI2200_WATCHDOG 0x08 #define APCI2200_WATCHDOG_ENABLEDISABLE 12 #define APCI2200_WATCHDOG_RELOAD_VALUE 4 #define APCI2200_WATCHDOG_STATUS 16 -// Hardware Layer functions for Apci2200 +/* Hardware Layer functions for Apci2200 */ -//Digital Input -INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +/* Digital Input */ +int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//Digital Output +/* Digital Output */ int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER +/* TIMER */ int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, @@ -57,5 +57,5 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//reset -INT i_APCI2200_Reset(struct comedi_device *dev); +/* reset */ +int i_APCI2200_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 68eb8dfd513..169cee41b87 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -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. @@ -45,9 +45,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc */ #include "hwdrv_apci3120.h" -static UINT ui_Temp = 0; +static unsigned int ui_Temp = 0; -// FUNCTION DEFINITIONS +/* FUNCTION DEFINITIONS */ /* +----------------------------------------------------------------------------+ @@ -74,20 +74,20 @@ static UINT ui_Temp = 0; +----------------------------------------------------------------------------+ */ -int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT i; + unsigned int i; if ((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE)) return -1; - // Check for Conversion time to be added ?? + /* Check for Conversion time to be added ?? */ devpriv->ui_EocEosConversionTime = data[2]; if (data[0] == APCI3120_EOS_MODE) { - //Test the number of the channel + /* Test the number of the channel */ for (i = 0; i < data[3]; i++) { if (CR_CHAN(data[4 + i]) >= this_board->i_NbrAiChannel) { @@ -102,14 +102,14 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_s devpriv->b_EocEosInterrupt = APCI3120_ENABLE; } else devpriv->b_EocEosInterrupt = APCI3120_DISABLE; - // Copy channel list and Range List to devpriv + /* Copy channel list and Range List to devpriv */ devpriv->ui_AiNbrofChannels = data[3]; for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) { devpriv->ui_AiChannelList[i] = data[4 + i]; } - } else // EOC + } else /* EOC */ { devpriv->b_InterruptMode = APCI3120_EOC_MODE; if (data[1]) { @@ -145,28 +145,28 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_s +----------------------------------------------------------------------------+ */ -int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - USHORT us_ConvertTiming, us_TmpValue, i; - BYTE b_Tmp; + unsigned short us_ConvertTiming, us_TmpValue, i; + unsigned char b_Tmp; - // fix convertion time to 10 us + /* fix convertion time to 10 us */ if (!devpriv->ui_EocEosConversionTime) { printk("No timer0 Value using 10 us\n"); us_ConvertTiming = 10; } else - us_ConvertTiming = (USHORT) (devpriv->ui_EocEosConversionTime / 1000); // nano to useconds + us_ConvertTiming = (unsigned short) (devpriv->ui_EocEosConversionTime / 1000); /* nano to useconds */ - // this_board->i_hwdrv_InsnReadAnalogInput(dev,us_ConvertTiming,insn->n,&insn->chanspec,data,insn->unused[0]); + /* this_board->i_hwdrv_InsnReadAnalogInput(dev,us_ConvertTiming,insn->n,&insn->chanspec,data,insn->unused[0]); */ - // Clear software registers + /* Clear software registers */ devpriv->b_TimerSelectMode = 0; devpriv->b_ModeSelectRegister = 0; devpriv->us_OutputRegister = 0; -// devpriv->b_DigitalOutputRegister=0; +/* devpriv->b_DigitalOutputRegister=0; */ - if (insn->unused[0] == 222) // second insn read + if (insn->unused[0] == 222) /* second insn read */ { for (i = 0; i < insn->n; i++) { @@ -174,14 +174,16 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub } } else { - devpriv->tsk_Current = current; // Save the current process task structure - //Testing if board have the new Quartz and calculate the time value - //to set in the timer + devpriv->tsk_Current = current; /* Save the current process task structure */ +/* + * Testing if board have the new Quartz and calculate the time value + * to set in the timer + */ us_TmpValue = - (USHORT) inw(devpriv->iobase + APCI3120_RD_STATUS); + (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS); - //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 + /* EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 */ if ((us_TmpValue & 0x00B0) == 0x00B0 || !strcmp(this_board->pc_DriverName, "apci3001")) { us_ConvertTiming = (us_ConvertTiming * 2) - 2; @@ -190,25 +192,26 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub ((us_ConvertTiming * 12926) / 10000) - 1; } - us_TmpValue = (USHORT) devpriv->b_InterruptMode; + us_TmpValue = (unsigned short) devpriv->b_InterruptMode; switch (us_TmpValue) { case APCI3120_EOC_MODE: - // Testing the interrupt flag and set the EOC bit - // Clears the FIFO +/* + * Testing the interrupt flag and set the EOC bit Clears the FIFO + */ inw(devpriv->iobase + APCI3120_RESET_FIFO); - // Initialize the sequence array + /* Initialize the sequence array */ - //if (!i_APCI3120_SetupChannelList(dev,s,1,chanlist,0)) return -EINVAL; + /* if (!i_APCI3120_SetupChannelList(dev,s,1,chanlist,0)) return -EINVAL; */ if (!i_APCI3120_SetupChannelList(dev, s, 1, &insn->chanspec, 0)) return -EINVAL; - //Initialize Timer 0 mode 4 + /* Initialize Timer 0 mode 4 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xFC) | @@ -216,14 +219,14 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outb(devpriv->b_TimerSelectMode, devpriv->iobase + APCI3120_TIMER_CRT1); - // Reset the scan bit and Disables the EOS, DMA, EOC interrupt + /* Reset the scan bit and Disables the EOS, DMA, EOC interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_SCAN; if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) { - //Disables the EOS,DMA and enables the EOC interrupt + /* Disables the EOS,DMA and enables the EOC interrupt */ devpriv->b_ModeSelectRegister = (devpriv-> b_ModeSelectRegister & @@ -241,7 +244,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - // Sets gate 0 + /* Sets gate 0 */ devpriv->us_OutputRegister = (devpriv-> us_OutputRegister & APCI3120_CLEAR_PA_PR) | @@ -249,30 +252,30 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS); - // Select Timer 0 + /* Select Timer 0 */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0); - //Set the convertion time + /* Set the convertion time */ outw(us_ConvertTiming, devpriv->iobase + APCI3120_TIMER_VALUE); us_TmpValue = - (USHORT) inw(dev->iobase + APCI3120_RD_STATUS); + (unsigned short) inw(dev->iobase + APCI3120_RD_STATUS); if (devpriv->b_EocEosInterrupt == APCI3120_DISABLE) { do { - // Waiting for the end of conversion + /* Waiting for the end of conversion */ us_TmpValue = inw(devpriv->iobase + APCI3120_RD_STATUS); } while ((us_TmpValue & APCI3120_EOC) == APCI3120_EOC); - //Read the result in FIFO and put it in insn data pointer + /* Read the result in FIFO and put it in insn data pointer */ us_TmpValue = inw(devpriv->iobase + 0); *data = us_TmpValue; @@ -284,9 +287,9 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub case APCI3120_EOS_MODE: inw(devpriv->iobase); - // Clears the FIFO + /* Clears the FIFO */ inw(devpriv->iobase + APCI3120_RESET_FIFO); - // clear PA PR and disable timer 0 + /* clear PA PR and disable timer 0 */ devpriv->us_OutputRegister = (devpriv-> @@ -301,7 +304,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub devpriv->ui_AiChannelList, 0)) return -EINVAL; - //Initialize Timer 0 mode 2 + /* Initialize Timer 0 mode 2 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xFC) | @@ -309,26 +312,26 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outb(devpriv->b_TimerSelectMode, devpriv->iobase + APCI3120_TIMER_CRT1); - //Select Timer 0 + /* Select Timer 0 */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0); - //Set the convertion time + /* Set the convertion time */ outw(us_ConvertTiming, devpriv->iobase + APCI3120_TIMER_VALUE); - //Set the scan bit + /* Set the scan bit */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister | APCI3120_ENABLE_SCAN; outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - //If Interrupt function is loaded + /* If Interrupt function is loaded */ if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) { - //Disables the EOC,DMA and enables the EOS interrupt + /* Disables the EOC,DMA and enables the EOS interrupt */ devpriv->b_ModeSelectRegister = (devpriv-> b_ModeSelectRegister & @@ -347,7 +350,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub inw(devpriv->iobase + APCI3120_RD_STATUS); - //Sets gate 0 + /* Sets gate 0 */ devpriv->us_OutputRegister = devpriv-> @@ -355,28 +358,27 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS); - //Start conversion + /* Start conversion */ outw(0, devpriv->iobase + APCI3120_START_CONVERSION); - //Waiting of end of convertion if interrupt is not installed + /* Waiting of end of convertion if interrupt is not installed */ if (devpriv->b_EocEosInterrupt == APCI3120_DISABLE) { - //Waiting the end of convertion + /* Waiting the end of convertion */ do { us_TmpValue = inw(devpriv->iobase + APCI3120_RD_STATUS); - } - while ((us_TmpValue & APCI3120_EOS) != - APCI3120_EOS); + } while ((us_TmpValue & APCI3120_EOS) != + APCI3120_EOS); for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) { - //Read the result in FIFO and write them in shared memory + /* Read the result in FIFO and write them in shared memory */ us_TmpValue = inw(devpriv->iobase); - data[i] = (UINT) us_TmpValue; + data[i] = (unsigned int) us_TmpValue; } - devpriv->b_InterruptMode = APCI3120_EOC_MODE; // Restore defaults. + devpriv->b_InterruptMode = APCI3120_EOC_MODE; /* Restore defaults. */ } break; @@ -384,7 +386,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub printk("inputs wrong\n"); } - devpriv->ui_EocEosConversionTime = 0; // re initializing the variable; + devpriv->ui_EocEosConversionTime = 0; /* re initializing the variable; */ } return insn->n; @@ -409,38 +411,41 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -int i_APCI3120_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_subdevice * s) +int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s) { - // Disable A2P Fifo write and AMWEN signal + /* Disable A2P Fifo write and AMWEN signal */ outw(0, devpriv->i_IobaseAddon + 4); - //Disable Bus Master ADD ON + /* Disable Bus Master ADD ON */ outw(APCI3120_ADD_ON_AGCSTS_LOW, devpriv->i_IobaseAddon + 0); outw(0, devpriv->i_IobaseAddon + 2); outw(APCI3120_ADD_ON_AGCSTS_HIGH, devpriv->i_IobaseAddon + 0); outw(0, devpriv->i_IobaseAddon + 2); - //Disable BUS Master PCI + /* Disable BUS Master PCI */ outl(0, devpriv->i_IobaseAmcc + AMCC_OP_REG_MCSR); - //outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR)&(~AINT_WRITE_COMPL), devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); // stop amcc irqs - //outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR)&(~EN_A2P_TRANSFERS), devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR); // stop DMA + /* outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR)&(~AINT_WRITE_COMPL), + * devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); stop amcc irqs */ + + /* outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR)&(~EN_A2P_TRANSFERS), + * devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR); stop DMA */ - //Disable ext trigger + /* Disable ext trigger */ i_APCI3120_ExttrigDisable(dev); devpriv->us_OutputRegister = 0; - //stop counters + /* stop counters */ outw(devpriv-> us_OutputRegister & APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1, dev->iobase + APCI3120_WR_ADDRESS); outw(APCI3120_DISABLE_ALL_TIMER, dev->iobase + APCI3120_WR_ADDRESS); - //DISABLE_ALL_INTERRUPT + /* DISABLE_ALL_INTERRUPT */ outb(APCI3120_DISABLE_ALL_INTERRUPT, dev->iobase + APCI3120_WRITE_MODE_SELECT); - //Flush FIFO + /* Flush FIFO */ inb(dev->iobase + APCI3120_RESET_FIFO); inw(dev->iobase + APCI3120_RD_STATUS); devpriv->ui_AiActualScan = 0; @@ -476,13 +481,13 @@ int i_APCI3120_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_s +----------------------------------------------------------------------------+ */ -int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_cmd * cmd) +int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_cmd *cmd) { int err = 0; - int tmp; // divisor1,divisor2; + int tmp; /* divisor1,divisor2; */ - // step 1: make sure trigger sources are trivially valid + /* step 1: make sure trigger sources are trivially valid */ tmp = cmd->start_src; cmd->start_src &= TRIG_NOW | TRIG_EXT; @@ -512,7 +517,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ if (err) return 1; - //step 2: make sure trigger sources are unique and mutually compatible + /* step 2: make sure trigger sources are unique and mutually compatible */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_EXT) { err++; @@ -536,14 +541,14 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ if (err) return 2; - // step 3: make sure arguments are trivially compatible + /* step 3: make sure arguments are trivially compatible */ if (cmd->start_arg != 0) { cmd->start_arg = 0; err++; } - if (cmd->scan_begin_src == TRIG_TIMER) // Test Delay timing + if (cmd->scan_begin_src == TRIG_TIMER) /* Test Delay timing */ { if (cmd->scan_begin_arg < this_board->ui_MinDelaytimeNs) { cmd->scan_begin_arg = this_board->ui_MinDelaytimeNs; @@ -551,7 +556,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ } } - if (cmd->convert_src == TRIG_TIMER) // Test Acquisition timing + if (cmd->convert_src == TRIG_TIMER) /* Test Acquisition timing */ { if (cmd->scan_begin_src == TRIG_TIMER) { if ((cmd->convert_arg) @@ -585,7 +590,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ cmd->stop_arg = 1; err++; } - } else { // TRIG_NONE + } else { /* TRIG_NONE */ if (cmd->stop_arg != 0) { cmd->stop_arg = 0; err++; @@ -595,7 +600,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ if (err) return 3; - // step 4: fix up any arguments + /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { @@ -633,19 +638,19 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ +----------------------------------------------------------------------------+ */ -int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s) +int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; - //loading private structure with cmd structure inputs + /* loading private structure with cmd structure inputs */ devpriv->ui_AiFlags = cmd->flags; devpriv->ui_AiNbrofChannels = cmd->chanlist_len; devpriv->ui_AiScanLength = cmd->scan_end_arg; devpriv->pui_AiChannelList = cmd->chanlist; - //UPDATE-0.7.57->0.7.68devpriv->AiData=s->async->data; + /* UPDATE-0.7.57->0.7.68devpriv->AiData=s->async->data; */ devpriv->AiData = s->async->prealloc_buf; - //UPDATE-0.7.57->0.7.68devpriv->ui_AiDataLength=s->async->data_len; + /* UPDATE-0.7.57->0.7.68devpriv->ui_AiDataLength=s->async->data_len; */ devpriv->ui_AiDataLength = s->async->prealloc_bufsz; if (cmd->stop_src == TRIG_COUNT) { @@ -654,11 +659,11 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd devpriv->ui_AiNbrofScans = 0; } - devpriv->ui_AiTimer0 = 0; // variables changed to timer0,timer1 + devpriv->ui_AiTimer0 = 0; /* variables changed to timer0,timer1 */ devpriv->ui_AiTimer1 = 0; if ((devpriv->ui_AiNbrofScans == 0) || (devpriv->ui_AiNbrofScans == -1)) - devpriv->b_AiContinuous = 1; // user want neverending analog acquisition - // stopped using cancel + devpriv->b_AiContinuous = 1; /* user want neverending analog acquisition */ + /* stopped using cancel */ if (cmd->start_src == TRIG_EXT) devpriv->b_ExttrigEnable = APCI3120_ENABLE; @@ -666,22 +671,22 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd devpriv->b_ExttrigEnable = APCI3120_DISABLE; if (cmd->scan_begin_src == TRIG_FOLLOW) { - // mode 1 or 3 + /* mode 1 or 3 */ if (cmd->convert_src == TRIG_TIMER) { - // mode 1 + /* mode 1 */ - devpriv->ui_AiTimer0 = cmd->convert_arg; // timer constant in nano seconds - //return this_board->i_hwdrv_CommandAnalogInput(1,dev,s); + devpriv->ui_AiTimer0 = cmd->convert_arg; /* timer constant in nano seconds */ + /* return this_board->i_hwdrv_CommandAnalogInput(1,dev,s); */ return i_APCI3120_CyclicAnalogInput(1, dev, s); } } if ((cmd->scan_begin_src == TRIG_TIMER) && (cmd->convert_src == TRIG_TIMER)) { - // mode 2 + /* mode 2 */ devpriv->ui_AiTimer1 = cmd->scan_begin_arg; - devpriv->ui_AiTimer0 = cmd->convert_arg; // variable changed timer2 to timer0 - //return this_board->i_hwdrv_CommandAnalogInput(2,dev,s); + devpriv->ui_AiTimer0 = cmd->convert_arg; /* variable changed timer2 to timer0 */ + /* return this_board->i_hwdrv_CommandAnalogInput(2,dev,s); */ return i_APCI3120_CyclicAnalogInput(2, dev, s); } return -1; @@ -707,73 +712,74 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, - struct comedi_subdevice * s) +int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev, + struct comedi_subdevice *s) { - BYTE b_Tmp; - UINT ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 = + unsigned char b_Tmp; + unsigned int ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 = 0, dmalen1 = 0, ui_TimerValue2 = 0, ui_TimerValue0, ui_ConvertTiming; - USHORT us_TmpValue; + unsigned short us_TmpValue; - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver - //devpriv->b_AiCyclicAcquisition=APCI3120_ENABLE; - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ + /* devpriv->b_AiCyclicAcquisition=APCI3120_ENABLE; */ + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ /*******************/ /* Resets the FIFO */ /*******************/ inb(dev->iobase + APCI3120_RESET_FIFO); - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver - //inw(dev->iobase+APCI3120_RD_STATUS); - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ + /* inw(dev->iobase+APCI3120_RD_STATUS); */ + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ /***************************/ /* Acquisition initialized */ /***************************/ - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ devpriv->b_AiCyclicAcquisition = APCI3120_ENABLE; - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ - // clear software registers + /* clear software registers */ devpriv->b_TimerSelectMode = 0; devpriv->us_OutputRegister = 0; devpriv->b_ModeSelectRegister = 0; - //devpriv->b_DigitalOutputRegister=0; + /* devpriv->b_DigitalOutputRegister=0; */ - //COMMENT JK 07.05.04: Followings calls are in i_APCI3120_StartAnalogInputAcquisition + /* COMMENT JK 07.05.04: Followings calls are in i_APCI3120_StartAnalogInputAcquisition */ - /****************************/ - /* Clear Timer Write TC INT */ - /****************************/ + /****************************/ + /* Clear Timer Write TC int */ + /****************************/ outl(APCI3120_CLEAR_WRITE_TC_INT, devpriv->i_IobaseAmcc + APCI3120_AMCC_OP_REG_INTCSR); - /************************************/ + /************************************/ /* Clears the timer status register */ - /************************************/ - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver - //inw(dev->iobase+APCI3120_TIMER_STATUS_REGISTER); - inb(dev->iobase + APCI3120_TIMER_STATUS_REGISTER); - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /************************************/ + + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ + /* inw(dev->iobase+APCI3120_TIMER_STATUS_REGISTER); */ + /* inb(dev->iobase + APCI3120_TIMER_STATUS_REGISTER); */ + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ - /**************************/ + /**************************/ /* Disables All Timer */ /* Sets PR and PA to 0 */ - /**************************/ + /**************************/ devpriv->us_OutputRegister = devpriv->us_OutputRegister & APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1 & APCI3120_CLEAR_PA_PR; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); - /*******************/ + /*******************/ /* Resets the FIFO */ - /*******************/ - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + /*******************/ + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ inb(devpriv->iobase + APCI3120_RESET_FIFO); - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ devpriv->ui_AiActualScan = 0; devpriv->ui_AiActualScanPosition = 0; @@ -781,7 +787,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, devpriv->ui_AiBufferPtr = 0; devpriv->ui_DmaActualBuffer = 0; - // value for timer2 minus -2 has to be done .....dunno y?? + /* value for timer2 minus -2 has to be done .....dunno y?? */ ui_TimerValue2 = devpriv->ui_AiNbrofScans - 2; ui_ConvertTiming = devpriv->ui_AiTimer0; @@ -795,31 +801,31 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, devpriv->pui_AiChannelList, 0)) return -EINVAL; - us_TmpValue = (USHORT) inw(dev->iobase + APCI3120_RD_STATUS); + us_TmpValue = (unsigned short) inw(dev->iobase + APCI3120_RD_STATUS); /*** EL241003 : add this section in comment because floats must not be used - if((us_TmpValue & 0x00B0)==0x00B0) + if((us_TmpValue & 0x00B0)==0x00B0) { - f_ConvertValue=(((float)ui_ConvertTiming * 0.002) - 2); - ui_TimerValue0=(UINT)f_ConvertValue; + f_ConvertValue=(((float)ui_ConvertTiming * 0.002) - 2); + ui_TimerValue0=(unsigned int)f_ConvertValue; if (mode==2) { f_DelayValue = (((float)ui_DelayTiming * 0.00002) - 2); - ui_TimerValue1 = (UINT) f_DelayValue; + ui_TimerValue1 = (unsigned int) f_DelayValue; } } - else + else { f_ConvertValue=(((float)ui_ConvertTiming * 0.0012926) - 1); - ui_TimerValue0=(UINT)f_ConvertValue; + ui_TimerValue0=(unsigned int)f_ConvertValue; if (mode == 2) { f_DelayValue = (((float)ui_DelayTiming * 0.000012926) - 1); - ui_TimerValue1 = (UINT) f_DelayValue; + ui_TimerValue1 = (unsigned int) f_DelayValue; } } ***********************************************************************************************/ /*** EL241003 Begin : add this section to replace floats calculation by integer calculations **/ - //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 + /* EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 */ if ((us_TmpValue & 0x00B0) == 0x00B0 || !strcmp(this_board->pc_DriverName, "apci3001")) { ui_TimerValue0 = ui_ConvertTiming * 2 - 2000; @@ -844,79 +850,82 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, /*** EL241003 End ******************************************************************************/ if (devpriv->b_ExttrigEnable == APCI3120_ENABLE) { - i_APCI3120_ExttrigEnable(dev); // activate EXT trigger + i_APCI3120_ExttrigEnable(dev); /* activate EXT trigger */ } switch (mode) { case 1: - // init timer0 in mode 2 + /* init timer0 in mode 2 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xFC) | APCI3120_TIMER_0_MODE_2; outb(devpriv->b_TimerSelectMode, dev->iobase + APCI3120_TIMER_CRT1); - //Select Timer 0 + /* Select Timer 0 */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0); - //Set the convertion time - outw(((USHORT) ui_TimerValue0), + /* Set the convertion time */ + outw(((unsigned short) ui_TimerValue0), dev->iobase + APCI3120_TIMER_VALUE); break; case 2: - // init timer1 in mode 2 + /* init timer1 in mode 2 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xF3) | APCI3120_TIMER_1_MODE_2; outb(devpriv->b_TimerSelectMode, dev->iobase + APCI3120_TIMER_CRT1); - //Select Timer 1 + /* Select Timer 1 */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_1_WORD; outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0); - //Set the convertion time - outw(((USHORT) ui_TimerValue1), + /* Set the convertion time */ + outw(((unsigned short) ui_TimerValue1), dev->iobase + APCI3120_TIMER_VALUE); - // init timer0 in mode 2 + /* init timer0 in mode 2 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xFC) | APCI3120_TIMER_0_MODE_2; outb(devpriv->b_TimerSelectMode, dev->iobase + APCI3120_TIMER_CRT1); - //Select Timer 0 + /* Select Timer 0 */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0); - //Set the convertion time - outw(((USHORT) ui_TimerValue0), + /* Set the convertion time */ + outw(((unsigned short) ui_TimerValue0), dev->iobase + APCI3120_TIMER_VALUE); break; } - // ##########common for all modes################# + /* ##########common for all modes################# */ /***********************/ /* Clears the SCAN bit */ /***********************/ - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver - //devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | APCI3120_DISABLE_SCAN; + + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ + /* devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | APCI3120_DISABLE_SCAN; */ + devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister & APCI3120_DISABLE_SCAN; - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ + outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - // If DMA is disabled + /* If DMA is disabled */ if (devpriv->us_UseDma == APCI3120_DISABLE) { - // disable EOC and enable EOS + /* disable EOC and enable EOS */ devpriv->b_InterruptMode = APCI3120_EOS_MODE; devpriv->b_EocEosInterrupt = APCI3120_ENABLE; @@ -928,15 +937,17 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, dev->iobase + APCI3120_WRITE_MODE_SELECT); if (!devpriv->b_AiContinuous) { - // configure Timer2 For counting EOS - //Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0) +/* + * configure Timer2 For counting EOS Reset gate 2 of Timer 2 to + * disable it (Set Bit D14 to 0) + */ devpriv->us_OutputRegister = devpriv-> us_OutputRegister & APCI3120_DISABLE_TIMER2; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); - // DISABLE TIMER INTERRUPT + /* DISABLE TIMER intERRUPT */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & @@ -944,7 +955,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - //(1) Init timer 2 in mode 0 and write timer value + /* (1) Init timer 2 in mode 0 and write timer value */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0x0F) | @@ -952,7 +963,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outb(devpriv->b_TimerSelectMode, dev->iobase + APCI3120_TIMER_CRT1); - //Writing LOW WORD + /* Writing LOW unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -960,7 +971,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outw(LOWORD(ui_TimerValue2), dev->iobase + APCI3120_TIMER_VALUE); - //Writing HIGH WORD + /* Writing HIGH unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; @@ -968,20 +979,20 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outw(HIWORD(ui_TimerValue2), dev->iobase + APCI3120_TIMER_VALUE); - //(2) Reset FC_TIMER BIT Clearing timer status register + /* (2) Reset FC_TIMER BIT Clearing timer status register */ inb(dev->iobase + APCI3120_TIMER_STATUS_REGISTER); - // enable timer counter and disable watch dog + /* enable timer counter and disable watch dog */ devpriv->b_ModeSelectRegister = (devpriv-> b_ModeSelectRegister | APCI3120_ENABLE_TIMER_COUNTER) & APCI3120_DISABLE_WATCHDOG; - // select EOS clock input for timer 2 + /* select EOS clock input for timer 2 */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister | APCI3120_TIMER2_SELECT_EOS; - // Enable timer2 interrupt + /* Enable timer2 interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister | @@ -992,15 +1003,16 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, devpriv->b_Timer2Interrupt = APCI3120_ENABLE; } } else { - // If DMA Enabled - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver - //inw(dev->iobase+0);// reset EOC bit - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* If DMA Enabled */ + + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ + /* inw(dev->iobase+0); reset EOC bit */ + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ devpriv->b_InterruptMode = APCI3120_DMA_MODE; - /************************************/ + /************************************/ /* Disables the EOC, EOS interrupt */ - /************************************/ + /************************************/ devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister & APCI3120_DISABLE_EOC_INT & APCI3120_DISABLE_EOS_INT; @@ -1012,18 +1024,18 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, if (!devpriv->b_AiContinuous) { - if (dmalen0 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2)) { // must we fill full first buffer? + if (dmalen0 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2)) { /* must we fill full first buffer? */ dmalen0 = devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2; - } else if (dmalen1 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2 - dmalen0)) // and must we fill full second buffer when first is once filled? + } else if (dmalen1 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2 - dmalen0)) /* and must we fill full second buffer when first is once filled? */ dmalen1 = devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2 - dmalen0; } if (devpriv->ui_AiFlags & TRIG_WAKE_EOS) { - // don't we want wake up every scan? + /* don't we want wake up every scan? */ if (dmalen0 > (devpriv->ui_AiScanLength * 2)) { dmalen0 = devpriv->ui_AiScanLength * 2; if (devpriv->ui_AiScanLength & 1) @@ -1036,7 +1048,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, if (dmalen1 < 4) dmalen1 = 4; } - } else { // isn't output buff smaller that our DMA buff? + } else { /* isn't output buff smaller that our DMA buff? */ if (dmalen0 > (devpriv->ui_AiDataLength)) { dmalen0 = devpriv->ui_AiDataLength; } @@ -1047,14 +1059,16 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, devpriv->ui_DmaBufferUsesize[0] = dmalen0; devpriv->ui_DmaBufferUsesize[1] = dmalen1; - //Initialize DMA + /* Initialize DMA */ - // Set Transfer count enable bit and A2P_fifo reset bit in AGCSTS register - //1 +/* + * Set Transfer count enable bit and A2P_fifo reset bit in AGCSTS + * register 1 + */ ui_Tmp = AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO; outl(ui_Tmp, devpriv->i_IobaseAmcc + AMCC_OP_REG_AGCSTS); - // changed since 16 bit interface for add on + /* changed since 16 bit interface for add on */ /*********************/ /* ENABLE BUS MASTER */ /*********************/ @@ -1066,104 +1080,121 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2); - // TO VERIFIED - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver +/* + * TO VERIFIED BEGIN JK 07.05.04: Comparison between WIN32 and Linux + * driver + */ outw(0x1000, devpriv->i_IobaseAddon + 2); - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ - //2 No change - // A2P FIFO MANAGEMENT - // A2P fifo reset & transfer control enable - /***********************/ + /* 2 No change */ /* A2P FIFO MANAGEMENT */ - /***********************/ + /* A2P fifo reset & transfer control enable */ + + /***********************/ + /* A2P FIFO MANAGEMENT */ + /***********************/ outl(APCI3120_A2P_FIFO_MANAGEMENT, devpriv->i_IobaseAmcc + APCI3120_AMCC_OP_MCSR); - //3 - //beginning address of dma buf - //The 32 bit address of dma buffer is converted into two 16 bit addresses - // Can done by using _attach and put into into an array - // array used may be for differnet pages +/* + * 3 + * beginning address of dma buf The 32 bit address of dma buffer + * is converted into two 16 bit addresses Can done by using _attach + * and put into into an array array used may be for differnet pages + */ - // DMA Start Adress Low + /* DMA Start Adress Low */ outw(APCI3120_ADD_ON_MWAR_LOW, devpriv->i_IobaseAddon + 0); outw((devpriv->ul_DmaBufferHw[0] & 0xFFFF), devpriv->i_IobaseAddon + 2); - /*************************/ + /*************************/ /* DMA Start Adress High */ - /*************************/ + /*************************/ outw(APCI3120_ADD_ON_MWAR_HIGH, devpriv->i_IobaseAddon + 0); outw((devpriv->ul_DmaBufferHw[0] / 65536), devpriv->i_IobaseAddon + 2); - //4 - // amount of bytes to be transfered set transfer count - // used ADDON MWTC register - //commented testing outl(devpriv->ui_DmaBufferUsesize[0], devpriv->i_IobaseAddon+AMCC_OP_REG_AMWTC); - - /**************************/ +/* + * 4 + * amount of bytes to be transfered set transfer count used ADDON + * MWTC register commented testing + * outl(devpriv->ui_DmaBufferUsesize[0], + * devpriv->i_IobaseAddon+AMCC_OP_REG_AMWTC); + */ + + /**************************/ /* Nbr of acquisition LOW */ - /**************************/ + /**************************/ outw(APCI3120_ADD_ON_MWTC_LOW, devpriv->i_IobaseAddon + 0); outw((devpriv->ui_DmaBufferUsesize[0] & 0xFFFF), devpriv->i_IobaseAddon + 2); - /***************************/ + /***************************/ /* Nbr of acquisition HIGH */ - /***************************/ + /***************************/ outw(APCI3120_ADD_ON_MWTC_HIGH, devpriv->i_IobaseAddon + 0); outw((devpriv->ui_DmaBufferUsesize[0] / 65536), devpriv->i_IobaseAddon + 2); - //5 - // To configure A2P FIFO - // testing outl( FIFO_ADVANCE_ON_BYTE_2,devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); +/* + * 5 + * To configure A2P FIFO testing outl( + * FIFO_ADVANCE_ON_BYTE_2,devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); + */ /******************/ /* A2P FIFO RESET */ /******************/ - // TO VERIFY - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver +/* + * TO VERIFY BEGIN JK 07.05.04: Comparison between WIN32 and Linux + * driver + */ outl(0x04000000UL, devpriv->i_IobaseAmcc + AMCC_OP_REG_MCSR); - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ + +/* + * 6 + * ENABLE A2P FIFO WRITE AND ENABLE AMWEN AMWEN_ENABLE | + * A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 + */ - //6 - //ENABLE A2P FIFO WRITE AND ENABLE AMWEN - // AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver - //outw(3,devpriv->i_IobaseAddon + 4); - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ + /* outw(3,devpriv->i_IobaseAddon + 4); */ + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ - //7 - //initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) +/* + * 7 + * initialise end of dma interrupt AINT_WRITE_COMPL = + * ENABLE_WRITE_TC_INT(ADDI) + */ /***************************************************/ - /* A2P FIFO CONFIGURATE, END OF DMA INTERRUPT INIT */ + /* A2P FIFO CONFIGURATE, END OF DMA intERRUPT INIT */ /***************************************************/ outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2 | APCI3120_ENABLE_WRITE_TC_INT), devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ /******************************************/ /* ENABLE A2P FIFO WRITE AND ENABLE AMWEN */ /******************************************/ outw(3, devpriv->i_IobaseAddon + 4); - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ /******************/ /* A2P FIFO RESET */ /******************/ - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + /* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */ outl(0x04000000UL, devpriv->i_IobaseAmcc + APCI3120_AMCC_OP_MCSR); - //END JK 07.05.04: Comparison between WIN32 and Linux driver + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ } if ((devpriv->us_UseDma == APCI3120_DISABLE) && !devpriv->b_AiContinuous) { - // set gate 2 to start conversion + /* set gate 2 to start conversion */ devpriv->us_OutputRegister = devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER2; outw(devpriv->us_OutputRegister, @@ -1172,14 +1203,14 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, switch (mode) { case 1: - // set gate 0 to start conversion + /* set gate 0 to start conversion */ devpriv->us_OutputRegister = devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER0; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); break; case 2: - // set gate 0 and gate 1 + /* set gate 0 and gate 1 */ devpriv->us_OutputRegister = devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER1; devpriv->us_OutputRegister = @@ -1196,7 +1227,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| INTERNAL FUNCTIONS | +| intERNAL FUNCTIONS | +----------------------------------------------------------------------------+ */ @@ -1218,7 +1249,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3120_Reset(struct comedi_device * dev) +int i_APCI3120_Reset(struct comedi_device *dev) { unsigned int i; unsigned short us_TmpValue; @@ -1226,47 +1257,49 @@ int i_APCI3120_Reset(struct comedi_device * dev) devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE; devpriv->b_EocEosInterrupt = APCI3120_DISABLE; devpriv->b_InterruptMode = APCI3120_EOC_MODE; - devpriv->ui_EocEosConversionTime = 0; // set eoc eos conv time to 0 + devpriv->ui_EocEosConversionTime = 0; /* set eoc eos conv time to 0 */ devpriv->b_OutputMemoryStatus = 0; - // variables used in timer subdevice + /* variables used in timer subdevice */ devpriv->b_Timer2Mode = 0; devpriv->b_Timer2Interrupt = 0; - devpriv->b_ExttrigEnable = 0; // Disable ext trigger + devpriv->b_ExttrigEnable = 0; /* Disable ext trigger */ /* Disable all interrupts, watchdog for the anolog output */ devpriv->b_ModeSelectRegister = 0; outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - // Disables all counters, ext trigger and clears PA, PR + /* Disables all counters, ext trigger and clears PA, PR */ devpriv->us_OutputRegister = 0; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); - //Code to set the all anolog o/p channel to 0v - //8191 is decimal value for zero(0 v)volt in bipolar mode(default) - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_1, dev->iobase + APCI3120_ANALOG_OUTPUT_1); //channel 1 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_2, dev->iobase + APCI3120_ANALOG_OUTPUT_1); //channel 2 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_3, dev->iobase + APCI3120_ANALOG_OUTPUT_1); //channel 3 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_4, dev->iobase + APCI3120_ANALOG_OUTPUT_1); //channel 4 - - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_5, dev->iobase + APCI3120_ANALOG_OUTPUT_2); //channel 5 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_6, dev->iobase + APCI3120_ANALOG_OUTPUT_2); //channel 6 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_7, dev->iobase + APCI3120_ANALOG_OUTPUT_2); //channel 7 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_8, dev->iobase + APCI3120_ANALOG_OUTPUT_2); //channel 8 - - // Reset digital output to L0W - -//ES05 outb(0x0,dev->iobase+APCI3120_DIGITAL_OUTPUT); +/* + * Code to set the all anolog o/p channel to 0v 8191 is decimal + * value for zero(0 v)volt in bipolar mode(default) + */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_1, dev->iobase + APCI3120_ANALOG_OUTPUT_1); /* channel 1 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_2, dev->iobase + APCI3120_ANALOG_OUTPUT_1); /* channel 2 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_3, dev->iobase + APCI3120_ANALOG_OUTPUT_1); /* channel 3 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_4, dev->iobase + APCI3120_ANALOG_OUTPUT_1); /* channel 4 */ + + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_5, dev->iobase + APCI3120_ANALOG_OUTPUT_2); /* channel 5 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_6, dev->iobase + APCI3120_ANALOG_OUTPUT_2); /* channel 6 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_7, dev->iobase + APCI3120_ANALOG_OUTPUT_2); /* channel 7 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_8, dev->iobase + APCI3120_ANALOG_OUTPUT_2); /* channel 8 */ + + /* Reset digital output to L0W */ + +/* ES05 outb(0x0,dev->iobase+APCI3120_DIGITAL_OUTPUT); */ udelay(10); - inw(dev->iobase + 0); //make a dummy read - inb(dev->iobase + APCI3120_RESET_FIFO); // flush FIFO - inw(dev->iobase + APCI3120_RD_STATUS); // flush A/D status register + inw(dev->iobase + 0); /* make a dummy read */ + inb(dev->iobase + APCI3120_RESET_FIFO); /* flush FIFO */ + inw(dev->iobase + APCI3120_RD_STATUS); /* flush A/D status register */ - //code to reset the RAM sequence + /* code to reset the RAM sequence */ for (i = 0; i < 16; i++) { - us_TmpValue = i << 8; //select the location + us_TmpValue = i << 8; /* select the location */ outw(us_TmpValue, dev->iobase + APCI3120_SEQ_RAM_ADDRESS); } return 0; @@ -1296,10 +1329,10 @@ int i_APCI3120_Reset(struct comedi_device * dev) +----------------------------------------------------------------------------+ */ -int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, unsigned int *chanlist, char check) { - unsigned int i; //, differencial=0, bipolar=0; + unsigned int i; /* , differencial=0, bipolar=0; */ unsigned int gain; unsigned short us_TmpValue; @@ -1309,29 +1342,29 @@ int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdev comedi_error(dev, "range/channel list is empty!"); return 0; } - // All is ok, so we can setup channel/range list + /* All is ok, so we can setup channel/range list */ if (check) return 1; - //Code to set the PA and PR...Here it set PA to 0.. + /* Code to set the PA and PR...Here it set PA to 0.. */ devpriv->us_OutputRegister = devpriv->us_OutputRegister & APCI3120_CLEAR_PA_PR; devpriv->us_OutputRegister = ((n_chan - 1) & 0xf) << 8; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); for (i = 0; i < n_chan; i++) { - // store range list to card - us_TmpValue = CR_CHAN(chanlist[i]); // get channel number; + /* store range list to card */ + us_TmpValue = CR_CHAN(chanlist[i]); /* get channel number; */ if (CR_RANGE(chanlist[i]) < APCI3120_BIPOLAR_RANGES) { - us_TmpValue &= ((~APCI3120_UNIPOLAR) & 0xff); // set bipolar + us_TmpValue &= ((~APCI3120_UNIPOLAR) & 0xff); /* set bipolar */ } else { - us_TmpValue |= APCI3120_UNIPOLAR; // enable unipolar...... + us_TmpValue |= APCI3120_UNIPOLAR; /* enable unipolar...... */ } - gain = CR_RANGE(chanlist[i]); // get gain number - us_TmpValue |= ((gain & 0x03) << 4); //<<4 for G0 and G1 bit in RAM - us_TmpValue |= i << 8; //To select the RAM LOCATION.... + gain = CR_RANGE(chanlist[i]); /* get gain number */ + us_TmpValue |= ((gain & 0x03) << 4); /* <<4 for G0 and G1 bit in RAM */ + us_TmpValue |= i << 8; /* To select the RAM LOCATION.... */ outw(us_TmpValue, dev->iobase + APCI3120_SEQ_RAM_ADDRESS); printk("\n Gain = %i", @@ -1339,7 +1372,7 @@ int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdev printk("\n Channel = %i", CR_CHAN(chanlist[i])); printk("\n Polarity = %i", us_TmpValue & APCI3120_UNIPOLAR); } - return 1; // we can serve this with scan logic + return 1; /* we can serve this with scan logic */ } /* @@ -1360,7 +1393,7 @@ int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdev +----------------------------------------------------------------------------+ */ -int i_APCI3120_ExttrigEnable(struct comedi_device * dev) +int i_APCI3120_ExttrigEnable(struct comedi_device *dev) { devpriv->us_OutputRegister |= APCI3120_ENABLE_EXT_TRIGGER; @@ -1385,7 +1418,7 @@ int i_APCI3120_ExttrigEnable(struct comedi_device * dev) +----------------------------------------------------------------------------+ */ -int i_APCI3120_ExttrigDisable(struct comedi_device * dev) +int i_APCI3120_ExttrigDisable(struct comedi_device *dev) { devpriv->us_OutputRegister &= ~APCI3120_ENABLE_EXT_TRIGGER; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); @@ -1394,7 +1427,7 @@ int i_APCI3120_ExttrigDisable(struct comedi_device * dev) /* +----------------------------------------------------------------------------+ -| INTERRUPT FUNCTIONS | +| intERRUPT FUNCTIONS | +----------------------------------------------------------------------------+ */ @@ -1422,33 +1455,33 @@ int i_APCI3120_ExttrigDisable(struct comedi_device * dev) void v_APCI3120_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - USHORT int_daq; + unsigned short int_daq; unsigned int int_amcc, ui_Check, i; - USHORT us_TmpValue; - BYTE b_DummyRead; + unsigned short us_TmpValue; + unsigned char b_DummyRead; struct comedi_subdevice *s = dev->subdevices + 0; ui_Check = 1; - int_daq = inw(dev->iobase + APCI3120_RD_STATUS) & 0xf000; // get IRQ reasons - int_amcc = inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); // get AMCC INT register + int_daq = inw(dev->iobase + APCI3120_RD_STATUS) & 0xf000; /* get IRQ reasons */ + int_amcc = inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); /* get AMCC int register */ if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) { comedi_error(dev, "IRQ from unknow source"); return; } - outl(int_amcc | 0x00ff0000, devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); // shutdown IRQ reasons in AMCC + outl(int_amcc | 0x00ff0000, devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); /* shutdown IRQ reasons in AMCC */ int_daq = (int_daq >> 12) & 0xF; if (devpriv->b_ExttrigEnable == APCI3120_ENABLE) { - //Disable ext trigger + /* Disable ext trigger */ i_APCI3120_ExttrigDisable(dev); devpriv->b_ExttrigEnable = APCI3120_DISABLE; } - //clear the timer 2 interrupt + /* clear the timer 2 interrupt */ inb(devpriv->i_IobaseAmcc + APCI3120_TIMER_STATUS_REGISTER); if (int_amcc & MASTER_ABORT_INT) @@ -1456,19 +1489,19 @@ void v_APCI3120_Interrupt(int irq, void *d) if (int_amcc & TARGET_ABORT_INT) comedi_error(dev, "AMCC IRQ - TARGET DMA ABORT!"); - // Ckeck if EOC interrupt + /* Ckeck if EOC interrupt */ if (((int_daq & 0x8) == 0) && (devpriv->b_InterruptMode == APCI3120_EOC_MODE)) { if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) { - // Read the AI Value + /* Read the AI Value */ devpriv->ui_AiReadData[0] = - (UINT) inw(devpriv->iobase + 0); + (unsigned int) inw(devpriv->iobase + 0); devpriv->b_EocEosInterrupt = APCI3120_DISABLE; - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ } else { - //Disable EOC Interrupt + /* Disable EOC Interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_EOC_INT; @@ -1478,10 +1511,10 @@ void v_APCI3120_Interrupt(int irq, void *d) } } - // Check If EOS interrupt + /* Check If EOS interrupt */ if ((int_daq & 0x2) && (devpriv->b_InterruptMode == APCI3120_EOS_MODE)) { - if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) // enable this in without DMA ??? + if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) /* enable this in without DMA ??? */ { if (devpriv->b_AiCyclicAcquisition == APCI3120_ENABLE) { @@ -1501,12 +1534,12 @@ void v_APCI3120_Interrupt(int irq, void *d) i++) { us_TmpValue = inw(devpriv->iobase + 0); devpriv->ui_AiReadData[i] = - (UINT) us_TmpValue; + (unsigned int) us_TmpValue; } devpriv->b_EocEosInterrupt = APCI3120_DISABLE; devpriv->b_InterruptMode = APCI3120_EOC_MODE; - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ } @@ -1516,12 +1549,12 @@ void v_APCI3120_Interrupt(int irq, void *d) b_ModeSelectRegister & APCI3120_DISABLE_EOS_INT; outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - devpriv->b_EocEosInterrupt = APCI3120_DISABLE; //Default settings + devpriv->b_EocEosInterrupt = APCI3120_DISABLE; /* Default settings */ devpriv->b_InterruptMode = APCI3120_EOC_MODE; } } - //Timer2 interrupt + /* Timer2 interrupt */ if (int_daq & 0x1) { switch (devpriv->b_Timer2Mode) { @@ -1534,18 +1567,18 @@ void v_APCI3120_Interrupt(int irq, void *d) outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - // stop timer 2 + /* stop timer 2 */ devpriv->us_OutputRegister = devpriv-> us_OutputRegister & APCI3120_DISABLE_ALL_TIMER; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); - //stop timer 0 and timer 1 + /* stop timer 0 and timer 1 */ i_APCI3120_StopCyclicAcquisition(dev, s); devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE; - //UPDATE-0.7.57->0.7.68comedi_done(dev,s); + /* UPDATE-0.7.57->0.7.68comedi_done(dev,s); */ s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s); @@ -1553,19 +1586,19 @@ void v_APCI3120_Interrupt(int irq, void *d) case APCI3120_TIMER: - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); break; case APCI3120_WATCHDOG: - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); break; default: - // disable Timer Interrupt + /* disable Timer Interrupt */ devpriv->b_ModeSelectRegister = devpriv-> @@ -1585,7 +1618,7 @@ void v_APCI3120_Interrupt(int irq, void *d) if (devpriv->b_AiCyclicAcquisition == APCI3120_ENABLE) { /****************************/ - /* Clear Timer Write TC INT */ + /* Clear Timer Write TC int */ /****************************/ outl(APCI3120_CLEAR_WRITE_TC_INT, @@ -1596,7 +1629,7 @@ void v_APCI3120_Interrupt(int irq, void *d) /* Clears the timer status register */ /************************************/ inw(dev->iobase + APCI3120_TIMER_STATUS_REGISTER); - v_APCI3120_InterruptDma(irq, d); // do some data transfer + v_APCI3120_InterruptDma(irq, d); /* do some data transfer */ } else { /* Stops the Timer */ outw(devpriv-> @@ -1630,32 +1663,8 @@ void v_APCI3120_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -/* - * int i_APCI3120_InterruptHandleEos(struct comedi_device *dev) -{ - int n_chan,i; - short *data; - struct comedi_subdevice *s=dev->subdevices+0; - struct comedi_async *async = s->async; - data=async->data+async->buf_int_ptr; - n_chan=devpriv->ui_AiNbrofChannels; - - for(i=0;i<n_chan;i++) - { - data[i]=inw(dev->iobase+0); - } - async->buf_int_count+=n_chan*sizeof(short); - async->buf_int_ptr+=n_chan*sizeof(short); - comedi_eos(dev,s); - if (s->async->buf_int_ptr>=s->async->data_len) // for buffer rool over - { -*//* buffer rollover */ -/* s->async->buf_int_ptr=0; - comedi_eobuf(dev,s); - } - return 0; -}*/ -int i_APCI3120_InterruptHandleEos(struct comedi_device * dev) + +int i_APCI3120_InterruptHandleEos(struct comedi_device *dev) { int n_chan, i; struct comedi_subdevice *s = dev->subdevices + 0; @@ -1704,7 +1713,7 @@ void v_APCI3120_InterruptDma(int irq, void *d) unsigned int next_dma_buf, samplesinbuf; unsigned long low_word, high_word, var; - UINT ui_Tmp; + unsigned int ui_Tmp; samplesinbuf = devpriv->ui_DmaBufferUsesize[devpriv->ui_DmaActualBuffer] - inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_MWTC); @@ -1720,20 +1729,20 @@ void v_APCI3120_InterruptDma(int irq, void *d) return; } - samplesinbuf = samplesinbuf >> 1; // number of received samples + samplesinbuf = samplesinbuf >> 1; /* number of received samples */ if (devpriv->b_DmaDoubleBuffer) { - // switch DMA buffers if is used double buffering + /* switch DMA buffers if is used double buffering */ next_dma_buf = 1 - devpriv->ui_DmaActualBuffer; ui_Tmp = AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO; outl(ui_Tmp, devpriv->i_IobaseAddon + AMCC_OP_REG_AGCSTS); - // changed since 16 bit interface for add on + /* changed since 16 bit interface for add on */ outw(APCI3120_ADD_ON_AGCSTS_LOW, devpriv->i_IobaseAddon + 0); outw(APCI3120_ENABLE_TRANSFER_ADD_ON_LOW, devpriv->i_IobaseAddon + 2); outw(APCI3120_ADD_ON_AGCSTS_HIGH, devpriv->i_IobaseAddon + 0); - outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2); // 0x1000 is out putted in windows driver + outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2); /* 0x1000 is out putted in windows driver */ var = devpriv->ul_DmaBufferHw[next_dma_buf]; low_word = var & 0xffff; @@ -1761,54 +1770,18 @@ void v_APCI3120_InterruptDma(int irq, void *d) outw(APCI3120_ADD_ON_MWTC_HIGH, devpriv->i_IobaseAddon + 0); outw(high_word, devpriv->i_IobaseAddon + 2); - // To configure A2P FIFO - // ENABLE A2P FIFO WRITE AND ENABLE AMWEN - // AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 +/* + * To configure A2P FIFO + * ENABLE A2P FIFO WRITE AND ENABLE AMWEN + * AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 + */ outw(3, devpriv->i_IobaseAddon + 4); - //initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) + /* initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) */ outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2 | APCI3120_ENABLE_WRITE_TC_INT), devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); } -/*UPDATE-0.7.57->0.7.68 - ptr=(short *)devpriv->ul_DmaBufferVirtual[devpriv->ui_DmaActualBuffer]; - - - // if there is not enough space left in the buffer to copy all data contained in the DMABufferVirtual - if(s->async->buf_int_ptr+samplesinbuf*sizeof(short)>=devpriv->ui_AiDataLength) - { - m=(devpriv->ui_AiDataLength-s->async->buf_int_ptr)/sizeof(short); - v_APCI3120_InterruptDmaMoveBlock16bit(dev,s,(void *)ptr,((void *)(devpriv->AiData))+s->async->buf_int_ptr,m); - s->async->buf_int_count+=m*sizeof(short); - ptr+=m*sizeof(short); - samplesinbuf-=m; - s->async->buf_int_ptr=0; - comedi_eobuf(dev,s); - } - - if (samplesinbuf) - { - v_APCI3120_InterruptDmaMoveBlock16bit(dev,s,(void *)ptr,((void *)(devpriv->AiData))+s->async->buf_int_ptr,samplesinbuf); - - s->async->buf_int_count+=samplesinbuf*sizeof(short); - s->async->buf_int_ptr+=samplesinbuf*sizeof(short); - if (!(devpriv->ui_AiFlags & TRIG_WAKE_EOS)) - { - comedi_bufcheck(dev,s); - } - } - if (!devpriv->b_AiContinuous) - if ( devpriv->ui_AiActualScan>=devpriv->ui_AiNbrofScans ) - { - // all data sampled - i_APCI3120_StopCyclicAcquisition(dev,s); - devpriv->b_AiCyclicAcquisition=APCI3120_DISABLE; - //DPRINTK("\n Single DMA completed..\n"); - comedi_done(dev,s); - return; - } -*/ if (samplesinbuf) { v_APCI3120_InterruptDmaMoveBlock16bit(dev, s, devpriv->ul_DmaBufferVirtual[devpriv-> @@ -1821,7 +1794,7 @@ void v_APCI3120_InterruptDma(int irq, void *d) } if (!devpriv->b_AiContinuous) if (devpriv->ui_AiActualScan >= devpriv->ui_AiNbrofScans) { - // all data sampled + /* all data sampled */ i_APCI3120_StopCyclicAcquisition(dev, s); devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE; s->async->events |= COMEDI_CB_EOA; @@ -1829,22 +1802,26 @@ void v_APCI3120_InterruptDma(int irq, void *d) return; } - if (devpriv->b_DmaDoubleBuffer) { // switch dma buffers + if (devpriv->b_DmaDoubleBuffer) { /* switch dma buffers */ devpriv->ui_DmaActualBuffer = 1 - devpriv->ui_DmaActualBuffer; } else { - // restart DMA if is not used double buffering - //ADDED REINITIALISE THE DMA +/* + * restart DMA if is not used double buffering + * ADDED REINITIALISE THE DMA + */ ui_Tmp = AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO; outl(ui_Tmp, devpriv->i_IobaseAddon + AMCC_OP_REG_AGCSTS); - // changed since 16 bit interface for add on + /* changed since 16 bit interface for add on */ outw(APCI3120_ADD_ON_AGCSTS_LOW, devpriv->i_IobaseAddon + 0); outw(APCI3120_ENABLE_TRANSFER_ADD_ON_LOW, devpriv->i_IobaseAddon + 2); outw(APCI3120_ADD_ON_AGCSTS_HIGH, devpriv->i_IobaseAddon + 0); - outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2); // - // A2P FIFO MANAGEMENT - // A2P fifo reset & transfer control enable + outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2); /* */ +/* + * A2P FIFO MANAGEMENT + * A2P fifo reset & transfer control enable + */ outl(APCI3120_A2P_FIFO_MANAGEMENT, devpriv->i_IobaseAmcc + AMCC_OP_REG_MCSR); @@ -1858,7 +1835,7 @@ void v_APCI3120_InterruptDma(int irq, void *d) outw(high_word, devpriv->i_IobaseAddon + 2); var = devpriv->ui_DmaBufferUsesize[0]; - low_word = var & 0xffff; //changed + low_word = var & 0xffff; /* changed */ var = devpriv->ui_DmaBufferUsesize[0]; high_word = var / 65536; outw(APCI3120_ADD_ON_MWTC_LOW, devpriv->i_IobaseAddon + 0); @@ -1866,11 +1843,13 @@ void v_APCI3120_InterruptDma(int irq, void *d) outw(APCI3120_ADD_ON_MWTC_HIGH, devpriv->i_IobaseAddon + 0); outw(high_word, devpriv->i_IobaseAddon + 2); - // To configure A2P FIFO - //ENABLE A2P FIFO WRITE AND ENABLE AMWEN - // AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 +/* + * To configure A2P FIFO + * ENABLE A2P FIFO WRITE AND ENABLE AMWEN + * AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 + */ outw(3, devpriv->i_IobaseAddon + 4); - //initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) + /* initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) */ outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2 | APCI3120_ENABLE_WRITE_TC_INT), devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); @@ -1897,37 +1876,8 @@ void v_APCI3120_InterruptDma(int irq, void *d) +----------------------------------------------------------------------------+ */ -/*void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n) -{ - int i,j,m; - - j=s->async->cur_chan; - m=devpriv->ui_AiActualScanPosition; - for(i=0;i<n;i++) - { - *data=*dma; - data++; dma++; - j++; - if(j>=devpriv->ui_AiNbrofChannels) - { - m+=j; - j=0; - if(m>=devpriv->ui_AiScanLength) - { - m=0; - devpriv->ui_AiActualScan++; - if (devpriv->ui_AiFlags & TRIG_WAKE_EOS) -;//UPDATE-0.7.57->0.7.68 comedi_eos(dev,s); - } - } - } - devpriv->ui_AiActualScanPosition=m; - s->async->cur_chan=j; - -} -*/ -void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device * dev, - struct comedi_subdevice * s, short * dma_buffer, unsigned int num_samples) +void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, + struct comedi_subdevice *s, short *dma_buffer, unsigned int num_samples) { devpriv->ui_AiActualScan += (s->async->cur_chan + num_samples) / devpriv->ui_AiScanLength; @@ -1968,71 +1918,77 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Timervalue2; - USHORT us_TmpValue; - BYTE b_Tmp; + unsigned int ui_Timervalue2; + unsigned short us_TmpValue; + unsigned char b_Tmp; if (!data[1]) comedi_error(dev, "config:No timer constant !"); - devpriv->b_Timer2Interrupt = (BYTE) data[2]; // save info whether to enable or disable interrupt + devpriv->b_Timer2Interrupt = (unsigned char) data[2]; /* save info whether to enable or disable interrupt */ - ui_Timervalue2 = data[1] / 1000; // convert nano seconds to u seconds + ui_Timervalue2 = data[1] / 1000; /* convert nano seconds to u seconds */ - //this_board->i_hwdrv_InsnConfigTimer(dev, ui_Timervalue2,(BYTE)data[0]); - us_TmpValue = (USHORT) inw(devpriv->iobase + APCI3120_RD_STATUS); + /* this_board->i_hwdrv_InsnConfigTimer(dev, ui_Timervalue2,(unsigned char)data[0]); */ + us_TmpValue = (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS); - //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 - // and calculate the time value to set in the timer +/* + * EL250804: Testing if board APCI3120 have the new Quartz or if it + * is an APCI3001 and calculate the time value to set in the timer + */ if ((us_TmpValue & 0x00B0) == 0x00B0 || !strcmp(this_board->pc_DriverName, "apci3001")) { - //Calculate the time value to set in the timer + /* Calculate the time value to set in the timer */ ui_Timervalue2 = ui_Timervalue2 / 50; } else { - //Calculate the time value to set in the timer + /* Calculate the time value to set in the timer */ ui_Timervalue2 = ui_Timervalue2 / 70; } - //Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0) + /* Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0) */ devpriv->us_OutputRegister = devpriv->us_OutputRegister & APCI3120_DISABLE_TIMER2; outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS); - // Disable TIMER Interrupt + /* Disable TIMER Interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_TIMER_INT & 0xEF; - // Disable Eoc and Eos Interrupts + /* Disable Eoc and Eos Interrupts */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_EOC_INT & APCI3120_DISABLE_EOS_INT; outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - if (data[0] == APCI3120_TIMER) //initialize timer + if (data[0] == APCI3120_TIMER) /* initialize timer */ { + /* devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | + * APCI3120_ENABLE_TIMER_INT; */ - //devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister| APCI3120_ENABLE_TIMER_INT ; - //outb(devpriv->b_ModeSelectRegister,devpriv->iobase+APCI3120_WRITE_MODE_SELECT); + /* outb(devpriv->b_ModeSelectRegister,devpriv->iobase+APCI3120_WRITE_MODE_SELECT); */ - //Set the Timer 2 in mode 2(Timer) + /* Set the Timer 2 in mode 2(Timer) */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0x0F) | APCI3120_TIMER_2_MODE_2; outb(devpriv->b_TimerSelectMode, devpriv->iobase + APCI3120_TIMER_CRT1); - //Configure the timer 2 for writing the LOW WORD of timer is Delay value - //You must make a b_tmp variable with DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0 - //you can set the digital output and configure the timer 2,and if you don't make this, digital output - //are erase (Set to 0) - - //Writing LOW WORD +/* + * Configure the timer 2 for writing the LOW unsigned short of timer + * is Delay value You must make a b_tmp variable with + * DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0 + * you can set the digital output and configure the timer 2,and if + * you don't make this, digital output are erase (Set to 0) + */ + + /* Writing LOW unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -2040,20 +1996,20 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi outw(LOWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - //Writing HIGH WORD + /* Writing HIGH unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0); outw(HIWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - // timer2 in Timer mode enabled + /* timer2 in Timer mode enabled */ devpriv->b_Timer2Mode = APCI3120_TIMER; - } else // Initialize Watch dog + } else /* Initialize Watch dog */ { - //Set the Timer 2 in mode 5(Watchdog) + /* Set the Timer 2 in mode 5(Watchdog) */ devpriv->b_TimerSelectMode = (devpriv-> @@ -2061,12 +2017,15 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi outb(devpriv->b_TimerSelectMode, devpriv->iobase + APCI3120_TIMER_CRT1); - //Configure the timer 2 for writing the LOW WORD of timer is Delay value - //You must make a b_tmp variable with DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0 - //you can set the digital output and configure the timer 2,and if you don't make this, digital output - //are erase (Set to 0) - - //Writing LOW WORD +/* + * Configure the timer 2 for writing the LOW unsigned short of timer + * is Delay value You must make a b_tmp variable with + * DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0 + * you can set the digital output and configure the timer 2,and if + * you don't make this, digital output are erase (Set to 0) + */ + + /* Writing LOW unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -2074,7 +2033,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi outw(LOWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - //Writing HIGH WORD + /* Writing HIGH unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; @@ -2082,7 +2041,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi outw(HIWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - //watchdog enabled + /* watchdog enabled */ devpriv->b_Timer2Mode = APCI3120_WATCHDOG; } @@ -2119,13 +2078,13 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi +----------------------------------------------------------------------------+ */ -int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Timervalue2 = 0; - USHORT us_TmpValue; - BYTE b_Tmp; + unsigned int ui_Timervalue2 = 0; + unsigned short us_TmpValue; + unsigned char b_Tmp; if ((devpriv->b_Timer2Mode != APCI3120_WATCHDOG) && (devpriv->b_Timer2Mode != APCI3120_TIMER)) { @@ -2133,7 +2092,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic return -EINVAL; } - if (data[0] == 2) // write new value + if (data[0] == 2) /* write new value */ { if (devpriv->b_Timer2Mode != APCI3120_TIMER) { comedi_error(dev, @@ -2147,35 +2106,35 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic ui_Timervalue2 = 0; } - //this_board->i_hwdrv_InsnWriteTimer(dev,data[0],ui_Timervalue2); + /* this_board->i_hwdrv_InsnWriteTimer(dev,data[0],ui_Timervalue2); */ switch (data[0]) { case APCI3120_START: - // Reset FC_TIMER BIT + /* Reset FC_TIMER BIT */ inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER); - if (devpriv->b_Timer2Mode == APCI3120_TIMER) //start timer + if (devpriv->b_Timer2Mode == APCI3120_TIMER) /* start timer */ { - //Enable Timer + /* Enable Timer */ devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister & 0x0B; - } else //start watch dog + } else /* start watch dog */ { - //Enable WatchDog + /* Enable WatchDog */ devpriv->b_ModeSelectRegister = (devpriv-> b_ModeSelectRegister & 0x0B) | APCI3120_ENABLE_WATCHDOG; } - //enable disable interrupt + /* enable disable interrupt */ if ((devpriv->b_Timer2Interrupt) == APCI3120_ENABLE) { devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister | APCI3120_ENABLE_TIMER_INT; - // save the task structure to pass info to user + /* save the task structure to pass info to user */ devpriv->tsk_Current = current; } else { @@ -2187,9 +2146,9 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - if (devpriv->b_Timer2Mode == APCI3120_TIMER) //start timer + if (devpriv->b_Timer2Mode == APCI3120_TIMER) /* start timer */ { - //For Timer mode is Gate2 must be activated **timer started + /* For Timer mode is Gate2 must be activated **timer started */ devpriv->us_OutputRegister = devpriv-> us_OutputRegister | APCI3120_ENABLE_TIMER2; @@ -2201,62 +2160,64 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic case APCI3120_STOP: if (devpriv->b_Timer2Mode == APCI3120_TIMER) { - //Disable timer + /* Disable timer */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_TIMER_COUNTER; } else { - //Disable WatchDog + /* Disable WatchDog */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_WATCHDOG; } - // Disable timer interrupt + /* Disable timer interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_TIMER_INT; - // Write above states to register + /* Write above states to register */ outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - // Reset Gate 2 + /* Reset Gate 2 */ devpriv->us_OutputRegister = devpriv->us_OutputRegister & APCI3120_DISABLE_TIMER_INT; outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS); - // Reset FC_TIMER BIT + /* Reset FC_TIMER BIT */ inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER); - // Disable timer - //devpriv->b_Timer2Mode=APCI3120_DISABLE; + /* Disable timer */ + /* devpriv->b_Timer2Mode=APCI3120_DISABLE; */ break; - case 2: //write new value to Timer + case 2: /* write new value to Timer */ if (devpriv->b_Timer2Mode != APCI3120_TIMER) { comedi_error(dev, "write :timer2 not configured in TIMER MODE"); return -EINVAL; } - // ui_Timervalue2=data[1]; // passed as argument + /* ui_Timervalue2=data[1]; // passed as argument */ us_TmpValue = - (USHORT) inw(devpriv->iobase + APCI3120_RD_STATUS); + (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS); - //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 - // and calculate the time value to set in the timer +/* + * EL250804: Testing if board APCI3120 have the new Quartz or if it + * is an APCI3001 and calculate the time value to set in the timer + */ if ((us_TmpValue & 0x00B0) == 0x00B0 || !strcmp(this_board->pc_DriverName, "apci3001")) { - //Calculate the time value to set in the timer + /* Calculate the time value to set in the timer */ ui_Timervalue2 = ui_Timervalue2 / 50; } else { - //Calculate the time value to set in the timer + /* Calculate the time value to set in the timer */ ui_Timervalue2 = ui_Timervalue2 / 70; } - //Writing LOW WORD + /* Writing LOW unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -2265,7 +2226,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic outw(LOWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - //Writing HIGH WORD + /* Writing HIGH unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; @@ -2276,7 +2237,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic break; default: - return -EINVAL; // Not a valid input + return -EINVAL; /* Not a valid input */ } return insn->n; @@ -2305,21 +2266,21 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic | | +----------------------------------------------------------------------------+ */ -int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - BYTE b_Tmp; - USHORT us_TmpValue, us_TmpValue_2, us_StatusValue; + unsigned char b_Tmp; + unsigned short us_TmpValue, us_TmpValue_2, us_StatusValue; if ((devpriv->b_Timer2Mode != APCI3120_WATCHDOG) && (devpriv->b_Timer2Mode != APCI3120_TIMER)) { comedi_error(dev, "\nread:timer2 not configured "); } - //this_board->i_hwdrv_InsnReadTimer(dev,data); + /* this_board->i_hwdrv_InsnReadTimer(dev,data); */ if (devpriv->b_Timer2Mode == APCI3120_TIMER) { - //Read the LOW WORD of Timer 2 register + /* Read the LOW unsigned short of Timer 2 register */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -2327,7 +2288,7 @@ int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice us_TmpValue = inw(devpriv->iobase + APCI3120_TIMER_VALUE); - //Read the HIGH WORD of Timer 2 register + /* Read the HIGH unsigned short of Timer 2 register */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; @@ -2335,20 +2296,20 @@ int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice us_TmpValue_2 = inw(devpriv->iobase + APCI3120_TIMER_VALUE); - // combining both words - data[0] = (UINT) ((us_TmpValue) | ((us_TmpValue_2) << 16)); + /* combining both words */ + data[0] = (unsigned int) ((us_TmpValue) | ((us_TmpValue_2) << 16)); - } else // Read watch dog status + } else /* Read watch dog status */ { us_StatusValue = inw(devpriv->iobase + APCI3120_RD_STATUS); us_StatusValue = ((us_StatusValue & APCI3120_FC_TIMER) >> 12) & 1; if (us_StatusValue == 1) { - // RESET FC_TIMER BIT + /* RESET FC_TIMER BIT */ inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER); } - data[0] = us_StatusValue; // when data[0] = 1 then the watch dog has rundown + data[0] = us_StatusValue; /* when data[0] = 1 then the watch dog has rundown */ } return insn->n; } @@ -2384,21 +2345,23 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - UINT ui_Chan, ui_TmpValue; + unsigned int ui_Chan, ui_TmpValue; - ui_Chan = CR_CHAN(insn->chanspec); // channel specified + ui_Chan = CR_CHAN(insn->chanspec); /* channel specified */ - //this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data); + /* this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data); */ if (ui_Chan >= 0 && ui_Chan <= 3) { - ui_TmpValue = (UINT) inw(devpriv->iobase + APCI3120_RD_STATUS); + ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS); - // since only 1 channel reqd to bring it to last bit it is rotated - // 8 +(chan - 1) times then ANDed with 1 for last bit. +/* + * since only 1 channel reqd to bring it to last bit it is rotated 8 + * +(chan - 1) times then ANDed with 1 for last bit. + */ *data = (ui_TmpValue >> (ui_Chan + 8)) & 1; - //return 0; + /* return 0; */ } else { - // comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + /* comedi_error(dev," chan spec wrong"); */ + return -EINVAL; /* "sorry channel spec wrong " */ } return insn->n; @@ -2423,18 +2386,18 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI3120_InsnBitsDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_TmpValue; - ui_TmpValue = (UINT) inw(devpriv->iobase + APCI3120_RD_STATUS); + unsigned int ui_TmpValue; + ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS); /***** state of 4 channels in the 11, 10, 9, 8 bits of status reg rotated right 8 times to bring them to last four bits ANDed with oxf for value. *****/ *data = (ui_TmpValue >> 8) & 0xf; - //this_board->i_hwdrv_InsnBitsDigitalInput(dev,data); + /* this_board->i_hwdrv_InsnBitsDigitalInput(dev,data); */ return insn->n; } @@ -2462,8 +2425,8 @@ int i_APCI3120_InsnBitsDigitalInput(struct comedi_device * dev, struct comedi_su +----------------------------------------------------------------------------+ */ -int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { if ((data[0] != 0) && (data[0] != 1)) { @@ -2481,7 +2444,7 @@ int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device * dev, if (!devpriv->b_OutputMemoryStatus) { ui_Temp = 0; - } //if(!devpriv->b_OutputMemoryStatus ) + } /* if(!devpriv->b_OutputMemoryStatus ) */ return insn->n; } @@ -2499,16 +2462,16 @@ int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device * dev, | struct comedi_subdevice *s | | struct comedi_insn *insn | | unsigned int *data | - data[0] Value to be written - data[1] :1 Set digital o/p ON - data[1] 2 Set digital o/p OFF with memory ON +| data[0] Value to be written +| data[1] :1 Set digital o/p ON +| data[1] 2 Set digital o/p OFF with memory ON +----------------------------------------------------------------------------+ | Return Value : | | | +----------------------------------------------------------------------------+ */ -int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device * dev, +int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -2530,7 +2493,7 @@ int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device * dev, default: printk("\nThe parameter passed is in error \n"); return -EINVAL; - } // switch(data[1]) + } /* switch(data[1]) */ outb(data[0], devpriv->iobase + APCI3120_DIGITAL_OUTPUT); devpriv->b_DigitalOutputRegister = data[0] & 0xF0; @@ -2567,9 +2530,9 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, unsigned int *data) { - UINT ui_Temp1; + unsigned int ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if ((data[0] != 0) && (data[0] != 1)) { comedi_error(dev, @@ -2586,7 +2549,7 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, switch (data[1]) { case 1: data[0] = (data[0] << ui_NoOfChannel); -//ES05 data[0]=(data[0]<<4)|ui_Temp; +/* ES05 data[0]=(data[0]<<4)|ui_Temp; */ data[0] = (data[0] << 4) | devpriv->b_DigitalOutputRegister; break; @@ -2595,24 +2558,24 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, ui_Temp1 = 1; ui_Temp1 = ui_Temp1 << ui_NoOfChannel; ui_Temp1 = ui_Temp1 << 4; -//ES05 ui_Temp=ui_Temp|ui_Temp1; +/* ES05 ui_Temp=ui_Temp|ui_Temp1; */ devpriv->b_DigitalOutputRegister = devpriv->b_DigitalOutputRegister | ui_Temp1; data[0] = (data[0] << ui_NoOfChannel) ^ 0xf; data[0] = data[0] << 4; -//ES05 data[0]=data[0]& ui_Temp; +/* ES05 data[0]=data[0]& ui_Temp; */ data[0] = data[0] & devpriv->b_DigitalOutputRegister; break; default: printk("\nThe parameter passed is in error \n"); return -EINVAL; - } // switch(data[1]) + } /* switch(data[1]) */ outb(data[0], devpriv->iobase + APCI3120_DIGITAL_OUTPUT); -//ES05 ui_Temp=data[0] & 0xf0; +/* ES05 ui_Temp=data[0] & 0xf0; */ devpriv->b_DigitalOutputRegister = data[0] & 0xf0; - return (insn->n); + return insn->n; } @@ -2646,14 +2609,14 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - UINT ui_Range, ui_Channel; - USHORT us_TmpValue; + unsigned int ui_Range, ui_Channel; + unsigned short us_TmpValue; ui_Range = CR_RANGE(insn->chanspec); ui_Channel = CR_CHAN(insn->chanspec); - //this_board->i_hwdrv_InsnWriteAnalogOutput(dev, ui_Range, ui_Channel,data[0]); - if (ui_Range) // if 1 then unipolar + /* this_board->i_hwdrv_InsnWriteAnalogOutput(dev, ui_Range, ui_Channel,data[0]); */ + if (ui_Range) /* if 1 then unipolar */ { if (data[0] != 0) @@ -2665,7 +2628,7 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, ((((ui_Channel & 0x03) << 14) & 0xC000) | (1 << 13) | 8192); - } else // if 0 then bipolar + } else /* if 0 then bipolar */ { data[0] = ((((ui_Channel & 0x03) << 14) & 0xC000) | (0 << 13) | @@ -2673,24 +2636,30 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, } - //out put n values at the given channel. - // rt_printk("\nwaiting for DA_READY BIT"); - do //Waiting of DA_READY BIT +/* + * out put n values at the given channel. printk("\nwaiting for + * DA_READY BIT"); + */ + do /* Waiting of DA_READY BIT */ { us_TmpValue = - ((USHORT) inw(devpriv->iobase + + ((unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS)) & 0x0001; } while (us_TmpValue != 0x0001); if (ui_Channel <= 3) - // for channel 0-3 out at the register 1 (wrDac1-8) - // data[i] typecasted to ushort since word write is to be done - outw((USHORT) data[0], +/* + * for channel 0-3 out at the register 1 (wrDac1-8) data[i] + * typecasted to ushort since word write is to be done + */ + outw((unsigned short) data[0], devpriv->iobase + APCI3120_ANALOG_OUTPUT_1); else - // for channel 4-7 out at the register 2 (wrDac5-8) - //data[i] typecasted to ushort since word write is to be done - outw((USHORT) data[0], +/* + * for channel 4-7 out at the register 2 (wrDac5-8) data[i] + * typecasted to ushort since word write is to be done + */ + outw((unsigned short) data[0], devpriv->iobase + APCI3120_ANALOG_OUTPUT_2); return insn->n; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h index 59d5d87a845..fedfc9c58a8 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h @@ -1,5 +1,5 @@ -// hwdrv_apci3120.h +/* hwdrv_apci3120.h */ /* * Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. @@ -18,9 +18,9 @@ * any later version. */ -// comedi related defines +/* comedi related defines */ -//ANALOG INPUT RANGE +/* ANALOG INPUT RANGE */ static const struct comedi_lrange range_apci3120_ai = { 8, { BIP_RANGE(10), BIP_RANGE(5), @@ -33,14 +33,14 @@ static const struct comedi_lrange range_apci3120_ai = { 8, { } }; -// ANALOG OUTPUT RANGE +/* ANALOG OUTPUT RANGE */ static const struct comedi_lrange range_apci3120_ao = { 2, { BIP_RANGE(10), UNI_RANGE(10) } }; -#define APCI3120_BIPOLAR_RANGES 4 // used for test on mixture of BIP/UNI ranges +#define APCI3120_BIPOLAR_RANGES 4 /* used for test on mixture of BIP/UNI ranges */ #define APCI3120_BOARD_VENDOR_ID 0x10E8 #define APCI3120_ADDRESS_RANGE 16 @@ -55,17 +55,17 @@ static const struct comedi_lrange range_apci3120_ao = { 2, { #define APCI3120_EOS_MODE 2 #define APCI3120_DMA_MODE 3 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI3120_DIGITAL_OUTPUT 0x0D #define APCI3120_RD_STATUS 0x02 #define APCI3120_RD_FIFO 0x00 -// digital output insn_write ON /OFF selection +/* digital output insn_write ON /OFF selection */ #define APCI3120_SET4DIGITALOUTPUTON 1 #define APCI3120_SET4DIGITALOUTPUTOFF 0 -// analog output SELECT BIT +/* analog output SELECT BIT */ #define APCI3120_ANALOG_OP_CHANNEL_1 0x0000 #define APCI3120_ANALOG_OP_CHANNEL_2 0x4000 #define APCI3120_ANALOG_OP_CHANNEL_3 0x8000 @@ -75,32 +75,32 @@ static const struct comedi_lrange range_apci3120_ao = { 2, { #define APCI3120_ANALOG_OP_CHANNEL_7 0x8000 #define APCI3120_ANALOG_OP_CHANNEL_8 0xC000 -// Enable external trigger bit in nWrAddress +/* Enable external trigger bit in nWrAddress */ #define APCI3120_ENABLE_EXT_TRIGGER 0x8000 -//ANALOG OUTPUT AND INPUT DEFINE -#define APCI3120_UNIPOLAR 0x80 //$$ RAM sequence polarity BIT -#define APCI3120_BIPOLAR 0x00 //$$ RAM sequence polarity BIT -#define APCI3120_ANALOG_OUTPUT_1 0x08 // (ADDRESS ) -#define APCI3120_ANALOG_OUTPUT_2 0x0A // (ADDRESS ) -#define APCI3120_1_GAIN 0x00 //$$ RAM sequence Gain Bits for gain 1 -#define APCI3120_2_GAIN 0x10 //$$ RAM sequence Gain Bits for gain 2 -#define APCI3120_5_GAIN 0x20 //$$ RAM sequence Gain Bits for gain 5 -#define APCI3120_10_GAIN 0x30 //$$ RAM sequence Gain Bits for gain 10 -#define APCI3120_SEQ_RAM_ADDRESS 0x06 //$$ EARLIER NAMED APCI3120_FIFO_ADDRESS -#define APCI3120_RESET_FIFO 0x0C //(ADDRESS) -#define APCI3120_TIMER_0_MODE_2 0x01 //$$ Bits for timer mode +/* ANALOG OUTPUT AND INPUT DEFINE */ +#define APCI3120_UNIPOLAR 0x80 /* $$ RAM sequence polarity BIT */ +#define APCI3120_BIPOLAR 0x00 /* $$ RAM sequence polarity BIT */ +#define APCI3120_ANALOG_OUTPUT_1 0x08 /* (ADDRESS ) */ +#define APCI3120_ANALOG_OUTPUT_2 0x0A /* (ADDRESS ) */ +#define APCI3120_1_GAIN 0x00 /* $$ RAM sequence Gain Bits for gain 1 */ +#define APCI3120_2_GAIN 0x10 /* $$ RAM sequence Gain Bits for gain 2 */ +#define APCI3120_5_GAIN 0x20 /* $$ RAM sequence Gain Bits for gain 5 */ +#define APCI3120_10_GAIN 0x30 /* $$ RAM sequence Gain Bits for gain 10 */ +#define APCI3120_SEQ_RAM_ADDRESS 0x06 /* $$ EARLIER NAMED APCI3120_FIFO_ADDRESS */ +#define APCI3120_RESET_FIFO 0x0C /* (ADDRESS) */ +#define APCI3120_TIMER_0_MODE_2 0x01 /* $$ Bits for timer mode */ #define APCI3120_TIMER_0_MODE_4 0x2 #define APCI3120_SELECT_TIMER_0_WORD 0x00 -#define APCI3120_ENABLE_TIMER0 0x1000 //$$Gatebit 0 in nWrAddress +#define APCI3120_ENABLE_TIMER0 0x1000 /* $$Gatebit 0 in nWrAddress */ #define APCI3120_CLEAR_PR 0xF0FF #define APCI3120_CLEAR_PA 0xFFF0 #define APCI3120_CLEAR_PA_PR (APCI3120_CLEAR_PR & APCI3120_CLEAR_PA) -// nWrMode_Select -#define APCI3120_ENABLE_SCAN 0x8 //$$ bit in nWrMode_Select +/* nWrMode_Select */ +#define APCI3120_ENABLE_SCAN 0x8 /* $$ bit in nWrMode_Select */ #define APCI3120_DISABLE_SCAN (~APCI3120_ENABLE_SCAN) -#define APCI3120_ENABLE_EOS_INT 0x2 //$$ bit in nWrMode_Select +#define APCI3120_ENABLE_EOS_INT 0x2 /* $$ bit in nWrMode_Select */ #define APCI3120_DISABLE_EOS_INT (~APCI3120_ENABLE_EOS_INT) #define APCI3120_ENABLE_EOC_INT 0x1 @@ -108,50 +108,50 @@ static const struct comedi_lrange range_apci3120_ao = { 2, { #define APCI3120_DISABLE_ALL_INTERRUPT_WITHOUT_TIMER (APCI3120_DISABLE_EOS_INT & APCI3120_DISABLE_EOC_INT) #define APCI3120_DISABLE_ALL_INTERRUPT (APCI3120_DISABLE_TIMER_INT & APCI3120_DISABLE_EOS_INT & APCI3120_DISABLE_EOC_INT) -//status register bits +/* status register bits */ #define APCI3120_EOC 0x8000 #define APCI3120_EOS 0x2000 -// software trigger dummy register -#define APCI3120_START_CONVERSION 0x02 //(ADDRESS) +/* software trigger dummy register */ +#define APCI3120_START_CONVERSION 0x02 /* (ADDRESS) */ -//TIMER DEFINE +/* TIMER DEFINE */ #define APCI3120_QUARTZ_A 70 #define APCI3120_QUARTZ_B 50 #define APCI3120_TIMER 1 #define APCI3120_WATCHDOG 2 #define APCI3120_TIMER_DISABLE 0 #define APCI3120_TIMER_ENABLE 1 -#define APCI3120_ENABLE_TIMER2 0x4000 //$$ gatebit 2 in nWrAddress +#define APCI3120_ENABLE_TIMER2 0x4000 /* $$ gatebit 2 in nWrAddress */ #define APCI3120_DISABLE_TIMER2 (~APCI3120_ENABLE_TIMER2) -#define APCI3120_ENABLE_TIMER_INT 0x04 //$$ ENAIRQ_FC_Bit in nWrModeSelect +#define APCI3120_ENABLE_TIMER_INT 0x04 /* $$ ENAIRQ_FC_Bit in nWrModeSelect */ #define APCI3120_DISABLE_TIMER_INT (~APCI3120_ENABLE_TIMER_INT) -#define APCI3120_WRITE_MODE_SELECT 0x0E // (ADDRESS) +#define APCI3120_WRITE_MODE_SELECT 0x0E /* (ADDRESS) */ #define APCI3120_SELECT_TIMER_0_WORD 0x00 #define APCI3120_SELECT_TIMER_1_WORD 0x01 #define APCI3120_TIMER_1_MODE_2 0x4 -//$$ BIT FOR MODE IN nCsTimerCtr1 +/* $$ BIT FOR MODE IN nCsTimerCtr1 */ #define APCI3120_TIMER_2_MODE_0 0x0 #define APCI3120_TIMER_2_MODE_2 0x10 #define APCI3120_TIMER_2_MODE_5 0x30 -//$$ BIT FOR MODE IN nCsTimerCtr0 +/* $$ BIT FOR MODE IN nCsTimerCtr0 */ #define APCI3120_SELECT_TIMER_2_LOW_WORD 0x02 #define APCI3120_SELECT_TIMER_2_HIGH_WORD 0x03 -#define APCI3120_TIMER_CRT0 0x0D //(ADDRESS for cCsTimerCtr0) -#define APCI3120_TIMER_CRT1 0x0C //(ADDRESS for cCsTimerCtr1) +#define APCI3120_TIMER_CRT0 0x0D /* (ADDRESS for cCsTimerCtr0) */ +#define APCI3120_TIMER_CRT1 0x0C /* (ADDRESS for cCsTimerCtr1) */ -#define APCI3120_TIMER_VALUE 0x04 //ADDRESS for nCsTimerWert -#define APCI3120_TIMER_STATUS_REGISTER 0x0D //ADDRESS for delete timer 2 interrupt -#define APCI3120_RD_STATUS 0x02 //ADDRESS -#define APCI3120_WR_ADDRESS 0x00 //ADDRESS -#define APCI3120_ENABLE_WATCHDOG 0x20 //$$BIT in nWrMode_Select +#define APCI3120_TIMER_VALUE 0x04 /* ADDRESS for nCsTimerWert */ +#define APCI3120_TIMER_STATUS_REGISTER 0x0D /* ADDRESS for delete timer 2 interrupt */ +#define APCI3120_RD_STATUS 0x02 /* ADDRESS */ +#define APCI3120_WR_ADDRESS 0x00 /* ADDRESS */ +#define APCI3120_ENABLE_WATCHDOG 0x20 /* $$BIT in nWrMode_Select */ #define APCI3120_DISABLE_WATCHDOG (~APCI3120_ENABLE_WATCHDOG) -#define APCI3120_ENABLE_TIMER_COUNTER 0x10 //$$BIT in nWrMode_Select +#define APCI3120_ENABLE_TIMER_COUNTER 0x10 /* $$BIT in nWrMode_Select */ #define APCI3120_DISABLE_TIMER_COUNTER (~APCI3120_ENABLE_TIMER_COUNTER) -#define APCI3120_FC_TIMER 0x1000 //bit in status register +#define APCI3120_FC_TIMER 0x1000 /* bit in status register */ #define APCI3120_ENABLE_TIMER0 0x1000 #define APCI3120_ENABLE_TIMER1 0x2000 #define APCI3120_ENABLE_TIMER2 0x4000 @@ -159,25 +159,27 @@ static const struct comedi_lrange range_apci3120_ao = { 2, { #define APCI3120_DISABLE_TIMER1 (~APCI3120_ENABLE_TIMER1) #define APCI3120_DISABLE_TIMER2 (~APCI3120_ENABLE_TIMER2) -#define APCI3120_TIMER2_SELECT_EOS 0xC0 // ADDED on 20-6 -#define APCI3120_COUNTER 3 // on 20-6 -#define APCI3120_DISABLE_ALL_TIMER ( APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1 & APCI3120_DISABLE_TIMER2 ) // on 20-6 +#define APCI3120_TIMER2_SELECT_EOS 0xC0 /* ADDED on 20-6 */ +#define APCI3120_COUNTER 3 /* on 20-6 */ +#define APCI3120_DISABLE_ALL_TIMER (APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1 & APCI3120_DISABLE_TIMER2) /* on 20-6 */ #define MAX_ANALOGINPUT_CHANNELS 32 -typedef struct { - BYTE b_Type; /* EOC or EOS */ - BYTE b_InterruptFlag; /* Interrupt use or not */ - UINT ui_ConvertTiming; /* Selection of the convertion time */ - BYTE b_NbrOfChannel; /* Number of channel to read */ - UINT ui_ChannelList[MAX_ANALOGINPUT_CHANNELS]; /* Number of the channel to be read */ - UINT ui_RangeList[MAX_ANALOGINPUT_CHANNELS]; /* Gain of each channel */ +struct str_AnalogReadInformation { -} str_AnalogReadInformation; + unsigned char b_Type; /* EOC or EOS */ + unsigned char b_InterruptFlag; /* Interrupt use or not */ + unsigned int ui_ConvertTiming; /* Selection of the convertion time */ + unsigned char b_NbrOfChannel; /* Number of channel to read */ + unsigned int ui_ChannelList[MAX_ANALOGINPUT_CHANNELS]; /* Number of the channel to be read */ + unsigned int ui_RangeList[MAX_ANALOGINPUT_CHANNELS]; /* Gain of each channel */ + +}; -// Function Declaration For APCI-3120 -// Internal functions +/* Function Declaration For APCI-3120 */ + +/* Internal functions */ int i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, unsigned int *chanlist, char check); int i_APCI3120_ExttrigEnable(struct comedi_device *dev); @@ -186,9 +188,9 @@ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_su int i_APCI3120_Reset(struct comedi_device *dev); int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev, struct comedi_subdevice *s); -// Interrupt functions +/* Interrupt functions */ void v_APCI3120_Interrupt(int irq, void *d); -//UPDATE-0.7.57->0.7.68 void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n); +/* UPDATE-0.7.57->0.7.68 void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n); */ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, struct comedi_subdevice *s, short *dma_buffer, @@ -196,7 +198,7 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, int i_APCI3120_InterruptHandleEos(struct comedi_device *dev); void v_APCI3120_InterruptDma(int irq, void *d); -// TIMER +/* TIMER */ int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -205,16 +207,19 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DI -// for di read +/* +* DI for di read +*/ int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DO -//int i_APCI3120_WriteDigitalOutput(struct comedi_device *dev, BYTE data); +/* DO */ +/* int i_APCI3120_WriteDigitalOutput(struct comedi_device *dev, + * unsigned char data); + */ int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -223,12 +228,15 @@ int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device *dev, struct comedi_su int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//AO -//int i_APCI3120_Write1AnalogValue(struct comedi_device *dev,UINT ui_Range,UINT ui_Channel,UINT data ); +/* AO */ +/* int i_APCI3120_Write1AnalogValue(struct comedi_device *dev,UINT ui_Range, + * UINT ui_Channel,UINT data ); + */ + int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//AI HArdware layer +/* AI HArdware layer */ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -237,5 +245,5 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); -//int i_APCI3120_CancelAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); +/* int i_APCI3120_CancelAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); */ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c index 1ff66bee548..9b53255bd45 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c @@ -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,73 +57,73 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ #include "hwdrv_apci3200.h" -//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +/* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ #include "addi_amcc_S5920.h" -//#define PRINT_INFO +/* #define PRINT_INFO */ -//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ -//BEGIN JK 06.07.04: Management of sevrals boards +/* BEGIN JK 06.07.04: Management of sevrals boards */ /* - INT i_CJCAvailable=1; - INT i_CJCPolarity=0; - INT i_CJCGain=2;//changed from 0 to 2 - INT i_InterruptFlag=0; - INT i_ADDIDATAPolarity; - INT i_ADDIDATAGain; - INT i_AutoCalibration=0; //: auto calibration - INT i_ADDIDATAConversionTime; - INT i_ADDIDATAConversionTimeUnit; - INT i_ADDIDATAType; - INT i_ChannelNo; - INT i_ChannelCount=0; - INT i_ScanType; - INT i_FirstChannel; - INT i_LastChannel; - INT i_Sum=0; - INT i_Offset; - UINT ui_Channel_num=0; + int i_CJCAvailable=1; + int i_CJCPolarity=0; + int i_CJCGain=2;/* changed from 0 to 2 */ + int i_InterruptFlag=0; + int i_ADDIDATAPolarity; + int i_ADDIDATAGain; + int i_AutoCalibration=0; /* : auto calibration */ + int i_ADDIDATAConversionTime; + int i_ADDIDATAConversionTimeUnit; + int i_ADDIDATAType; + int i_ChannelNo; + int i_ChannelCount=0; + int i_ScanType; + int i_FirstChannel; + int i_LastChannel; + int i_Sum=0; + int i_Offset; + unsigned int ui_Channel_num=0; static int i_Count=0; - INT i_Initialised=0; - UINT ui_InterruptChannelValue[96]; //Buffer + int i_Initialised=0; + unsigned int ui_InterruptChannelValue[96]; /* Buffer */ */ -str_BoardInfos s_BoardInfos[100]; // 100 will be the max number of boards to be used -//END JK 06.07.04: Management of sevrals boards +struct str_BoardInfos s_BoardInfos[100]; /* 100 will be the max number of boards to be used */ +/* END JK 06.07.04: Management of sevrals boards */ -//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +/* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ /*+----------------------------------------------------------------------------+*/ -/*| Function Name : INT i_AddiHeaderRW_ReadEeprom |*/ -/*| (INT i_NbOfWordsToRead, |*/ -/*| DWORD dw_PCIBoardEepromAddress, |*/ -/*| WORD w_EepromStartAddress, |*/ -/*| PWORD pw_DataRead) |*/ +/*| Function Name : int i_AddiHeaderRW_ReadEeprom |*/ +/*| (int i_NbOfWordsToRead, |*/ +/*| unsigned int dw_PCIBoardEepromAddress, |*/ +/*| unsigned short w_EepromStartAddress, |*/ +/*| unsigned short * pw_DataRead) |*/ /*+----------------------------------------------------------------------------+*/ /*| Task : Read word from the 5920 eeprom. |*/ /*+----------------------------------------------------------------------------+*/ -/*| Input Parameters : INT i_NbOfWordsToRead : Nbr. of word to read |*/ -/*| DWORD dw_PCIBoardEepromAddress : Address of the eeprom |*/ -/*| WORD w_EepromStartAddress : Eeprom strat address |*/ +/*| Input Parameters : int i_NbOfWordsToRead : Nbr. of word to read |*/ +/*| unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/ +/*| unsigned short w_EepromStartAddress : Eeprom strat address |*/ /*+----------------------------------------------------------------------------+*/ -/*| Output Parameters : PWORD pw_DataRead : Read data |*/ +/*| Output Parameters : unsigned short * pw_DataRead : Read data |*/ /*+----------------------------------------------------------------------------+*/ /*| Return Value : - |*/ /*+----------------------------------------------------------------------------+*/ -INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, - DWORD dw_PCIBoardEepromAddress, - WORD w_EepromStartAddress, PWORD pw_DataRead) +int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead, + unsigned int dw_PCIBoardEepromAddress, + unsigned short w_EepromStartAddress, unsigned short *pw_DataRead) { - DWORD dw_eeprom_busy = 0; - INT i_Counter = 0; - INT i_WordCounter; - INT i; - BYTE pb_ReadByte[1]; - BYTE b_ReadLowByte = 0; - BYTE b_ReadHighByte = 0; - BYTE b_SelectedAddressLow = 0; - BYTE b_SelectedAddressHigh = 0; - WORD w_ReadWord = 0; + unsigned int dw_eeprom_busy = 0; + int i_Counter = 0; + int i_WordCounter; + int i; + unsigned char pb_ReadByte[1]; + unsigned char b_ReadLowByte = 0; + unsigned char b_ReadHighByte = 0; + unsigned char b_SelectedAddressLow = 0; + unsigned char b_SelectedAddressHigh = 0; + unsigned short w_ReadWord = 0; for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead; i_WordCounter++) { @@ -132,106 +132,99 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); for (i_Counter = 0; i_Counter < 2; i_Counter++) { - b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; //Read the low 8 bit part - b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; //Read the high 8 bit part + b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; /* Read the low 8 bit part */ + b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; /* Read the high 8 bit part */ - //Select the load low address mode + /* Select the load low address mode */ outb(NVCMD_LOAD_LOW, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Load the low address + /* Load the low address */ outb(b_SelectedAddressLow, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the load high address mode + /* Select the load high address mode */ outb(NVCMD_LOAD_HIGH, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Load the high address + /* Load the high address */ outb(b_SelectedAddressHigh, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the READ mode + /* Select the READ mode */ outb(NVCMD_BEGIN_READ, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Read data into the EEPROM + /* Read data into the EEPROM */ *pb_ReadByte = inb(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR); dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY; - } - while (dw_eeprom_busy == EEPROM_BUSY); + } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the upper address part - if (i_Counter == 0) { + /* Select the upper address part */ + if (i_Counter == 0) b_ReadLowByte = pb_ReadByte[0]; - } else { + else b_ReadHighByte = pb_ReadByte[0]; - } - //Sleep - for (i = 0; i < 10000; i++) ; + + /* Sleep */ + msleep(1); } w_ReadWord = @@ -240,10 +233,10 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, pw_DataRead[i_WordCounter] = w_ReadWord; - w_EepromStartAddress += 2; // to read the next word + w_EepromStartAddress += 2; /* to read the next word */ - } // for (...) i_NbOfWordsToRead - return (0); + } /* for (...) i_NbOfWordsToRead */ + return 0; } /*+----------------------------------------------------------------------------+*/ @@ -258,31 +251,31 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, /*| Return Value : - |*/ /*+----------------------------------------------------------------------------+*/ -void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, - str_BoardInfos * BoardInformations) +void v_GetAPCI3200EepromCalibrationValue(unsigned int dw_PCIBoardEepromAddress, + struct str_BoardInfos *BoardInformations) { - WORD w_AnalogInputMainHeaderAddress; - WORD w_AnalogInputComponentAddress; - WORD w_NumberOfModuls = 0; - WORD w_CurrentSources[2]; - WORD w_ModulCounter = 0; - WORD w_FirstHeaderSize = 0; - WORD w_NumberOfInputs = 0; - WORD w_CJCFlag = 0; - WORD w_NumberOfGainValue = 0; - WORD w_SingleHeaderAddress = 0; - WORD w_SingleHeaderSize = 0; - WORD w_Input = 0; - WORD w_GainFactorAddress = 0; - WORD w_GainFactorValue[2]; - WORD w_GainIndex = 0; - WORD w_GainValue = 0; + unsigned short w_AnalogInputMainHeaderAddress; + unsigned short w_AnalogInputComponentAddress; + unsigned short w_NumberOfModuls = 0; + unsigned short w_CurrentSources[2]; + unsigned short w_ModulCounter = 0; + unsigned short w_FirstHeaderSize = 0; + unsigned short w_NumberOfInputs = 0; + unsigned short w_CJCFlag = 0; + unsigned short w_NumberOfGainValue = 0; + unsigned short w_SingleHeaderAddress = 0; + unsigned short w_SingleHeaderSize = 0; + unsigned short w_Input = 0; + unsigned short w_GainFactorAddress = 0; + unsigned short w_GainFactorValue[2]; + unsigned short w_GainIndex = 0; + unsigned short w_GainValue = 0; /*****************************************/ /** Get the Analog input header address **/ /*****************************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, 0x116, //w_EepromStartAddress: Analog input header address + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, 0x116, /* w_EepromStartAddress: Analog input header address */ &w_AnalogInputMainHeaderAddress); /*******************************************/ @@ -293,8 +286,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /******************************/ /** Get the number of moduls **/ /******************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputMainHeaderAddress + 0x02, //w_EepromStartAddress: Number of conponment + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputMainHeaderAddress + 0x02, /* w_EepromStartAddress: Number of conponment */ &w_NumberOfModuls); for (w_ModulCounter = 0; w_ModulCounter < w_NumberOfModuls; @@ -309,8 +302,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /****************************/ /** Read first header size **/ /****************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress, // Address of the first header + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress, /* Address of the first header */ &w_FirstHeaderSize); w_FirstHeaderSize = w_FirstHeaderSize >> 4; @@ -318,8 +311,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /***************************/ /** Read number of inputs **/ /***************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x06, // Number of inputs for the first modul + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x06, /* Number of inputs for the first modul */ &w_NumberOfInputs); w_NumberOfInputs = w_NumberOfInputs >> 4; @@ -327,17 +320,17 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /***********************/ /** Read the CJC flag **/ /***********************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x08, // CJC flag + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x08, /* CJC flag */ &w_CJCFlag); - w_CJCFlag = (w_CJCFlag >> 3) & 0x1; // Get only the CJC flag + w_CJCFlag = (w_CJCFlag >> 3) & 0x1; /* Get only the CJC flag */ /*******************************/ /** Read number of gain value **/ /*******************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x44, // Number of gain value + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x44, /* Number of gain value */ &w_NumberOfGainValue); w_NumberOfGainValue = w_NumberOfGainValue & 0xFF; @@ -354,8 +347,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /********************************************/ /** Read current sources value for input 1 **/ /********************************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_SingleHeaderAddress, //w_EepromStartAddress: Single header address + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_SingleHeaderAddress, /* w_EepromStartAddress: Single header address */ &w_SingleHeaderSize); w_SingleHeaderSize = w_SingleHeaderSize >> 4; @@ -370,8 +363,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /************************************/ /** Read gain value for the module **/ /************************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 70 + (2 * (1 + (w_NumberOfGainValue / 16))) + (0x02 * w_GainIndex), // Gain value + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 70 + (2 * (1 + (w_NumberOfGainValue / 16))) + (0x02 * w_GainIndex), /* Gain value */ &w_GainValue); BoardInformations->s_Module[w_ModulCounter]. @@ -386,8 +379,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /*************************************/ /** Read gain factor for the module **/ /*************************************/ - i_AddiHeaderRW_ReadEeprom(2, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 70 + ((2 * w_NumberOfGainValue) + (2 * (1 + (w_NumberOfGainValue / 16)))) + (0x04 * w_GainIndex), // Gain factor + i_AddiHeaderRW_ReadEeprom(2, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 70 + ((2 * w_NumberOfGainValue) + (2 * (1 + (w_NumberOfGainValue / 16)))) + (0x04 * w_GainIndex), /* Gain factor */ w_GainFactorValue); BoardInformations->s_Module[w_ModulCounter]. @@ -409,7 +402,7 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /********************************************/ /** Read current sources value for input 1 **/ /********************************************/ - i_AddiHeaderRW_ReadEeprom(2, //i_NbOfWordsToRead + i_AddiHeaderRW_ReadEeprom(2, /* i_NbOfWordsToRead */ dw_PCIBoardEepromAddress, (w_Input * w_SingleHeaderSize) + w_SingleHeaderAddress + 0x0C, w_CurrentSources); @@ -432,7 +425,7 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /***************************************/ /** Read the CJC current source value **/ /***************************************/ - i_AddiHeaderRW_ReadEeprom(2, //i_NbOfWordsToRead + i_AddiHeaderRW_ReadEeprom(2, /* i_NbOfWordsToRead */ dw_PCIBoardEepromAddress, (w_Input * w_SingleHeaderSize) + w_SingleHeaderAddress + 0x0C, w_CurrentSources); @@ -453,9 +446,9 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, } } -INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, - unsigned int ui_Channel_num, unsigned int * CJCCurrentSource, - unsigned int * ChannelCurrentSource, unsigned int * ChannelGainFactor) +int i_APCI3200_GetChannelCalibrationValue(struct comedi_device *dev, + unsigned int ui_Channel_num, unsigned int *CJCCurrentSource, + unsigned int *ChannelCurrentSource, unsigned int *ChannelGainFactor) { int i_DiffChannel = 0; int i_Module = 0; @@ -464,9 +457,9 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, printk("\n Channel = %u", ui_Channel_num); #endif - //Test if single or differential mode + /* Test if single or differential mode */ if (s_BoardInfos[dev->minor].i_ConnectionType == 1) { - //if diff + /* if diff */ if ((ui_Channel_num >= 0) && (ui_Channel_num <= 1)) i_DiffChannel = ui_Channel_num, i_Module = 0; @@ -478,7 +471,7 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, i_DiffChannel = ui_Channel_num - 6, i_Module = 3; } else { - // if single + /* if single */ if ((ui_Channel_num == 0) || (ui_Channel_num == 1)) i_DiffChannel = 0, i_Module = 0; else if ((ui_Channel_num == 2) || (ui_Channel_num == 3)) @@ -497,7 +490,7 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, i_DiffChannel = 1, i_Module = 3; } - //Test if thermocouple or RTD mode + /* Test if thermocouple or RTD mode */ *CJCCurrentSource = s_BoardInfos[dev->minor].s_Module[i_Module].ul_CurrentSourceCJC; #ifdef PRINT_INFO @@ -510,22 +503,22 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, #ifdef PRINT_INFO printk("\n ChannelCurrentSource = %lu", *ChannelCurrentSource); #endif - // } - // } + /* } */ + /* } */ - //Channle gain factor + /* Channle gain factor */ *ChannelGainFactor = s_BoardInfos[dev->minor].s_Module[i_Module]. ul_GainFactor[s_BoardInfos[dev->minor].i_ADDIDATAGain]; #ifdef PRINT_INFO printk("\n ChannelGainFactor = %lu", *ChannelGainFactor); #endif - //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ - return (0); + return 0; } -//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ /* +----------------------------------------------------------------------------+ @@ -536,9 +529,9 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannels : No Of Channels To read for Port + | unsigned int ui_NoOfChannels : No Of Channels To read for Port Channel Numberfor single channel - | UINT data[0] : 0: Read single channel + | unsigned int data[0] : 0: Read single channel 1: Read port value data[1] Port number +----------------------------------------------------------------------------+ @@ -550,24 +543,24 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp = 0; - UINT ui_NoOfChannel = 0; + unsigned int ui_Temp = 0; + unsigned int ui_NoOfChannel = 0; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->i_IobaseReserved); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } //if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { if (data[1] < 0 || data[1] > 1) { printk("\nThe port number is in error\n"); return -EINVAL; - } //if(data[1] < 0 || data[1] >1) + } /* if(data[1] < 0 || data[1] >1) */ switch (ui_NoOfChannel) { case 2: @@ -578,13 +571,13 @@ INT i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev break; default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) - } //if (ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif (ui_Temp==1) + } /* elseif (ui_Temp==1) */ } return insn->n; } @@ -608,21 +601,21 @@ INT i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { if ((data[0] != 0) && (data[0] != 1)) { comedi_error(dev, "Not a valid Data !!! ,Data should be 1 or 0\n"); return -EINVAL; - } //if ( (data[0]!=0) && (data[0]!=1) ) + } /* if ( (data[0]!=0) && (data[0]!=1) ) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0]) + } /* if (data[0]) */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } //else if (data[0]) + } /* else if (data[0]) */ return insn->n; } @@ -653,23 +646,23 @@ int i_APCI3200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp = 0, ui_Temp1 = 0; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp = 0, ui_Temp1 = 0; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inl(devpriv->i_IobaseAddon); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outl(data[0], devpriv->i_IobaseAddon); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -682,15 +675,15 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd case 3: data[0] = (data[0] | ui_Temp); break; - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->i_IobaseAddon); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==0) + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -701,7 +694,7 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = (data[0] << ui_NoOfChannel) ^ 0xf; data[0] = data[0] & ui_Temp; outl(data[0], devpriv->i_IobaseAddon); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -725,21 +718,21 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannels) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->i_IobaseAddon); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==1); + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==1); */ else { printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } //if else data[3]==1) - } //if else data[3]==0) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return insn->n; } @@ -752,8 +745,8 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannels : No Of Channels To read | - | UINT *data : Data Pointer to read status | + | unsigned int ui_NoOfChannels : No Of Channels To read | + | unsigned int *data : Data Pointer to read status | data[0] :0 read single channel 1 read port value data[1] port no @@ -766,23 +759,23 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->i_IobaseAddon); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } // if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { if (data[1] < 0 || data[1] > 1) { printk("\nThe port selection is in error\n"); return -EINVAL; - } //if(data[1] <0 ||data[1] >1) + } /* if(data[1] <0 ||data[1] >1) */ switch (ui_NoOfChannel) { case 2: *data = (*data >> (2 * data[1])) & 3; @@ -793,20 +786,20 @@ INT i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } // switch(ui_NoOfChannels) - } // if (ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // else if (ui_Temp==0) + } /* else if (ui_Temp==1) */ + } /* else if (ui_Temp==0) */ return insn->n; } /* +----------------------------------------------------------------------------+ - | Function Name : INT i_APCI3200_ConfigAnalogInput | + | Function Name : int i_APCI3200_ConfigAnalogInput | | (struct comedi_device *dev,struct comedi_subdevice *s, | | struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ @@ -874,30 +867,30 @@ INT i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ul_Config = 0, ul_Temp = 0; - UINT ui_ChannelNo = 0; - UINT ui_Dummy = 0; - INT i_err = 0; + unsigned int ul_Config = 0, ul_Temp = 0; + unsigned int ui_ChannelNo = 0; + unsigned int ui_Dummy = 0; + int i_err = 0; - //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ #ifdef PRINT_INFO - INT i = 0, i2 = 0; + int i = 0, i2 = 0; #endif - //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ - //BEGIN JK 06.07.04: Management of sevrals boards - // Initialize the structure + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* Initialize the structure */ if (s_BoardInfos[dev->minor].b_StructInitialized != 1) { s_BoardInfos[dev->minor].i_CJCAvailable = 1; s_BoardInfos[dev->minor].i_CJCPolarity = 0; - s_BoardInfos[dev->minor].i_CJCGain = 2; //changed from 0 to 2 + s_BoardInfos[dev->minor].i_CJCGain = 2; /* changed from 0 to 2 */ s_BoardInfos[dev->minor].i_InterruptFlag = 0; - s_BoardInfos[dev->minor].i_AutoCalibration = 0; //: auto calibration + s_BoardInfos[dev->minor].i_AutoCalibration = 0; /* : auto calibration */ s_BoardInfos[dev->minor].i_ChannelCount = 0; s_BoardInfos[dev->minor].i_Sum = 0; s_BoardInfos[dev->minor].ui_Channel_num = 0; @@ -905,11 +898,11 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde s_BoardInfos[dev->minor].i_Initialised = 0; s_BoardInfos[dev->minor].b_StructInitialized = 1; - //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ s_BoardInfos[dev->minor].i_ConnectionType = 0; - //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ - //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ memset(s_BoardInfos[dev->minor].s_Module, 0, sizeof(s_BoardInfos[dev->minor].s_Module[MAX_MODULE])); @@ -938,72 +931,72 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde } } #endif - //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ } if (data[0] != 0 && data[0] != 1 && data[0] != 2) { printk("\nThe selection of acquisition type is in error\n"); i_err++; - } //if(data[0]!=0 && data[0]!=1 && data[0]!=2) + } /* if(data[0]!=0 && data[0]!=1 && data[0]!=2) */ if (data[0] == 1) { if (data[14] != 0 && data[14] != 1 && data[14] != 2 && data[14] != 4) { printk("\n Error in selection of RTD connection type\n"); i_err++; - } //if(data[14]!=0 && data[14]!=1 && data[14]!=2 && data[14]!=4) - } //if(data[0]==1 ) + } /* if(data[14]!=0 && data[14]!=1 && data[14]!=2 && data[14]!=4) */ + } /* if(data[0]==1 ) */ if (data[1] < 0 || data[1] > 7) { printk("\nThe selection of gain is in error\n"); i_err++; - } // if(data[1]<0 || data[1]>7) + } /* if(data[1]<0 || data[1]>7) */ if (data[2] != 0 && data[2] != 1) { printk("\nThe selection of polarity is in error\n"); i_err++; - } //if(data[2]!=0 && data[2]!=1) + } /* if(data[2]!=0 && data[2]!=1) */ if (data[3] != 0) { printk("\nThe selection of offset range is in error\n"); i_err++; - } // if(data[3]!=0) + } /* if(data[3]!=0) */ if (data[4] != 0 && data[4] != 1) { printk("\nThe selection of coupling is in error\n"); i_err++; - } //if(data[4]!=0 && data[4]!=1) + } /* if(data[4]!=0 && data[4]!=1) */ if (data[5] != 0 && data[5] != 1) { printk("\nThe selection of single/differential mode is in error\n"); i_err++; - } //if(data[5]!=0 && data[5]!=1) + } /* if(data[5]!=0 && data[5]!=1) */ if (data[8] != 0 && data[8] != 1 && data[2] != 2) { printk("\nError in selection of functionality\n"); - } //if(data[8]!=0 && data[8]!=1 && data[2]!=2) + } /* if(data[8]!=0 && data[8]!=1 && data[2]!=2) */ if (data[12] == 0 || data[12] == 1) { if (data[6] != 20 && data[6] != 40 && data[6] != 80 && data[6] != 160) { printk("\nThe selection of conversion time reload value is in error\n"); i_err++; - } // if (data[6]!=20 && data[6]!=40 && data[6]!=80 && data[6]!=160 ) + } /* if (data[6]!=20 && data[6]!=40 && data[6]!=80 && data[6]!=160 ) */ if (data[7] != 2) { printk("\nThe selection of conversion time unit is in error\n"); i_err++; - } // if(data[7]!=2) + } /* if(data[7]!=2) */ } if (data[9] != 0 && data[9] != 1) { printk("\nThe selection of interrupt enable is in error\n"); i_err++; - } //if(data[9]!=0 && data[9]!=1) + } /* if(data[9]!=0 && data[9]!=1) */ if (data[11] < 0 || data[11] > 4) { printk("\nThe selection of module is in error\n"); i_err++; - } //if(data[11] <0 || data[11]>1) + } /* if(data[11] <0 || data[11]>1) */ if (data[12] < 0 || data[12] > 3) { printk("\nThe selection of singlechannel/scan selection is in error\n"); i_err++; - } //if(data[12] < 0 || data[12]> 3) + } /* if(data[12] < 0 || data[12]> 3) */ if (data[13] < 0 || data[13] > 16) { printk("\nThe selection of number of channels is in error\n"); i_err++; - } // if(data[13] <0 ||data[13] >15) + } /* if(data[13] <0 ||data[13] >15) */ - //BEGIN JK 06.07.04: Management of sevrals boards + /* BEGIN JK 06.07.04: Management of sevrals boards */ /* i_ChannelCount=data[13]; i_ScanType=data[12]; @@ -1014,7 +1007,7 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde i_ADDIDATAType=data[0]; */ - // Save acquisition configuration for the actual board + /* Save acquisition configuration for the actual board */ s_BoardInfos[dev->minor].i_ChannelCount = data[13]; s_BoardInfos[dev->minor].i_ScanType = data[12]; s_BoardInfos[dev->minor].i_ADDIDATAPolarity = data[2]; @@ -1022,307 +1015,307 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde s_BoardInfos[dev->minor].i_ADDIDATAConversionTime = data[6]; s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit = data[7]; s_BoardInfos[dev->minor].i_ADDIDATAType = data[0]; - //Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + /* Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ s_BoardInfos[dev->minor].i_ConnectionType = data[5]; - //End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - //END JK 06.07.04: Management of sevrals boards + /* End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + /* END JK 06.07.04: Management of sevrals boards */ - //Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - memset(s_BoardInfos[dev->minor].ui_ScanValueArray, 0, (7 + 12) * sizeof(unsigned int)); // 7 is the maximal number of channels - //End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + /* Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + memset(s_BoardInfos[dev->minor].ui_ScanValueArray, 0, (7 + 12) * sizeof(unsigned int)); /* 7 is the maximal number of channels */ + /* End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ - //BEGIN JK 02.07.04 : This while can't be do, it block the process when using severals boards - //while(i_InterruptFlag==1) + /* BEGIN JK 02.07.04 : This while can't be do, it block the process when using severals boards */ + /* while(i_InterruptFlag==1) */ while (s_BoardInfos[dev->minor].i_InterruptFlag == 1) { #ifndef MSXBOX udelay(1); #else - // In the case where the driver is compiled for the MSX-Box - // we used a printk to have a little delay because udelay - // seems to be broken under the MSX-Box. - // This solution hat to be studied. + /* In the case where the driver is compiled for the MSX-Box */ + /* we used a printk to have a little delay because udelay */ + /* seems to be broken under the MSX-Box. */ + /* This solution hat to be studied. */ printk(""); #endif } - //END JK 02.07.04 : This while can't be do, it block the process when using severals boards + /* END JK 02.07.04 : This while can't be do, it block the process when using severals boards */ - ui_ChannelNo = CR_CHAN(insn->chanspec); // get the channel - //BEGIN JK 06.07.04: Management of sevrals boards - //i_ChannelNo=ui_ChannelNo; - //ui_Channel_num =ui_ChannelNo; + ui_ChannelNo = CR_CHAN(insn->chanspec); /* get the channel */ + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_ChannelNo=ui_ChannelNo; */ + /* ui_Channel_num =ui_ChannelNo; */ s_BoardInfos[dev->minor].i_ChannelNo = ui_ChannelNo; s_BoardInfos[dev->minor].ui_Channel_num = ui_ChannelNo; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ if (data[5] == 0) { if (ui_ChannelNo < 0 || ui_ChannelNo > 15) { printk("\nThe Selection of the channel is in error\n"); i_err++; - } // if(ui_ChannelNo<0 || ui_ChannelNo>15) - } //if(data[5]==0) + } /* if(ui_ChannelNo<0 || ui_ChannelNo>15) */ + } /* if(data[5]==0) */ else { if (data[14] == 2) { if (ui_ChannelNo < 0 || ui_ChannelNo > 3) { printk("\nThe Selection of the channel is in error\n"); i_err++; - } // if(ui_ChannelNo<0 || ui_ChannelNo>3) - } //if(data[14]==2) + } /* if(ui_ChannelNo<0 || ui_ChannelNo>3) */ + } /* if(data[14]==2) */ else { if (ui_ChannelNo < 0 || ui_ChannelNo > 7) { printk("\nThe Selection of the channel is in error\n"); i_err++; - } // if(ui_ChannelNo<0 || ui_ChannelNo>7) - } //elseif(data[14]==2) - } //elseif(data[5]==0) + } /* if(ui_ChannelNo<0 || ui_ChannelNo>7) */ + } /* elseif(data[14]==2) */ + } /* elseif(data[5]==0) */ if (data[12] == 0 || data[12] == 1) { switch (data[5]) { case 0: if (ui_ChannelNo >= 0 && ui_ChannelNo <= 3) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=0; */ s_BoardInfos[dev->minor].i_Offset = 0; - //END JK 06.07.04: Management of sevrals boards - } //if(ui_ChannelNo >=0 && ui_ChannelNo <=3) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo >=0 && ui_ChannelNo <=3) */ if (ui_ChannelNo >= 4 && ui_ChannelNo <= 7) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=64; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=64; */ s_BoardInfos[dev->minor].i_Offset = 64; - //END JK 06.07.04: Management of sevrals boards - } //if(ui_ChannelNo >=4 && ui_ChannelNo <=7) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo >=4 && ui_ChannelNo <=7) */ if (ui_ChannelNo >= 8 && ui_ChannelNo <= 11) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=128; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=128; */ s_BoardInfos[dev->minor].i_Offset = 128; - //END JK 06.07.04: Management of sevrals boards - } //if(ui_ChannelNo >=8 && ui_ChannelNo <=11) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo >=8 && ui_ChannelNo <=11) */ if (ui_ChannelNo >= 12 && ui_ChannelNo <= 15) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=192; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=192; */ s_BoardInfos[dev->minor].i_Offset = 192; - //END JK 06.07.04: Management of sevrals boards - } //if(ui_ChannelNo >=12 && ui_ChannelNo <=15) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo >=12 && ui_ChannelNo <=15) */ break; case 1: if (data[14] == 2) { if (ui_ChannelNo == 0) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=0; */ s_BoardInfos[dev->minor].i_Offset = 0; - //END JK 06.07.04: Management of sevrals boards - } //if(ui_ChannelNo ==0 ) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo ==0 ) */ if (ui_ChannelNo == 1) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=0; */ s_BoardInfos[dev->minor].i_Offset = 64; - //END JK 06.07.04: Management of sevrals boards - } // if(ui_ChannelNo ==1) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo ==1) */ if (ui_ChannelNo == 2) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=128; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=128; */ s_BoardInfos[dev->minor].i_Offset = 128; - //END JK 06.07.04: Management of sevrals boards - } //if(ui_ChannelNo ==2 ) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo ==2 ) */ if (ui_ChannelNo == 3) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=192; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=192; */ s_BoardInfos[dev->minor].i_Offset = 192; - //END JK 06.07.04: Management of sevrals boards - } //if(ui_ChannelNo ==3) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo ==3) */ - //BEGIN JK 06.07.04: Management of sevrals boards - //i_ChannelNo=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_ChannelNo=0; */ s_BoardInfos[dev->minor].i_ChannelNo = 0; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ ui_ChannelNo = 0; break; - } //if(data[14]==2) + } /* if(data[14]==2) */ if (ui_ChannelNo >= 0 && ui_ChannelNo <= 1) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=0; */ s_BoardInfos[dev->minor].i_Offset = 0; - //END JK 06.07.04: Management of sevrals boards - } //if(ui_ChannelNo >=0 && ui_ChannelNo <=1) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(ui_ChannelNo >=0 && ui_ChannelNo <=1) */ if (ui_ChannelNo >= 2 && ui_ChannelNo <= 3) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_ChannelNo=i_ChannelNo-2; - //i_Offset=64; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_ChannelNo=i_ChannelNo-2; */ + /* i_Offset=64; */ s_BoardInfos[dev->minor].i_ChannelNo = s_BoardInfos[dev->minor].i_ChannelNo - 2; s_BoardInfos[dev->minor].i_Offset = 64; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ ui_ChannelNo = ui_ChannelNo - 2; - } //if(ui_ChannelNo >=2 && ui_ChannelNo <=3) + } /* if(ui_ChannelNo >=2 && ui_ChannelNo <=3) */ if (ui_ChannelNo >= 4 && ui_ChannelNo <= 5) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_ChannelNo=i_ChannelNo-4; - //i_Offset=128; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_ChannelNo=i_ChannelNo-4; */ + /* i_Offset=128; */ s_BoardInfos[dev->minor].i_ChannelNo = s_BoardInfos[dev->minor].i_ChannelNo - 4; s_BoardInfos[dev->minor].i_Offset = 128; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ ui_ChannelNo = ui_ChannelNo - 4; - } //if(ui_ChannelNo >=4 && ui_ChannelNo <=5) + } /* if(ui_ChannelNo >=4 && ui_ChannelNo <=5) */ if (ui_ChannelNo >= 6 && ui_ChannelNo <= 7) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_ChannelNo=i_ChannelNo-6; - //i_Offset=192; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_ChannelNo=i_ChannelNo-6; */ + /* i_Offset=192; */ s_BoardInfos[dev->minor].i_ChannelNo = s_BoardInfos[dev->minor].i_ChannelNo - 6; s_BoardInfos[dev->minor].i_Offset = 192; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ ui_ChannelNo = ui_ChannelNo - 6; - } //if(ui_ChannelNo >=6 && ui_ChannelNo <=7) + } /* if(ui_ChannelNo >=6 && ui_ChannelNo <=7) */ break; default: printk("\n This selection of polarity does not exist\n"); i_err++; - } //switch(data[2]) - } //if(data[12]==0 || data[12]==1) + } /* switch(data[2]) */ + } /* if(data[12]==0 || data[12]==1) */ else { switch (data[11]) { case 1: - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=0; */ s_BoardInfos[dev->minor].i_Offset = 0; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ break; case 2: - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=64; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=64; */ s_BoardInfos[dev->minor].i_Offset = 64; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ break; case 3: - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=128; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=128; */ s_BoardInfos[dev->minor].i_Offset = 128; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ break; case 4: - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=192; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Offset=192; */ s_BoardInfos[dev->minor].i_Offset = 192; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ break; default: printk("\nError in module selection\n"); i_err++; - } // switch(data[11]) - } // elseif(data[12]==0 || data[12]==1) + } /* switch(data[11]) */ + } /* elseif(data[12]==0 || data[12]==1) */ if (i_err) { i_APCI3200_Reset(dev); return -EINVAL; } - //if(i_ScanType!=1) + /* if(i_ScanType!=1) */ if (s_BoardInfos[dev->minor].i_ScanType != 1) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Count=0; - //i_Sum=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Count=0; */ + /* i_Sum=0; */ s_BoardInfos[dev->minor].i_Count = 0; s_BoardInfos[dev->minor].i_Sum = 0; - //END JK 06.07.04: Management of sevrals boards - } //if(i_ScanType!=1) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(i_ScanType!=1) */ ul_Config = data[1] | (data[2] << 6) | (data[5] << 7) | (data[3] << 8) | (data[4] << 9); - //BEGIN JK 06.07.04: Management of sevrals boards - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ /*********************************/ /* Write the channel to configure */ /*********************************/ - //BEGIN JK 06.07.04: Management of sevrals boards - //outl(0 | ui_ChannelNo , devpriv->iobase+i_Offset + 0x4); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* outl(0 | ui_ChannelNo , devpriv->iobase+i_Offset + 0x4); */ outl(0 | ui_ChannelNo, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x4); - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ - //BEGIN JK 06.07.04: Management of sevrals boards - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ /**************************/ /* Reset the configuration */ /**************************/ - //BEGIN JK 06.07.04: Management of sevrals boards - //outl(0 , devpriv->iobase+i_Offset + 0x0); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* outl(0 , devpriv->iobase+i_Offset + 0x0); */ outl(0, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x0); - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ - //BEGIN JK 06.07.04: Management of sevrals boards - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ /***************************/ /* Write the configuration */ /***************************/ - //BEGIN JK 06.07.04: Management of sevrals boards - //outl(ul_Config , devpriv->iobase+i_Offset + 0x0); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* outl(ul_Config , devpriv->iobase+i_Offset + 0x0); */ outl(ul_Config, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x0); - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ /***************************/ /*Reset the calibration bit */ /***************************/ - //BEGIN JK 06.07.04: Management of sevrals boards - //ul_Temp = inl(devpriv->iobase+i_Offset + 12); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ul_Temp = inl(devpriv->iobase+i_Offset + 12); */ ul_Temp = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ - //BEGIN JK 06.07.04: Management of sevrals boards - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ - //BEGIN JK 06.07.04: Management of sevrals boards - //outl((ul_Temp & 0xFFF9FFFF) , devpriv->iobase+.i_Offset + 12); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* outl((ul_Temp & 0xFFF9FFFF) , devpriv->iobase+.i_Offset + 12); */ outl((ul_Temp & 0xFFF9FFFF), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ if (data[9] == 1) { devpriv->tsk_Current = current; - //BEGIN JK 06.07.04: Management of sevrals boards - //i_InterruptFlag=1; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_InterruptFlag=1; */ s_BoardInfos[dev->minor].i_InterruptFlag = 1; - //END JK 06.07.04: Management of sevrals boards - } // if(data[9]==1) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(data[9]==1) */ else { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_InterruptFlag=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_InterruptFlag=0; */ s_BoardInfos[dev->minor].i_InterruptFlag = 0; - //END JK 06.07.04: Management of sevrals boards - } //else if(data[9]==1) + /* END JK 06.07.04: Management of sevrals boards */ + } /* else if(data[9]==1) */ - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Initialised=1; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Initialised=1; */ s_BoardInfos[dev->minor].i_Initialised = 1; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_ScanType==1) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if(i_ScanType==1) */ if (s_BoardInfos[dev->minor].i_ScanType == 1) - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Sum=i_Sum+1; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* i_Sum=i_Sum+1; */ s_BoardInfos[dev->minor].i_Sum = s_BoardInfos[dev->minor].i_Sum + 1; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ insn->unused[0] = 0; i_APCI3200_ReadAnalogInput(dev, s, insn, &ui_Dummy); @@ -1340,8 +1333,8 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde | Task : Read value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannels : No Of Channels To read | - | UINT *data : Data Pointer to read status | + | unsigned int ui_NoOfChannels : No Of Channels To read | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Digital Value Of Input | @@ -1361,21 +1354,21 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_DummyValue = 0; + unsigned int ui_DummyValue = 0; int i_ConvertCJCCalibration; int i = 0; - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_Initialised==0) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if(i_Initialised==0) */ if (s_BoardInfos[dev->minor].i_Initialised == 0) - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ { i_APCI3200_Reset(dev); return -EINVAL; - } //if(i_Initialised==0); + } /* if(i_Initialised==0); */ #ifdef PRINT_INFO printk("\n insn->unused[0] = %i", insn->unused[0]); @@ -1386,14 +1379,14 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi i_APCI3200_Read1AnalogInputChannel(dev, s, insn, &ui_DummyValue); - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count+0]=ui_DummyValue; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_InterruptChannelValue[i_Count+0]=ui_DummyValue; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos[dev->minor]. i_Count + 0] = ui_DummyValue; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ - //Begin JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* Begin JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ i_APCI3200_GetChannelCalibrationValue(dev, s_BoardInfos[dev->minor].ui_Channel_num, &s_BoardInfos[dev->minor]. @@ -1414,62 +1407,62 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi printk("\n s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+8] = %lu", s_BoardInfos[dev->minor].ui_InterruptChannelValue[s_BoardInfos[dev->minor].i_Count + 8]); #endif - //End JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ - //BEGIN JK 06.07.04: Management of sevrals boards - //if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) */ if ((s_BoardInfos[dev->minor].i_ADDIDATAType == 2) && (s_BoardInfos[dev->minor].i_InterruptFlag == FALSE) && (s_BoardInfos[dev->minor].i_CJCAvailable == 1)) - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ { i_APCI3200_ReadCJCValue(dev, &ui_DummyValue); - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count + 3]=ui_DummyValue; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_InterruptChannelValue[i_Count + 3]=ui_DummyValue; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos[dev-> minor].i_Count + 3] = ui_DummyValue; - //END JK 06.07.04: Management of sevrals boards - } //if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) */ else { - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count + 3]=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_InterruptChannelValue[i_Count + 3]=0; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos[dev-> minor].i_Count + 3] = 0; - //END JK 06.07.04: Management of sevrals boards - } //elseif((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) + /* END JK 06.07.04: Management of sevrals boards */ + } /* elseif((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) */ - //BEGIN JK 06.07.04: Management of sevrals boards - //if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) */ if ((s_BoardInfos[dev->minor].i_AutoCalibration == FALSE) && (s_BoardInfos[dev->minor].i_InterruptFlag == FALSE)) - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ { i_APCI3200_ReadCalibrationOffsetValue(dev, &ui_DummyValue); - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count + 1]=ui_DummyValue; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_InterruptChannelValue[i_Count + 1]=ui_DummyValue; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos[dev-> minor].i_Count + 1] = ui_DummyValue; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ i_APCI3200_ReadCalibrationGainValue(dev, &ui_DummyValue); - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count + 2]=ui_DummyValue; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_InterruptChannelValue[i_Count + 2]=ui_DummyValue; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos[dev-> minor].i_Count + 2] = ui_DummyValue; - //END JK 06.07.04: Management of sevrals boards - } //if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) */ - //BEGIN JK 06.07.04: Management of sevrals boards - //if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)&& (i_CJCAvailable==1)) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)&& (i_CJCAvailable==1)) */ if ((s_BoardInfos[dev->minor].i_ADDIDATAType == 2) && (s_BoardInfos[dev->minor].i_InterruptFlag == FALSE) && (s_BoardInfos[dev->minor].i_CJCAvailable == 1)) - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ { /**********************************************************/ /*Test if the Calibration channel must be read for the CJC */ @@ -1477,52 +1470,52 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi /**********************************/ /*Test if the polarity is the same */ /**********************************/ - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_CJCPolarity!=i_ADDIDATAPolarity) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if(i_CJCPolarity!=i_ADDIDATAPolarity) */ if (s_BoardInfos[dev->minor].i_CJCPolarity != s_BoardInfos[dev->minor].i_ADDIDATAPolarity) - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ { i_ConvertCJCCalibration = 1; - } //if(i_CJCPolarity!=i_ADDIDATAPolarity) + } /* if(i_CJCPolarity!=i_ADDIDATAPolarity) */ else { - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_CJCGain==i_ADDIDATAGain) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if(i_CJCGain==i_ADDIDATAGain) */ if (s_BoardInfos[dev->minor].i_CJCGain == s_BoardInfos[dev->minor].i_ADDIDATAGain) - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ { i_ConvertCJCCalibration = 0; - } //if(i_CJCGain==i_ADDIDATAGain) + } /* if(i_CJCGain==i_ADDIDATAGain) */ else { i_ConvertCJCCalibration = 1; - } //elseif(i_CJCGain==i_ADDIDATAGain) - } //elseif(i_CJCPolarity!=i_ADDIDATAPolarity) + } /* elseif(i_CJCGain==i_ADDIDATAGain) */ + } /* elseif(i_CJCPolarity!=i_ADDIDATAPolarity) */ if (i_ConvertCJCCalibration == 1) { i_APCI3200_ReadCJCCalOffset(dev, &ui_DummyValue); - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count+4]=ui_DummyValue; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_InterruptChannelValue[i_Count+4]=ui_DummyValue; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 4] = ui_DummyValue; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ i_APCI3200_ReadCJCCalGain(dev, &ui_DummyValue); - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count+5]=ui_DummyValue; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_InterruptChannelValue[i_Count+5]=ui_DummyValue; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 5] = ui_DummyValue; - //END JK 06.07.04: Management of sevrals boards - } //if(i_ConvertCJCCalibration==1) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(i_ConvertCJCCalibration==1) */ else { - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count+4]=0; - //ui_InterruptChannelValue[i_Count+5]=0; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_InterruptChannelValue[i_Count+4]=0; */ + /* ui_InterruptChannelValue[i_Count+5]=0; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos @@ -1530,36 +1523,36 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi s_BoardInfos[dev->minor]. ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 5] = 0; - //END JK 06.07.04: Management of sevrals boards - } //elseif(i_ConvertCJCCalibration==1) - } //if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) + /* END JK 06.07.04: Management of sevrals boards */ + } /* elseif(i_ConvertCJCCalibration==1) */ + } /* if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) */ - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_ScanType!=1) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if(i_ScanType!=1) */ if (s_BoardInfos[dev->minor].i_ScanType != 1) { - //i_Count=0; + /* i_Count=0; */ s_BoardInfos[dev->minor].i_Count = 0; - } //if(i_ScanType!=1) + } /* if(i_ScanType!=1) */ else { - //i_Count=i_Count +6; - //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - //s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count +6; + /* i_Count=i_Count +6; */ + /* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + /* s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count +6; */ s_BoardInfos[dev->minor].i_Count = s_BoardInfos[dev->minor].i_Count + 9; - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - } //else if(i_ScanType!=1) + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + } /* else if(i_ScanType!=1) */ - //if((i_ScanType==1) &&(i_InterruptFlag==1)) + /* if((i_ScanType==1) &&(i_InterruptFlag==1)) */ if ((s_BoardInfos[dev->minor].i_ScanType == 1) && (s_BoardInfos[dev->minor].i_InterruptFlag == 1)) { - //i_Count=i_Count-6; - //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - //s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count-6; + /* i_Count=i_Count-6; */ + /* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + /* s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count-6; */ s_BoardInfos[dev->minor].i_Count = s_BoardInfos[dev->minor].i_Count - 9; - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ } - //if(i_ScanType==0) + /* if(i_ScanType==0) */ if (s_BoardInfos[dev->minor].i_ScanType == 0) { /* data[0]= ui_InterruptChannelValue[0]; @@ -1591,41 +1584,41 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi s_BoardInfos[dev->minor]. ui_InterruptChannelValue[5]; - //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - //printk("\n 0 - i_APCI3200_GetChannelCalibrationValue data [6] = %lu, data [7] = %lu, data [8] = %lu", data [6], data [7], data [8]); + /* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + /* printk("\n 0 - i_APCI3200_GetChannelCalibrationValue data [6] = %lu, data [7] = %lu, data [8] = %lu", data [6], data [7], data [8]); */ i_APCI3200_GetChannelCalibrationValue(dev, s_BoardInfos[dev->minor].ui_Channel_num, &data[6], &data[7], &data[8]); - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ } break; case 1: for (i = 0; i < insn->n; i++) { - //data[i]=ui_InterruptChannelValue[i]; + /* data[i]=ui_InterruptChannelValue[i]; */ data[i] = s_BoardInfos[dev->minor]. ui_InterruptChannelValue[i]; } - //i_Count=0; - //i_Sum=0; - //if(i_ScanType==1) + /* i_Count=0; */ + /* i_Sum=0; */ + /* if(i_ScanType==1) */ s_BoardInfos[dev->minor].i_Count = 0; s_BoardInfos[dev->minor].i_Sum = 0; if (s_BoardInfos[dev->minor].i_ScanType == 1) { - //i_Initialised=0; - //i_InterruptFlag=0; + /* i_Initialised=0; */ + /* i_InterruptFlag=0; */ s_BoardInfos[dev->minor].i_Initialised = 0; s_BoardInfos[dev->minor].i_InterruptFlag = 0; - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ } break; default: printk("\nThe parameters passed are in error\n"); i_APCI3200_Reset(dev); return -EINVAL; - } //switch(insn->unused[0]) + } /* switch(insn->unused[0]) */ return insn->n; } @@ -1639,8 +1632,8 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi | Task : Read value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannel : Channel No to read | - | UINT *data : Data Pointer to read status | + | unsigned int ui_NoOfChannel : Channel No to read | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Digital Value read | @@ -1651,49 +1644,49 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - UINT ui_EOC = 0; - UINT ui_ChannelNo = 0; - UINT ui_CommandRegister = 0; + unsigned int ui_EOC = 0; + unsigned int ui_ChannelNo = 0; + unsigned int ui_CommandRegister = 0; - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_ChannelNo=i_ChannelNo; + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* ui_ChannelNo=i_ChannelNo; */ ui_ChannelNo = s_BoardInfos[dev->minor].i_ChannelNo; - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; /*********************************/ /* Write the channel to configure */ /*********************************/ - //Begin JK 20.10.2004: Bad channel value is used when using differential mode - //outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); - //outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); + /* Begin JK 20.10.2004: Bad channel value is used when using differential mode */ + /* outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); */ + /* outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); */ outl(0 | s_BoardInfos[dev->minor].i_ChannelNo, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x4); - //End JK 20.10.2004: Bad channel value is used when using differential mode + /* End JK 20.10.2004: Bad channel value is used when using differential mode */ /*******************************/ /* Set the convert timing unit */ /*******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + /* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36); /**************************/ /* Set the convert timing */ /**************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + /* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32); @@ -1707,36 +1700,36 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, /*Test if the interrupt is enable */ /*********************************/ - //if (i_InterruptFlag == ADDIDATA_ENABLE) + /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) { /************************/ /* Enable the interrupt */ /************************/ ui_CommandRegister = ui_CommandRegister | 0x00100000; - } //if (i_InterruptFlag == ADDIDATA_ENABLE) + } /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ /******************************/ /* Write the command register */ /******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); + /* outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); /*****************************/ /*Test if interrupt is enable */ /*****************************/ - //if (i_InterruptFlag == ADDIDATA_DISABLE) + /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) { do { /*************************/ /*Read the EOC Status bit */ /*************************/ - //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + /* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */ ui_EOC = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 20) & 1; @@ -1746,13 +1739,13 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, /* Read the digital value of the input */ /***************************************/ - //data[0] = inl (devpriv->iobase+i_Offset + 28); + /* data[0] = inl (devpriv->iobase+i_Offset + 28); */ data[0] = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); - //END JK 06.07.04: Management of sevrals boards + /* END JK 06.07.04: Management of sevrals boards */ - } // if (i_InterruptFlag == ADDIDATA_DISABLE) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -1765,7 +1758,7 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, | Task : Read calibration offset value of the selected channel| +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT *data : Data Pointer to read status | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Calibration offset Value | @@ -1776,54 +1769,54 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * data) +int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data) { - UINT ui_Temp = 0, ui_EOC = 0; - UINT ui_CommandRegister = 0; + unsigned int ui_Temp = 0, ui_EOC = 0; + unsigned int ui_CommandRegister = 0; - //BEGIN JK 06.07.04: Management of sevrals boards - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; /*********************************/ /* Write the channel to configure */ /*********************************/ - //Begin JK 20.10.2004: This seems not necessary ! - //outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); - //outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); - //End JK 20.10.2004: This seems not necessary ! + /* Begin JK 20.10.2004: This seems not necessary ! */ + /* outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); */ + /* outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); */ + /* End JK 20.10.2004: This seems not necessary ! */ /*******************************/ /* Set the convert timing unit */ /*******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + /* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36); /**************************/ /* Set the convert timing */ /**************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + /* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32); /*****************************/ /*Read the calibration offset */ /*****************************/ - //ui_Temp = inl(devpriv->iobase+i_Offset + 12); + /* ui_Temp = inl(devpriv->iobase+i_Offset + 12); */ ui_Temp = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); /*********************************/ /*Configure the Offset Conversion */ /*********************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl((ui_Temp | 0x00020000), devpriv->iobase+i_Offset + 12); + /* outl((ui_Temp | 0x00020000), devpriv->iobase+i_Offset + 12); */ outl((ui_Temp | 0x00020000), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); /*******************************/ @@ -1836,7 +1829,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /*Test if the interrupt is enable */ /*********************************/ - //if (i_InterruptFlag == ADDIDATA_ENABLE) + /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) { /**********************/ @@ -1845,7 +1838,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat ui_CommandRegister = ui_CommandRegister | 0x00100000; - } //if (i_InterruptFlag == ADDIDATA_ENABLE) + } /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ /**********************/ /*Start the conversion */ @@ -1855,10 +1848,10 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); + /* outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); @@ -1866,7 +1859,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /*Test if interrupt is enable */ /*****************************/ - //if (i_InterruptFlag == ADDIDATA_DISABLE) + /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) { do { @@ -1874,7 +1867,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /*Read the EOC flag */ /*******************/ - //ui_EOC = inl (devpriv->iobase+i_Offset + 20) & 1; + /* ui_EOC = inl (devpriv->iobase+i_Offset + 20) & 1; */ ui_EOC = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 20) & 1; @@ -1884,11 +1877,11 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /*Read the digital value of the calibration Offset */ /**************************************************/ - //data[0] = inl(devpriv->iobase+i_Offset+ 28); + /* data[0] = inl(devpriv->iobase+i_Offset+ 28); */ data[0] = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); - } //if (i_InterruptFlag == ADDIDATA_DISABLE) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -1901,7 +1894,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat | Task : Read calibration gain value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT *data : Data Pointer to read status | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Calibration gain Value Of Input | @@ -1912,21 +1905,21 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) +int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data) { - UINT ui_EOC = 0; - INT ui_CommandRegister = 0; + unsigned int ui_EOC = 0; + int ui_CommandRegister = 0; - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; /*********************************/ /* Write the channel to configure */ /*********************************/ - //Begin JK 20.10.2004: This seems not necessary ! - //outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); - //outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); - //End JK 20.10.2004: This seems not necessary ! + /* Begin JK 20.10.2004: This seems not necessary ! */ + /* outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); */ + /* outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); */ + /* End JK 20.10.2004: This seems not necessary ! */ /***************************/ /*Read the calibration gain */ @@ -1934,28 +1927,28 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*******************************/ /* Set the convert timing unit */ /*******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + /* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36); /**************************/ /* Set the convert timing */ /**************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + /* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32); /*******************************/ /*Configure the Gain Conversion */ /*******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(0x00040000 , devpriv->iobase+i_Offset + 12); + /* outl(0x00040000 , devpriv->iobase+i_Offset + 12); */ outl(0x00040000, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); @@ -1969,7 +1962,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*Test if the interrupt is enable */ /*********************************/ - //if (i_InterruptFlag == ADDIDATA_ENABLE) + /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) { /**********************/ @@ -1978,7 +1971,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) ui_CommandRegister = ui_CommandRegister | 0x00100000; - } //if (i_InterruptFlag == ADDIDATA_ENABLE) + } /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ /**********************/ /*Start the conversion */ @@ -1988,10 +1981,10 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); + /* outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); @@ -1999,7 +1992,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*Test if interrupt is enable */ /*****************************/ - //if (i_InterruptFlag == ADDIDATA_DISABLE) + /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) { do { @@ -2008,7 +2001,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*Read the EOC flag */ /*******************/ - //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + /* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */ ui_EOC = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 20) & 1; @@ -2018,12 +2011,12 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*Read the digital value of the calibration Gain */ /************************************************/ - //data[0] = inl(devpriv->iobase+i_Offset + 28); + /* data[0] = inl(devpriv->iobase+i_Offset + 28); */ data[0] = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); - } //if (i_InterruptFlag == ADDIDATA_DISABLE) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -2036,7 +2029,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) | Task : Read CJC value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT *data : Data Pointer to read status | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : CJC Value | @@ -2048,41 +2041,41 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) +----------------------------------------------------------------------------+ */ -int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) +int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data) { - UINT ui_EOC = 0; - INT ui_CommandRegister = 0; + unsigned int ui_EOC = 0; + int ui_CommandRegister = 0; /******************************/ /*Set the converting time unit */ /******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + /* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36); /**************************/ /* Set the convert timing */ /**************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + /* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32); /******************************/ /*Configure the CJC Conversion */ /******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl( 0x00000400 , devpriv->iobase+i_Offset + 4); + /* outl( 0x00000400 , devpriv->iobase+i_Offset + 4); */ outl(0x00000400, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); /*******************************/ @@ -2092,7 +2085,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /*********************************/ /*Test if the interrupt is enable */ /*********************************/ - //if (i_InterruptFlag == ADDIDATA_ENABLE) + /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) { /**********************/ /*Enable the interrupt */ @@ -2109,10 +2102,10 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); + /* outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); @@ -2120,7 +2113,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /*Test if interrupt is enable */ /*****************************/ - //if (i_InterruptFlag == ADDIDATA_DISABLE) + /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) { do { @@ -2128,7 +2121,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /*Read the EOC flag */ /*******************/ - //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + /* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */ ui_EOC = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 20) & 1; @@ -2138,12 +2131,12 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /*Read the digital value of the CJC */ /***********************************/ - //data[0] = inl(devpriv->iobase+i_Offset + 28); + /* data[0] = inl(devpriv->iobase+i_Offset + 28); */ data[0] = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); - } //if (i_InterruptFlag == ADDIDATA_DISABLE) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -2156,7 +2149,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) | Task : Read CJC calibration offset value of the selected channel +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT *data : Data Pointer to read status | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : CJC calibration offset Value @@ -2167,47 +2160,47 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) +int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data) { - UINT ui_EOC = 0; - INT ui_CommandRegister = 0; + unsigned int ui_EOC = 0; + int ui_CommandRegister = 0; /*******************************************/ /*Read calibration offset value for the CJC */ /*******************************************/ /*******************************/ /* Set the convert timing unit */ /*******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + /* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36); /**************************/ /* Set the convert timing */ /**************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + /* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32); /******************************/ /*Configure the CJC Conversion */ /******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(0x00000400 , devpriv->iobase+i_Offset + 4); + /* outl(0x00000400 , devpriv->iobase+i_Offset + 4); */ outl(0x00000400, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); /*********************************/ /*Configure the Offset Conversion */ /*********************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(0x00020000, devpriv->iobase+i_Offset + 12); + /* outl(0x00020000, devpriv->iobase+i_Offset + 12); */ outl(0x00020000, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); /*******************************/ @@ -2218,7 +2211,7 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) /*Test if the interrupt is enable */ /*********************************/ - //if (i_InterruptFlag == ADDIDATA_ENABLE) + /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) { /**********************/ /*Enable the interrupt */ @@ -2234,19 +2227,19 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_CommandRegister,devpriv->iobase+i_Offset + 8); + /* outl(ui_CommandRegister,devpriv->iobase+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); - //if (i_InterruptFlag == ADDIDATA_DISABLE) + /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) { do { /*******************/ /*Read the EOC flag */ /*******************/ - //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + /* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */ ui_EOC = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 20) & 1; } while (ui_EOC != 1); @@ -2254,11 +2247,11 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) /**************************************************/ /*Read the digital value of the calibration Offset */ /**************************************************/ - //data[0] = inl(devpriv->iobase+i_Offset + 28); + /* data[0] = inl(devpriv->iobase+i_Offset + 28); */ data[0] = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); - } //if (i_InterruptFlag == ADDIDATA_DISABLE) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -2271,8 +2264,8 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) | Task : Read CJC calibration gain value +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannels : No Of Channels To read | - | UINT *data : Data Pointer to read status | + | unsigned int ui_NoOfChannels : No Of Channels To read | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : CJC calibration gain value @@ -2283,44 +2276,44 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data) +int i_APCI3200_ReadCJCCalGain(struct comedi_device *dev, unsigned int *data) { - UINT ui_EOC = 0; - INT ui_CommandRegister = 0; + unsigned int ui_EOC = 0; + int ui_CommandRegister = 0; /*******************************/ /* Set the convert timing unit */ /*******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + /* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36); /**************************/ /* Set the convert timing */ /**************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + /* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32); /******************************/ /*Configure the CJC Conversion */ /******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(0x00000400,devpriv->iobase+i_Offset + 4); + /* outl(0x00000400,devpriv->iobase+i_Offset + 4); */ outl(0x00000400, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); /*******************************/ /*Configure the Gain Conversion */ /*******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(0x00040000,devpriv->iobase+i_Offset + 12); + /* outl(0x00040000,devpriv->iobase+i_Offset + 12); */ outl(0x00040000, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); @@ -2331,7 +2324,7 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data) /*********************************/ /*Test if the interrupt is enable */ /*********************************/ - //if (i_InterruptFlag == ADDIDATA_ENABLE) + /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) { /**********************/ /*Enable the interrupt */ @@ -2345,30 +2338,30 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data) /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_CommandRegister ,devpriv->iobase+i_Offset + 8); + /* outl(ui_CommandRegister ,devpriv->iobase+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); - //if (i_InterruptFlag == ADDIDATA_DISABLE) + /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) { do { /*******************/ /*Read the EOC flag */ /*******************/ - //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + /* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */ ui_EOC = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 20) & 1; } while (ui_EOC != 1); /************************************************/ /*Read the digital value of the calibration Gain */ /************************************************/ - //data[0] = inl (devpriv->iobase+i_Offset + 28); + /* data[0] = inl (devpriv->iobase+i_Offset + 28); */ data[0] = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); - } //if (i_InterruptFlag == ADDIDATA_DISABLE) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -2404,33 +2397,33 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data) +----------------------------------------------------------------------------+ */ -INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - UINT ui_Configuration = 0; - INT i_Temp; //,i_TimeUnit; - //if(i_Initialised==0) + unsigned int ui_Configuration = 0; + int i_Temp; /* ,i_TimeUnit; */ + /* if(i_Initialised==0) */ if (s_BoardInfos[dev->minor].i_Initialised == 0) { i_APCI3200_Reset(dev); return -EINVAL; - } //if(i_Initialised==0); + } /* if(i_Initialised==0); */ if (data[0] != 0 && data[0] != 1) { printk("\nError in selection of functionality\n"); i_APCI3200_Reset(dev); return -EINVAL; - } //if(data[0]!=0 && data[0]!=1) + } /* if(data[0]!=0 && data[0]!=1) */ - if (data[0] == 1) //Perform Short Circuit TEST + if (data[0] == 1) /* Perform Short Circuit TEST */ { /**************************/ /*Set the short-cicuit bit */ /**************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor]. i_Offset + 12) >> 19) & 1) != 1) ; - //outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); + /* outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); */ outl((0x00001000 | s_BoardInfos[dev->minor].i_ChannelNo), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); @@ -2439,19 +2432,19 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, /*************************/ /* i_TimeUnit= i_ADDIDATAConversionTimeUnit; i_ADDIDATAConversionTimeUnit= 1; */ - //i_Temp= i_InterruptFlag ; + /* i_Temp= i_InterruptFlag ; */ i_Temp = s_BoardInfos[dev->minor].i_InterruptFlag; - //i_InterruptFlag = ADDIDATA_DISABLE; + /* i_InterruptFlag = ADDIDATA_DISABLE; */ s_BoardInfos[dev->minor].i_InterruptFlag = ADDIDATA_DISABLE; i_APCI3200_Read1AnalogInputChannel(dev, s, insn, data); - //if(i_AutoCalibration == FALSE) + /* if(i_AutoCalibration == FALSE) */ if (s_BoardInfos[dev->minor].i_AutoCalibration == FALSE) { - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor]. i_Offset + 12) >> 19) & 1) != 1) ; - //outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); + /* outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); */ outl((0x00001000 | s_BoardInfos[dev->minor]. i_ChannelNo), devpriv->iobase + @@ -2462,15 +2455,15 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, i_APCI3200_ReadCalibrationGainValue(dev, data); } } else { - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor]. i_Offset + 12) >> 19) & 1) != 1) ; - //outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); + /* outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); */ outl((0x00000800 | s_BoardInfos[dev->minor].i_ChannelNo), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); - //ui_Configuration = inl(devpriv->iobase+i_Offset + 0); + /* ui_Configuration = inl(devpriv->iobase+i_Offset + 0); */ ui_Configuration = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0); @@ -2479,18 +2472,18 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, /*************************/ /* i_TimeUnit= i_ADDIDATAConversionTimeUnit; i_ADDIDATAConversionTimeUnit= 1; */ - //i_Temp= i_InterruptFlag ; + /* i_Temp= i_InterruptFlag ; */ i_Temp = s_BoardInfos[dev->minor].i_InterruptFlag; - //i_InterruptFlag = ADDIDATA_DISABLE; + /* i_InterruptFlag = ADDIDATA_DISABLE; */ s_BoardInfos[dev->minor].i_InterruptFlag = ADDIDATA_DISABLE; i_APCI3200_Read1AnalogInputChannel(dev, s, insn, data); - //if(i_AutoCalibration == FALSE) + /* if(i_AutoCalibration == FALSE) */ if (s_BoardInfos[dev->minor].i_AutoCalibration == FALSE) { - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor]. i_Offset + 12) >> 19) & 1) != 1) ; - //outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); + /* outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); */ outl((0x00000800 | s_BoardInfos[dev->minor]. i_ChannelNo), devpriv->iobase + @@ -2501,9 +2494,9 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, i_APCI3200_ReadCalibrationGainValue(dev, data); } } - //i_InterruptFlag=i_Temp ; + /* i_InterruptFlag=i_Temp ; */ s_BoardInfos[dev->minor].i_InterruptFlag = i_Temp; - //printk("\ni_InterruptFlag=%d\n",i_InterruptFlag); + /* printk("\ni_InterruptFlag=%d\n",i_InterruptFlag); */ return insn->n; } @@ -2529,8 +2522,8 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { i_APCI3200_Reset(dev); return insn->n; @@ -2560,23 +2553,23 @@ INT i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_cmd * cmd) +int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_cmd *cmd) { int err = 0; - int tmp; // divisor1,divisor2; - UINT ui_ConvertTime = 0; - UINT ui_ConvertTimeBase = 0; - UINT ui_DelayTime = 0; - UINT ui_DelayTimeBase = 0; - INT i_Triggermode = 0; - INT i_TriggerEdge = 0; - INT i_NbrOfChannel = 0; - INT i_Cpt = 0; + int tmp; /* divisor1,divisor2; */ + unsigned int ui_ConvertTime = 0; + unsigned int ui_ConvertTimeBase = 0; + unsigned int ui_DelayTime = 0; + unsigned int ui_DelayTimeBase = 0; + int i_Triggermode = 0; + int i_TriggerEdge = 0; + int i_NbrOfChannel = 0; + int i_Cpt = 0; double d_ConversionTimeForAllChannels = 0.0; double d_SCANTimeNewUnit = 0.0; - // step 1: make sure trigger sources are trivially valid + /* step 1: make sure trigger sources are trivially valid */ tmp = cmd->start_src; cmd->start_src &= TRIG_NOW | TRIG_EXT; @@ -2598,10 +2591,10 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ cmd->stop_src &= TRIG_COUNT | TRIG_NONE; if (!cmd->stop_src || tmp != cmd->stop_src) err++; - //if(i_InterruptFlag==0) + /* if(i_InterruptFlag==0) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == 0) { err++; - // printk("\nThe interrupt should be enabled\n"); + /* printk("\nThe interrupt should be enabled\n"); */ } if (err) { i_APCI3200_Reset(dev); @@ -2643,9 +2636,9 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ i_APCI3200_Reset(dev); return 2; } - //i_FirstChannel=cmd->chanlist[0]; + /* i_FirstChannel=cmd->chanlist[0]; */ s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0]; - //i_LastChannel=cmd->chanlist[1]; + /* i_LastChannel=cmd->chanlist[1]; */ s_BoardInfos[dev->minor].i_LastChannel = cmd->chanlist[1]; if (cmd->convert_src == TRIG_TIMER) { @@ -2656,11 +2649,11 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ { printk("\nThe selection of conversion time reload value is in error\n"); err++; - } // if (ui_ConvertTime!=20 && ui_ConvertTime!=40 && ui_ConvertTime!=80 && ui_ConvertTime!=160 ) + } /* if (ui_ConvertTime!=20 && ui_ConvertTime!=40 && ui_ConvertTime!=80 && ui_ConvertTime!=160 ) */ if (ui_ConvertTimeBase != 2) { printk("\nThe selection of conversion time unit is in error\n"); err++; - } //if(ui_ConvertTimeBase!=2) + } /* if(ui_ConvertTimeBase!=2) */ } else { ui_ConvertTime = 0; ui_ConvertTimeBase = 0; @@ -2668,7 +2661,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ if (cmd->scan_begin_src == TRIG_FOLLOW) { ui_DelayTime = 0; ui_DelayTimeBase = 0; - } //if(cmd->scan_begin_src==TRIG_FOLLOW) + } /* if(cmd->scan_begin_src==TRIG_FOLLOW) */ else { ui_DelayTime = cmd->scan_begin_arg & 0xFFFF; ui_DelayTimeBase = cmd->scan_begin_arg >> 16; @@ -2686,7 +2679,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ } fpu_begin(); d_SCANTimeNewUnit = (double)ui_DelayTime; - //i_NbrOfChannel= i_LastChannel-i_FirstChannel + 4; + /* i_NbrOfChannel= i_LastChannel-i_FirstChannel + 4; */ i_NbrOfChannel = s_BoardInfos[dev->minor].i_LastChannel - s_BoardInfos[dev->minor].i_FirstChannel + 4; @@ -2736,7 +2729,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ err++; } fpu_end(); - } //else if(cmd->scan_begin_src==TRIG_FOLLOW) + } /* else if(cmd->scan_begin_src==TRIG_FOLLOW) */ if (err) { i_APCI3200_Reset(dev); @@ -2764,13 +2757,13 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ +----------------------------------------------------------------------------+ */ -int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_subdevice * s) +int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s) { - UINT ui_Configuration = 0; - //i_InterruptFlag=0; - //i_Initialised=0; - //i_Count=0; - //i_Sum=0; + unsigned int ui_Configuration = 0; + /* i_InterruptFlag=0; */ + /* i_Initialised=0; */ + /* i_Count=0; */ + /* i_Sum=0; */ s_BoardInfos[dev->minor].i_InterruptFlag = 0; s_BoardInfos[dev->minor].i_Initialised = 0; s_BoardInfos[dev->minor].i_Count = 0; @@ -2779,16 +2772,16 @@ int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_s /*******************/ /*Read the register */ /*******************/ - //ui_Configuration = inl(devpriv->iobase+i_Offset + 8); + /* ui_Configuration = inl(devpriv->iobase+i_Offset + 8); */ ui_Configuration = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); /*****************************/ /*Reset the START and IRQ bit */ /*****************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl((ui_Configuration & 0xFFE7FFFF),devpriv->iobase+i_Offset + 8); + /* outl((ui_Configuration & 0xFFE7FFFF),devpriv->iobase+i_Offset + 8); */ outl((ui_Configuration & 0xFFE7FFFF), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); return 0; @@ -2814,52 +2807,52 @@ int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_s +----------------------------------------------------------------------------+ */ -int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s) +int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; - UINT ui_Configuration = 0; - //INT i_CurrentSource = 0; - UINT ui_Trigger = 0; - UINT ui_TriggerEdge = 0; - UINT ui_Triggermode = 0; - UINT ui_ScanMode = 0; - UINT ui_ConvertTime = 0; - UINT ui_ConvertTimeBase = 0; - UINT ui_DelayTime = 0; - UINT ui_DelayTimeBase = 0; - UINT ui_DelayMode = 0; - //i_FirstChannel=cmd->chanlist[0]; - //i_LastChannel=cmd->chanlist[1]; + unsigned int ui_Configuration = 0; + /* INT i_CurrentSource = 0; */ + unsigned int ui_Trigger = 0; + unsigned int ui_TriggerEdge = 0; + unsigned int ui_Triggermode = 0; + unsigned int ui_ScanMode = 0; + unsigned int ui_ConvertTime = 0; + unsigned int ui_ConvertTimeBase = 0; + unsigned int ui_DelayTime = 0; + unsigned int ui_DelayTimeBase = 0; + unsigned int ui_DelayMode = 0; + /* i_FirstChannel=cmd->chanlist[0]; */ + /* i_LastChannel=cmd->chanlist[1]; */ s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0]; s_BoardInfos[dev->minor].i_LastChannel = cmd->chanlist[1]; if (cmd->start_src == TRIG_EXT) { ui_Trigger = 1; ui_TriggerEdge = cmd->start_arg & 0xFFFF; ui_Triggermode = cmd->start_arg >> 16; - } //if(cmd->start_src==TRIG_EXT) + } /* if(cmd->start_src==TRIG_EXT) */ else { ui_Trigger = 0; - } //elseif(cmd->start_src==TRIG_EXT) + } /* elseif(cmd->start_src==TRIG_EXT) */ if (cmd->stop_src == TRIG_COUNT) { ui_ScanMode = 0; - } // if (cmd->stop_src==TRIG_COUNT) + } /* if (cmd->stop_src==TRIG_COUNT) */ else { ui_ScanMode = 2; - } //else if (cmd->stop_src==TRIG_COUNT) + } /* else if (cmd->stop_src==TRIG_COUNT) */ if (cmd->scan_begin_src == TRIG_FOLLOW) { ui_DelayTime = 0; ui_DelayTimeBase = 0; ui_DelayMode = 0; - } //if(cmd->scan_begin_src==TRIG_FOLLOW) + } /* if(cmd->scan_begin_src==TRIG_FOLLOW) */ else { ui_DelayTime = cmd->scan_begin_arg & 0xFFFF; ui_DelayTimeBase = cmd->scan_begin_arg >> 16; ui_DelayMode = 1; - } //else if(cmd->scan_begin_src==TRIG_FOLLOW) - // printk("\nui_DelayTime=%u\n",ui_DelayTime); - // printk("\nui_DelayTimeBase=%u\n",ui_DelayTimeBase); + } /* else if(cmd->scan_begin_src==TRIG_FOLLOW) */ + /* printk("\nui_DelayTime=%u\n",ui_DelayTime); */ + /* printk("\nui_DelayTimeBase=%u\n",ui_DelayTimeBase); */ if (cmd->convert_src == TRIG_TIMER) { ui_ConvertTime = cmd->convert_arg & 0xFFFF; ui_ConvertTimeBase = cmd->convert_arg >> 16; @@ -2868,34 +2861,34 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd ui_ConvertTimeBase = 0; } - // if(i_ADDIDATAType ==1 || ((i_ADDIDATAType==2))) - // { + /* if(i_ADDIDATAType ==1 || ((i_ADDIDATAType==2))) */ + /* { */ /**************************************************/ /*Read the old configuration of the current source */ /**************************************************/ - //ui_Configuration = inl(devpriv->iobase+i_Offset + 12); + /* ui_Configuration = inl(devpriv->iobase+i_Offset + 12); */ ui_Configuration = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); /***********************************************/ /*Write the configuration of the current source */ /***********************************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl((ui_Configuration & 0xFFC00000 ), devpriv->iobase+i_Offset +12); + /* outl((ui_Configuration & 0xFFC00000 ), devpriv->iobase+i_Offset +12); */ outl((ui_Configuration & 0xFFC00000), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); - // } + /* } */ ui_Configuration = 0; - // printk("\nfirstchannel=%u\n",i_FirstChannel); - // printk("\nlastchannel=%u\n",i_LastChannel); - // printk("\nui_Trigger=%u\n",ui_Trigger); - // printk("\nui_TriggerEdge=%u\n",ui_TriggerEdge); - // printk("\nui_Triggermode=%u\n",ui_Triggermode); - // printk("\nui_DelayMode=%u\n",ui_DelayMode); - // printk("\nui_ScanMode=%u\n",ui_ScanMode); - - //ui_Configuration = i_FirstChannel |(i_LastChannel << 8)| 0x00100000 | + /* printk("\nfirstchannel=%u\n",i_FirstChannel); */ + /* printk("\nlastchannel=%u\n",i_LastChannel); */ + /* printk("\nui_Trigger=%u\n",ui_Trigger); */ + /* printk("\nui_TriggerEdge=%u\n",ui_TriggerEdge); */ + /* printk("\nui_Triggermode=%u\n",ui_Triggermode); */ + /* printk("\nui_DelayMode=%u\n",ui_DelayMode); */ + /* printk("\nui_ScanMode=%u\n",ui_ScanMode); */ + + /* ui_Configuration = i_FirstChannel |(i_LastChannel << 8)| 0x00100000 | */ ui_Configuration = s_BoardInfos[dev->minor].i_FirstChannel | (s_BoardInfos[dev-> minor]. @@ -2906,80 +2899,80 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd /*************************/ /*Write the Configuration */ /*************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl( ui_Configuration, devpriv->iobase+i_Offset + 0x8); + /* outl( ui_Configuration, devpriv->iobase+i_Offset + 0x8); */ outl(ui_Configuration, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x8); /***********************/ /*Write the Delay Value */ /***********************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_DelayTime,devpriv->iobase+i_Offset + 40); + /* outl(ui_DelayTime,devpriv->iobase+i_Offset + 40); */ outl(ui_DelayTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 40); /***************************/ /*Write the Delay time base */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_DelayTimeBase,devpriv->iobase+i_Offset + 44); + /* outl(ui_DelayTimeBase,devpriv->iobase+i_Offset + 44); */ outl(ui_DelayTimeBase, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 44); /*********************************/ /*Write the conversion time value */ /*********************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_ConvertTime,devpriv->iobase+i_Offset + 32); + /* outl(ui_ConvertTime,devpriv->iobase+i_Offset + 32); */ outl(ui_ConvertTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32); /********************************/ /*Write the conversion time base */ /********************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(ui_ConvertTimeBase,devpriv->iobase+i_Offset + 36); + /* outl(ui_ConvertTimeBase,devpriv->iobase+i_Offset + 36); */ outl(ui_ConvertTimeBase, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36); /*******************/ /*Read the register */ /*******************/ - //ui_Configuration = inl(devpriv->iobase+i_Offset + 4); + /* ui_Configuration = inl(devpriv->iobase+i_Offset + 4); */ ui_Configuration = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); /******************/ /*Set the SCAN bit */ /******************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl(((ui_Configuration & 0x1E0FF) | 0x00002000),devpriv->iobase+i_Offset + 4); + /* outl(((ui_Configuration & 0x1E0FF) | 0x00002000),devpriv->iobase+i_Offset + 4); */ outl(((ui_Configuration & 0x1E0FF) | 0x00002000), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); /*******************/ /*Read the register */ /*******************/ ui_Configuration = 0; - //ui_Configuration = inl(devpriv->iobase+i_Offset + 8); + /* ui_Configuration = inl(devpriv->iobase+i_Offset + 8); */ ui_Configuration = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); /*******************/ /*Set the START bit */ /*******************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */ while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12) >> 19) & 1) != 1) ; - //outl((ui_Configuration | 0x00080000),devpriv->iobase+i_Offset + 8); + /* outl((ui_Configuration | 0x00080000),devpriv->iobase+i_Offset + 8); */ outl((ui_Configuration | 0x00080000), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); return 0; @@ -3001,14 +2994,14 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -int i_APCI3200_Reset(struct comedi_device * dev) +int i_APCI3200_Reset(struct comedi_device *dev) { - INT i_Temp; - DWORD dw_Dummy; - //i_InterruptFlag=0; - //i_Initialised==0; - //i_Count=0; - //i_Sum=0; + int i_Temp; + unsigned int dw_Dummy; + /* i_InterruptFlag=0; */ + /* i_Initialised==0; */ + /* i_Count=0; */ + /* i_Sum=0; */ s_BoardInfos[dev->minor].i_InterruptFlag = 0; s_BoardInfos[dev->minor].i_Initialised = 0; @@ -3018,17 +3011,17 @@ int i_APCI3200_Reset(struct comedi_device * dev) outl(0x83838383, devpriv->i_IobaseAmcc + 0x60); - // Enable the interrupt for the controler + /* Enable the interrupt for the controler */ dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38); outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38); - outl(0, devpriv->i_IobaseAddon); //Resets the output + outl(0, devpriv->i_IobaseAddon); /* Resets the output */ /***************/ /*Empty the buffer */ /**************/ for (i_Temp = 0; i_Temp <= 95; i_Temp++) { - //ui_InterruptChannelValue[i_Temp]=0; + /* ui_InterruptChannelValue[i_Temp]=0; */ s_BoardInfos[dev->minor].ui_InterruptChannelValue[i_Temp] = 0; - } //for(i_Temp=0;i_Temp<=95;i_Temp++) + } /* for(i_Temp=0;i_Temp<=95;i_Temp++) */ /*****************************/ /*Reset the START and IRQ bit */ /*****************************/ @@ -3036,7 +3029,7 @@ int i_APCI3200_Reset(struct comedi_device * dev) while (((inl(devpriv->iobase + i_Temp + 12) >> 19) & 1) != 1) ; outl(0, devpriv->iobase + i_Temp + 8); i_Temp = i_Temp + 64; - } //for(i_Temp=0;i_Temp<=192;i_Temp+64) + } /* for(i_Temp=0;i_Temp<=192;i_Temp+64) */ return 0; } @@ -3060,26 +3053,26 @@ int i_APCI3200_Reset(struct comedi_device * dev) void v_APCI3200_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - UINT ui_StatusRegister = 0; - UINT ui_ChannelNumber = 0; - INT i_CalibrationFlag = 0; - INT i_CJCFlag = 0; - UINT ui_DummyValue = 0; - UINT ui_DigitalTemperature = 0; - UINT ui_DigitalInput = 0; + unsigned int ui_StatusRegister = 0; + unsigned int ui_ChannelNumber = 0; + int i_CalibrationFlag = 0; + int i_CJCFlag = 0; + unsigned int ui_DummyValue = 0; + unsigned int ui_DigitalTemperature = 0; + unsigned int ui_DigitalInput = 0; int i_ConvertCJCCalibration; - //BEGIN JK TEST + /* BEGIN JK TEST */ int i_ReturnValue = 0; - //END JK TEST + /* END JK TEST */ - //printk ("\n i_ScanType = %i i_ADDIDATAType = %i", s_BoardInfos [dev->minor].i_ScanType, s_BoardInfos [dev->minor].i_ADDIDATAType); + /* printk ("\n i_ScanType = %i i_ADDIDATAType = %i", s_BoardInfos [dev->minor].i_ScanType, s_BoardInfos [dev->minor].i_ADDIDATAType); */ - //switch(i_ScanType) + /* switch(i_ScanType) */ switch (s_BoardInfos[dev->minor].i_ScanType) { case 0: case 1: - //switch(i_ADDIDATAType) + /* switch(i_ADDIDATAType) */ switch (s_BoardInfos[dev->minor].i_ADDIDATAType) { case 0: case 1: @@ -3087,12 +3080,12 @@ void v_APCI3200_Interrupt(int irq, void *d) /************************************/ /*Read the interrupt status register */ /************************************/ - //ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); + /* ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); */ ui_StatusRegister = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 16); if ((ui_StatusRegister & 0x2) == 0x2) { - //i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); + /* i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); */ i_CalibrationFlag = ((inl(devpriv->iobase + s_BoardInfos[dev-> @@ -3103,12 +3096,12 @@ void v_APCI3200_Interrupt(int irq, void *d) /*************************/ /*Read the channel number */ /*************************/ - //ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); + /* ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); */ /*************************************/ /*Read the digital analog input value */ /*************************************/ - //ui_DigitalInput = inl(devpriv->iobase+i_Offset + 28); + /* ui_DigitalInput = inl(devpriv->iobase+i_Offset + 28); */ ui_DigitalInput = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); @@ -3117,13 +3110,13 @@ void v_APCI3200_Interrupt(int irq, void *d) /* Test if the value read is the channel value */ /***********************************************/ if (i_CalibrationFlag == 0) { - //ui_InterruptChannelValue[i_Count + 0] = ui_DigitalInput; + /* ui_InterruptChannelValue[i_Count + 0] = ui_DigitalInput; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. i_Count + 0] = ui_DigitalInput; - //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ /* printk("\n 1 - i_APCI3200_GetChannelCalibrationValue (dev, s_BoardInfos %i", ui_ChannelNumber); i_APCI3200_GetChannelCalibrationValue (dev, s_BoardInfos [dev->minor].ui_Channel_num, @@ -3131,14 +3124,14 @@ void v_APCI3200_Interrupt(int irq, void *d) &s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 7], &s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 8]); */ - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ /******************************************************/ /*Start the conversion of the calibration offset value */ /******************************************************/ i_APCI3200_ReadCalibrationOffsetValue (dev, &ui_DummyValue); - } //if (i_CalibrationFlag == 0) + } /* if (i_CalibrationFlag == 0) */ /**********************************************************/ /* Test if the value read is the calibration offset value */ /**********************************************************/ @@ -3149,7 +3142,7 @@ void v_APCI3200_Interrupt(int irq, void *d) /* Save the value */ /******************/ - //ui_InterruptChannelValue[i_Count + 1] = ui_DigitalInput; + /* ui_InterruptChannelValue[i_Count + 1] = ui_DigitalInput; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3160,7 +3153,7 @@ void v_APCI3200_Interrupt(int irq, void *d) /******************************************************/ i_APCI3200_ReadCalibrationGainValue(dev, &ui_DummyValue); - } //if (i_CalibrationFlag == 1) + } /* if (i_CalibrationFlag == 1) */ /******************************************************/ /*Test if the value read is the calibration gain value */ /******************************************************/ @@ -3170,48 +3163,48 @@ void v_APCI3200_Interrupt(int irq, void *d) /****************/ /*Save the value */ /****************/ - //ui_InterruptChannelValue[i_Count + 2] = ui_DigitalInput; + /* ui_InterruptChannelValue[i_Count + 2] = ui_DigitalInput; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. i_Count + 2] = ui_DigitalInput; - //if(i_ScanType==1) + /* if(i_ScanType==1) */ if (s_BoardInfos[dev->minor]. i_ScanType == 1) { - //i_InterruptFlag=0; + /* i_InterruptFlag=0; */ s_BoardInfos[dev->minor]. i_InterruptFlag = 0; - //i_Count=i_Count + 6; - //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - //s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6; + /* i_Count=i_Count + 6; */ + /* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + /* s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6; */ s_BoardInfos[dev->minor]. i_Count = s_BoardInfos[dev-> minor].i_Count + 9; - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - } //if(i_ScanType==1) + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + } /* if(i_ScanType==1) */ else { - //i_Count=0; + /* i_Count=0; */ s_BoardInfos[dev->minor]. i_Count = 0; - } //elseif(i_ScanType==1) - //if(i_ScanType!=1) + } /* elseif(i_ScanType==1) */ + /* if(i_ScanType!=1) */ if (s_BoardInfos[dev->minor]. i_ScanType != 1) { - i_ReturnValue = send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample - } //if(i_ScanType!=1) + i_ReturnValue = send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ + } /* if(i_ScanType!=1) */ else { - //if(i_ChannelCount==i_Sum) + /* if(i_ChannelCount==i_Sum) */ if (s_BoardInfos[dev->minor]. i_ChannelCount == s_BoardInfos[dev-> minor].i_Sum) { - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ } - } //if(i_ScanType!=1) - } //if (i_CalibrationFlag == 2) - } // if ((ui_StatusRegister & 0x2) == 0x2) + } /* if(i_ScanType!=1) */ + } /* if (i_CalibrationFlag == 2) */ + } /* if ((ui_StatusRegister & 0x2) == 0x2) */ break; @@ -3220,7 +3213,7 @@ void v_APCI3200_Interrupt(int irq, void *d) /*Read the interrupt status register */ /************************************/ - //ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); + /* ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); */ ui_StatusRegister = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 16); @@ -3230,7 +3223,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((ui_StatusRegister & 0x2) == 0x2) { - //i_CJCFlag = ((inl(devpriv->iobase+i_Offset + 4) & 0x00000400) >> 10); + /* i_CJCFlag = ((inl(devpriv->iobase+i_Offset + 4) & 0x00000400) >> 10); */ i_CJCFlag = ((inl(devpriv->iobase + s_BoardInfos[dev-> @@ -3238,7 +3231,7 @@ void v_APCI3200_Interrupt(int irq, void *d) i_Offset + 4) & 0x00000400) >> 10); - //i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); + /* i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); */ i_CalibrationFlag = ((inl(devpriv->iobase + s_BoardInfos[dev-> @@ -3251,19 +3244,19 @@ void v_APCI3200_Interrupt(int irq, void *d) /*Read the channel number */ /*************************/ - //ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); + /* ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); */ ui_ChannelNumber = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 24); - //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ s_BoardInfos[dev->minor].ui_Channel_num = ui_ChannelNumber; - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ /************************************/ /*Read the digital temperature value */ /************************************/ - //ui_DigitalTemperature = inl(devpriv->iobase+i_Offset + 28); + /* ui_DigitalTemperature = inl(devpriv->iobase+i_Offset + 28); */ ui_DigitalTemperature = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); @@ -3274,7 +3267,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) { - //ui_InterruptChannelValue[i_Count + 0]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 0]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3287,7 +3280,7 @@ void v_APCI3200_Interrupt(int irq, void *d) i_APCI3200_ReadCJCValue(dev, &ui_DummyValue); - } //if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) + } /* if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) */ /*****************************************/ /*Test if the value read is the CJC value */ @@ -3295,7 +3288,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) { - //ui_InterruptChannelValue[i_Count + 3]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 3]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3307,7 +3300,7 @@ void v_APCI3200_Interrupt(int irq, void *d) /******************************************************/ i_APCI3200_ReadCalibrationOffsetValue (dev, &ui_DummyValue); - } // if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) + } /* if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) */ /********************************************************/ /*Test if the value read is the calibration offset value */ @@ -3315,7 +3308,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) { - //ui_InterruptChannelValue[i_Count + 1]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 1]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3328,7 +3321,7 @@ void v_APCI3200_Interrupt(int irq, void *d) i_APCI3200_ReadCalibrationGainValue(dev, &ui_DummyValue); - } //if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) + } /* if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) */ /******************************************************/ /*Test if the value read is the calibration gain value */ @@ -3336,7 +3329,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) { - //ui_InterruptChannelValue[i_Count + 2]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 2]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3349,15 +3342,15 @@ void v_APCI3200_Interrupt(int irq, void *d) /*Test if the polarity is the same */ /**********************************/ - //if(i_CJCPolarity!=i_ADDIDATAPolarity) + /* if(i_CJCPolarity!=i_ADDIDATAPolarity) */ if (s_BoardInfos[dev->minor]. i_CJCPolarity != s_BoardInfos[dev->minor]. i_ADDIDATAPolarity) { i_ConvertCJCCalibration = 1; - } //if(i_CJCPolarity!=i_ADDIDATAPolarity) + } /* if(i_CJCPolarity!=i_ADDIDATAPolarity) */ else { - //if(i_CJCGain==i_ADDIDATAGain) + /* if(i_CJCGain==i_ADDIDATAGain) */ if (s_BoardInfos[dev->minor]. i_CJCGain == s_BoardInfos[dev-> @@ -3365,12 +3358,12 @@ void v_APCI3200_Interrupt(int irq, void *d) i_ADDIDATAGain) { i_ConvertCJCCalibration = 0; - } //if(i_CJCGain==i_ADDIDATAGain) + } /* if(i_CJCGain==i_ADDIDATAGain) */ else { i_ConvertCJCCalibration = 1; - } //elseif(i_CJCGain==i_ADDIDATAGain) - } //elseif(i_CJCPolarity!=i_ADDIDATAPolarity) + } /* elseif(i_CJCGain==i_ADDIDATAGain) */ + } /* elseif(i_CJCPolarity!=i_ADDIDATAPolarity) */ if (i_ConvertCJCCalibration == 1) { /****************************************************************/ /*Start the conversion of the calibration gain value for the CJC */ @@ -3378,10 +3371,10 @@ void v_APCI3200_Interrupt(int irq, void *d) i_APCI3200_ReadCJCCalOffset(dev, &ui_DummyValue); - } //if(i_ConvertCJCCalibration==1) + } /* if(i_ConvertCJCCalibration==1) */ else { - //ui_InterruptChannelValue[i_Count + 4]=0; - //ui_InterruptChannelValue[i_Count + 5]=0; + /* ui_InterruptChannelValue[i_Count + 4]=0; */ + /* ui_InterruptChannelValue[i_Count + 5]=0; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev-> @@ -3392,8 +3385,8 @@ void v_APCI3200_Interrupt(int irq, void *d) [s_BoardInfos[dev-> minor].i_Count + 5] = 0; - } //elseif(i_ConvertCJCCalibration==1) - } //else if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) + } /* elseif(i_ConvertCJCCalibration==1) */ + } /* else if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) */ /********************************************************************/ /*Test if the value read is the calibration offset value for the CJC */ @@ -3401,7 +3394,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) { - //ui_InterruptChannelValue[i_Count + 4]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 4]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3414,7 +3407,7 @@ void v_APCI3200_Interrupt(int irq, void *d) i_APCI3200_ReadCJCCalGain(dev, &ui_DummyValue); - } //if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) + } /* if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) */ /******************************************************************/ /*Test if the value read is the calibration gain value for the CJC */ @@ -3422,61 +3415,61 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) { - //ui_InterruptChannelValue[i_Count + 5]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 5]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. i_Count + 5] = ui_DigitalTemperature; - //if(i_ScanType==1) + /* if(i_ScanType==1) */ if (s_BoardInfos[dev->minor]. i_ScanType == 1) { - //i_InterruptFlag=0; + /* i_InterruptFlag=0; */ s_BoardInfos[dev->minor]. i_InterruptFlag = 0; - //i_Count=i_Count + 6; - //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - //s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6; + /* i_Count=i_Count + 6; */ + /* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + /* s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6; */ s_BoardInfos[dev->minor]. i_Count = s_BoardInfos[dev-> minor].i_Count + 9; - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - } //if(i_ScanType==1) + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + } /* if(i_ScanType==1) */ else { - //i_Count=0; + /* i_Count=0; */ s_BoardInfos[dev->minor]. i_Count = 0; - } //elseif(i_ScanType==1) + } /* elseif(i_ScanType==1) */ - //if(i_ScanType!=1) + /* if(i_ScanType!=1) */ if (s_BoardInfos[dev->minor]. i_ScanType != 1) { - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample - } //if(i_ScanType!=1) + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ + } /* if(i_ScanType!=1) */ else { - //if(i_ChannelCount==i_Sum) + /* if(i_ChannelCount==i_Sum) */ if (s_BoardInfos[dev->minor]. i_ChannelCount == s_BoardInfos[dev-> minor].i_Sum) { - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ - } //if(i_ChannelCount==i_Sum) - } //else if(i_ScanType!=1) - } //if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) + } /* if(i_ChannelCount==i_Sum) */ + } /* else if(i_ScanType!=1) */ + } /* if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) */ - } //else if ((ui_StatusRegister & 0x2) == 0x2) + } /* else if ((ui_StatusRegister & 0x2) == 0x2) */ break; - } //switch(i_ADDIDATAType) + } /* switch(i_ADDIDATAType) */ break; case 2: case 3: i_APCI3200_InterruptHandleEos(dev); break; - } //switch(i_ScanType) + } /* switch(i_ScanType) */ return; } @@ -3499,22 +3492,22 @@ void v_APCI3200_Interrupt(int irq, void *d) | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_InterruptHandleEos(struct comedi_device * dev) +int i_APCI3200_InterruptHandleEos(struct comedi_device *dev) { - UINT ui_StatusRegister = 0; + unsigned int ui_StatusRegister = 0; struct comedi_subdevice *s = dev->subdevices + 0; - //BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - //comedi_async *async = s->async; - //UINT *data; - //data=async->data+async->buf_int_ptr;//new samples added from here onwards + /* BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + /* comedi_async *async = s->async; */ + /* UINT *data; */ + /* data=async->data+async->buf_int_ptr;//new samples added from here onwards */ int n = 0, i = 0; - //END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + /* END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ /************************************/ /*Read the interrupt status register */ /************************************/ - //ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); + /* ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); */ ui_StatusRegister = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 16); @@ -3526,33 +3519,33 @@ int i_APCI3200_InterruptHandleEos(struct comedi_device * dev) /*************************/ /*Read the channel number */ /*************************/ - //ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); - //BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - //This value is not used - //ui_ChannelNumber = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 24); + /* ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); */ + /* BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + /* This value is not used */ + /* ui_ChannelNumber = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 24); */ s->async->events = 0; - //END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + /* END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ /*************************************/ /*Read the digital Analog Input value */ /*************************************/ - //data[i_Count] = inl(devpriv->iobase+i_Offset + 28); - //Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - //data[s_BoardInfos [dev->minor].i_Count] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); + /* data[i_Count] = inl(devpriv->iobase+i_Offset + 28); */ + /* Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + /* data[s_BoardInfos [dev->minor].i_Count] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); */ s_BoardInfos[dev->minor].ui_ScanValueArray[s_BoardInfos[dev-> minor].i_Count] = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); - //End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + /* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ - //if((i_Count == (i_LastChannel-i_FirstChannel+3))) + /* if((i_Count == (i_LastChannel-i_FirstChannel+3))) */ if ((s_BoardInfos[dev->minor].i_Count == (s_BoardInfos[dev->minor].i_LastChannel - s_BoardInfos[dev->minor]. i_FirstChannel + 3))) { - //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ s_BoardInfos[dev->minor].i_Count++; for (i = s_BoardInfos[dev->minor].i_FirstChannel; @@ -3582,61 +3575,61 @@ int i_APCI3200_InterruptHandleEos(struct comedi_device * dev) * 3) + 2]); } - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ - //i_Count=-1; + /* i_Count=-1; */ s_BoardInfos[dev->minor].i_Count = -1; - //async->buf_int_count+=(i_LastChannel-i_FirstChannel+4)*sizeof(UINT); - //Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - //async->buf_int_count+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(UINT); - //End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - //async->buf_int_ptr+=(i_LastChannel-i_FirstChannel+4)*sizeof(UINT); - //Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - //async->buf_int_ptr+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(UINT); - //comedi_eos(dev,s); + /* async->buf_int_count+=(i_LastChannel-i_FirstChannel+4)*sizeof(unsigned int); */ + /* Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + /* async->buf_int_count+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(unsigned int); */ + /* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + /* async->buf_int_ptr+=(i_LastChannel-i_FirstChannel+4)*sizeof(unsigned int); */ + /* Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + /* async->buf_int_ptr+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(unsigned int); */ + /* comedi_eos(dev,s); */ - // Set the event type (Comedi Buffer End Of Scan) + /* Set the event type (Comedi Buffer End Of Scan) */ s->async->events |= COMEDI_CB_EOS; - // Test if enougth memory is available and allocate it for 7 values - //n = comedi_buf_write_alloc(s->async, 7*sizeof(unsigned int)); + /* Test if enougth memory is available and allocate it for 7 values */ + /* n = comedi_buf_write_alloc(s->async, 7*sizeof(unsigned int)); */ n = comedi_buf_write_alloc(s->async, (7 + 12) * sizeof(unsigned int)); - // If not enougth memory available, event is set to Comedi Buffer Errror + /* If not enougth memory available, event is set to Comedi Buffer Errror */ if (n > ((7 + 12) * sizeof(unsigned int))) { printk("\ncomedi_buf_write_alloc n = %i", n); s->async->events |= COMEDI_CB_ERROR; } - // Write all 7 scan values in the comedi buffer + /* Write all 7 scan values in the comedi buffer */ comedi_buf_memcpy_to(s->async, 0, (unsigned int *) s_BoardInfos[dev->minor]. ui_ScanValueArray, (7 + 12) * sizeof(unsigned int)); - // Update comedi buffer pinters indexes + /* Update comedi buffer pinters indexes */ comedi_buf_write_free(s->async, (7 + 12) * sizeof(unsigned int)); - // Send events + /* Send events */ comedi_event(dev, s); - //End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - - //BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - // - //if (s->async->buf_int_ptr>=s->async->data_len) // for buffer rool over - // { - // /* buffer rollover */ - // s->async->buf_int_ptr=0; - // comedi_eobuf(dev,s); - // } - //End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + /* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + + /* BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + /* */ + /* if (s->async->buf_int_ptr>=s->async->data_len) // for buffer rool over */ + /* { */ + /* /* buffer rollover */ */ + /* s->async->buf_int_ptr=0; */ + /* comedi_eobuf(dev,s); */ + /* } */ + /* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ } - //i_Count++; + /* i_Count++; */ s_BoardInfos[dev->minor].i_Count++; } - //i_InterruptFlag=0; + /* i_InterruptFlag=0; */ s_BoardInfos[dev->minor].i_InterruptFlag = 0; return 0; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h index a6f57f55e79..f3e7ebf8c1f 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h @@ -15,26 +15,26 @@ * any later version. */ -// Card Specific information +/* Card Specific information */ #define APCI3200_BOARD_VENDOR_ID 0x15B8 -//#define APCI3200_ADDRESS_RANGE 264 +/* #define APCI3200_ADDRESS_RANGE 264 */ int MODULE_NO; struct { - INT i_Gain; - INT i_Polarity; - INT i_OffsetRange; - INT i_Coupling; - INT i_SingleDiff; - INT i_AutoCalibration; - UINT ui_ReloadValue; - UINT ui_TimeUnitReloadVal; - INT i_Interrupt; - INT i_ModuleSelection; + int i_Gain; + int i_Polarity; + int i_OffsetRange; + int i_Coupling; + int i_SingleDiff; + int i_AutoCalibration; + unsigned int ui_ReloadValue; + unsigned int ui_TimeUnitReloadVal; + int i_Interrupt; + int i_ModuleSelection; } Config_Parameters_Module1, Config_Parameters_Module2, Config_Parameters_Module3, Config_Parameters_Module4; -//ANALOG INPUT RANGE +/* ANALOG INPUT RANGE */ static const struct comedi_lrange range_apci3200_ai = { 8, { BIP_RANGE(10), BIP_RANGE(5), @@ -55,7 +55,7 @@ static const struct comedi_lrange range_apci3300_ai = { 4, { } }; -//Analog Input related Defines +/* Analog Input related Defines */ #define APCI3200_AI_OFFSET_GAIN 0 #define APCI3200_AI_SC_TEST 4 #define APCI3200_AI_IRQ 8 @@ -89,98 +89,102 @@ static const struct comedi_lrange range_apci3300_ai = { 4, { #define ADDIDATA_UNIPOLAR 1 #define ADDIDATA_BIPOLAR 2 -//BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +/* BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ #define MAX_MODULE 4 -//END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +/* END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ -typedef struct { - ULONG ul_NumberOfValue; - ULONG *pul_ResistanceValue; - ULONG *pul_TemperatureValue; -} str_ADDIDATA_RTDStruct, *pstr_ADDIDATA_RTDStruct; +struct str_ADDIDATA_RTDStruct { + unsigned int ul_NumberOfValue; + unsigned int *pul_ResistanceValue; + unsigned int *pul_TemperatureValue; +}; + +/* BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ +struct str_Module { -//BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values -typedef struct { - // Begin JK 05/08/2003 change for Linux + /* Begin JK 05/08/2003 change for Linux */ unsigned long ul_CurrentSourceCJC; unsigned long ul_CurrentSource[5]; - // End JK 05/08/2003 change for Linux + /* End JK 05/08/2003 change for Linux */ - // Begin CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 - unsigned long ul_GainFactor[8]; // Gain Factor + /* Begin CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 */ + unsigned long ul_GainFactor[8]; /* Gain Factor */ unsigned int w_GainValue[10]; - // End CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 -} str_Module; -//END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - -//BEGIN JK 06.07.04: Management of sevrals boards -typedef struct { - INT i_CJCAvailable; - INT i_CJCPolarity; - INT i_CJCGain; - INT i_InterruptFlag; - INT i_ADDIDATAPolarity; - INT i_ADDIDATAGain; - INT i_AutoCalibration; - INT i_ADDIDATAConversionTime; - INT i_ADDIDATAConversionTimeUnit; - INT i_ADDIDATAType; - INT i_ChannelNo; - INT i_ChannelCount; - INT i_ScanType; - INT i_FirstChannel; - INT i_LastChannel; - INT i_Sum; - INT i_Offset; - UINT ui_Channel_num; - INT i_Count; - INT i_Initialised; - //UINT ui_InterruptChannelValue[96]; //Buffer - UINT ui_InterruptChannelValue[144]; //Buffer - BYTE b_StructInitialized; - //Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - unsigned int ui_ScanValueArray[7 + 12]; // 7 is the maximal number of channels - //End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - - //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - INT i_ConnectionType; - INT i_NbrOfModule; - str_Module s_Module[MAX_MODULE]; - //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values -} str_BoardInfos; -//END JK 06.07.04: Management of sevrals boards - -// Hardware Layer functions for Apci3200 - -//AI - -INT i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, + /* End CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 */ +}; + +/* END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + +/* BEGIN JK 06.07.04: Management of sevrals boards */ +struct str_BoardInfos { + + int i_CJCAvailable; + int i_CJCPolarity; + int i_CJCGain; + int i_InterruptFlag; + int i_ADDIDATAPolarity; + int i_ADDIDATAGain; + int i_AutoCalibration; + int i_ADDIDATAConversionTime; + int i_ADDIDATAConversionTimeUnit; + int i_ADDIDATAType; + int i_ChannelNo; + int i_ChannelCount; + int i_ScanType; + int i_FirstChannel; + int i_LastChannel; + int i_Sum; + int i_Offset; + unsigned int ui_Channel_num; + int i_Count; + int i_Initialised; + /* UINT ui_InterruptChannelValue[96]; //Buffer */ + unsigned int ui_InterruptChannelValue[144]; /* Buffer */ + unsigned char b_StructInitialized; + /* Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + unsigned int ui_ScanValueArray[7 + 12]; /* 7 is the maximal number of channels */ + /* End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + + /* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + int i_ConnectionType; + int i_NbrOfModule; + struct str_Module s_Module[MAX_MODULE]; + /* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ +}; + +/* END JK 06.07.04: Management of sevrals boards */ + +/* Hardware Layer functions for Apci3200 */ + +/* AI */ + +int i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev, +int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev, +int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s); -INT i_APCI3200_InterruptHandleEos(struct comedi_device *dev); -INT i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s); +int i_APCI3200_InterruptHandleEos(struct comedi_device *dev); +int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); -INT i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); -INT i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); +int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//Interrupt +/* Interrupt */ void v_APCI3200_Interrupt(int irq, void *d); int i_APCI3200_InterruptHandleEos(struct comedi_device *dev); -//Reset functions -INT i_APCI3200_Reset(struct comedi_device *dev); +/* Reset functions */ +int i_APCI3200_Reset(struct comedi_device *dev); int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data); int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data); -int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, UINT *data); -int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, UINT *data); +int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data); +int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data); int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 20391a91da0..ef21f03fc96 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -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. @@ -62,8 +62,8 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -73,26 +73,26 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->iobase + APCI3501_DIGITAL_IP); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } //if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { *data = *data & 0x3; - } //if (ui_Temp==1) + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif (ui_Temp==1) - } //elseif (ui_Temp==0) + } /* elseif (ui_Temp==1) */ + } /* elseif (ui_Temp==0) */ return insn->n; } @@ -105,7 +105,7 @@ INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[1] : 1 Enable VCC Interrupt | @@ -121,21 +121,21 @@ INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev | | +----------------------------------------------------------------------------+ */ -int i_APCI3501_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { if ((data[0] != 0) && (data[0] != 1)) { comedi_error(dev, "Not a valid Data !!! ,Data should be 1 or 0\n"); return -EINVAL; - } //if ( (data[0]!=0) && (data[0]!=1) ) + } /* if ( (data[0]!=0) && (data[0]!=1) ) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0]) + } /* if (data[0]) */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } //else if (data[0]) + } /* else if (data[0]) */ return insn->n; } @@ -161,33 +161,33 @@ int i_APCI3501_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inl(devpriv->iobase + APCI3501_DIGITAL_OP); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { data[0] = (data[0] << (2 * data[2])) | ui_Temp; outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==0) + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -201,7 +201,7 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = data[0] & ui_Temp; outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { data[0] = ~data[0] & 0x3; @@ -215,17 +215,17 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP); - } // if(data[1]==1) + } /* if(data[1]==1) */ else { printk("\nSpecified channel not supported\n"); - } //else if(data[1]==1) - } //elseif(data[1]==0) - } //if(data[3]==1); + } /* else if(data[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==1); */ else { printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } //if else data[3]==1) - } //if else data[3]==0) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return insn->n; } @@ -238,8 +238,8 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -248,27 +248,27 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->iobase + APCI3501_DIGITAL_OP); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } // if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { *data = *data & 0x3; - } // if (ui_Temp==1) + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // else if (ui_Temp==0) + } /* else if (ui_Temp==1) */ + } /* else if (ui_Temp==0) */ return insn->n; } @@ -298,8 +298,8 @@ INT i_APCI3501_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_ConfigAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { outl(data[0], devpriv->iobase + APCI3501_ANALOG_OUTPUT + @@ -336,10 +336,10 @@ INT i_APCI3501_ConfigAnalogOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { - ULONG ul_Command1 = 0, ul_Channel_no, ul_Polarity, ul_DAC_Ready = 0;; + unsigned int ul_Command1 = 0, ul_Channel_no, ul_Polarity, ul_DAC_Ready = 0;; ul_Channel_no = CR_CHAN(insn->chanspec); @@ -349,18 +349,18 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde printk("\nIn WriteAnalogOutput :: Not Valid Data\n"); } - } // end if(devpriv->b_InterruptMode==MODE1) + } /* end if(devpriv->b_InterruptMode==MODE1) */ else { ul_Polarity = 0; if ((*data < 0) || (*data > 8192)) { printk("\nIn WriteAnalogOutput :: Not Valid Data\n"); } - } // end else + } /* end else */ if ((ul_Channel_no < 0) || (ul_Channel_no > 7)) { printk("\nIn WriteAnalogOutput :: Not Valid Channel\n"); - } // end if((ul_Channel_no<0)||(ul_Channel_no>7)) + } /* end if((ul_Channel_no<0)||(ul_Channel_no>7)) */ ul_DAC_Ready = inl(devpriv->iobase + APCI3501_ANALOG_OUTPUT); @@ -370,11 +370,11 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde } if (ul_DAC_Ready) { -// Output the Value on the output channels. +/* Output the Value on the output channels. */ ul_Command1 = - (ULONG) ((ULONG) (ul_Channel_no & 0xFF) | - (ULONG) ((*data << 0x8) & 0x7FFFFF00L) | - (ULONG) (ul_Polarity)); + (unsigned int) ((unsigned int) (ul_Channel_no & 0xFF) | + (unsigned int) ((*data << 0x8) & 0x7FFFFF00L) | + (unsigned int) (ul_Polarity)); outl(ul_Command1, devpriv->iobase + APCI3501_ANALOG_OUTPUT + APCI3501_AO_PROG); @@ -392,7 +392,7 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde | Task : Configures The Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Configure As Timer | @@ -410,78 +410,78 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; devpriv->tsk_Current = current; if (data[0] == ADDIDATA_WATCHDOG) { devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG; - //Disable the watchdog - outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //disable Wa + /* Disable the watchdog */ + outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* disable Wa */ if (data[1] == 1) { - //Enable TIMER int & DISABLE ALL THE OTHER int SOURCES + /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ outl(0x02, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); } else { - outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //disable Timer interrupt + outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* disable Timer interrupt */ } - //Loading the Timebase value + /* Loading the Timebase value */ outl(data[2], devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TIMEBASE); - //Loading the Reload value + /* Loading the Reload value */ outl(data[3], devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_RELOAD_VALUE); - //Set the mode - ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG) | 0xFFF819E0UL; //e2->e0 + /* Set the mode */ + ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG) | 0xFFF819E0UL; /* e2->e0 */ outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); - } //end if(data[0]==ADDIDATA_WATCHDOG) + } /* end if(data[0]==ADDIDATA_WATCHDOG) */ else if (data[0] == ADDIDATA_TIMER) { - //First Stop The Timer + /* First Stop The Timer */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); ul_Command1 = ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //Stop The Timer + outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* Stop The Timer */ devpriv->b_TimerSelectMode = ADDIDATA_TIMER; if (data[1] == 1) { - //Enable TIMER int & DISABLE ALL THE OTHER int SOURCES + /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ outl(0x02, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); } else { - outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //disable Timer interrupt + outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* disable Timer interrupt */ } - // Loading Timebase + /* Loading Timebase */ outl(data[2], devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TIMEBASE); - //Loading the Reload value + /* Loading the Reload value */ outl(data[3], devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_RELOAD_VALUE); - // printk ("\nTimer Address :: %x\n", (devpriv->iobase+APCI3501_WATCHDOG)); + /* printk ("\nTimer Address :: %x\n", (devpriv->iobase+APCI3501_WATCHDOG)); */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL; - outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //mode 2 + outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* mode 2 */ - } //end if(data[0]==ADDIDATA_TIMER) + } /* end if(data[0]==ADDIDATA_TIMER) */ return insn->n; } @@ -495,7 +495,7 @@ INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev, | Task : Start / Stop The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Timer | @@ -511,10 +511,10 @@ INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; int i_Temp; if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { @@ -523,15 +523,15 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - //Enable the Watchdog + /* Enable the Watchdog */ outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); } - else if (data[1] == 0) //Stop The Watchdog + else if (data[1] == 0) /* Stop The Watchdog */ { - //Stop The Watchdog + /* Stop The Watchdog */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); @@ -547,8 +547,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); - } //if(data[1]==2) - } // end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + } /* if(data[1]==2) */ + } /* end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */ if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { if (data[1] == 1) { @@ -557,12 +557,12 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - //Enable the Timer + /* Enable the Timer */ outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); } else if (data[1] == 0) { - //Stop The Timer + /* Stop The Timer */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); @@ -573,7 +573,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, } else if (data[1] == 2) { - //Trigger the Timer + /* Trigger the Timer */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); @@ -583,7 +583,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, APCI3501_TCW_PROG); } - } // end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */ i_Temp = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TRIG_STATUS) & 0x1; return insn->n; @@ -598,7 +598,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, | Task : Read The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Timer | @@ -613,8 +613,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { @@ -622,14 +622,14 @@ int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev, inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TRIG_STATUS) & 0x1; data[1] = inl(devpriv->iobase + APCI3501_WATCHDOG); - } // end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + } /* end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */ else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { data[0] = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TRIG_STATUS) & 0x1; data[1] = inl(devpriv->iobase + APCI3501_WATCHDOG); - } // end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */ else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)) { @@ -654,10 +654,10 @@ int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3501_Reset(struct comedi_device * dev) +int i_APCI3501_Reset(struct comedi_device *dev) { int i_Count = 0, i_temp = 0; - ULONG ul_Command1 = 0, ul_Polarity, ul_DAC_Ready = 0; + unsigned int ul_Command1 = 0, ul_Polarity, ul_DAC_Ready = 0; outl(0x0, devpriv->iobase + APCI3501_DIGITAL_OP); outl(1, devpriv->iobase + APCI3501_ANALOG_OUTPUT + APCI3501_AO_VOLT_MODE); @@ -674,11 +674,11 @@ int i_APCI3501_Reset(struct comedi_device * dev) } if (ul_DAC_Ready) { - // Output the Value on the output channels. + /* Output the Value on the output channels. */ ul_Command1 = - (ULONG) ((ULONG) (i_Count & 0xFF) | - (ULONG) ((i_temp << 0x8) & 0x7FFFFF00L) | - (ULONG) (ul_Polarity)); + (unsigned int) ((unsigned int) (i_Count & 0xFF) | + (unsigned int) ((i_temp << 0x8) & 0x7FFFFF00L) | + (unsigned int) (ul_Polarity)); outl(ul_Command1, devpriv->iobase + APCI3501_ANALOG_OUTPUT + APCI3501_AO_PROG); @@ -711,7 +711,7 @@ void v_APCI3501_Interrupt(int irq, void *d) struct comedi_device *dev = d; unsigned int ui_Timer_AOWatchdog; unsigned long ul_Command1; - // Disable Interrupt + /* Disable Interrupt */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); @@ -728,8 +728,9 @@ void v_APCI3501_Interrupt(int irq, void *d) return; } - // Enable Interrupt - //Send a signal to from kernel to user space +/* +* Enable Interrupt Send a signal to from kernel to user space +*/ send_sig(SIGIO, devpriv->tsk_Current, 0); ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h index 51e7b66544a..c456d75674b 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h @@ -15,7 +15,7 @@ * any later version. */ -// Card Specific information +/* Card Specific information */ #define APCI3501_BOARD_VENDOR_ID 0x15B8 #define APCI3501_ADDRESS_RANGE 255 @@ -23,7 +23,7 @@ #define APCI3501_DIGITAL_OP 0x40 #define APCI3501_ANALOG_OUTPUT 0x00 -//Analog Output related Defines +/* Analog Output related Defines */ #define APCI3501_AO_VOLT_MODE 0 #define APCI3501_AO_PROG 4 #define APCI3501_AO_TRIG_SCS 8 @@ -31,14 +31,14 @@ #define BIPOLAR 1 #define MODE0 0 #define MODE1 1 -// ANALOG OUTPUT RANGE +/* ANALOG OUTPUT RANGE */ struct comedi_lrange range_apci3501_ao = { 2, { BIP_RANGE(10), UNI_RANGE(10) } }; -//Watchdog Related Defines +/* Watchdog Related Defines */ #define APCI3501_WATCHDOG 0x20 #define APCI3501_TCW_SYNC_ENABLEDISABLE 0 @@ -52,32 +52,36 @@ struct comedi_lrange range_apci3501_ao = { 2, { #define ADDIDATA_TIMER 0 #define ADDIDATA_WATCHDOG 2 -// Hardware Layer functions for Apci3501 +/* Hardware Layer functions for Apci3501 */ -//AO -INT i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, +/* AO */ +int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DI -// for di read -//INT i_APCI3501_ReadDigitalInput(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data); +/* +* DI for di read INT i_APCI3501_ReadDigitalInput(struct +* comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn +* *insn,unsigned int *data); +*/ -INT i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DO +/* DO */ int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds -INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev, +/* TIMER + * timer value is passed as u seconds + */ + +int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, @@ -87,8 +91,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//Interrupt +/* Interrupt */ void v_APCI3501_Interrupt(int irq, void *d); -//Reset functions +/* Reset functions */ int i_APCI3501_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c index b7268e4da64..33872787982 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -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. @@ -54,7 +54,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_TestConversionStarted | +| Function Name : int i_APCI3XXX_TestConversionStarted | | (struct comedi_device *dev) | +----------------------------------------------------------------------------+ | Task Test if any conversion started | @@ -68,18 +68,18 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev) +int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) { - if ((readl((void *)(devpriv->dw_AiBase + 8)) & 0x80000UL) == 0x80000UL) { - return (1); - } else { - return (0); - } + if ((readl((void *)(devpriv->dw_AiBase + 8)) & 0x80000UL) == 0x80000UL) + return 1; + else + return 0; + } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_AnalogInputConfigOperatingMode | +| Function Name : int i_APCI3XXX_AnalogInputConfigOperatingMode | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -87,9 +87,9 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev) +----------------------------------------------------------------------------+ | Task Converting mode and convert time selection | +----------------------------------------------------------------------------+ -| Input Parameters : b_SingleDiff = (BYTE) data[1]; | -| b_TimeBase = (BYTE) data[2]; (0: ns, 1:micros 2:ms)| -| dw_ReloadValue = (DWORD) data[3]; | +| Input Parameters : b_SingleDiff = (unsigned char) data[1]; | +| b_TimeBase = (unsigned char) data[2]; (0: ns, 1:micros 2:ms)| +| dw_ReloadValue = (unsigned int) data[3]; | | ........ | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -105,14 +105,14 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev) +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - BYTE b_TimeBase = 0; - BYTE b_SingleDiff = 0; - DWORD dw_ReloadValue = 0; - DWORD dw_TestReloadValue = 0; + int i_ReturnValue = insn->n; + unsigned char b_TimeBase = 0; + unsigned char b_SingleDiff = 0; + unsigned int dw_ReloadValue = 0; + unsigned int dw_TestReloadValue = 0; /************************/ /* Test the buffer size */ @@ -123,19 +123,19 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, /* Get the Singel/Diff flag */ /****************************/ - b_SingleDiff = (BYTE) data[1]; + b_SingleDiff = (unsigned char) data[1]; /****************************/ /* Get the time base unitiy */ /****************************/ - b_TimeBase = (BYTE) data[2]; + b_TimeBase = (unsigned char) data[2]; /*************************************/ /* Get the convert time reload value */ /*************************************/ - dw_ReloadValue = (DWORD) data[3]; + dw_ReloadValue = (unsigned int) data[3]; /**********************/ /* Test the time base */ @@ -186,7 +186,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, devpriv-> ui_EocEosConversionTime = - (UINT) + (unsigned int) dw_ReloadValue; devpriv-> b_EocEosConversionTimeBase @@ -204,7 +204,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, /* Set the convert timing unit */ /*******************************/ - writel((DWORD) + writel((unsigned int) b_TimeBase, (void *) (devpriv-> @@ -268,12 +268,12 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnConfigAnalogInput | +| Function Name : int i_APCI3XXX_InsnConfigAnalogInput | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -281,9 +281,9 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, +----------------------------------------------------------------------------+ | Task Converting mode and convert time selection | +----------------------------------------------------------------------------+ -| Input Parameters : b_ConvertMode = (BYTE) data[0]; | -| b_TimeBase = (BYTE) data[1]; (0: ns, 1:micros 2:ms)| -| dw_ReloadValue = (DWORD) data[2]; | +| Input Parameters : b_ConvertMode = (unsigned char) data[0]; | +| b_TimeBase = (unsigned char) data[1]; (0: ns, 1:micros 2:ms)| +| dw_ReloadValue = (unsigned int) data[2]; | | ........ | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -295,17 +295,17 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; + int i_ReturnValue = insn->n; /************************/ /* Test the buffer size */ /************************/ if (insn->n >= 1) { - switch ((BYTE) data[0]) { + switch ((unsigned char) data[0]) { case APCI3XXX_CONFIGURATION: i_ReturnValue = i_APCI3XXX_AnalogInputConfigOperatingMode(dev, @@ -326,12 +326,12 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnReadAnalogInput | +| Function Name : int i_APCI3XXX_InsnReadAnalogInput | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -355,16 +355,16 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - BYTE b_Configuration = (BYTE) CR_RANGE(insn->chanspec); - BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); - DWORD dw_Temp = 0; - DWORD dw_Configuration = 0; - DWORD dw_AcquisitionCpt = 0; - BYTE b_Interrupt = 0; + int i_ReturnValue = insn->n; + unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec); + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + unsigned int dw_Temp = 0; + unsigned int dw_Configuration = 0; + unsigned int dw_AcquisitionCpt = 0; + unsigned char b_Interrupt = 0; /*************************************/ /* Test if operating mode configured */ @@ -449,8 +449,8 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, dw_Configuration = (b_Configuration & 3) | - ((DWORD) (b_Configuration >> 2) - << 6) | ((DWORD) devpriv-> + ((unsigned int) (b_Configuration >> 2) + << 6) | ((unsigned int) devpriv-> b_SingelDiff << 7); /***************************/ @@ -468,7 +468,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, writel(dw_Temp | 0x100UL, (void *)(devpriv->dw_AiBase + 4)); - writel((DWORD) b_Channel, + writel((unsigned int) b_Channel, (void *)(devpriv->dw_AiBase + 0)); @@ -535,8 +535,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, dw_Temp = dw_Temp & 1; - } - while (dw_Temp != 1); + } while (dw_Temp != 1); /*************************/ /* Read the analog value */ @@ -585,7 +584,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, printk("Operating mode not configured\n"); i_ReturnValue = -1; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -607,15 +606,15 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, void v_APCI3XXX_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - BYTE b_CopyCpt = 0; - DWORD dw_Status = 0; + unsigned char b_CopyCpt = 0; + unsigned int dw_Status = 0; /***************************/ /* Test if interrupt occur */ /***************************/ - if (((dw_Status = readl((void *)(devpriv->dw_AiBase + 16))) & 0x2UL) == - 0x2UL) { + dw_Status = readl((void *)(devpriv->dw_AiBase + 16)); + if ( (dw_Status & 0x2UL) == 0x2UL) { /***********************/ /* Reset the interrupt */ /***********************/ @@ -635,7 +634,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d) b_CopyCpt < devpriv->ui_AiNbrofChannels; b_CopyCpt++) { devpriv->ui_AiReadData[b_CopyCpt] = - (UINT) readl((void *)(devpriv-> + (unsigned int) readl((void *)(devpriv-> dw_AiBase + 28)); } @@ -662,7 +661,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d) /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnWriteAnalogOutput | +| Function Name : int i_APCI3XXX_InsnWriteAnalogOutput | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -684,13 +683,13 @@ void v_APCI3XXX_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - BYTE b_Range = (BYTE) CR_RANGE(insn->chanspec); - BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); - DWORD dw_Status = 0; - INT i_ReturnValue = insn->n; + unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec); + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + unsigned int dw_Status = 0; + int i_ReturnValue = insn->n; /************************/ /* Test the buffer size */ @@ -729,8 +728,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, dw_Status = readl((void *)(devpriv-> dw_AiBase + 96)); - } - while ((dw_Status & 0x100) != 0x100); + } while ((dw_Status & 0x100) != 0x100); } else { /***************************/ /* Channel not initialised */ @@ -757,7 +755,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -768,7 +766,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnConfigInitTTLIO | +| Function Name : int i_APCI3XXX_InsnConfigInitTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -778,8 +776,8 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, | for you call any other function witch access of TTL. | | APCI3XXX_TTL_INIT_DIRECTION_PORT2(user inputs for direction)| +----------------------------------------------------------------------------+ -| Input Parameters : b_InitType = (BYTE) data[0]; | -| b_Port2Mode = (BYTE) data[1]; | +| Input Parameters : b_InitType = (unsigned char) data[0]; | +| b_Port2Mode = (unsigned char) data[1]; | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -791,11 +789,11 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_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; + int i_ReturnValue = insn->n; + unsigned char b_Command = 0; /************************/ /* Test the buffer size */ @@ -806,7 +804,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, /* Get the command */ /* **************** */ - b_Command = (BYTE) data[0]; + b_Command = (unsigned char) data[0]; /********************/ /* Test the command */ @@ -888,7 +886,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, } } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -899,7 +897,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnBitsTTLIO | +| Function Name : int i_APCI3XXX_InsnBitsTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -919,14 +917,14 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - BYTE b_ChannelCpt = 0; - DWORD dw_ChannelMask = 0; - DWORD dw_BitMask = 0; - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_ChannelCpt = 0; + unsigned int dw_ChannelMask = 0; + unsigned int dw_BitMask = 0; + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ @@ -1051,12 +1049,12 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnReadTTLIO | +| Function Name : int i_APCI3XXX_InsnReadTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -1074,11 +1072,11 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); - INT i_ReturnValue = insn->n; + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + int i_ReturnValue = insn->n; unsigned int *pls_ReadData = data; /************************/ @@ -1157,7 +1155,7 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1168,7 +1166,7 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnWriteTTLIO | +| Function Name : int i_APCI3XXX_InsnWriteTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -1187,20 +1185,20 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); - BYTE b_State = 0; - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + unsigned char b_State = 0; + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ /************************/ if (insn->n >= 1) { - b_State = (BYTE) data[0]; + b_State = (unsigned char) data[0]; /***********************/ /* Test if read port 0 */ @@ -1269,7 +1267,7 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1298,12 +1296,12 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); - DWORD dw_Temp = 0; + int i_ReturnValue = insn->n; + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + unsigned int dw_Temp = 0; /***************************/ /* Test the channel number */ @@ -1334,7 +1332,7 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev, i_ReturnValue = -3; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1356,11 +1354,11 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - DWORD dw_Temp = 0; + int i_ReturnValue = insn->n; + unsigned int dw_Temp = 0; /************************/ /* Test the buffer size */ @@ -1378,7 +1376,7 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1409,14 +1407,14 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - BYTE b_ChannelCpt = 0; - DWORD dw_ChannelMask = 0; - DWORD dw_BitMask = 0; - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_ChannelCpt = 0; + unsigned int dw_ChannelMask = 0; + unsigned int dw_BitMask = 0; + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ @@ -1481,7 +1479,7 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1505,13 +1503,13 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - BYTE b_Channel = CR_CHAN(insn->chanspec); - BYTE b_State = 0; - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_Channel = CR_CHAN(insn->chanspec); + unsigned char b_State = 0; + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ @@ -1527,7 +1525,7 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev, /* Get the command */ /*******************/ - b_State = (BYTE) data[0]; + b_State = (unsigned char) data[0]; /********************************/ /* Read the digital output port */ @@ -1557,7 +1555,7 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1580,12 +1578,12 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device * dev, - struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) +int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = insn->n; - BYTE b_Channel = CR_CHAN(insn->chanspec); - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_Channel = CR_CHAN(insn->chanspec); + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ @@ -1622,7 +1620,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device * dev, i_ReturnValue = -101; } - return (i_ReturnValue); + return i_ReturnValue; } /* @@ -1638,7 +1636,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_Reset(struct comedi_device * dev) +int i_APCI3XXX_Reset(struct comedi_device *dev) { unsigned char b_Cpt = 0; |