comedi_spin_unlock_irqrestore(&dev->spinlock,flags);
}
-#define win_out2(data,addr) do{ \
- win_out((data)>>16, (addr)); \
- win_out((data)&0xffff, (addr)+1); \
-}while(0)
-
#define win_in(addr) __win_in(dev,addr)
static inline unsigned short __win_in(comedi_device *dev, int addr)
{
return ret;
}
-#define ao_win_out(a,b) do{ \
- ni_writew((b),AO_Window_Address_671x); \
- ni_writew((a),AO_Window_Data_671x); \
-}while(0)
-
-
-
#ifdef __ISAPNP__
static struct isapnp_device_id device_ids[] = {
{ ISAPNP_DEVICE_SINGLE('N','I','C',0x1900,'N','I','C',0x0000), },
static int ni_ai_drain_dma(comedi_device *dev );
#endif
+#define win_out2(data,addr) do{ \
+ win_out((data)>>16, (addr)); \
+ win_out((data)&0xffff, (addr)+1); \
+}while(0)
+
+
+#define ao_win_out(data,addr) ni_ao_win_outw(dev,data,addr)
+static inline void ni_ao_win_outw( comedi_device *dev, uint16_t data, int addr )
+{
+ unsigned long flags;
+
+ comedi_spin_lock_irqsave(&dev->spinlock,flags);
+ ni_writew(addr,AO_Window_Address_671x);
+ ni_writew(data,AO_Window_Data_671x);
+ comedi_spin_unlock_irqrestore(&dev->spinlock,flags);
+}
+
+static inline void ni_ao_win_outl(comedi_device *dev, uint32_t data, int addr)
+{
+ unsigned long flags;
+
+ comedi_spin_lock_irqsave(&dev->spinlock,flags);
+ ni_writew(addr,AO_Window_Address_671x);
+ ni_writel(data,AO_Window_Data_671x);
+ comedi_spin_unlock_irqrestore(&dev->spinlock,flags);
+}
+
/* ni_set_bits( ) allows different parts of the ni_mio_common driver to
* share registers (such as Interrupt_A_Register) without interfering with
-* each other.
+* each other.
*
* NOTE: the switch/case statements are optimized out for a constant argument
* so this is actually quite fast--- If you must wrap another function around this
static const int timeout = 10000;
int i;
- for( i = 0; i < timeout; i++ )
+ for(i = 0; i < timeout; i++)
{
unsigned short b_status;
b_status = win_in( AO_Status_1_Register );
if( b_status & AO_FIFO_Half_Full_St )
break;
+ comedi_udelay(1);
+ }
+ if( i == timeout )
+ {
+ comedi_error(dev, "timed out waiting for dma load");
+ return -EPIPE;
}
- if( i == timeout ) return -EPIPE;
-
return 0;
}
}
n /= sizeof(sampl_t);
- if(n>boardtype.ao_fifo_depth/sizeof(sampl_t))
- n=boardtype.ao_fifo_depth/sizeof(sampl_t);
+ if(n > boardtype.ao_fifo_depth / 2)
+ n = boardtype.ao_fifo_depth / 2;
ni_ao_fifo_load(dev,s,n);
/* reset fifo */
win_out(0,DAC_FIFO_Clear);
+ ni_ao_win_outl(dev, 0x6, AO_FIFO_Offset_Load_611x);
/* load some data */
n = comedi_buf_read_n_available(s);
if(n==0)return 0;
n /= sizeof(sampl_t);
- if(n>boardtype.ao_fifo_depth)
- n=boardtype.ao_fifo_depth;
+ if(n > boardtype.ao_fifo_depth)
+ n = boardtype.ao_fifo_depth;
ni_ao_fifo_load(dev,s,n);
bits = AO_Error_Interrupt_Enable;
#ifdef PCIDMA
win_out(0, DAC_FIFO_Clear);
- // offset load doesn't seem to be necessary
- //ao_win_out( 0x6, AO_FIFO_Offset_Load_611x );
+ ni_ao_win_outl(dev, 0x6, AO_FIFO_Offset_Load_611x);
ni_ao_setup_MITE_dma(dev, &s->async->cmd);
ret = ni_ao_wait_for_dma_load(dev);
if(ret < 0) return ret;
comedi_spin_unlock_irqrestore(&dev->spinlock,flags);
}
-#define win_out2(data,addr) do{ \
- win_out((data)>>16, (addr)); \
- win_out((data)&0xffff, (addr)+1); \
-}while(0)
-
#define win_in(addr) __win_in(dev,addr)
static inline unsigned short __win_in(comedi_device *dev, int addr)
{
return ret;
}
-#define ao_win_out(a,b) do{ \
- ni_writew((b),AO_Window_Address_671x); \
- ni_writew((a),AO_Window_Data_671x); \
-}while(0)
-
-
typedef struct{
dev_link_t *link;
n_aochan: 4,
aobits: 12,
ao_unipolar: 0,
- ao_fifo_depth: 8192,
+ ao_fifo_depth: 16384, /* data sheet says 8192, but fifo really holds 16384 samples */
reg_type: ni_reg_6711,
caldac: {ad8804_debug,ad8804_debug},
},
comedi_spin_unlock_irqrestore(&dev->spinlock,flags);
}
-#define win_out2(data,addr) do{ \
- win_out((data)>>16, (addr)); \
- win_out((data)&0xffff, (addr)+1); \
-}while(0)
-
#define win_in(addr) __win_in(dev,addr)
static inline unsigned short __win_in(comedi_device *dev, int addr)
{
return ret;
}
-#define ao_win_out(data,addr) __ao_win_out(dev,data,addr)
-static inline void __ao_win_out( comedi_device *dev, uint16_t data, int addr )
-{
- unsigned long flags;
-
- comedi_spin_lock_irqsave(&dev->spinlock,flags);
- ni_writew(addr,AO_Window_Address_671x);
- ni_writew(data,AO_Window_Data_671x);
- comedi_spin_unlock_irqrestore(&dev->spinlock,flags);
-}
-
-#define ao_win_out2(data,addr) do{ \
- ao_win_out((data)>>16, (addr)); \
- ao_win_out((data)&0xffff, (addr)+1); \
-}while(0)
-
-
#define interrupt_pin(a) 0
#define IRQ_POLARITY 1
#define Calibration_Channel_Select_611x 0x1a /* w16 (new) */
#define ADC_FIFO_Data_611x 0x1c /* r32 (incompatible) */
#define AI_FIFO_Offset_Load_611x 0x05 /* r8 (new) */
-#define AO_FIFO_Offset_Load_611x 0x13 /* W32? */
+#define AO_FIFO_Offset_Load_611x 0x13 /* W32 */
#define DAC_FIFO_Data_611x 0x14 /* w32 (incompatible) */
#define AO_Window_Addr_611x 0x18 /* w16 */
#define AO_Window_Data_611x 0x1e /* w16 */