Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324974
b: refs/heads/master
c: db9132e
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 8, 2012
1 parent a363d33 commit f9da0bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 124 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: 2f348ecd2b2a3e014908a820a420e22431650c93
refs/heads/master: db9132e03054f1332952961ecc0db4fa955a46a5
130 changes: 7 additions & 123 deletions trunk/drivers/staging/comedi/drivers/me4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ broken.
#include <linux/list.h>
#include <linux/spinlock.h>

#include "8253.h"
#include "me4000.h"
#if 0
/* file removed due to GPL incompatibility */
Expand Down Expand Up @@ -1513,28 +1514,8 @@ static int cnt_reset(struct comedi_device *dev, unsigned int channel)
{
struct me4000_info *info = dev->private;

switch (channel) {
case 0:
outb(0x30, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
break;
case 1:
outb(0x70, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
break;
case 2:
outb(0xB0, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
break;
default:
printk(KERN_ERR
"comedi%d: me4000: cnt_reset(): Invalid channel\n",
dev->minor);
return -EINVAL;
}
i8254_load(info->timer_regbase, 0, channel, 0,
I8254_MODE0 | I8254_BINARY);

return 0;
}
Expand All @@ -1543,54 +1524,9 @@ static int cnt_config(struct comedi_device *dev, unsigned int channel,
unsigned int mode)
{
struct me4000_info *info = dev->private;
int tmp = 0;

switch (channel) {
case 0:
tmp |= ME4000_CNT_COUNTER_0;
break;
case 1:
tmp |= ME4000_CNT_COUNTER_1;
break;
case 2:
tmp |= ME4000_CNT_COUNTER_2;
break;
default:
printk(KERN_ERR
"comedi%d: me4000: cnt_config(): Invalid channel\n",
dev->minor);
return -EINVAL;
}

switch (mode) {
case 0:
tmp |= ME4000_CNT_MODE_0;
break;
case 1:
tmp |= ME4000_CNT_MODE_1;
break;
case 2:
tmp |= ME4000_CNT_MODE_2;
break;
case 3:
tmp |= ME4000_CNT_MODE_3;
break;
case 4:
tmp |= ME4000_CNT_MODE_4;
break;
case 5:
tmp |= ME4000_CNT_MODE_5;
break;
default:
printk(KERN_ERR
"comedi%d: me4000: cnt_config(): Invalid counter mode\n",
dev->minor);
return -EINVAL;
}

/* Write the control word */
tmp |= 0x30;
outb(tmp, info->timer_regbase + ME4000_CNT_CTRL_REG);
i8254_set_mode(info->timer_regbase, 0, channel,
(mode << 1) | I8254_BINARY);

return 0;
}
Expand Down Expand Up @@ -1644,7 +1580,6 @@ static int me4000_cnt_insn_read(struct comedi_device *dev,
struct comedi_insn *insn, unsigned int *data)
{
struct me4000_info *info = dev->private;
unsigned short tmp;

if (insn->n == 0)
return 0;
Expand All @@ -1657,32 +1592,7 @@ static int me4000_cnt_insn_read(struct comedi_device *dev,
return -EINVAL;
}

switch (insn->chanspec) {
case 0:
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
data[0] = tmp;
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
data[0] |= tmp << 8;
break;
case 1:
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
data[0] = tmp;
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
data[0] |= tmp << 8;
break;
case 2:
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
data[0] = tmp;
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
data[0] |= tmp << 8;
break;
default:
printk(KERN_ERR
"comedi%d: me4000: me4000_cnt_insn_read(): "
"Invalid channel %d\n",
dev->minor, insn->chanspec);
return -EINVAL;
}
data[0] = i8254_read(info->timer_regbase, 0, insn->chanspec);

return 1;
}
Expand All @@ -1692,7 +1602,6 @@ static int me4000_cnt_insn_write(struct comedi_device *dev,
struct comedi_insn *insn, unsigned int *data)
{
struct me4000_info *info = dev->private;
unsigned short tmp;

if (insn->n == 0) {
return 0;
Expand All @@ -1704,32 +1613,7 @@ static int me4000_cnt_insn_write(struct comedi_device *dev,
return -EINVAL;
}

switch (insn->chanspec) {
case 0:
tmp = data[0] & 0xFF;
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
tmp = (data[0] >> 8) & 0xFF;
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
break;
case 1:
tmp = data[0] & 0xFF;
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
tmp = (data[0] >> 8) & 0xFF;
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
break;
case 2:
tmp = data[0] & 0xFF;
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
tmp = (data[0] >> 8) & 0xFF;
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
break;
default:
printk(KERN_ERR
"comedi%d: me4000: me4000_cnt_insn_write(): "
"Invalid channel %d\n",
dev->minor, insn->chanspec);
return -EINVAL;
}
i8254_write(info->timer_regbase, 0, insn->chanspec, data[0]);

return 1;
}
Expand Down

0 comments on commit f9da0bd

Please sign in to comment.