Commit 48cf60d1 authored by Chase Southwood's avatar Chase Southwood Committed by Greg Kroah-Hartman

Staging: comedi: addi-data: tidy up digital output register map defines in hwdrv_apci1564.c

This patch fixes the register map defines for the digital output registers
such that they are all the real offsets to each register, rather than a
mix of real offsets and adders to those offsets.

Further, some of the old defines were being used incorrectly in the
i_APCI1564_Reset() function.  Upon swapping the old defines out for the
new ones in this function, their use has been corrected.
Signed-off-by: default avatarChase Southwood <chase.southwood@yahoo.com>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7df86732
...@@ -46,21 +46,10 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY ...@@ -46,21 +46,10 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
#define APCI1564_ADDRESS_RANGE 128 #define APCI1564_ADDRESS_RANGE 128
/* DIGITAL INPUT-OUTPUT DEFINE */
/* Output defines */
#define APCI1564_DIGITAL_OP 0x18
#define APCI1564_DIGITAL_OP_RW 0
#define APCI1564_DIGITAL_OP_INTERRUPT 4
#define APCI1564_DIGITAL_OP_IRQ 12
/* Digital Input IRQ Function Selection */ /* Digital Input IRQ Function Selection */
#define ADDIDATA_OR 0 #define ADDIDATA_OR 0
#define ADDIDATA_AND 1 #define ADDIDATA_AND 1
/* Digital Output Interrupt Status */
#define APCI1564_DIGITAL_OP_INTERRUPT_STATUS 8
/* Digital Input Interrupt Enable Disable. */ /* Digital Input Interrupt Enable Disable. */
#define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE 0x4 #define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE 0x4
#define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE 0xfffffffb #define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE 0xfffffffb
...@@ -99,6 +88,10 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY ...@@ -99,6 +88,10 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
#define APCI1564_DI_INT_MODE2_REG 0x0c #define APCI1564_DI_INT_MODE2_REG 0x0c
#define APCI1564_DI_INT_STATUS_REG 0x10 #define APCI1564_DI_INT_STATUS_REG 0x10
#define APCI1564_DI_IRQ_REG 0x14 #define APCI1564_DI_IRQ_REG 0x14
#define APCI1564_DO_REG 0x18
#define APCI1564_DO_INT_CTRL_REG 0x1c
#define APCI1564_DO_INT_STATUS_REG 0x20
#define APCI1564_DO_IRQ_REG 0x24
/* Global variables */ /* Global variables */
static unsigned int ui_InterruptStatus_1564; static unsigned int ui_InterruptStatus_1564;
...@@ -226,12 +219,8 @@ static int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, ...@@ -226,12 +219,8 @@ static int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev,
else else
ul_Command = ul_Command & 0xFFFFFFFD; ul_Command = ul_Command & 0xFFFFFFFD;
outl(ul_Command, outl(ul_Command, devpriv->i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG);
devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + ui_InterruptData = inl(devpriv->i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG);
APCI1564_DIGITAL_OP_INTERRUPT);
ui_InterruptData =
inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
APCI1564_DIGITAL_OP_INTERRUPT);
devpriv->tsk_Current = current; devpriv->tsk_Current = current;
return insn->n; return insn->n;
} }
...@@ -243,12 +232,10 @@ static int apci1564_do_insn_bits(struct comedi_device *dev, ...@@ -243,12 +232,10 @@ static int apci1564_do_insn_bits(struct comedi_device *dev,
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
s->state = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + s->state = inl(devpriv->i_IobaseAmcc + APCI1564_DO_REG);
APCI1564_DIGITAL_OP_RW);
if (comedi_dio_update_state(s, data)) if (comedi_dio_update_state(s, data))
outl(s->state, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + outl(s->state, devpriv->i_IobaseAmcc + APCI1564_DO_REG);
APCI1564_DIGITAL_OP_RW);
data[1] = s->state; data[1] = s->state;
...@@ -317,9 +304,7 @@ static int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev, ...@@ -317,9 +304,7 @@ static int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
if (data[1] == 1) { if (data[1] == 1) {
outl(0x02, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ outl(0x02, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_IRQ_REG); outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_IRQ_REG);
outl(0x0, outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_IRQ_REG);
devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
APCI1564_DIGITAL_OP_IRQ);
outl(0x0, outl(0x0,
devpriv->i_IobaseAmcc + devpriv->i_IobaseAmcc +
APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_DIGITAL_OP_WATCHDOG +
...@@ -634,8 +619,7 @@ static void v_APCI1564_Interrupt(int irq, void *d) ...@@ -634,8 +619,7 @@ static void v_APCI1564_Interrupt(int irq, void *d)
unsigned int ul_Command2 = 0; unsigned int ul_Command2 = 0;
ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DI_IRQ_REG) & 0x01; ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DI_IRQ_REG) & 0x01;
ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DO_IRQ_REG) & 0x01;
APCI1564_DIGITAL_OP_IRQ) & 0x01;
ui_Timer = ui_Timer =
inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
APCI1564_TCW_IRQ) & 0x01; APCI1564_TCW_IRQ) & 0x01;
...@@ -666,13 +650,9 @@ static void v_APCI1564_Interrupt(int irq, void *d) ...@@ -666,13 +650,9 @@ static void v_APCI1564_Interrupt(int irq, void *d)
if (ui_DO == 1) { if (ui_DO == 1) {
/* Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. */ /* Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. */
ui_Type = ui_Type = inl(devpriv->i_IobaseAmcc + APCI1564_DO_INT_STATUS_REG) & 0x3;
inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
APCI1564_DIGITAL_OP_INTERRUPT_STATUS) & 0x3;
/* Disable the Interrupt */ /* Disable the Interrupt */
outl(0x0, outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG);
devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
APCI1564_DIGITAL_OP_INTERRUPT);
/* Sends signal to user space */ /* Sends signal to user space */
send_sig(SIGIO, devpriv->tsk_Current, 0); send_sig(SIGIO, devpriv->tsk_Current, 0);
...@@ -819,8 +799,10 @@ static int i_APCI1564_Reset(struct comedi_device *dev) ...@@ -819,8 +799,10 @@ static int i_APCI1564_Reset(struct comedi_device *dev)
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_INT_MODE2_REG); outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_INT_MODE2_REG);
devpriv->b_DigitalOutputRegister = 0; devpriv->b_DigitalOutputRegister = 0;
ui_Type = 0; ui_Type = 0;
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP); /* Resets the output channels */ /* Resets the output channels */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_INTERRUPT); /* Disables the interrupt. */ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_REG);
/* Disables the interrupt. */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG);
outl(0x0, outl(0x0,
devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
APCI1564_TCW_RELOAD_VALUE); APCI1564_TCW_RELOAD_VALUE);
......
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