[PATCH 27/41] staging: comedi: addi_apci_1516: merge in hwdrv_apci1516.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Merge the code from hwdrv_apci1516.c into the driver and delete the
now unused file.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 .../comedi/drivers/addi-data/hwdrv_apci1516.c      | 227 ---------------------
 drivers/staging/comedi/drivers/addi_apci_1516.c    | 147 ++++++++++++-
 2 files changed, 143 insertions(+), 231 deletions(-)
 delete mode 100644 drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c
deleted file mode 100644
index 1aa0be3..0000000
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
-@verbatim
-
-Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
-
-	ADDI-DATA GmbH
-	Dieselstrasse 3
-	D-77833 Ottersweier
-	Tel: +19(0)7223/9493-0
-	Fax: +49(0)7223/9493-92
-	http://www.addi-data.com
-	info@xxxxxxxxxxxxx
-
-This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-You should also find the complete GPL in the COPYING file accompanying this source code.
-
-@endverbatim
-*/
-/*
-
-  +-----------------------------------------------------------------------+
-  | (C) ADDI-DATA GmbH          Dieselstraße 3       D-77833 Ottersweier  |
-  +-----------------------------------------------------------------------+
-  | Tel : +49 (0) 7223/9493-0     | email    : info@xxxxxxxxxxxxx         |
-  | Fax : +49 (0) 7223/9493-92    | Internet : http://www.addi-data.com   |
-  +-------------------------------+---------------------------------------+
-  | Project     : APCI-1516       | Compiler   : GCC                      |
-  | Module name : hwdrv_apci1516.c| Version    : 2.96                     |
-  +-------------------------------+---------------------------------------+
-  | Project manager: Eric Stolz   | Date       :  02/12/2002              |
-  +-------------------------------+---------------------------------------+
-  | Description :   Hardware Layer Access For APCI-1516                   |
-  +-----------------------------------------------------------------------+
-  |                             UPDATES                                   |
-  +----------+-----------+------------------------------------------------+
-  |   Date   |   Author  |          Description of updates                |
-  +----------+-----------+------------------------------------------------+
-  |          |           |                                                |
-  |          |           |                                                |
-  |          |           |                                                |
-  +----------+-----------+------------------------------------------------+
-*/
-
-/*********      Definitions for APCI-1516 card  *****/
-
-/* Card Specific information */
-#define APCI1516_ADDRESS_RANGE			8
-
-/*
- * PCI bar 1 I/O Register map
- */
-#define APCI1516_DI_REG				0x00
-#define APCI1516_DO_REG				0x04
-
-/*
- * 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_CTRL_ENABLE		(1 << 0)
-#define APCI1516_WDOG_CTRL_SOFT_TRIG		(1 << 9)
-#define APCI1516_WDOG_STATUS_REG		0x10
-
-#define ADDIDATA_WATCHDOG			2
-
-static int apci1516_di_insn_bits(struct comedi_device *dev,
-				 struct comedi_subdevice *s,
-				 struct comedi_insn *insn,
-				 unsigned int *data)
-{
-	data[1] = inw(dev->iobase + APCI1516_DI_REG);
-
-	return insn->n;
-}
-
-static int apci1516_do_insn_bits(struct comedi_device *dev,
-				 struct comedi_subdevice *s,
-				 struct comedi_insn *insn,
-				 unsigned int *data)
-{
-	unsigned int mask = data[0];
-	unsigned int bits = data[1];
-
-	s->state = inw(dev->iobase + APCI1516_DO_REG);
-	if (mask) {
-		s->state &= ~mask;
-		s->state |= (bits & mask);
-
-		outw(s->state, dev->iobase + APCI1516_DO_REG);
-	}
-
-	data[1] = s->state;
-
-	return insn->n;
-}
-
-/*
-+----------------------------------------------------------------------------+
-| Function   Name   : int i_APCI1516_ConfigWatchdog(struct comedi_device *dev,
-|                      struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)  |
-|				                                                     |
-+----------------------------------------------------------------------------+
-| Task              : Configures The Watchdog                                |
-+----------------------------------------------------------------------------+
-| Input Parameters  :   struct comedi_device *dev      : Driver handle              |
-|                     struct comedi_subdevice *s,   :pointer to subdevice structure
-|                      struct comedi_insn *insn      :pointer to insn structure      |
-|                     unsigned int *data          : Data Pointer to read status                                                     |
-+----------------------------------------------------------------------------+
-| Output Parameters :	--													 |
-+----------------------------------------------------------------------------+
-| Return Value      : TRUE  : No error occur                                 |
-|		            : FALSE : Error occur. Return the error          |
-|			                                                         |
-+----------------------------------------------------------------------------+
-*/
-
-static int i_APCI1516_ConfigWatchdog(struct comedi_device *dev,
-				     struct comedi_subdevice *s,
-				     struct comedi_insn *insn,
-				     unsigned int *data)
-{
-	struct apci1516_private *devpriv = dev->private;
-
-	if (data[0] == 0) {
-		/* Disable the watchdog */
-		outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
-		/* Loading the Reload value */
-		outw(data[1], devpriv->wdog_iobase +
-				APCI1516_WDOG_RELOAD_LSB_REG);
-		data[1] = data[1] >> 16;
-		outw(data[1], devpriv->wdog_iobase +
-				APCI1516_WDOG_RELOAD_MSB_REG);
-	}			/* if(data[0]==0) */
-	else {
-		printk("\nThe input parameters are wrong\n");
-		return -EINVAL;
-	}			/* elseif(data[0]==0) */
-
-	return insn->n;
-}
-
- /*
-    +----------------------------------------------------------------------------+
-    | Function   Name   : int i_APCI1516_StartStopWriteWatchdog                  |
-    |                           (struct comedi_device *dev,struct comedi_subdevice *s,
-    struct comedi_insn *insn,unsigned int *data);                      |
-    +----------------------------------------------------------------------------+
-    | Task              : Start / Stop The Watchdog                              |
-    +----------------------------------------------------------------------------+
-    | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-    |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-    struct comedi_insn *insn      :pointer to insn structure      |
-    |                     unsigned int *data          : Data Pointer to read status  |
-    +----------------------------------------------------------------------------+
-    | Output Parameters :       --                                                                                                       |
-    +----------------------------------------------------------------------------+
-    | Return Value      : TRUE  : No error occur                                 |
-    |                       : FALSE : Error occur. Return the error          |
-    |                                                                            |
-    +----------------------------------------------------------------------------+
-  */
-
-static int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev,
-					     struct comedi_subdevice *s,
-					     struct comedi_insn *insn,
-					     unsigned int *data)
-{
-	struct apci1516_private *devpriv = dev->private;
-
-	switch (data[0]) {
-	case 0:		/* stop the watchdog */
-		outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
-		break;
-	case 1:		/* start the watchdog */
-		outw(APCI1516_WDOG_CTRL_ENABLE,
-		     devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
-		break;
-	case 2:		/* Software trigger */
-		outw(APCI1516_WDOG_CTRL_ENABLE | APCI1516_WDOG_CTRL_SOFT_TRIG,
-		     devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
-		break;
-	default:
-		printk("\nSpecified functionality does not exist\n");
-		return -EINVAL;
-	}			/*  switch(data[0]) */
-	return insn->n;
-}
-
-/*
-+----------------------------------------------------------------------------+
-| Function   Name   : int i_APCI1516_ReadWatchdog                            |
-|			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data); 	                                     |
-+----------------------------------------------------------------------------+
-| Task              : Read The Watchdog                                      |
-+----------------------------------------------------------------------------+
-| Input Parameters  :   struct comedi_device *dev      : Driver handle              |
-|                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
-|                     unsigned int *data          : Data Pointer to read status  |
-+----------------------------------------------------------------------------+
-| Output Parameters :	--													 |
-+----------------------------------------------------------------------------+
-| Return Value      : TRUE  : No error occur                                 |
-|		            : FALSE : Error occur. Return the error          |
-|			                                                         |
-+----------------------------------------------------------------------------+
-*/
-
-static int i_APCI1516_ReadWatchdog(struct comedi_device *dev,
-				   struct comedi_subdevice *s,
-				   struct comedi_insn *insn,
-				   unsigned int *data)
-{
-	struct apci1516_private *devpriv = dev->private;
-
-	data[0] = inw(devpriv->wdog_iobase + APCI1516_WDOG_STATUS_REG) & 0x1;
-	return insn->n;
-}
diff --git a/drivers/staging/comedi/drivers/addi_apci_1516.c b/drivers/staging/comedi/drivers/addi_apci_1516.c
index e2d79c3..d39278d 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1516.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1516.c
@@ -1,11 +1,53 @@
+/*
+ * addi_apci_1516.c
+ * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
+ * Project manager: Eric Stolz
+ *
+ *	ADDI-DATA GmbH
+ *	Dieselstrasse 3
+ *	D-77833 Ottersweier
+ *	Tel: +19(0)7223/9493-0
+ *	Fax: +49(0)7223/9493-92
+ *	http://www.addi-data.com
+ *	info@xxxxxxxxxxxxx
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * You should also find the complete GPL in the COPYING file accompanying
+ * this source code.
+ */
+
 #include "../comedidev.h"
 #include "comedi_fc.h"
 
-struct apci1516_private {
-	unsigned long wdog_iobase;
-};
+/*
+ * PCI bar 1 I/O Register map
+ */
+#define APCI1516_DI_REG				0x00
+#define APCI1516_DO_REG				0x04
 
-#include "addi-data/hwdrv_apci1516.c"
+/*
+ * 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_CTRL_ENABLE		(1 << 0)
+#define APCI1516_WDOG_CTRL_SOFT_TRIG		(1 << 9)
+#define APCI1516_WDOG_STATUS_REG		0x10
 
 struct apci1516_boardinfo {
 	const char *name;
@@ -34,6 +76,103 @@ static const struct apci1516_boardinfo apci1516_boardtypes[] = {
 	},
 };
 
+struct apci1516_private {
+	unsigned long wdog_iobase;
+};
+
+static int apci1516_di_insn_bits(struct comedi_device *dev,
+				 struct comedi_subdevice *s,
+				 struct comedi_insn *insn,
+				 unsigned int *data)
+{
+	data[1] = inw(dev->iobase + APCI1516_DI_REG);
+
+	return insn->n;
+}
+
+static int apci1516_do_insn_bits(struct comedi_device *dev,
+				 struct comedi_subdevice *s,
+				 struct comedi_insn *insn,
+				 unsigned int *data)
+{
+	unsigned int mask = data[0];
+	unsigned int bits = data[1];
+
+	s->state = inw(dev->iobase + APCI1516_DO_REG);
+	if (mask) {
+		s->state &= ~mask;
+		s->state |= (bits & mask);
+
+		outw(s->state, dev->iobase + APCI1516_DO_REG);
+	}
+
+	data[1] = s->state;
+
+	return insn->n;
+}
+
+static int i_APCI1516_ConfigWatchdog(struct comedi_device *dev,
+				     struct comedi_subdevice *s,
+				     struct comedi_insn *insn,
+				     unsigned int *data)
+{
+	struct apci1516_private *devpriv = dev->private;
+
+	if (data[0] == 0) {
+		/* Disable the watchdog */
+		outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
+		/* Loading the Reload value */
+		outw(data[1], devpriv->wdog_iobase +
+				APCI1516_WDOG_RELOAD_LSB_REG);
+		data[1] = data[1] >> 16;
+		outw(data[1], devpriv->wdog_iobase +
+				APCI1516_WDOG_RELOAD_MSB_REG);
+	}			/* if(data[0]==0) */
+	else {
+		printk("\nThe input parameters are wrong\n");
+		return -EINVAL;
+	}			/* elseif(data[0]==0) */
+
+	return insn->n;
+}
+
+static int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev,
+					     struct comedi_subdevice *s,
+					     struct comedi_insn *insn,
+					     unsigned int *data)
+{
+	struct apci1516_private *devpriv = dev->private;
+
+	switch (data[0]) {
+	case 0:		/* stop the watchdog */
+		outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
+		break;
+	case 1:		/* start the watchdog */
+		outw(APCI1516_WDOG_CTRL_ENABLE,
+		     devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
+		break;
+	case 2:		/* Software trigger */
+		outw(APCI1516_WDOG_CTRL_ENABLE | APCI1516_WDOG_CTRL_SOFT_TRIG,
+		     devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
+		break;
+	default:
+		printk("\nSpecified functionality does not exist\n");
+		return -EINVAL;
+	}			/*  switch(data[0]) */
+	return insn->n;
+}
+
+static int i_APCI1516_ReadWatchdog(struct comedi_device *dev,
+				   struct comedi_subdevice *s,
+				   struct comedi_insn *insn,
+				   unsigned int *data)
+{
+	struct apci1516_private *devpriv = dev->private;
+
+	data[0] = inw(devpriv->wdog_iobase + APCI1516_WDOG_STATUS_REG) & 0x1;
+	return insn->n;
+}
+
 static int apci1516_reset(struct comedi_device *dev)
 {
 	const struct apci1516_boardinfo *this_board = comedi_board(dev);
-- 
1.7.11

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux