Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 337877
b: refs/heads/master
c: 87450c0
h: refs/heads/master
i:
  337875: 5e72d35
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Nov 13, 2012
1 parent 6314693 commit bdf8ab3
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 232 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e32a32c9098c745048e28c2851ac356763d3bbba
refs/heads/master: 87450c0271dd9da9242b13fa3ecade3af3d31eb9
227 changes: 0 additions & 227 deletions trunk/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c

This file was deleted.

147 changes: 143 additions & 4 deletions trunk/drivers/staging/comedi/drivers/addi_apci_1516.c
Original file line number Diff line number Diff line change
@@ -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@addi-data.com
*
* 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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bdf8ab3

Please sign in to comment.