Digital-IO and Analog-Out only support instruction mode.
+FIXME: This driver needs to be fixed to probe the fifo lengths, instead of
+relying on the user to pass the appropriate board_name to comedi config.
+Then the driver can simply accept the driver name as the board type
+and figure out the rest on its own. The fifo sizes can be probed by
+clearing the fifo, then doing software-driven conversions one at a time
+until the fifo-half-empty status flag clears.
+
*/
#include <linux/comedidev.h>
for (ii = 0; ii < RTD_ADC_TIMEOUT; ++ii) {
stat = RtdFifoStatus(dev);
- if (stat & FS_ADC_EMPTY) /* 1 -> not empty */
+ if (stat & FS_ADC_NOT_EMPTY) /* 1 -> not empty */
break;
WAIT_QUIETLY;
}
continue;
}
#if 0
- if (0 == (RtdFifoStatus(dev) & FS_ADC_EMPTY)) { /* DEBUG */
+ if (0 == (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY)) { /* DEBUG */
DPRINTK("comedi: READ OOPS on %d of %d\n", ii + 1,
count);
break;
*/
static int ai_read_dregs(comedi_device * dev, comedi_subdevice * s)
{
- while (RtdFifoStatus(dev) & FS_ADC_EMPTY) { /* 1 -> not empty */
+ while (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */
sampl_t sample;
s16 d = RtdAdcFifoGet(dev); /* get 2s comp value */
fifoStatus = RtdFifoStatus(dev);
/* check for FIFO full, this automatically halts the ADC! */
- if (!(fifoStatus & FS_ADC_FULL)) { /* 0 -> full */
+ if (!(fifoStatus & FS_ADC_NOT_FULL)) { /* 0 -> full */
DPRINTK("rtd520: FIFO full! fifo_status=0x%x\n", (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */
goto abortTransfer;
}
} else if (devpriv->transCount > 0) { /* read often */
/*DPRINTK("rtd520: Sample int, reading %d fifo_status 0x%x\n",
devpriv->transCount, (fifoStatus ^ 0x6666) & 0x7777); */
- if (fifoStatus & FS_ADC_EMPTY) { /* 1 -> not empty */
+ if (fifoStatus & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */
if (ai_read_n(dev, s, devpriv->transCount) < 0) {
DPRINTK("rtd520: comedi read buffer overflow (N) with %ld to go!\n", devpriv->aiCount);
goto abortTransfer;
for (ii = 0; ii < RTD_DAC_TIMEOUT; ++ii) {
stat = RtdFifoStatus(dev);
/* 1 -> not empty */
- if (stat & ((0 == chan) ? FS_DAC1_EMPTY :
- FS_DAC2_EMPTY))
+ if (stat & ((0 == chan) ? FS_DAC1_NOT_EMPTY :
+ FS_DAC2_NOT_EMPTY))
break;
WAIT_QUIETLY;
}
/*
comedi/drivers/rtd520.h
Comedi driver defines for Real Time Devices (RTD) PCI4520/DM7520
-
+
COMEDI - Linux Control and Measurement Device Interface
Copyright (C) 2001 David A. Schleef <ds@schleef.org>
/*
LAS0 Runtime Area
- Local Address Space 0 Offset Read Function Write Function
+ Local Address Space 0 Offset Read Function Write Function
*/
#define LAS0_SPARE_00 0x0000 // - -
#define LAS0_SPARE_04 0x0004 // - -
#define LAS0_SPARE_3C 0x003C // - -
/*
- LAS0 Runtime Area Timer/Counter,Dig.IO
+ LAS0 Runtime Area Timer/Counter,Dig.IO
Name Local Address Function
*/
#define LAS0_PCLK 0x0040 // Pacer Clock value (24bit) Pacer Clock load (24bit)
======================================================================*/
// FIFO Status Word Bits (RtdFifoStatus)
-#define FS_DAC1_EMPTY 0x0001 // D0 - DAC1 FIFO not empty
-#define FS_DAC1_HEMPTY 0x0002 // D1 - DAC1 FIFO not half empty
-#define FS_DAC1_FULL 0x0004 // D2 - DAC1 FIFO not full
-#define FS_DAC2_EMPTY 0x0010 // D4 - DAC2 FIFO not empty
-#define FS_DAC2_HEMPTY 0x0020 // D5 - DAC2 FIFO not half empty
-#define FS_DAC2_FULL 0x0040 // D6 - DAC2 FIFO not full
-#define FS_ADC_EMPTY 0x0100 // D8 - ADC FIFO not empty
-#define FS_ADC_HEMPTY 0x0200 // D9 - ADC FIFO not half empty
-#define FS_ADC_FULL 0x0400 // D10 - ADC FIFO not full
-#define FS_DIN_EMPTY 0x1000 // D12 - DIN FIFO not empty
-#define FS_DIN_HEMPTY 0x2000 // D13 - DIN FIFO not half empty
-#define FS_DIN_FULL 0x4000 // D14 - DIN FIFO not full
+#define FS_DAC1_NOT_EMPTY 0x0001 // D0 - DAC1 FIFO not empty
+#define FS_DAC1_HEMPTY 0x0002 // D1 - DAC1 FIFO half empty
+#define FS_DAC1_NOT_FULL 0x0004 // D2 - DAC1 FIFO not full
+#define FS_DAC2_NOT_EMPTY 0x0010 // D4 - DAC2 FIFO not empty
+#define FS_DAC2_HEMPTY 0x0020 // D5 - DAC2 FIFO half empty
+#define FS_DAC2_NOT_FULL 0x0040 // D6 - DAC2 FIFO not full
+#define FS_ADC_NOT_EMPTY 0x0100 // D8 - ADC FIFO not empty
+#define FS_ADC_HEMPTY 0x0200 // D9 - ADC FIFO half empty
+#define FS_ADC_NOT_FULL 0x0400 // D10 - ADC FIFO not full
+#define FS_DIN_NOT_EMPTY 0x1000 // D12 - DIN FIFO not empty
+#define FS_DIN_HEMPTY 0x2000 // D13 - DIN FIFO half empty
+#define FS_DIN_NOT_FULL 0x4000 // D14 - DIN FIFO not full
// Timer Status Word Bits (GetTimerStatus)
#define TS_PCLK_GATE 0x0001