From: H Hartley Sweeten Date: Tue, 13 Nov 2012 20:37:01 +0000 (-0700) Subject: staging: comedi: addi_apci_1516: cleanup the register map defines X-Git-Tag: firefly_0821_release~3680^2~1519^2~429 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f57f797a6cc1d5ad101f90244b936480079c6dab;p=firefly-linux-kernel-4.4.55.git staging: comedi: addi_apci_1516: cleanup the register map defines For aesthetic reasons, rename the defines used for the register map and convert them from decimal to hex values. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c index 48e58a3154e3..f1b209df0fd4 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c @@ -51,19 +51,22 @@ You should also find the complete GPL in the COPYING file accompanying this sour /* Card Specific information */ #define APCI1516_ADDRESS_RANGE 8 -/* DIGITAL INPUT-OUTPUT DEFINE */ - -#define APCI1516_DIGITAL_OP 4 -#define APCI1516_DIGITAL_OP_RW 4 -#define APCI1516_DIGITAL_IP 0 +/* + * PCI bar 1 I/O Register map + */ +#define APCI1516_DI_REG 0x00 +#define APCI1516_DO_REG 0x04 -/* TIMER COUNTER WATCHDOG DEFINES */ +/* + * PCI bar 2 I/O Register map + */ +#define APCI1516_WDOG_REG 0x00 +#define APCI1516_WDOG_RELOAD_LSB_REG 0x04 +#define APCI1516_WDOG_RELOAD_MSB_REG 0x06 +#define APCI1516_WDOG_CTRL_REG 0x0c +#define APCI1516_WDOG_STATUS_REG 0x10 #define ADDIDATA_WATCHDOG 2 -#define APCI1516_DIGITAL_OP_WATCHDOG 0 -#define APCI1516_WATCHDOG_ENABLEDISABLE 12 -#define APCI1516_WATCHDOG_RELOAD_VALUE 4 -#define APCI1516_WATCHDOG_STATUS 16 static int apci1516_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, @@ -72,7 +75,7 @@ static int apci1516_di_insn_bits(struct comedi_device *dev, { struct addi_private *devpriv = dev->private; - data[1] = inw(devpriv->iobase + APCI1516_DIGITAL_IP); + data[1] = inw(devpriv->iobase + APCI1516_DI_REG); return insn->n; } @@ -87,12 +90,12 @@ static int apci1516_do_insn_bits(struct comedi_device *dev, unsigned int mask = data[0]; unsigned int bits = data[1]; - s->state = inw(devpriv->iobase + APCI1516_DIGITAL_OP_RW); + s->state = inw(devpriv->iobase + APCI1516_DO_REG); if (mask) { s->state &= ~mask; s->state |= (bits & mask); - outw(s->state, devpriv->iobase + APCI1516_DIGITAL_OP); + outw(s->state, devpriv->iobase + APCI1516_DO_REG); } data[1] = s->state; @@ -130,17 +133,13 @@ static int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, if (data[0] == 0) { /* Disable the watchdog */ - outw(0x0, - devpriv->i_IobaseAddon + - APCI1516_WATCHDOG_ENABLEDISABLE); + outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG); /* Loading the Reload value */ - outw(data[1], - devpriv->i_IobaseAddon + - APCI1516_WATCHDOG_RELOAD_VALUE); + outw(data[1], devpriv->i_IobaseAddon + + APCI1516_WDOG_RELOAD_LSB_REG); data[1] = data[1] >> 16; - outw(data[1], - devpriv->i_IobaseAddon + - APCI1516_WATCHDOG_RELOAD_VALUE + 2); + outw(data[1], devpriv->i_IobaseAddon + + APCI1516_WDOG_RELOAD_MSB_REG); } /* if(data[0]==0) */ else { printk("\nThe input parameters are wrong\n"); @@ -180,17 +179,13 @@ static int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, switch (data[0]) { case 0: /* stop the watchdog */ - outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ + outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG); break; case 1: /* start the watchdog */ - outw(0x0001, - devpriv->i_IobaseAddon + - APCI1516_WATCHDOG_ENABLEDISABLE); + outw(0x0001, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG); break; case 2: /* Software trigger */ - outw(0x0201, - devpriv->i_IobaseAddon + - APCI1516_WATCHDOG_ENABLEDISABLE); + outw(0x0201, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG); break; default: printk("\nSpecified functionality does not exist\n"); @@ -227,7 +222,7 @@ static int i_APCI1516_ReadWatchdog(struct comedi_device *dev, { struct addi_private *devpriv = dev->private; - data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WATCHDOG_STATUS) & 0x1; + data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WDOG_STATUS_REG) & 0x1; return insn->n; } @@ -250,9 +245,9 @@ static 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); - outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE + 2); + outw(0x0, devpriv->iobase + APCI1516_DO_REG); + outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG); + outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_RELOAD_LSB_REG); + outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_RELOAD_MSB_REG); return 0; }