This macro relies on a local variable having a specific name.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
int i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned char b_ModulNbr;
unsigned char b_TimerNbr;
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_DummyRead;
unsigned char b_ModulNbr;
int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned char b_ModulNbr, b_ReadType;
unsigned int *pul_TimerValueArray;
unsigned char b_ModulNbr, unsigned char b_TimerNbr,
unsigned int *pul_TimerValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/* Test the module number */
unsigned char b_ModulNbr, unsigned char b_TimerNbr,
unsigned char *pb_OutputLevel)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_TimerStatus;
unsigned char b_ModulNbr, unsigned char b_TimerNbr,
unsigned char *pb_TimerStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_TimerStatus;
unsigned char b_ModulNbr, unsigned char b_TimerNbr,
unsigned int ul_WriteValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/* Test the module number */
int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int ul_TimerValue = 0;
unsigned int ul_TimingInterval = 0;
int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned char b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action;
b_ModulNbr = CR_AREF(insn->chanspec);
int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_ReadType;
int i_ReturnValue = insn->n;
int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_ChronoStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status;
unsigned char b_ModulNbr,
unsigned int ui_TimeOut, unsigned char *pb_ChronoStatus, unsigned int *pul_ChronoValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status;
unsigned int dw_TimeOut = 0;
unsigned char *pb_Second,
unsigned int *pui_MilliSecond, unsigned int *pui_MicroSecond, unsigned int *pui_NanoSecond)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
double d_Hour;
double d_Minute;
int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned char b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType;
unsigned int dw_Status;
int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_ModulNbr, b_ChannelAMode, b_ChannelBMode;
unsigned char b_MemoryOnOff, b_ConfigType;
int i_ReturnValue = 0;
int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg;
unsigned char b_ModulNbr, b_InputChannel;
int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_WriteValue = 0;
unsigned char b_ModulNbr, b_OutputChannel;
int i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_WriteValue = 0;
unsigned int dw_StatusReg;
int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_ConfigType;
int i_ReturnValue = 0;
+
ui_ConfigType = CR_CHAN(insn->chanspec);
printk("\nINC_CPT");
unsigned char b_FirstCounterOption,
unsigned char b_SecondCounterModus, unsigned char b_SecondCounterOption)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/*******************************/
int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char *pb_TestStatus)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_ModulCpt = 0;
int i_ReturnValue = 0;
unsigned int dw_LathchValue;
unsigned char b_ReferenceAction,
unsigned char b_IndexOperation, unsigned char b_AutoMode, unsigned char b_InterruptEnable)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_InitReference(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ReferenceLevel)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_ExternalStrobe, unsigned char b_ExternalStrobeLevel)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned int ui_CompareValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
unsigned char b_TimingUnity,
unsigned int ul_TimingInterval, unsigned int *pul_RealTimingInterval)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int ul_TimerValue = 0;
double d_RealTimingInterval;
int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_BitsType;
int i_ReturnValue = 0;
+
ui_BitsType = CR_CHAN(insn->chanspec);
devpriv->tsk_Current = current; /* Save the current process task structure */
int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_ModulCpt = 0;
int i_ReturnValue = 0;
int i_APCI1710_SetInputFilter(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_PCIInputClock, unsigned char b_Filter)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status = 0;
int i_APCI1710_LatchCounter(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_LatchReg)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_SourceSelection)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_WriteType;
int i_ReturnValue = 0;
int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int ui_WriteValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned int ul_WriteValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int ul_InterruptLatchReg;
int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_InterruptEnable)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned char b_ModulNbr)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_ReadType;
int i_ReturnValue = 0;
int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned char *pb_LatchStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_LatchReg;
int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned int *pul_LatchValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int *pui_CounterValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_LathchValue = 0;
int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned int *pul_CounterValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
/**************************/
int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_IndexStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0;
int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_ReferenceStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0;
int i_APCI1710_GetUASStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_UASStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0;
int i_APCI1710_GetCBStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_CBStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0;
int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_CBStatusCounter0, unsigned char *pb_CBStatusCounter1)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0;
int i_APCI1710_GetUDStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_UDStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0;
int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
unsigned char b_ModulNbr, unsigned char *pb_UDStatus)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0;
unsigned char b_ModulNbr,
unsigned char *pb_Status, unsigned char *pb_UDStatus, unsigned int *pul_ReadValue)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int ui_16BitValue;
unsigned int dw_StatusReg;
int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_IntRegister;
-
unsigned char b_ModulNbr;
unsigned char b_PulseEncoderNbr;
unsigned char b_InputLevelSelection;
int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned char b_ModulNbr;
unsigned char b_PulseEncoderNbr;
int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusRegister;
unsigned char b_ModulNbr;
int i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
data[0] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv->
unsigned int ul_HighTiming,
unsigned int *pul_RealLowTiming, unsigned int *pul_RealHighTiming)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int ul_LowTimerValue = 0;
unsigned int ul_HighTimerValue = 0;
unsigned char *pb_StopLevel,
unsigned char *pb_ExternGate, unsigned char *pb_InterruptEnable, unsigned char *pb_Enable)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status;
unsigned int dw_Command;
unsigned char b_StopMode,
unsigned char b_StopLevel, unsigned char b_ExternGate, unsigned char b_InterruptEnable)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status;
unsigned int dw_Command;
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;
unsigned int dw_Status;
unsigned char b_ModulNbr,
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;
int i_ReturnValue = 0;
unsigned int ul_LowTimerValue = 0;
int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status;
-
unsigned char b_ModulNbr;
unsigned char b_PWM;
unsigned char *pb_PWMOutputStatus;
int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
data[0] = devpriv->s_InterruptParameters.
s_FIFOInterruptParameters[devpriv->
s_InterruptParameters.ui_Read].b_OldModuleMask;
int i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int ui_TimerValue;
unsigned char b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength,
int i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned char b_Cpt;
unsigned char b_Length;
int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg;
unsigned char b_ModulNbr;
unsigned char *pb_ChannelStatus;
unsigned char *pb_InputStatus;
unsigned char b_IOType;
+
i_ReturnValue = insn->n;
b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
b_IOType = (unsigned char) data[0];
int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int ul_TimerValue = 0;
unsigned int dw_Command;
int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status;
unsigned int dw_DummyRead;
int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status;
unsigned char b_ModulNbr;
int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_Status;
unsigned int dw_TimeOut = 0;
-
unsigned char b_ModulNbr;
unsigned char b_TorCounter;
unsigned char b_ReadType;
int i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned char b_ModulNbr;
unsigned char b_InitType;
int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg;
unsigned char b_ModulNbr;
int i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg;
unsigned char b_ModulNbr;
int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = 0;
unsigned int dw_StatusReg = 0;
unsigned char b_ModulNbr;
/* Update-0.7.57->0.7.68MODULE_DESCRIPTION("Comedi ADDI-DATA module"); */
/* 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)
#if defined(CONFIG_APCI_1710) || defined(CONFIG_APCI_3200) || defined(CONFIG_APCI_3300)
static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
+ struct addi_private *devpriv;
struct comedi_subdevice *s;
int ret, pages, i, n_subdevices;
unsigned int dw_Dummy;
unsigned char pci_bus, pci_slot, pci_func;
int i_Dma = 0;
- ret = alloc_private(dev, sizeof(struct addi_private));
- if (ret < 0)
- return -ENOMEM;
+ ret = alloc_private(dev, sizeof(*devpriv));
+ if (ret)
+ return ret;
+ devpriv = dev->private;
if (!pci_list_builded) {
v_pci_card_list_init(this_board->i_VendorId, 1); /* 1 for displaying the list.. */
static void i_ADDI_Detach(struct comedi_device *dev)
{
- if (dev->private) {
+ struct addi_private *devpriv = dev->private;
+
+ if (devpriv) {
if (devpriv->b_ValidDriver)
i_ADDI_Reset(dev);
if (dev->irq)
static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned short w_Data;
unsigned short w_Address;
w_Address = CR_CHAN(insn->chanspec); /* address to be read as 0,1,2,3...255 */
int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
char *pc_PCIChipInformation, struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
unsigned short w_Temp, i, w_Count = 0;
unsigned int ui_Temp;
struct str_MainHeader s_MainHeader;
int i_APCI1710_Reset(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
int ret;
unsigned int dw_Dummy;
void v_APCI1710_Interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned char b_ModuleCpt = 0;
unsigned char b_InterruptFlag = 0;
unsigned char b_PWMCpt = 0;
int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Status = 0;
unsigned int ui_Command = 0;
unsigned int ui_Mode = 0;
+
i_Temp = 0;
devpriv->tsk_Current = current;
devpriv->b_TimerSelectMode = data[0];
int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Command = 0;
int i_Count = 0;
+
if (data[0] == 1) {
ui_Command =
inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Status = 0; /* Status register */
+
i_WatchdogNbr = insn->unused[0];
/******************/
int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
devpriv->tsk_Current = current;
outl(0x200 | 0, devpriv->iobase + 128 + 0x4);
outl(0, devpriv->iobase + 128 + 0);
int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_CommandRegister = 0;
+
/******************/
/* Set the start */
/******************/
*/
int i_APCI035_Reset(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
int i_Count = 0;
+
for (i_Count = 1; i_Count <= 4; i_Count++) {
i_WatchdogNbr = i_Count;
outl(0x0, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0); /* stop all timers */
static void v_APCI035_Interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned int ui_StatusRegister1 = 0;
unsigned int ui_StatusRegister2 = 0;
unsigned int ui_ReadCommand = 0;
unsigned int ui_ChannelNumber = 0;
unsigned int ui_DigitalTemperature = 0;
+
if (i_Temp == 1) {
i_WatchdogNbr = i_Flag;
i_Flag = i_Flag + 1;
int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue;
-
unsigned int ul_Command1 = 0;
unsigned int ul_Command2 = 0;
+
devpriv->tsk_Current = current;
/*******************************/
int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue = 0;
unsigned int ui_Channel;
ui_Channel = CR_CHAN(insn->chanspec);
+
if (ui_Channel <= 31) {
ui_TmpValue = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP);
/*
int i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[0];
unsigned int ui_Mask = 0;
unsigned int ui_NoOfChannels;
static void v_APCI1032_Interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
-
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
+
/* disable the interrupt */
ui_Temp = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
outl(ui_Temp & APCI1032_DIGITAL_IP_INTERRUPT_DISABLE,
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 */
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 */
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0;
int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0;
int i_PatternTransitionCount = 0, i_RegValue;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_Event1InterruptStatus = 0, i_Event2InterruptStatus =
0, i_RegValue;
+
switch (data[0]) {
case START:
/*************************/
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_DummyRead = 0;
+
/******************/
/* Software reset */
/******************/
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[1];
unsigned int ui_Mask = 0;
unsigned int ui_Channel;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
devpriv->b_OutputMemoryStatus = data[0];
return insn->n;
}
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
static unsigned int ui_Temp = 0;
unsigned int ui_Temp1;
-
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
if (!devpriv->b_OutputMemoryStatus) {
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_TimerCounterMode, i_MasterConfiguration;
devpriv->tsk_Current = current;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_CommandAndStatusValue;
switch (data[0]) {
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_CommandAndStatusValue;
+
switch (data[0]) {
case COUNTER1:
/* Read counter/timer1 */
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Status;
int i_RegValue;
int i_Constant;
+
devpriv->tsk_Current = current;
outl(0x0, devpriv->i_IobaseAmcc + 0x38);
if (data[0] == 1) {
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned int ui_InterruptStatus = 0;
int i_RegValue = 0;
i_InterruptMask = 0;
*/
static int i_APCI1500_Reset(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
int i_DummyRead = 0;
+
i_TimerCounter1Init = 0;
i_TimerCounter2Init = 0;
i_WatchdogCounter3Init = 0;
int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue = 0;
unsigned int ui_Channel;
+
ui_Channel = CR_CHAN(insn->chanspec);
if (ui_Channel <= 7) {
ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP);
int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[0];
unsigned int ui_Mask = 0;
unsigned int ui_NoOfChannels;
int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
devpriv->b_OutputMemoryStatus = data[0];
return insn->n;
}
int i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
+
ui_Temp = data[0];
*data = inw(devpriv->iobase + APCI1516_DIGITAL_OP_RW);
if (ui_Temp == 0) {
int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
if (data[0] == 0) {
/* Disable the watchdog */
outw(0x0,
int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
switch (data[0]) {
case 0: /* stop the watchdog */
outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */
int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WATCHDOG_STATUS) & 0x1;
return insn->n;
}
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->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE);
outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE);
int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
devpriv->tsk_Current = current;
/*******************************/
/* Set the digital input logic */
int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue = 0;
unsigned int ui_Channel;
int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[0];
unsigned int ui_Mask = 0;
unsigned int ui_NoOfChannels;
int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ul_Command = 0;
if ((data[0] != 0) && (data[0] != 1)) {
int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel;
int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
unsigned int ui_NoOfChannel;
int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0;
+
devpriv->tsk_Current = current;
if (data[0] == ADDIDATA_WATCHDOG) {
devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG;
int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0;
+
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
switch (data[1]) {
case 0: /* stop the watchdog */
int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0;
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
static void v_APCI1564_Interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned int ui_DO, ui_DI;
unsigned int ui_Timer;
unsigned int ui_C1, ui_C2, ui_C3, ui_C4;
unsigned int ul_Command2 = 0;
+
ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
APCI1564_DIGITAL_IP_IRQ) & 0x01;
ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
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 */
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 */
int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Command = 0;
unsigned char b_Cpt = 0;
int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Command = 0;
unsigned char b_NumberOfPort =
int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
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);
int i_ReturnValue = insn->n;
unsigned char b_Cpt = 0;
int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Command = 0;
unsigned char b_NumberOfPort =
int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
if ((data[0] != 0) && (data[0] != 1)) {
comedi_error(dev,
"Not a valid Data !!! ,Data should be 1 or 0\n");
int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_NoOfChannel;
unsigned int ui_Temp, ui_Temp1;
+
ui_NoOfChannel = CR_CHAN(insn->chanspec);
if (ui_NoOfChannel > 15) {
comedi_error(dev,
int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
unsigned int ui_NoOfChannel;
+
ui_NoOfChannel = CR_CHAN(insn->chanspec);
if (ui_NoOfChannel > 15) {
comedi_error(dev,
int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
if (data[0] == 0) {
/* Disable the watchdog */
int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
switch (data[0]) {
case 0: /* stop the watchdog */
int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
udelay(5);
data[0] = inw(devpriv->i_IobaseAddon + APCI2016_WATCHDOG_STATUS) & 0x1;
return insn->n;
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->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE);
outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE);
int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ul_Command = 0;
+
devpriv->tsk_Current = current;
if ((data[0] != 0) && (data[0] != 1)) {
int i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
+
if (devpriv->b_OutputMemoryStatus) {
ui_Temp = inl(devpriv->iobase + APCI2032_DIGITAL_OP);
int i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
unsigned int ui_NoOfChannel;
+
ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0];
*data = inl(devpriv->iobase + APCI2032_DIGITAL_OP_RW);
int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
if (data[0] == 0) {
/* Disable the watchdog */
outl(0x0,
int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
switch (data[0]) {
case 0: /* stop the watchdog */
outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); /* disable the watchdog */
int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
data[0] =
inl(devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
void v_APCI2032_Interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned int ui_DO;
ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; /* Check if VCC OR CC interrupt has occurred. */
int i_APCI2032_Reset(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
+
devpriv->b_DigitalOutputRegister = 0;
ui_Type = 0;
outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP); /* Resets the output channels */
int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue = 0;
unsigned int ui_Channel;
+
ui_Channel = CR_CHAN(insn->chanspec);
if (ui_Channel <= 7) {
ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP);
int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct addi_private *devpriv = dev->private;
unsigned int ui_PortValue = data[0];
unsigned int ui_Mask = 0;
unsigned int ui_NoOfChannels;
int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
devpriv->b_OutputMemoryStatus = data[0];
return insn->n;
}
int i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
+
if (devpriv->b_OutputMemoryStatus) {
ui_Temp = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
int i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
+
ui_Temp = data[0];
*data = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
if (ui_Temp == 0) {
int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
if (data[0] == 0) {
/* Disable the watchdog */
outw(0x0,
int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
switch (data[0]) {
case 0: /* stop the watchdog */
outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */
int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
data[0] =
inw(devpriv->iobase + APCI2200_WATCHDOG +
APCI2200_WATCHDOG_STATUS) & 0x1;
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_WATCHDOG +
int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int i;
if ((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE))
int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned short us_ConvertTiming, us_TmpValue, i;
unsigned char b_Tmp;
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 */
outw(0, devpriv->i_IobaseAddon + 4);
int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
+ struct addi_private *devpriv = dev->private;
int err = 0;
/* Step 1 : check if triggers are trivially valid */
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;
/* loading private structure with cmd structure inputs */
int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
struct comedi_subdevice *s)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_Tmp;
unsigned int ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 =
0, dmalen1 = 0, ui_TimerValue2 =
int i_APCI3120_Reset(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
unsigned int i;
unsigned short us_TmpValue;
int i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevice *s,
int n_chan, unsigned int *chanlist, char check)
{
+ struct addi_private *devpriv = dev->private;
unsigned int i; /* , differencial=0, bipolar=0; */
unsigned int gain;
unsigned short us_TmpValue;
int i_APCI3120_ExttrigEnable(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
devpriv->us_OutputRegister |= APCI3120_ENABLE_EXT_TRIGGER;
outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
int i_APCI3120_ExttrigDisable(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
+
devpriv->us_OutputRegister &= ~APCI3120_ENABLE_EXT_TRIGGER;
outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
return 0;
void v_APCI3120_Interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned short int_daq;
-
unsigned int int_amcc, ui_Check, i;
unsigned short us_TmpValue;
unsigned char b_DummyRead;
-
struct comedi_subdevice *s = &dev->subdevices[0];
+
ui_Check = 1;
int_daq = inw(dev->iobase + APCI3120_RD_STATUS) & 0xf000; /* get IRQ reasons */
int i_APCI3120_InterruptHandleEos(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
int n_chan, i;
struct comedi_subdevice *s = &dev->subdevices[0];
int err = 1;
void v_APCI3120_InterruptDma(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
struct comedi_subdevice *s = &dev->subdevices[0];
unsigned int next_dma_buf, samplesinbuf;
unsigned long low_word, high_word, var;
-
unsigned int ui_Tmp;
+
samplesinbuf =
devpriv->ui_DmaBufferUsesize[devpriv->ui_DmaActualBuffer] -
inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_MWTC);
void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
struct comedi_subdevice *s, short *dma_buffer, unsigned int num_samples)
{
+ struct addi_private *devpriv = dev->private;
+
devpriv->ui_AiActualScan +=
(s->async->cur_chan + num_samples) / devpriv->ui_AiScanLength;
s->async->cur_chan += num_samples;
int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Timervalue2;
unsigned short us_TmpValue;
unsigned char b_Tmp;
int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Timervalue2 = 0;
unsigned short us_TmpValue;
unsigned char b_Tmp;
int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_Tmp;
unsigned short us_TmpValue, us_TmpValue_2, us_StatusValue;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Chan, ui_TmpValue;
ui_Chan = CR_CHAN(insn->chanspec); /* channel specified */
int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue;
+
ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS);
/***** state of 4 channels in the 11, 10, 9, 8 bits of status reg
rotated right 8 times to bring them to last four bits
int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
if ((data[0] != 0) && (data[0] != 1)) {
comedi_error(dev,
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
if ((data[0] > devpriv->s_EeParameters.i_DoMaxdata) || (data[0] < 0)) {
comedi_error(dev, "Data is not valid !!! \n");
struct comedi_insn *insn,
unsigned int *data)
{
-
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp1;
-
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
if ((data[0] != 0) && (data[0] != 1)) {
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Range, ui_Channel;
unsigned short us_TmpValue;
int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp = 0;
unsigned int ui_NoOfChannel = 0;
+
ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0];
*data = inl(devpriv->i_IobaseReserved);
int i_APCI3200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
if ((data[0] != 0) && (data[0] != 1)) {
comedi_error(dev,
int i_APCI3200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp = 0, ui_Temp1 = 0;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
+
if (devpriv->b_OutputMemoryStatus) {
ui_Temp = inl(devpriv->i_IobaseAddon);
int i_APCI3200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
unsigned int ui_NoOfChannel;
+
ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0];
*data = inl(devpriv->i_IobaseAddon);
int i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct addi_private *devpriv = dev->private;
unsigned int ul_Config = 0, ul_Temp = 0;
unsigned int ui_ChannelNo = 0;
unsigned int ui_Dummy = 0;
int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev,
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_ChannelNo = 0;
unsigned int ui_CommandRegister = 0;
*/
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_CommandRegister = 0;
*/
int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0;
int ui_CommandRegister = 0;
int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0;
int ui_CommandRegister = 0;
*/
int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0;
int ui_CommandRegister = 0;
+
/*******************************************/
/*Read calibration offset value for the CJC */
/*******************************************/
*/
int i_APCI3200_ReadCJCCalGain(struct comedi_device *dev, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_EOC = 0;
int ui_CommandRegister = 0;
+
/*******************************/
/* Set the convert timing unit */
/*******************************/
int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Configuration = 0;
int i_Temp; /* ,i_TimeUnit; */
+
/* if(i_Initialised==0) */
if (s_BoardInfos[dev->minor].i_Initialised == 0) {
int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Configuration = 0;
+
/* i_InterruptFlag=0; */
/* i_Initialised=0; */
/* i_Count=0; */
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;
unsigned int ui_Configuration = 0;
/* INT i_CurrentSource = 0; */
unsigned int ui_DelayTime = 0;
unsigned int ui_DelayTimeBase = 0;
unsigned int ui_DelayMode = 0;
+
/* i_FirstChannel=cmd->chanlist[0]; */
/* i_LastChannel=cmd->chanlist[1]; */
s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0];
int i_APCI3200_Reset(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
int i_Temp;
unsigned int dw_Dummy;
+
/* i_InterruptFlag=0; */
/* i_Initialised==0; */
/* i_Count=0; */
void v_APCI3200_Interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned int ui_StatusRegister = 0;
unsigned int ui_ChannelNumber = 0;
int i_CalibrationFlag = 0;
unsigned int ui_DigitalTemperature = 0;
unsigned int ui_DigitalInput = 0;
int i_ConvertCJCCalibration;
-
/* BEGIN JK TEST */
int i_ReturnValue = 0;
/* END JK TEST */
*/
int i_APCI3200_InterruptHandleEos(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_StatusRegister = 0;
struct comedi_subdevice *s = &dev->subdevices[0];
int i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
unsigned int ui_NoOfChannel;
+
ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0];
*data = inl(devpriv->iobase + APCI3501_DIGITAL_IP);
int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
if ((data[0] != 0) && (data[0] != 1)) {
comedi_error(dev,
int i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp, ui_Temp1;
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
+
if (devpriv->b_OutputMemoryStatus) {
ui_Temp = inl(devpriv->iobase + APCI3501_DIGITAL_OP);
} /* if(devpriv->b_OutputMemoryStatus ) */
int i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
unsigned int ui_NoOfChannel;
int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
+
outl(data[0],
devpriv->iobase + APCI3501_ANALOG_OUTPUT +
APCI3501_AO_VOLT_MODE);
int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
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;
ul_Channel_no = CR_CHAN(insn->chanspec);
int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0;
+
devpriv->tsk_Current = current;
if (data[0] == ADDIDATA_WATCHDOG) {
int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned int ul_Command1 = 0;
int i_Temp;
+
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
if (data[1] == 1) {
int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
data[0] =
int i_APCI3501_Reset(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
int i_Count = 0, i_temp = 0;
unsigned int ul_Command1 = 0, ul_Polarity, ul_DAC_Ready = 0;
+
outl(0x0, devpriv->iobase + APCI3501_DIGITAL_OP);
outl(1, devpriv->iobase + APCI3501_ANALOG_OUTPUT +
APCI3501_AO_VOLT_MODE);
{
int i_temp;
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned int ui_Timer_AOWatchdog;
unsigned long ul_Command1;
+
/* Disable Interrupt */
ul_Command1 =
inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);
*/
static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
+
if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL)
return 1;
else
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_TimeBase = 0;
unsigned char b_SingleDiff = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec);
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
static void v_APCI3XXX_Interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
unsigned char b_CopyCpt = 0;
unsigned int dw_Status = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec);
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
unsigned int dw_Status = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Command = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_ChannelCpt = 0;
unsigned int dw_ChannelMask = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
int i_ReturnValue = insn->n;
unsigned int *pls_ReadData = data;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
unsigned char b_State = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
unsigned int dw_Temp = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned int dw_Temp = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_ChannelCpt = 0;
unsigned int dw_ChannelMask = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Channel = CR_CHAN(insn->chanspec);
unsigned char b_State = 0;
struct comedi_insn *insn,
unsigned int *data)
{
+ struct addi_private *devpriv = dev->private;
int i_ReturnValue = insn->n;
unsigned char b_Channel = CR_CHAN(insn->chanspec);
unsigned int dw_Status = 0;
static int i_APCI3XXX_Reset(struct comedi_device *dev)
{
+ struct addi_private *devpriv = dev->private;
unsigned char b_Cpt = 0;
/*************************/