Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 337722
b: refs/heads/master
c: 7395ab3
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Nov 13, 2012
1 parent 7276683 commit fc2860b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 48 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: 9741b0ac620211d86d04c83400b08622d84347cf
refs/heads/master: 7395ab3f0ad68507f59bf626017fd6ea0041bea4
50 changes: 5 additions & 45 deletions trunk/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,55 +609,15 @@ static int i_APCI3200_GetChannelCalibrationValue(struct comedi_device *dev,
return 0;
}

/*
* Read value of the selected channel or port
*
* data[0] = 0: Read single channel
* = 1 Read port value
* data[1] = Port number
*
* data[0] : Read status value
*/
static int i_APCI3200_ReadDigitalInput(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
static int apci3200_di_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp = 0;
unsigned int ui_NoOfChannel = 0;

ui_NoOfChannel = CR_CHAN(insn->chanspec);
ui_Temp = data[0];
*data = inl(devpriv->i_IobaseReserved);
data[1] = inl(devpriv->i_IobaseReserved) & 0xf;

if (ui_Temp == 0) {
*data = (*data >> ui_NoOfChannel) & 0x1;
} /* if (ui_Temp==0) */
else {
if (ui_Temp == 1) {
if (data[1] < 0 || data[1] > 1) {
printk("\nThe port number is in error\n");
return -EINVAL;
} /* if(data[1] < 0 || data[1] >1) */
switch (ui_NoOfChannel) {

case 2:
*data = (*data >> (2 * data[1])) & 0x3;
break;
case 3:
*data = (*data & 15);
break;
default:
comedi_error(dev, " chan spec wrong");
return -EINVAL; /* "sorry channel spec wrong " */

} /* switch(ui_NoOfChannels) */
} /* if (ui_Temp==1) */
else {
printk("\nSpecified channel not supported \n");
} /* elseif (ui_Temp==1) */
}
return insn->n;
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/staging/comedi/drivers/addi_apci_3200.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static const struct addi_board apci3200_boardtypes[] = {
.ai_cmdtest = i_APCI3200_CommandTestAnalogInput,
.ai_cmd = i_APCI3200_CommandAnalogInput,
.ai_cancel = i_APCI3200_StopCyclicAcquisition,
.di_bits = i_APCI3200_ReadDigitalInput,
.di_bits = apci3200_di_insn_bits,
.do_config = i_APCI3200_ConfigDigitalOutput,
.do_write = i_APCI3200_WriteDigitalOutput,
.do_bits = i_APCI3200_ReadDigitalOutput,
Expand Down Expand Up @@ -80,7 +80,7 @@ static const struct addi_board apci3200_boardtypes[] = {
.ai_cmdtest = i_APCI3200_CommandTestAnalogInput,
.ai_cmd = i_APCI3200_CommandAnalogInput,
.ai_cancel = i_APCI3200_StopCyclicAcquisition,
.di_bits = i_APCI3200_ReadDigitalInput,
.di_bits = apci3200_di_insn_bits,
.do_config = i_APCI3200_ConfigDigitalOutput,
.do_write = i_APCI3200_WriteDigitalOutput,
.do_bits = i_APCI3200_ReadDigitalOutput,
Expand Down

0 comments on commit fc2860b

Please sign in to comment.