Commit 843690b7 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi-data: remove devpriv macro

This macro relies on a local variable having a specific name.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 22201cea
...@@ -222,7 +222,7 @@ int i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, ...@@ -222,7 +222,7 @@ int i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s,
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
unsigned char b_TimerNbr; unsigned char b_TimerNbr;
...@@ -452,6 +452,7 @@ int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev, ...@@ -452,6 +452,7 @@ int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_DummyRead; unsigned int dw_DummyRead;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
...@@ -593,6 +594,7 @@ int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_sub ...@@ -593,6 +594,7 @@ 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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned char b_ModulNbr, b_ReadType; unsigned char b_ModulNbr, b_ReadType;
unsigned int *pul_TimerValueArray; unsigned int *pul_TimerValueArray;
...@@ -764,6 +766,7 @@ int i_APCI1710_ReadTimerValue(struct comedi_device *dev, ...@@ -764,6 +766,7 @@ int i_APCI1710_ReadTimerValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_TimerNbr, unsigned char b_ModulNbr, unsigned char b_TimerNbr,
unsigned int *pul_TimerValue) unsigned int *pul_TimerValue)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
/* Test the module number */ /* Test the module number */
...@@ -852,6 +855,7 @@ int i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev, ...@@ -852,6 +855,7 @@ int i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_TimerNbr, unsigned char b_ModulNbr, unsigned char b_TimerNbr,
unsigned char *pb_OutputLevel) unsigned char *pb_OutputLevel)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_TimerStatus; unsigned int dw_TimerStatus;
...@@ -931,6 +935,7 @@ int i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, ...@@ -931,6 +935,7 @@ int i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_TimerNbr, unsigned char b_ModulNbr, unsigned char b_TimerNbr,
unsigned char *pb_TimerStatus) unsigned char *pb_TimerStatus)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_TimerStatus; unsigned int dw_TimerStatus;
...@@ -1010,6 +1015,7 @@ int i_APCI1710_WriteTimerValue(struct comedi_device *dev, ...@@ -1010,6 +1015,7 @@ int i_APCI1710_WriteTimerValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_TimerNbr, unsigned char b_ModulNbr, unsigned char b_TimerNbr,
unsigned int ul_WriteValue) unsigned int ul_WriteValue)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
/* Test the module number */ /* Test the module number */
......
...@@ -134,6 +134,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -134,6 +134,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int ul_TimerValue = 0; unsigned int ul_TimerValue = 0;
unsigned int ul_TimingInterval = 0; unsigned int ul_TimingInterval = 0;
...@@ -843,6 +844,7 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | ...@@ -843,6 +844,7 @@ 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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned char b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action; unsigned char b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action;
b_ModulNbr = CR_AREF(insn->chanspec); b_ModulNbr = CR_AREF(insn->chanspec);
...@@ -1093,6 +1095,7 @@ struct comedi_insn *insn,unsigned int *data) | ...@@ -1093,6 +1095,7 @@ struct comedi_insn *insn,unsigned int *data) |
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_ReadType; unsigned char b_ReadType;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
...@@ -1197,6 +1200,7 @@ int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice ...@@ -1197,6 +1200,7 @@ int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice
int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev, int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_ChronoStatus) unsigned char b_ModulNbr, unsigned char *pb_ChronoStatus)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
...@@ -1359,6 +1363,7 @@ int i_APCI1710_ReadChronoValue(struct comedi_device *dev, ...@@ -1359,6 +1363,7 @@ int i_APCI1710_ReadChronoValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ModulNbr,
unsigned int ui_TimeOut, unsigned char *pb_ChronoStatus, unsigned int *pul_ChronoValue) unsigned int ui_TimeOut, unsigned char *pb_ChronoStatus, unsigned int *pul_ChronoValue)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
unsigned int dw_TimeOut = 0; unsigned int dw_TimeOut = 0;
...@@ -1626,6 +1631,7 @@ int i_APCI1710_ConvertChronoValue(struct comedi_device *dev, ...@@ -1626,6 +1631,7 @@ int i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
unsigned char *pb_Second, unsigned char *pb_Second,
unsigned int *pui_MilliSecond, unsigned int *pui_MicroSecond, unsigned int *pui_NanoSecond) unsigned int *pui_MilliSecond, unsigned int *pui_MicroSecond, unsigned int *pui_NanoSecond)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
double d_Hour; double d_Hour;
double d_Minute; double d_Minute;
...@@ -1878,6 +1884,7 @@ int i_APCI1710_ConvertChronoValue(struct comedi_device *dev, ...@@ -1878,6 +1884,7 @@ int i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned char b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType; unsigned char b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType;
unsigned int dw_Status; unsigned int dw_Status;
......
...@@ -102,6 +102,7 @@ Activates and deactivates the digital output memory. ...@@ -102,6 +102,7 @@ Activates and deactivates the digital output memory.
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_ModulNbr, b_ChannelAMode, b_ChannelBMode; unsigned char b_ModulNbr, b_ChannelAMode, b_ChannelBMode;
unsigned char b_MemoryOnOff, b_ConfigType; unsigned char b_MemoryOnOff, b_ConfigType;
int i_ReturnValue = 0; int i_ReturnValue = 0;
...@@ -296,6 +297,7 @@ int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subd ...@@ -296,6 +297,7 @@ int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subd
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_StatusReg; unsigned int dw_StatusReg;
unsigned char b_ModulNbr, b_InputChannel; unsigned char b_ModulNbr, b_InputChannel;
...@@ -484,6 +486,7 @@ int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev, ...@@ -484,6 +486,7 @@ int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_WriteValue = 0; unsigned int dw_WriteValue = 0;
unsigned char b_ModulNbr, b_OutputChannel; unsigned char b_ModulNbr, b_OutputChannel;
...@@ -734,6 +737,7 @@ int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev, ...@@ -734,6 +737,7 @@ int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_WriteValue = 0; unsigned int dw_WriteValue = 0;
unsigned int dw_StatusReg; unsigned int dw_StatusReg;
......
...@@ -126,9 +126,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -126,9 +126,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_IntRegister; unsigned int dw_IntRegister;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
unsigned char b_PulseEncoderNbr; unsigned char b_PulseEncoderNbr;
unsigned char b_InputLevelSelection; unsigned char b_InputLevelSelection;
...@@ -417,6 +417,7 @@ int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev, ...@@ -417,6 +417,7 @@ int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
unsigned char b_PulseEncoderNbr; unsigned char b_PulseEncoderNbr;
...@@ -711,6 +712,7 @@ int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev, ...@@ -711,6 +712,7 @@ int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_StatusRegister; unsigned int dw_StatusRegister;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
...@@ -837,6 +839,7 @@ int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev, ...@@ -837,6 +839,7 @@ int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
data[0] = devpriv->s_InterruptParameters. data[0] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv-> s_FIFOInterruptParameters[devpriv->
......
...@@ -188,6 +188,7 @@ int i_APCI1710_InitPWM(struct comedi_device *dev, ...@@ -188,6 +188,7 @@ int i_APCI1710_InitPWM(struct comedi_device *dev,
unsigned int ul_HighTiming, unsigned int ul_HighTiming,
unsigned int *pul_RealLowTiming, unsigned int *pul_RealHighTiming) unsigned int *pul_RealLowTiming, unsigned int *pul_RealHighTiming)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int ul_LowTimerValue = 0; unsigned int ul_LowTimerValue = 0;
unsigned int ul_HighTimerValue = 0; unsigned int ul_HighTimerValue = 0;
...@@ -1545,6 +1546,7 @@ int i_APCI1710_GetPWMInitialisation(struct comedi_device *dev, ...@@ -1545,6 +1546,7 @@ int i_APCI1710_GetPWMInitialisation(struct comedi_device *dev,
unsigned char *pb_StopLevel, unsigned char *pb_StopLevel,
unsigned char *pb_ExternGate, unsigned char *pb_InterruptEnable, unsigned char *pb_Enable) unsigned char *pb_ExternGate, unsigned char *pb_InterruptEnable, unsigned char *pb_Enable)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
unsigned int dw_Command; unsigned int dw_Command;
...@@ -1813,6 +1815,7 @@ int i_APCI1710_EnablePWM(struct comedi_device *dev, ...@@ -1813,6 +1815,7 @@ int i_APCI1710_EnablePWM(struct comedi_device *dev,
unsigned char b_StopMode, unsigned char b_StopMode,
unsigned char b_StopLevel, unsigned char b_ExternGate, unsigned char b_InterruptEnable) unsigned char b_StopLevel, unsigned char b_ExternGate, unsigned char b_InterruptEnable)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
unsigned int dw_Command; unsigned int dw_Command;
...@@ -2064,6 +2067,7 @@ int i_APCI1710_EnablePWM(struct comedi_device *dev, ...@@ -2064,6 +2067,7 @@ int i_APCI1710_EnablePWM(struct comedi_device *dev,
int i_APCI1710_DisablePWM(struct comedi_device *dev, unsigned char b_ModulNbr, unsigned char b_PWM) int i_APCI1710_DisablePWM(struct comedi_device *dev, unsigned char b_ModulNbr, unsigned char b_PWM)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
...@@ -2193,6 +2197,7 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev, ...@@ -2193,6 +2197,7 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ModulNbr,
unsigned char b_PWM, unsigned char b_TimingUnit, unsigned int ul_LowTiming, unsigned int ul_HighTiming) unsigned char b_PWM, unsigned char b_TimingUnit, unsigned int ul_LowTiming, unsigned int ul_HighTiming)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_ClockSelection; unsigned char b_ClockSelection;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int ul_LowTimerValue = 0; unsigned int ul_LowTimerValue = 0;
...@@ -3463,9 +3468,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev, ...@@ -3463,9 +3468,9 @@ int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev,
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
unsigned char b_PWM; unsigned char b_PWM;
unsigned char *pb_PWMOutputStatus; unsigned char *pb_PWMOutputStatus;
...@@ -3564,6 +3569,8 @@ int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_sub ...@@ -3564,6 +3569,8 @@ int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_sub
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
data[0] = devpriv->s_InterruptParameters. data[0] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv-> s_FIFOInterruptParameters[devpriv->
s_InterruptParameters.ui_Read].b_OldModuleMask; s_InterruptParameters.ui_Read].b_OldModuleMask;
......
...@@ -122,6 +122,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -122,6 +122,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int ui_TimerValue; unsigned int ui_TimerValue;
unsigned char b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength, unsigned char b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength,
...@@ -389,6 +390,7 @@ pul_Position = (unsigned int *) &data[0]; ...@@ -389,6 +390,7 @@ pul_Position = (unsigned int *) &data[0];
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned char b_Cpt; unsigned char b_Cpt;
unsigned char b_Length; unsigned char b_Length;
...@@ -722,6 +724,7 @@ int i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevi ...@@ -722,6 +724,7 @@ int i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevi
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_StatusReg; unsigned int dw_StatusReg;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
...@@ -729,6 +732,7 @@ int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_sub ...@@ -729,6 +732,7 @@ int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_sub
unsigned char *pb_ChannelStatus; unsigned char *pb_ChannelStatus;
unsigned char *pb_InputStatus; unsigned char *pb_InputStatus;
unsigned char b_IOType; unsigned char b_IOType;
i_ReturnValue = insn->n; i_ReturnValue = insn->n;
b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
b_IOType = (unsigned char) data[0]; b_IOType = (unsigned char) data[0];
......
...@@ -133,6 +133,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -133,6 +133,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int ul_TimerValue = 0; unsigned int ul_TimerValue = 0;
unsigned int dw_Command; unsigned int dw_Command;
...@@ -990,6 +991,7 @@ int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev, ...@@ -990,6 +991,7 @@ int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
unsigned int dw_DummyRead; unsigned int dw_DummyRead;
...@@ -1463,6 +1465,7 @@ int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev, ...@@ -1463,6 +1465,7 @@ int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
...@@ -1703,10 +1706,10 @@ int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev, ...@@ -1703,10 +1706,10 @@ int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev,
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_Status; unsigned int dw_Status;
unsigned int dw_TimeOut = 0; unsigned int dw_TimeOut = 0;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
unsigned char b_TorCounter; unsigned char b_TorCounter;
unsigned char b_ReadType; unsigned char b_ReadType;
......
...@@ -103,6 +103,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -103,6 +103,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
unsigned char b_InitType; unsigned char b_InitType;
...@@ -409,6 +410,7 @@ APCI1710_TTL_READCHANNEL ...@@ -409,6 +410,7 @@ APCI1710_TTL_READCHANNEL
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_StatusReg; unsigned int dw_StatusReg;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
...@@ -658,6 +660,7 @@ int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdev ...@@ -658,6 +660,7 @@ int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdev
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_StatusReg; unsigned int dw_StatusReg;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
...@@ -828,6 +831,7 @@ int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi ...@@ -828,6 +831,7 @@ int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0; int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0; unsigned int dw_StatusReg = 0;
unsigned char b_ModulNbr; unsigned char b_ModulNbr;
......
...@@ -76,7 +76,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -76,7 +76,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour
/* Update-0.7.57->0.7.68MODULE_DESCRIPTION("Comedi ADDI-DATA module"); */ /* 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_LICENSE("GPL"); */
#define devpriv ((struct addi_private *)dev->private)
#define this_board ((const struct addi_board *)dev->board_ptr) #define this_board ((const struct addi_board *)dev->board_ptr)
#if defined(CONFIG_APCI_1710) || defined(CONFIG_APCI_3200) || defined(CONFIG_APCI_3300) #if defined(CONFIG_APCI_1710) || defined(CONFIG_APCI_3200) || defined(CONFIG_APCI_3300)
...@@ -1472,6 +1471,7 @@ module_exit(driver_addi_cleanup_module); ...@@ -1472,6 +1471,7 @@ module_exit(driver_addi_cleanup_module);
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 addi_private *devpriv;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret, pages, i, n_subdevices; int ret, pages, i, n_subdevices;
unsigned int dw_Dummy; unsigned int dw_Dummy;
...@@ -1482,9 +1482,10 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1482,9 +1482,10 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
unsigned char pci_bus, pci_slot, pci_func; unsigned char pci_bus, pci_slot, pci_func;
int i_Dma = 0; int i_Dma = 0;
ret = alloc_private(dev, sizeof(struct addi_private)); ret = alloc_private(dev, sizeof(*devpriv));
if (ret < 0) if (ret)
return -ENOMEM; return ret;
devpriv = dev->private;
if (!pci_list_builded) { 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.. */
...@@ -1817,7 +1818,9 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1817,7 +1818,9 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
static void i_ADDI_Detach(struct comedi_device *dev) static void i_ADDI_Detach(struct comedi_device *dev)
{ {
if (dev->private) { struct addi_private *devpriv = dev->private;
if (devpriv) {
if (devpriv->b_ValidDriver) if (devpriv->b_ValidDriver)
i_ADDI_Reset(dev); i_ADDI_Reset(dev);
if (dev->irq) if (dev->irq)
...@@ -1923,6 +1926,7 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d) ...@@ -1923,6 +1926,7 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s, static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned short w_Data; unsigned short w_Data;
unsigned short w_Address; unsigned short w_Address;
w_Address = CR_CHAN(insn->chanspec); /* address to be read as 0,1,2,3...255 */ w_Address = CR_CHAN(insn->chanspec); /* address to be read as 0,1,2,3...255 */
......
...@@ -805,6 +805,7 @@ void v_EepromCs76Read(unsigned int dw_Address, unsigned short w_offset, unsigned ...@@ -805,6 +805,7 @@ void v_EepromCs76Read(unsigned int dw_Address, unsigned short w_offset, unsigned
int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress, int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, struct comedi_device *dev) char *pc_PCIChipInformation, struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
unsigned short w_Temp, i, w_Count = 0; unsigned short w_Temp, i, w_Count = 0;
unsigned int ui_Temp; unsigned int ui_Temp;
struct str_MainHeader s_MainHeader; struct str_MainHeader s_MainHeader;
......
...@@ -201,6 +201,7 @@ void v_APCI1710_Interrupt(int irq, void *d); ...@@ -201,6 +201,7 @@ void v_APCI1710_Interrupt(int irq, void *d);
int i_APCI1710_Reset(struct comedi_device *dev) int i_APCI1710_Reset(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
int ret; int ret;
unsigned int dw_Dummy; unsigned int dw_Dummy;
...@@ -250,6 +251,7 @@ int i_APCI1710_Reset(struct comedi_device *dev) ...@@ -250,6 +251,7 @@ int i_APCI1710_Reset(struct comedi_device *dev)
void v_APCI1710_Interrupt(int irq, void *d) void v_APCI1710_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned char b_ModuleCpt = 0; unsigned char b_ModuleCpt = 0;
unsigned char b_InterruptFlag = 0; unsigned char b_InterruptFlag = 0;
unsigned char b_PWMCpt = 0; unsigned char b_PWMCpt = 0;
......
...@@ -112,9 +112,11 @@ static int i_Flag = 1; ...@@ -112,9 +112,11 @@ static int i_Flag = 1;
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Status = 0; unsigned int ui_Status = 0;
unsigned int ui_Command = 0; unsigned int ui_Command = 0;
unsigned int ui_Mode = 0; unsigned int ui_Mode = 0;
i_Temp = 0; i_Temp = 0;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
devpriv->b_TimerSelectMode = data[0]; devpriv->b_TimerSelectMode = data[0];
...@@ -281,8 +283,10 @@ int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subde ...@@ -281,8 +283,10 @@ int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subde
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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Command = 0; unsigned int ui_Command = 0;
int i_Count = 0; int i_Count = 0;
if (data[0] == 1) { if (data[0] == 1) {
ui_Command = ui_Command =
inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
...@@ -396,7 +400,9 @@ int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev, ...@@ -396,7 +400,9 @@ int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev,
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Status = 0; /* Status register */ unsigned int ui_Status = 0; /* Status register */
i_WatchdogNbr = insn->unused[0]; i_WatchdogNbr = insn->unused[0];
/******************/ /******************/
...@@ -456,6 +462,8 @@ int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevi ...@@ -456,6 +462,8 @@ int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevi
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
outl(0x200 | 0, devpriv->iobase + 128 + 0x4); outl(0x200 | 0, devpriv->iobase + 128 + 0x4);
outl(0, devpriv->iobase + 128 + 0); outl(0, devpriv->iobase + 128 + 0);
...@@ -493,7 +501,9 @@ int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevi ...@@ -493,7 +501,9 @@ int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevi
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_CommandRegister = 0; unsigned int ui_CommandRegister = 0;
/******************/ /******************/
/* Set the start */ /* Set the start */
/******************/ /******************/
...@@ -527,7 +537,9 @@ int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice ...@@ -527,7 +537,9 @@ int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice
*/ */
int i_APCI035_Reset(struct comedi_device *dev) int i_APCI035_Reset(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
int i_Count = 0; int i_Count = 0;
for (i_Count = 1; i_Count <= 4; i_Count++) { for (i_Count = 1; i_Count <= 4; i_Count++) {
i_WatchdogNbr = 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 */
...@@ -557,11 +569,13 @@ int i_APCI035_Reset(struct comedi_device *dev) ...@@ -557,11 +569,13 @@ int i_APCI035_Reset(struct comedi_device *dev)
static void v_APCI035_Interrupt(int irq, void *d) static void v_APCI035_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned int ui_StatusRegister1 = 0; unsigned int ui_StatusRegister1 = 0;
unsigned int ui_StatusRegister2 = 0; unsigned int ui_StatusRegister2 = 0;
unsigned int ui_ReadCommand = 0; unsigned int ui_ReadCommand = 0;
unsigned int ui_ChannelNumber = 0; unsigned int ui_ChannelNumber = 0;
unsigned int ui_DigitalTemperature = 0; unsigned int ui_DigitalTemperature = 0;
if (i_Temp == 1) { if (i_Temp == 1) {
i_WatchdogNbr = i_Flag; i_WatchdogNbr = i_Flag;
i_Flag = i_Flag + 1; i_Flag = i_Flag + 1;
......
...@@ -87,10 +87,11 @@ static unsigned int ui_InterruptStatus; ...@@ -87,10 +87,11 @@ static unsigned int ui_InterruptStatus;
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue; unsigned int ui_TmpValue;
unsigned int ul_Command1 = 0; unsigned int ul_Command1 = 0;
unsigned int ul_Command2 = 0; unsigned int ul_Command2 = 0;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
/*******************************/ /*******************************/
...@@ -147,9 +148,11 @@ int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subde ...@@ -147,9 +148,11 @@ int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subde
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue = 0; unsigned int ui_TmpValue = 0;
unsigned int ui_Channel; unsigned int ui_Channel;
ui_Channel = CR_CHAN(insn->chanspec); ui_Channel = CR_CHAN(insn->chanspec);
if (ui_Channel <= 31) { if (ui_Channel <= 31) {
ui_TmpValue = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP); ui_TmpValue = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP);
/* /*
...@@ -188,6 +191,7 @@ int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev ...@@ -188,6 +191,7 @@ int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[0]; unsigned int ui_PortValue = data[0];
unsigned int ui_Mask = 0; unsigned int ui_Mask = 0;
unsigned int ui_NoOfChannels; unsigned int ui_NoOfChannels;
...@@ -248,8 +252,9 @@ int i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub ...@@ -248,8 +252,9 @@ int i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub
static void v_APCI1032_Interrupt(int irq, void *d) static void v_APCI1032_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
/* disable the interrupt */ /* disable the interrupt */
ui_Temp = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); ui_Temp = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
outl(ui_Temp & APCI1032_DIGITAL_IP_INTERRUPT_DISABLE, outl(ui_Temp & APCI1032_DIGITAL_IP_INTERRUPT_DISABLE,
...@@ -279,6 +284,8 @@ static void v_APCI1032_Interrupt(int irq, void *d) ...@@ -279,6 +284,8 @@ 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)
{ {
struct addi_private *devpriv = dev->private;
outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); /* disable the interrupts */ outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); /* disable the interrupts */
inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS); /* Reset the interrupt status register */ 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_MODE1); /* Disable the and/or interrupt */
......
...@@ -141,6 +141,7 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, ...@@ -141,6 +141,7 @@ static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0; int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0;
int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0; int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0;
int i_PatternTransitionCount = 0, i_RegValue; int i_PatternTransitionCount = 0, i_RegValue;
...@@ -525,8 +526,10 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, ...@@ -525,8 +526,10 @@ static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_Event1InterruptStatus = 0, i_Event2InterruptStatus = int i_Event1InterruptStatus = 0, i_Event2InterruptStatus =
0, i_RegValue; 0, i_RegValue;
switch (data[0]) { switch (data[0]) {
case START: case START:
/*************************/ /*************************/
...@@ -792,7 +795,9 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev, ...@@ -792,7 +795,9 @@ static int i_APCI1500_Initialisation(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_DummyRead = 0; int i_DummyRead = 0;
/******************/ /******************/
/* Software reset */ /* Software reset */
/******************/ /******************/
...@@ -966,6 +971,7 @@ static int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, ...@@ -966,6 +971,7 @@ static int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[1]; unsigned int ui_PortValue = data[1];
unsigned int ui_Mask = 0; unsigned int ui_Mask = 0;
unsigned int ui_Channel; unsigned int ui_Channel;
...@@ -1051,6 +1057,8 @@ static int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *de ...@@ -1051,6 +1057,8 @@ static int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *de
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
devpriv->b_OutputMemoryStatus = data[0]; devpriv->b_OutputMemoryStatus = data[0];
return insn->n; return insn->n;
} }
...@@ -1079,9 +1087,9 @@ static int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, ...@@ -1079,9 +1087,9 @@ static int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
static unsigned int ui_Temp = 0; static unsigned int ui_Temp = 0;
unsigned int ui_Temp1; unsigned int ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
if (!devpriv->b_OutputMemoryStatus) { if (!devpriv->b_OutputMemoryStatus) {
...@@ -1274,6 +1282,7 @@ static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, ...@@ -1274,6 +1282,7 @@ static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_TimerCounterMode, i_MasterConfiguration; int i_TimerCounterMode, i_MasterConfiguration;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
...@@ -1875,6 +1884,7 @@ static int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device ...@@ -1875,6 +1884,7 @@ static int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_CommandAndStatusValue; int i_CommandAndStatusValue;
switch (data[0]) { switch (data[0]) {
...@@ -2198,7 +2208,9 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, ...@@ -2198,7 +2208,9 @@ static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_CommandAndStatusValue; int i_CommandAndStatusValue;
switch (data[0]) { switch (data[0]) {
case COUNTER1: case COUNTER1:
/* Read counter/timer1 */ /* Read counter/timer1 */
...@@ -2421,9 +2433,11 @@ static int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev, ...@@ -2421,9 +2433,11 @@ static int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Status; unsigned int ui_Status;
int i_RegValue; int i_RegValue;
int i_Constant; int i_Constant;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
outl(0x0, devpriv->i_IobaseAmcc + 0x38); outl(0x0, devpriv->i_IobaseAmcc + 0x38);
if (data[0] == 1) { if (data[0] == 1) {
...@@ -2597,6 +2611,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) ...@@ -2597,6 +2611,7 @@ static void v_APCI1500_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned int ui_InterruptStatus = 0; unsigned int ui_InterruptStatus = 0;
int i_RegValue = 0; int i_RegValue = 0;
i_InterruptMask = 0; i_InterruptMask = 0;
...@@ -2840,7 +2855,9 @@ static void v_APCI1500_Interrupt(int irq, void *d) ...@@ -2840,7 +2855,9 @@ static void v_APCI1500_Interrupt(int irq, void *d)
*/ */
static int i_APCI1500_Reset(struct comedi_device *dev) static int i_APCI1500_Reset(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
int i_DummyRead = 0; int i_DummyRead = 0;
i_TimerCounter1Init = 0; i_TimerCounter1Init = 0;
i_TimerCounter2Init = 0; i_TimerCounter2Init = 0;
i_WatchdogCounter3Init = 0; i_WatchdogCounter3Init = 0;
......
...@@ -76,8 +76,10 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -76,8 +76,10 @@ You should also find the complete GPL in the COPYING file accompanying this sour
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue = 0; unsigned int ui_TmpValue = 0;
unsigned int ui_Channel; unsigned int ui_Channel;
ui_Channel = CR_CHAN(insn->chanspec); ui_Channel = CR_CHAN(insn->chanspec);
if (ui_Channel <= 7) { if (ui_Channel <= 7) {
ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP); ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP);
...@@ -117,7 +119,7 @@ int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev ...@@ -117,7 +119,7 @@ int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev
int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[0]; unsigned int ui_PortValue = data[0];
unsigned int ui_Mask = 0; unsigned int ui_Mask = 0;
unsigned int ui_NoOfChannels; unsigned int ui_NoOfChannels;
...@@ -174,6 +176,8 @@ int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub ...@@ -174,6 +176,8 @@ int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub
int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
devpriv->b_OutputMemoryStatus = data[0]; devpriv->b_OutputMemoryStatus = data[0];
return insn->n; return insn->n;
} }
...@@ -202,6 +206,7 @@ int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd ...@@ -202,6 +206,7 @@ int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1; unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
...@@ -363,8 +368,10 @@ int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -363,8 +368,10 @@ int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
ui_Temp = data[0]; ui_Temp = data[0];
*data = inw(devpriv->iobase + APCI1516_DIGITAL_OP_RW); *data = inw(devpriv->iobase + APCI1516_DIGITAL_OP_RW);
if (ui_Temp == 0) { if (ui_Temp == 0) {
...@@ -422,6 +429,8 @@ int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -422,6 +429,8 @@ int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev
int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if (data[0] == 0) { if (data[0] == 0) {
/* Disable the watchdog */ /* Disable the watchdog */
outw(0x0, outw(0x0,
...@@ -468,6 +477,8 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice ...@@ -468,6 +477,8 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice
int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
switch (data[0]) { switch (data[0]) {
case 0: /* stop the watchdog */ case 0: /* stop the watchdog */
outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */
...@@ -513,6 +524,8 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s ...@@ -513,6 +524,8 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s
int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WATCHDOG_STATUS) & 0x1; data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WATCHDOG_STATUS) & 0x1;
return insn->n; return insn->n;
} }
...@@ -534,6 +547,8 @@ int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice * ...@@ -534,6 +547,8 @@ 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)
{ {
struct addi_private *devpriv = dev->private;
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_ENABLEDISABLE);
outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE); outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE);
......
...@@ -89,6 +89,8 @@ static unsigned int ui_InterruptData, ui_Type; ...@@ -89,6 +89,8 @@ static unsigned int ui_InterruptData, ui_Type;
int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
/*******************************/ /*******************************/
/* Set the digital input logic */ /* Set the digital input logic */
...@@ -150,6 +152,7 @@ int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subde ...@@ -150,6 +152,7 @@ int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subde
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue = 0; unsigned int ui_TmpValue = 0;
unsigned int ui_Channel; unsigned int ui_Channel;
...@@ -192,6 +195,7 @@ int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev ...@@ -192,6 +195,7 @@ int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[0]; unsigned int ui_PortValue = data[0];
unsigned int ui_Mask = 0; unsigned int ui_Mask = 0;
unsigned int ui_NoOfChannels; unsigned int ui_NoOfChannels;
...@@ -260,6 +264,7 @@ int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub ...@@ -260,6 +264,7 @@ int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub
int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ul_Command = 0; unsigned int ul_Command = 0;
if ((data[0] != 0) && (data[0] != 1)) { if ((data[0] != 0) && (data[0] != 1)) {
...@@ -317,6 +322,7 @@ int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd ...@@ -317,6 +322,7 @@ int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1; unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel; unsigned int ui_NoOfChannel;
...@@ -491,6 +497,7 @@ int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde ...@@ -491,6 +497,7 @@ int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
unsigned int ui_NoOfChannel; unsigned int ui_NoOfChannel;
...@@ -569,7 +576,9 @@ int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -569,7 +576,9 @@ int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev
int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev, int i_APCI1564_ConfigTimerCounterWatchdog(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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0; unsigned int ul_Command1 = 0;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
if (data[0] == ADDIDATA_WATCHDOG) { if (data[0] == ADDIDATA_WATCHDOG) {
devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG; devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG;
...@@ -723,7 +732,9 @@ int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev, ...@@ -723,7 +732,9 @@ int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, int i_APCI1564_StartStopWriteTimerCounterWatchdog(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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0; unsigned int ul_Command1 = 0;
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
switch (data[1]) { switch (data[1]) {
case 0: /* stop the watchdog */ case 0: /* stop the watchdog */
...@@ -818,6 +829,7 @@ int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, ...@@ -818,6 +829,7 @@ int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev, int i_APCI1564_ReadTimerCounterWatchdog(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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0; unsigned int ul_Command1 = 0;
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
...@@ -921,10 +933,12 @@ int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subd ...@@ -921,10 +933,12 @@ int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subd
static void v_APCI1564_Interrupt(int irq, void *d) static void v_APCI1564_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned int ui_DO, ui_DI; unsigned int ui_DO, ui_DI;
unsigned int ui_Timer; unsigned int ui_Timer;
unsigned int ui_C1, ui_C2, ui_C3, ui_C4; unsigned int ui_C1, ui_C2, ui_C3, ui_C4;
unsigned int ul_Command2 = 0; unsigned int ul_Command2 = 0;
ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
APCI1564_DIGITAL_IP_IRQ) & 0x01; APCI1564_DIGITAL_IP_IRQ) & 0x01;
ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
...@@ -1106,6 +1120,8 @@ static void v_APCI1564_Interrupt(int irq, void *d) ...@@ -1106,6 +1120,8 @@ 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)
{ {
struct addi_private *devpriv = dev->private;
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_IRQ); /* disable the interrupts */ 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 */ 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_MODE1); /* Disable the and/or interrupt */
......
...@@ -93,6 +93,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -93,6 +93,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour
int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, int i_APCI16XX_InsnConfigInitTTLIO(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)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Command = 0; unsigned char b_Command = 0;
unsigned char b_Cpt = 0; unsigned char b_Cpt = 0;
...@@ -286,6 +287,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -286,6 +287,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, int i_APCI16XX_InsnBitsReadTTLIO(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)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Command = 0; unsigned char b_Command = 0;
unsigned char b_NumberOfPort = unsigned char b_NumberOfPort =
...@@ -433,6 +435,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, ...@@ -433,6 +435,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev,
int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, int i_APCI16XX_InsnReadTTLIOAllPortValue(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)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_Command = (unsigned char) CR_AREF(insn->chanspec); unsigned char b_Command = (unsigned char) CR_AREF(insn->chanspec);
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Cpt = 0; unsigned char b_Cpt = 0;
...@@ -573,6 +576,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, ...@@ -573,6 +576,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, int i_APCI16XX_InsnBitsWriteTTLIO(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)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Command = 0; unsigned char b_Command = 0;
unsigned char b_NumberOfPort = unsigned char b_NumberOfPort =
......
...@@ -78,6 +78,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -78,6 +78,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour
int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if ((data[0] != 0) && (data[0] != 1)) { if ((data[0] != 0) && (data[0] != 1)) {
comedi_error(dev, comedi_error(dev,
"Not a valid Data !!! ,Data should be 1 or 0\n"); "Not a valid Data !!! ,Data should be 1 or 0\n");
...@@ -114,8 +116,10 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd ...@@ -114,8 +116,10 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd
int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_NoOfChannel; unsigned int ui_NoOfChannel;
unsigned int ui_Temp, ui_Temp1; unsigned int ui_Temp, ui_Temp1;
ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_NoOfChannel = CR_CHAN(insn->chanspec);
if (ui_NoOfChannel > 15) { if (ui_NoOfChannel > 15) {
comedi_error(dev, comedi_error(dev,
...@@ -269,8 +273,10 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde ...@@ -269,8 +273,10 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde
int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
unsigned int ui_NoOfChannel; unsigned int ui_NoOfChannel;
ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_NoOfChannel = CR_CHAN(insn->chanspec);
if (ui_NoOfChannel > 15) { if (ui_NoOfChannel > 15) {
comedi_error(dev, comedi_error(dev,
...@@ -340,6 +346,7 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -340,6 +346,7 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdev
int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if (data[0] == 0) { if (data[0] == 0) {
/* Disable the watchdog */ /* Disable the watchdog */
...@@ -383,6 +390,7 @@ int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice ...@@ -383,6 +390,7 @@ int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice
int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
switch (data[0]) { switch (data[0]) {
case 0: /* stop the watchdog */ case 0: /* stop the watchdog */
...@@ -430,6 +438,8 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s ...@@ -430,6 +438,8 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s
int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
udelay(5); udelay(5);
data[0] = inw(devpriv->i_IobaseAddon + APCI2016_WATCHDOG_STATUS) & 0x1; data[0] = inw(devpriv->i_IobaseAddon + APCI2016_WATCHDOG_STATUS) & 0x1;
return insn->n; return insn->n;
...@@ -452,6 +462,8 @@ int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice * ...@@ -452,6 +462,8 @@ 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)
{ {
struct addi_private *devpriv = dev->private;
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_ENABLEDISABLE);
outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE); outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE);
......
...@@ -82,7 +82,9 @@ static unsigned int ui_InterruptData, ui_Type; ...@@ -82,7 +82,9 @@ static unsigned int ui_InterruptData, ui_Type;
int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ul_Command = 0; unsigned int ul_Command = 0;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
if ((data[0] != 0) && (data[0] != 1)) { if ((data[0] != 0) && (data[0] != 1)) {
...@@ -137,8 +139,10 @@ int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd ...@@ -137,8 +139,10 @@ int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1; unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
if (devpriv->b_OutputMemoryStatus) { if (devpriv->b_OutputMemoryStatus) {
ui_Temp = inl(devpriv->iobase + APCI2032_DIGITAL_OP); ui_Temp = inl(devpriv->iobase + APCI2032_DIGITAL_OP);
...@@ -316,8 +320,10 @@ int i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde ...@@ -316,8 +320,10 @@ int i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
unsigned int ui_NoOfChannel; unsigned int ui_NoOfChannel;
ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0]; ui_Temp = data[0];
*data = inl(devpriv->iobase + APCI2032_DIGITAL_OP_RW); *data = inl(devpriv->iobase + APCI2032_DIGITAL_OP_RW);
...@@ -383,6 +389,8 @@ int i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -383,6 +389,8 @@ int i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev
int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if (data[0] == 0) { if (data[0] == 0) {
/* Disable the watchdog */ /* Disable the watchdog */
outl(0x0, outl(0x0,
...@@ -424,6 +432,8 @@ int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice ...@@ -424,6 +432,8 @@ int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice
int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
switch (data[0]) { switch (data[0]) {
case 0: /* stop the watchdog */ case 0: /* stop the watchdog */
outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); /* disable the watchdog */ outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); /* disable the watchdog */
...@@ -469,6 +479,7 @@ int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s ...@@ -469,6 +479,7 @@ int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s
int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
data[0] = data[0] =
inl(devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + inl(devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
...@@ -496,6 +507,7 @@ int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice * ...@@ -496,6 +507,7 @@ int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *
void v_APCI2032_Interrupt(int irq, void *d) void v_APCI2032_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned int ui_DO; unsigned int ui_DO;
ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; /* Check if VCC OR CC interrupt has occurred. */ ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; /* Check if VCC OR CC interrupt has occurred. */
...@@ -569,6 +581,8 @@ int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subd ...@@ -569,6 +581,8 @@ int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subd
int i_APCI2032_Reset(struct comedi_device *dev) int i_APCI2032_Reset(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
devpriv->b_DigitalOutputRegister = 0; devpriv->b_DigitalOutputRegister = 0;
ui_Type = 0; ui_Type = 0;
outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP); /* Resets the output channels */ outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP); /* Resets the output channels */
......
...@@ -76,8 +76,10 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -76,8 +76,10 @@ You should also find the complete GPL in the COPYING file accompanying this sour
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue = 0; unsigned int ui_TmpValue = 0;
unsigned int ui_Channel; unsigned int ui_Channel;
ui_Channel = CR_CHAN(insn->chanspec); ui_Channel = CR_CHAN(insn->chanspec);
if (ui_Channel <= 7) { if (ui_Channel <= 7) {
ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP); ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP);
...@@ -115,7 +117,7 @@ int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev ...@@ -115,7 +117,7 @@ int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev
int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[0]; unsigned int ui_PortValue = data[0];
unsigned int ui_Mask = 0; unsigned int ui_Mask = 0;
unsigned int ui_NoOfChannels; unsigned int ui_NoOfChannels;
...@@ -172,6 +174,8 @@ int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub ...@@ -172,6 +174,8 @@ int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub
int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
devpriv->b_OutputMemoryStatus = data[0]; devpriv->b_OutputMemoryStatus = data[0];
return insn->n; return insn->n;
} }
...@@ -200,8 +204,10 @@ int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd ...@@ -200,8 +204,10 @@ int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1; unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
if (devpriv->b_OutputMemoryStatus) { if (devpriv->b_OutputMemoryStatus) {
ui_Temp = inw(devpriv->iobase + APCI2200_DIGITAL_OP); ui_Temp = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
...@@ -357,9 +363,10 @@ int i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde ...@@ -357,9 +363,10 @@ int i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
ui_Temp = data[0]; ui_Temp = data[0];
*data = inw(devpriv->iobase + APCI2200_DIGITAL_OP); *data = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
if (ui_Temp == 0) { if (ui_Temp == 0) {
...@@ -421,6 +428,8 @@ int i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -421,6 +428,8 @@ int i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev
int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if (data[0] == 0) { if (data[0] == 0) {
/* Disable the watchdog */ /* Disable the watchdog */
outw(0x0, outw(0x0,
...@@ -467,6 +476,8 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice ...@@ -467,6 +476,8 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice
int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
switch (data[0]) { switch (data[0]) {
case 0: /* stop the watchdog */ case 0: /* stop the watchdog */
outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */
...@@ -512,6 +523,8 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s ...@@ -512,6 +523,8 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s
int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
data[0] = data[0] =
inw(devpriv->iobase + APCI2200_WATCHDOG + inw(devpriv->iobase + APCI2200_WATCHDOG +
APCI2200_WATCHDOG_STATUS) & 0x1; APCI2200_WATCHDOG_STATUS) & 0x1;
...@@ -535,6 +548,8 @@ int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice * ...@@ -535,6 +548,8 @@ 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)
{ {
struct addi_private *devpriv = dev->private;
outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP); /* RESETS THE DIGITAL OUTPUTS */ outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP); /* RESETS THE DIGITAL OUTPUTS */
outw(0x0, outw(0x0,
devpriv->iobase + APCI2200_WATCHDOG + devpriv->iobase + APCI2200_WATCHDOG +
......
...@@ -77,6 +77,7 @@ static unsigned int ui_Temp; ...@@ -77,6 +77,7 @@ static unsigned int ui_Temp;
int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int i; unsigned int i;
if ((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE)) if ((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE))
...@@ -146,6 +147,7 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_su ...@@ -146,6 +147,7 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_su
int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned short us_ConvertTiming, us_TmpValue, i; unsigned short us_ConvertTiming, us_TmpValue, i;
unsigned char b_Tmp; unsigned char b_Tmp;
...@@ -407,6 +409,8 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd ...@@ -407,6 +409,8 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd
int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s) int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
struct addi_private *devpriv = dev->private;
/* Disable A2P Fifo write and AMWEN signal */ /* Disable A2P Fifo write and AMWEN signal */
outw(0, devpriv->i_IobaseAddon + 4); outw(0, devpriv->i_IobaseAddon + 4);
...@@ -478,6 +482,7 @@ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_su ...@@ -478,6 +482,7 @@ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_su
int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_cmd *cmd) struct comedi_cmd *cmd)
{ {
struct addi_private *devpriv = dev->private;
int err = 0; int err = 0;
/* Step 1 : check if triggers are trivially valid */ /* Step 1 : check if triggers are trivially valid */
...@@ -604,6 +609,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_s ...@@ -604,6 +609,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_s
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 addi_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
/* loading private structure with cmd structure inputs */ /* loading private structure with cmd structure inputs */
...@@ -678,6 +684,7 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subde ...@@ -678,6 +684,7 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subde
int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev, int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
struct comedi_subdevice *s) struct comedi_subdevice *s)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_Tmp; unsigned char b_Tmp;
unsigned int ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 = unsigned int ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 =
0, dmalen1 = 0, ui_TimerValue2 = 0, dmalen1 = 0, ui_TimerValue2 =
...@@ -1211,6 +1218,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev, ...@@ -1211,6 +1218,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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int i; unsigned int i;
unsigned short us_TmpValue; unsigned short us_TmpValue;
...@@ -1292,6 +1300,7 @@ int i_APCI3120_Reset(struct comedi_device *dev) ...@@ -1292,6 +1300,7 @@ 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) int n_chan, unsigned int *chanlist, char check)
{ {
struct addi_private *devpriv = dev->private;
unsigned int i; /* , differencial=0, bipolar=0; */ unsigned int i; /* , differencial=0, bipolar=0; */
unsigned int gain; unsigned int gain;
unsigned short us_TmpValue; unsigned short us_TmpValue;
...@@ -1354,6 +1363,7 @@ int i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevi ...@@ -1354,6 +1363,7 @@ int i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevi
int i_APCI3120_ExttrigEnable(struct comedi_device *dev) int i_APCI3120_ExttrigEnable(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
devpriv->us_OutputRegister |= APCI3120_ENABLE_EXT_TRIGGER; devpriv->us_OutputRegister |= APCI3120_ENABLE_EXT_TRIGGER;
outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
...@@ -1379,6 +1389,8 @@ int i_APCI3120_ExttrigEnable(struct comedi_device *dev) ...@@ -1379,6 +1389,8 @@ int i_APCI3120_ExttrigEnable(struct comedi_device *dev)
int i_APCI3120_ExttrigDisable(struct comedi_device *dev) int i_APCI3120_ExttrigDisable(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
devpriv->us_OutputRegister &= ~APCI3120_ENABLE_EXT_TRIGGER; devpriv->us_OutputRegister &= ~APCI3120_ENABLE_EXT_TRIGGER;
outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
return 0; return 0;
...@@ -1414,13 +1426,13 @@ int i_APCI3120_ExttrigDisable(struct comedi_device *dev) ...@@ -1414,13 +1426,13 @@ int i_APCI3120_ExttrigDisable(struct comedi_device *dev)
void v_APCI3120_Interrupt(int irq, void *d) void v_APCI3120_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned short int_daq; unsigned short int_daq;
unsigned int int_amcc, ui_Check, i; unsigned int int_amcc, ui_Check, i;
unsigned short us_TmpValue; unsigned short us_TmpValue;
unsigned char b_DummyRead; unsigned char b_DummyRead;
struct comedi_subdevice *s = &dev->subdevices[0]; struct comedi_subdevice *s = &dev->subdevices[0];
ui_Check = 1; ui_Check = 1;
int_daq = inw(dev->iobase + APCI3120_RD_STATUS) & 0xf000; /* get IRQ reasons */ int_daq = inw(dev->iobase + APCI3120_RD_STATUS) & 0xf000; /* get IRQ reasons */
...@@ -1624,6 +1636,7 @@ void v_APCI3120_Interrupt(int irq, void *d) ...@@ -1624,6 +1636,7 @@ void v_APCI3120_Interrupt(int irq, void *d)
int i_APCI3120_InterruptHandleEos(struct comedi_device *dev) int i_APCI3120_InterruptHandleEos(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
int n_chan, i; int n_chan, i;
struct comedi_subdevice *s = &dev->subdevices[0]; struct comedi_subdevice *s = &dev->subdevices[0];
int err = 1; int err = 1;
...@@ -1667,11 +1680,12 @@ int i_APCI3120_InterruptHandleEos(struct comedi_device *dev) ...@@ -1667,11 +1680,12 @@ int i_APCI3120_InterruptHandleEos(struct comedi_device *dev)
void v_APCI3120_InterruptDma(int irq, void *d) void v_APCI3120_InterruptDma(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
struct comedi_subdevice *s = &dev->subdevices[0]; struct comedi_subdevice *s = &dev->subdevices[0];
unsigned int next_dma_buf, samplesinbuf; unsigned int next_dma_buf, samplesinbuf;
unsigned long low_word, high_word, var; unsigned long low_word, high_word, var;
unsigned int ui_Tmp; unsigned int ui_Tmp;
samplesinbuf = samplesinbuf =
devpriv->ui_DmaBufferUsesize[devpriv->ui_DmaActualBuffer] - devpriv->ui_DmaBufferUsesize[devpriv->ui_DmaActualBuffer] -
inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_MWTC); inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_MWTC);
...@@ -1837,6 +1851,8 @@ void v_APCI3120_InterruptDma(int irq, void *d) ...@@ -1837,6 +1851,8 @@ void v_APCI3120_InterruptDma(int irq, void *d)
void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
struct comedi_subdevice *s, short *dma_buffer, unsigned int num_samples) struct comedi_subdevice *s, short *dma_buffer, unsigned int num_samples)
{ {
struct addi_private *devpriv = dev->private;
devpriv->ui_AiActualScan += devpriv->ui_AiActualScan +=
(s->async->cur_chan + num_samples) / devpriv->ui_AiScanLength; (s->async->cur_chan + num_samples) / devpriv->ui_AiScanLength;
s->async->cur_chan += num_samples; s->async->cur_chan += num_samples;
...@@ -1879,7 +1895,7 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, ...@@ -1879,7 +1895,7 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Timervalue2; unsigned int ui_Timervalue2;
unsigned short us_TmpValue; unsigned short us_TmpValue;
unsigned char b_Tmp; unsigned char b_Tmp;
...@@ -2037,7 +2053,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevic ...@@ -2037,7 +2053,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevic
int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Timervalue2 = 0; unsigned int ui_Timervalue2 = 0;
unsigned short us_TmpValue; unsigned short us_TmpValue;
unsigned char b_Tmp; unsigned char b_Tmp;
...@@ -2221,6 +2237,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice ...@@ -2221,6 +2237,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice
int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_Tmp; unsigned char b_Tmp;
unsigned short us_TmpValue, us_TmpValue_2, us_StatusValue; unsigned short us_TmpValue, us_TmpValue_2, us_StatusValue;
...@@ -2296,6 +2313,7 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, ...@@ -2296,6 +2313,7 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int 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 */
...@@ -2340,7 +2358,9 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, ...@@ -2340,7 +2358,9 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev,
int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue; unsigned int ui_TmpValue;
ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS); ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS);
/***** state of 4 channels in the 11, 10, 9, 8 bits of status reg /***** 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 rotated right 8 times to bring them to last four bits
...@@ -2379,6 +2399,7 @@ int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_sub ...@@ -2379,6 +2399,7 @@ int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_sub
int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device *dev, int i_APCI3120_InsnConfigDigitalOutput(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)
{ {
struct addi_private *devpriv = dev->private;
if ((data[0] != 0) && (data[0] != 1)) { if ((data[0] != 0) && (data[0] != 1)) {
comedi_error(dev, comedi_error(dev,
...@@ -2426,6 +2447,8 @@ int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device *dev, ...@@ -2426,6 +2447,8 @@ int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if ((data[0] > devpriv->s_EeParameters.i_DoMaxdata) || (data[0] < 0)) { if ((data[0] > devpriv->s_EeParameters.i_DoMaxdata) || (data[0] < 0)) {
comedi_error(dev, "Data is not valid !!! \n"); comedi_error(dev, "Data is not valid !!! \n");
...@@ -2479,9 +2502,8 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, ...@@ -2479,9 +2502,8 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp1; unsigned int ui_Temp1;
unsigned int 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)) { if ((data[0] != 0) && (data[0] != 1)) {
...@@ -2558,6 +2580,7 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, ...@@ -2558,6 +2580,7 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Range, ui_Channel; unsigned int ui_Range, ui_Channel;
unsigned short us_TmpValue; unsigned short us_TmpValue;
......
...@@ -548,8 +548,10 @@ int i_APCI3200_GetChannelCalibrationValue(struct comedi_device *dev, ...@@ -548,8 +548,10 @@ int i_APCI3200_GetChannelCalibrationValue(struct comedi_device *dev,
int i_APCI3200_ReadDigitalInput(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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp = 0; unsigned int ui_Temp = 0;
unsigned int ui_NoOfChannel = 0; unsigned int ui_NoOfChannel = 0;
ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0]; ui_Temp = data[0];
*data = inl(devpriv->i_IobaseReserved); *data = inl(devpriv->i_IobaseReserved);
...@@ -606,6 +608,7 @@ int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevi ...@@ -606,6 +608,7 @@ int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevi
int i_APCI3200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if ((data[0] != 0) && (data[0] != 1)) { if ((data[0] != 0) && (data[0] != 1)) {
comedi_error(dev, comedi_error(dev,
...@@ -651,8 +654,10 @@ int i_APCI3200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd ...@@ -651,8 +654,10 @@ int i_APCI3200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd
int i_APCI3200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp = 0, ui_Temp1 = 0; unsigned int ui_Temp = 0, ui_Temp1 = 0;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
if (devpriv->b_OutputMemoryStatus) { if (devpriv->b_OutputMemoryStatus) {
ui_Temp = inl(devpriv->i_IobaseAddon); ui_Temp = inl(devpriv->i_IobaseAddon);
...@@ -764,8 +769,10 @@ int i_APCI3200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde ...@@ -764,8 +769,10 @@ int i_APCI3200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde
int i_APCI3200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
unsigned int ui_NoOfChannel; unsigned int ui_NoOfChannel;
ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0]; ui_Temp = data[0];
*data = inl(devpriv->i_IobaseAddon); *data = inl(devpriv->i_IobaseAddon);
...@@ -872,7 +879,7 @@ int i_APCI3200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -872,7 +879,7 @@ int i_APCI3200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev
int i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ul_Config = 0, ul_Temp = 0; unsigned int ul_Config = 0, ul_Temp = 0;
unsigned int ui_ChannelNo = 0; unsigned int ui_ChannelNo = 0;
unsigned int ui_Dummy = 0; unsigned int ui_Dummy = 0;
...@@ -1649,6 +1656,7 @@ int i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevic ...@@ -1649,6 +1656,7 @@ int i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevic
int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev, int i_APCI3200_Read1AnalogInputChannel(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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0; unsigned int ui_EOC = 0;
unsigned int ui_ChannelNo = 0; unsigned int ui_ChannelNo = 0;
unsigned int ui_CommandRegister = 0; unsigned int ui_CommandRegister = 0;
...@@ -1773,6 +1781,7 @@ int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev, ...@@ -1773,6 +1781,7 @@ int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev,
*/ */
int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data) int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp = 0, ui_EOC = 0; unsigned int ui_Temp = 0, ui_EOC = 0;
unsigned int ui_CommandRegister = 0; unsigned int ui_CommandRegister = 0;
...@@ -1909,6 +1918,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned in ...@@ -1909,6 +1918,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned in
*/ */
int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data) int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0; unsigned int ui_EOC = 0;
int ui_CommandRegister = 0; int ui_CommandRegister = 0;
...@@ -2045,6 +2055,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int ...@@ -2045,6 +2055,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int
int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data) int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0; unsigned int ui_EOC = 0;
int ui_CommandRegister = 0; int ui_CommandRegister = 0;
...@@ -2164,8 +2175,10 @@ int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data) ...@@ -2164,8 +2175,10 @@ 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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0; unsigned int ui_EOC = 0;
int ui_CommandRegister = 0; int ui_CommandRegister = 0;
/*******************************************/ /*******************************************/
/*Read calibration offset value for the CJC */ /*Read calibration offset value for the CJC */
/*******************************************/ /*******************************************/
...@@ -2280,8 +2293,10 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data) ...@@ -2280,8 +2293,10 @@ 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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0; unsigned int ui_EOC = 0;
int ui_CommandRegister = 0; int ui_CommandRegister = 0;
/*******************************/ /*******************************/
/* Set the convert timing unit */ /* Set the convert timing unit */
/*******************************/ /*******************************/
...@@ -2402,8 +2417,10 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device *dev, unsigned int *data) ...@@ -2402,8 +2417,10 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device *dev, 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) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Configuration = 0; unsigned int ui_Configuration = 0;
int i_Temp; /* ,i_TimeUnit; */ int i_Temp; /* ,i_TimeUnit; */
/* if(i_Initialised==0) */ /* if(i_Initialised==0) */
if (s_BoardInfos[dev->minor].i_Initialised == 0) { if (s_BoardInfos[dev->minor].i_Initialised == 0) {
...@@ -2736,7 +2753,9 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_s ...@@ -2736,7 +2753,9 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_s
int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s) int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Configuration = 0; unsigned int ui_Configuration = 0;
/* i_InterruptFlag=0; */ /* i_InterruptFlag=0; */
/* i_Initialised=0; */ /* i_Initialised=0; */
/* i_Count=0; */ /* i_Count=0; */
...@@ -2786,6 +2805,7 @@ int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_su ...@@ -2786,6 +2805,7 @@ int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_su
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 addi_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
unsigned int ui_Configuration = 0; unsigned int ui_Configuration = 0;
/* INT i_CurrentSource = 0; */ /* INT i_CurrentSource = 0; */
...@@ -2798,6 +2818,7 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subde ...@@ -2798,6 +2818,7 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subde
unsigned int ui_DelayTime = 0; unsigned int ui_DelayTime = 0;
unsigned int ui_DelayTimeBase = 0; unsigned int ui_DelayTimeBase = 0;
unsigned int ui_DelayMode = 0; unsigned int ui_DelayMode = 0;
/* i_FirstChannel=cmd->chanlist[0]; */ /* i_FirstChannel=cmd->chanlist[0]; */
/* i_LastChannel=cmd->chanlist[1]; */ /* i_LastChannel=cmd->chanlist[1]; */
s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0]; s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0];
...@@ -2973,8 +2994,10 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subde ...@@ -2973,8 +2994,10 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subde
int i_APCI3200_Reset(struct comedi_device *dev) int i_APCI3200_Reset(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
int i_Temp; int i_Temp;
unsigned int dw_Dummy; unsigned int dw_Dummy;
/* i_InterruptFlag=0; */ /* i_InterruptFlag=0; */
/* i_Initialised==0; */ /* i_Initialised==0; */
/* i_Count=0; */ /* i_Count=0; */
...@@ -3030,6 +3053,7 @@ int i_APCI3200_Reset(struct comedi_device *dev) ...@@ -3030,6 +3053,7 @@ int i_APCI3200_Reset(struct comedi_device *dev)
void v_APCI3200_Interrupt(int irq, void *d) void v_APCI3200_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned int ui_StatusRegister = 0; unsigned int ui_StatusRegister = 0;
unsigned int ui_ChannelNumber = 0; unsigned int ui_ChannelNumber = 0;
int i_CalibrationFlag = 0; int i_CalibrationFlag = 0;
...@@ -3038,7 +3062,6 @@ void v_APCI3200_Interrupt(int irq, void *d) ...@@ -3038,7 +3062,6 @@ void v_APCI3200_Interrupt(int irq, void *d)
unsigned int ui_DigitalTemperature = 0; unsigned int ui_DigitalTemperature = 0;
unsigned int ui_DigitalInput = 0; unsigned int ui_DigitalInput = 0;
int i_ConvertCJCCalibration; int i_ConvertCJCCalibration;
/* BEGIN JK TEST */ /* BEGIN JK TEST */
int i_ReturnValue = 0; int i_ReturnValue = 0;
/* END JK TEST */ /* END JK TEST */
...@@ -3471,6 +3494,7 @@ void v_APCI3200_Interrupt(int irq, void *d) ...@@ -3471,6 +3494,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
*/ */
int i_APCI3200_InterruptHandleEos(struct comedi_device *dev) int i_APCI3200_InterruptHandleEos(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_StatusRegister = 0; unsigned int ui_StatusRegister = 0;
struct comedi_subdevice *s = &dev->subdevices[0]; struct comedi_subdevice *s = &dev->subdevices[0];
......
...@@ -76,8 +76,10 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -76,8 +76,10 @@ You should also find the complete GPL in the COPYING file accompanying this sour
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
unsigned int ui_NoOfChannel; unsigned int ui_NoOfChannel;
ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0]; ui_Temp = data[0];
*data = inl(devpriv->iobase + APCI3501_DIGITAL_IP); *data = inl(devpriv->iobase + APCI3501_DIGITAL_IP);
...@@ -124,6 +126,7 @@ int i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevi ...@@ -124,6 +126,7 @@ int i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevi
int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
if ((data[0] != 0) && (data[0] != 1)) { if ((data[0] != 0) && (data[0] != 1)) {
comedi_error(dev, comedi_error(dev,
...@@ -164,8 +167,10 @@ int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd ...@@ -164,8 +167,10 @@ int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subd
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1; unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
if (devpriv->b_OutputMemoryStatus) { if (devpriv->b_OutputMemoryStatus) {
ui_Temp = inl(devpriv->iobase + APCI3501_DIGITAL_OP); ui_Temp = inl(devpriv->iobase + APCI3501_DIGITAL_OP);
} /* if(devpriv->b_OutputMemoryStatus ) */ } /* if(devpriv->b_OutputMemoryStatus ) */
...@@ -251,6 +256,7 @@ int i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde ...@@ -251,6 +256,7 @@ int i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
unsigned int ui_NoOfChannel; unsigned int ui_NoOfChannel;
...@@ -301,6 +307,8 @@ int i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -301,6 +307,8 @@ int i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev
int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
outl(data[0], outl(data[0],
devpriv->iobase + APCI3501_ANALOG_OUTPUT + devpriv->iobase + APCI3501_ANALOG_OUTPUT +
APCI3501_AO_VOLT_MODE); APCI3501_AO_VOLT_MODE);
...@@ -339,6 +347,7 @@ int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subde ...@@ -339,6 +347,7 @@ int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subde
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) struct comedi_insn *insn, unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned int 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); ul_Channel_no = CR_CHAN(insn->chanspec);
...@@ -413,7 +422,9 @@ int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdev ...@@ -413,7 +422,9 @@ int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdev
int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev, int i_APCI3501_ConfigTimerCounterWatchdog(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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0; unsigned int ul_Command1 = 0;
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
if (data[0] == ADDIDATA_WATCHDOG) { if (data[0] == ADDIDATA_WATCHDOG) {
...@@ -514,8 +525,10 @@ int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev, ...@@ -514,8 +525,10 @@ int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev,
int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, int i_APCI3501_StartStopWriteTimerCounterWatchdog(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)
{ {
struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0; unsigned int ul_Command1 = 0;
int i_Temp; int i_Temp;
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
if (data[1] == 1) { if (data[1] == 1) {
...@@ -616,6 +629,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, ...@@ -616,6 +629,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev, int i_APCI3501_ReadTimerCounterWatchdog(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)
{ {
struct addi_private *devpriv = dev->private;
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
data[0] = data[0] =
...@@ -656,8 +670,10 @@ int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev, ...@@ -656,8 +670,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)
{ {
struct addi_private *devpriv = dev->private;
int i_Count = 0, i_temp = 0; int i_Count = 0, i_temp = 0;
unsigned int 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(0x0, devpriv->iobase + APCI3501_DIGITAL_OP);
outl(1, devpriv->iobase + APCI3501_ANALOG_OUTPUT + outl(1, devpriv->iobase + APCI3501_ANALOG_OUTPUT +
APCI3501_AO_VOLT_MODE); APCI3501_AO_VOLT_MODE);
...@@ -709,8 +725,10 @@ void v_APCI3501_Interrupt(int irq, void *d) ...@@ -709,8 +725,10 @@ void v_APCI3501_Interrupt(int irq, void *d)
{ {
int i_temp; int i_temp;
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned int ui_Timer_AOWatchdog; unsigned int ui_Timer_AOWatchdog;
unsigned long ul_Command1; unsigned long ul_Command1;
/* Disable Interrupt */ /* Disable Interrupt */
ul_Command1 = ul_Command1 =
inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);
......
...@@ -69,6 +69,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -69,6 +69,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour
*/ */
static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL) if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL)
return 1; return 1;
else else
...@@ -108,6 +110,7 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, ...@@ -108,6 +110,7 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_TimeBase = 0; unsigned char b_TimeBase = 0;
unsigned char b_SingleDiff = 0; unsigned char b_SingleDiff = 0;
...@@ -358,6 +361,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, ...@@ -358,6 +361,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec);
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
...@@ -571,6 +575,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, ...@@ -571,6 +575,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
static void v_APCI3XXX_Interrupt(int irq, void *d) static void v_APCI3XXX_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private;
unsigned char b_CopyCpt = 0; unsigned char b_CopyCpt = 0;
unsigned int dw_Status = 0; unsigned int dw_Status = 0;
...@@ -651,6 +656,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, ...@@ -651,6 +656,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec);
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
unsigned int dw_Status = 0; unsigned int dw_Status = 0;
...@@ -755,6 +761,7 @@ static int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -755,6 +761,7 @@ static int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Command = 0; unsigned char b_Command = 0;
...@@ -884,6 +891,7 @@ static int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, ...@@ -884,6 +891,7 @@ static int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_ChannelCpt = 0; unsigned char b_ChannelCpt = 0;
unsigned int dw_ChannelMask = 0; unsigned int dw_ChannelMask = 0;
...@@ -1040,6 +1048,7 @@ static int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, ...@@ -1040,6 +1048,7 @@ static int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned int *pls_ReadData = data; unsigned int *pls_ReadData = data;
...@@ -1154,6 +1163,7 @@ static int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, ...@@ -1154,6 +1163,7 @@ static int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
unsigned char b_State = 0; unsigned char b_State = 0;
...@@ -1267,6 +1277,7 @@ static int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, ...@@ -1267,6 +1277,7 @@ static int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
unsigned int dw_Temp = 0; unsigned int dw_Temp = 0;
...@@ -1327,6 +1338,7 @@ static int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, ...@@ -1327,6 +1338,7 @@ static int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned int dw_Temp = 0; unsigned int dw_Temp = 0;
...@@ -1382,6 +1394,7 @@ static int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, ...@@ -1382,6 +1394,7 @@ static int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_ChannelCpt = 0; unsigned char b_ChannelCpt = 0;
unsigned int dw_ChannelMask = 0; unsigned int dw_ChannelMask = 0;
...@@ -1480,6 +1493,7 @@ static int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev, ...@@ -1480,6 +1493,7 @@ static int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = CR_CHAN(insn->chanspec); unsigned char b_Channel = CR_CHAN(insn->chanspec);
unsigned char b_State = 0; unsigned char b_State = 0;
...@@ -1557,6 +1571,7 @@ static int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, ...@@ -1557,6 +1571,7 @@ static int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = CR_CHAN(insn->chanspec); unsigned char b_Channel = CR_CHAN(insn->chanspec);
unsigned int dw_Status = 0; unsigned int dw_Status = 0;
...@@ -1614,6 +1629,7 @@ static int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, ...@@ -1614,6 +1629,7 @@ static int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev,
static int i_APCI3XXX_Reset(struct comedi_device *dev) static int i_APCI3XXX_Reset(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private;
unsigned char b_Cpt = 0; unsigned char b_Cpt = 0;
/*************************/ /*************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment