Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 167285
b: refs/heads/master
c: 5044a2c
h: refs/heads/master
i:
  167283: d179861
v: v3
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Oct 9, 2009
1 parent c244c5c commit 9978464
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 32 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: 2b0318a600989ed85fe020079fa20132f8aebaf3
refs/heads/master: 5044a2c0e0e951afeb4dce87e18e10036635410a
50 changes: 19 additions & 31 deletions trunk/drivers/staging/comedi/drivers/s526.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,11 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it)
udelay(1000);
printk("Read back mode reg=0x%04x\n", inw(ADDR_CHAN_REG(REG_C0M, n)));

/* Load the pre-laod register high word */
/* Load the pre-load register high word */
/* value = (short) (0x55); */
/* outw(value, ADDR_CHAN_REG(REG_C0H, n)); */

/* Load the pre-laod register low word */
/* Load the pre-load register low word */
/* value = (short)(0xaa55); */
/* outw(value, ADDR_CHAN_REG(REG_C0L, n)); */

Expand Down Expand Up @@ -587,19 +587,8 @@ static int s526_gpct_insn_config(struct comedi_device *dev,

#if 1
/* Set Counter Mode Register */
cmReg.reg.coutSource = 0; /* out RCAP */
cmReg.reg.coutPolarity = 0; /* Polarity inverted */
cmReg.reg.autoLoadResetRcap = 0; /* Auto load disabled */
cmReg.reg.hwCtEnableSource = 2; /* NOT RCAP */
cmReg.reg.ctEnableCtrl = 1; /* 1: Software, >1 : Hardware */
cmReg.reg.clockSource = 3; /* x4 */
cmReg.reg.countDir = 0; /* up */
cmReg.reg.countDirCtrl = 0; /* quadrature */
cmReg.reg.outputRegLatchCtrl = 0; /* latch on read */
cmReg.reg.preloadRegSel = 0; /* PR0 */
cmReg.reg.reserved = 0;
cmReg.value = insn->data[1] & 0xFFFF;

/* Set Counter Mode Register */
/* printk("s526: Counter Mode register=%x\n", cmReg.value); */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel));

Expand Down Expand Up @@ -634,11 +623,11 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
cmReg.value = (short)(insn->data[1] & 0xFFFF);
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel));

/* Load the pre-laod register high word */
/* Load the pre-load register high word */
value = (short)((insn->data[2] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel));

/* Load the pre-laod register low word */
/* Load the pre-load register low word */
value = (short)(insn->data[2] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel));

Expand Down Expand Up @@ -672,11 +661,11 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
cmReg.reg.preloadRegSel = 0; /* PR0 */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel));

/* Load the pre-laod register 0 high word */
/* Load the pre-load register 0 high word */
value = (short)((insn->data[2] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel));

/* Load the pre-laod register 0 low word */
/* Load the pre-load register 0 low word */
value = (short)(insn->data[2] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel));

Expand All @@ -685,17 +674,17 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
cmReg.reg.preloadRegSel = 1; /* PR1 */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel));

/* Load the pre-laod register 1 high word */
/* Load the pre-load register 1 high word */
value = (short)((insn->data[3] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel));

/* Load the pre-laod register 1 low word */
/* Load the pre-load register 1 low word */
value = (short)(insn->data[3] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel));

/* Write the Counter Control Register */
if (insn->data[3] != 0) {
value = (short)(insn->data[3] & 0xFFFF);
if (insn->data[4] != 0) {
value = (short)(insn->data[4] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0C, subdev_channel));
}
break;
Expand All @@ -717,11 +706,11 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
cmReg.reg.preloadRegSel = 0; /* PR0 */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel));

/* Load the pre-laod register 0 high word */
/* Load the pre-load register 0 high word */
value = (short)((insn->data[2] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel));

/* Load the pre-laod register 0 low word */
/* Load the pre-load register 0 low word */
value = (short)(insn->data[2] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel));

Expand All @@ -730,17 +719,17 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
cmReg.reg.preloadRegSel = 1; /* PR1 */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel));

/* Load the pre-laod register 1 high word */
/* Load the pre-load register 1 high word */
value = (short)((insn->data[3] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel));

/* Load the pre-laod register 1 low word */
/* Load the pre-load register 1 low word */
value = (short)(insn->data[3] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel));

/* Write the Counter Control Register */
if (insn->data[3] != 0) {
value = (short)(insn->data[3] & 0xFFFF);
if (insn->data[4] != 0) {
value = (short)(insn->data[4] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0C, subdev_channel));
}
break;
Expand Down Expand Up @@ -795,9 +784,8 @@ static int s526_gpct_winsn(struct comedi_device *dev,
(devpriv->s526_gpct_config[subdev_channel]).data[1] =
insn->data[1];
} else {
printk("%d \t %d\n", insn->data[1], insn->data[2]);
printk
("s526: INSN_WRITE: PTG: Problem with Pulse params\n");
printk("s526: INSN_WRITE: PTG: Problem with Pulse params -> %d %d\n",
insn->data[0], insn->data[1]);
return -EINVAL;
}

Expand Down

0 comments on commit 9978464

Please sign in to comment.