Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354174
b: refs/heads/master
c: 5458f3e
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jan 25, 2013
1 parent bd50427 commit a830792
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 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: 99c9fa48b6bbc640066c414d6b413a1f1b4aa857
refs/heads/master: 5458f3e7b5a8707a49948857d69b2eb2fa5931ac
21 changes: 8 additions & 13 deletions trunk/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ static int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev,
unsigned int *data)
{
struct apci3501_private *devpriv = dev->private;
unsigned int ul_Command1 = 0, ul_Channel_no, ul_Polarity, ul_DAC_Ready = 0;
unsigned int ul_Command1 = 0, ul_Channel_no, ul_Polarity;
int ret;

ul_Channel_no = CR_CHAN(insn->chanspec);

Expand All @@ -159,21 +160,15 @@ static int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev,
printk("\nIn WriteAnalogOutput :: Not Valid Channel\n");
} /* end if((ul_Channel_no<0)||(ul_Channel_no>7)) */

ul_DAC_Ready = inl(dev->iobase + APCI3501_AO_CTRL_STATUS_REG);
ret = apci3501_wait_for_dac(dev);
if (ret)
return ret;

while (ul_DAC_Ready == 0) {
ul_DAC_Ready = inl(dev->iobase + APCI3501_AO_CTRL_STATUS_REG);
ul_DAC_Ready = (ul_DAC_Ready >> 8) & 1;
}

if (ul_DAC_Ready) {
/* Output the Value on the output channels. */
ul_Command1 =
(unsigned int) ((unsigned int) (ul_Channel_no & 0xFF) |
/* Output the Value on the output channels. */
ul_Command1 = (unsigned int) ((unsigned int) (ul_Channel_no & 0xFF) |
(unsigned int) ((*data << 0x8) & 0x7FFFFF00L) |
(unsigned int) (ul_Polarity));
outl(ul_Command1, dev->iobase + APCI3501_AO_DATA_REG);
}
outl(ul_Command1, dev->iobase + APCI3501_AO_DATA_REG);

return insn->n;
}
Expand Down
29 changes: 19 additions & 10 deletions trunk/drivers/staging/comedi/drivers/addi_apci_3501.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ static struct comedi_lrange apci3501_ao_range = {
}
};

static int apci3501_wait_for_dac(struct comedi_device *dev)
{
unsigned int status;

do {
status = inl(dev->iobase + APCI3501_AO_CTRL_STATUS_REG);
} while (!(status & APCI3501_AO_STATUS_READY));

return 0;
}

#include "addi-data/hwdrv_apci3501.c"

static int apci3501_di_insn_bits(struct comedi_device *dev,
Expand Down Expand Up @@ -209,23 +220,21 @@ static irqreturn_t apci3501_interrupt(int irq, void *d)
static int apci3501_reset(struct comedi_device *dev)
{
int i_Count = 0, i_temp = 0;
unsigned int ul_Command1 = 0, ul_Polarity, ul_DAC_Ready = 0;
unsigned int ul_Command1 = 0, ul_Polarity;
int ret;

outl(0x0, dev->iobase + APCI3501_DO_REG);
outl(1, dev->iobase + APCI3501_AO_CTRL_STATUS_REG);

ul_Polarity = 0x80000000;

for (i_Count = 0; i_Count <= 7; i_Count++) {
ul_DAC_Ready = inl(dev->iobase + APCI3501_AO_CTRL_STATUS_REG);

while (ul_DAC_Ready == 0) {
ul_DAC_Ready =
inl(dev->iobase + APCI3501_AO_CTRL_STATUS_REG);
ul_DAC_Ready = (ul_DAC_Ready >> 8) & 1;
}

if (ul_DAC_Ready) {
ret = apci3501_wait_for_dac(dev);
if (ret) {
dev_warn(dev->class_dev,
"%s: DAC not-ready for channel %i\n",
__func__, i_Count);
} else {
/* Output the Value on the output channels. */
ul_Command1 =
(unsigned int) ((unsigned int) (i_Count & 0xFF) |
Expand Down

0 comments on commit a830792

Please sign in to comment.