aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/ni_mio_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/comedi/drivers/ni_mio_common.c')
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c1663
1 files changed, 900 insertions, 763 deletions
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index d727d7533fc8..753ee0512342 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -62,6 +62,7 @@
/* #define DEBUG_STATUS_B */
#include <linux/interrupt.h>
+#include <linux/sched.h>
#include "8255.h"
#include "mite.h"
#include "comedi_fc.h"
@@ -77,110 +78,128 @@ static const unsigned old_RTSI_clock_channel = 7;
/* Note: this table must match the ai_gain_* definitions */
static const short ni_gainlkup[][16] = {
[ai_gain_16] = {0, 1, 2, 3, 4, 5, 6, 7,
- 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107},
+ 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107},
[ai_gain_8] = {1, 2, 4, 7, 0x101, 0x102, 0x104, 0x107},
[ai_gain_14] = {1, 2, 3, 4, 5, 6, 7,
- 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107},
+ 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107},
[ai_gain_4] = {0, 1, 4, 7},
[ai_gain_611x] = {0x00a, 0x00b, 0x001, 0x002,
- 0x003, 0x004, 0x005, 0x006},
+ 0x003, 0x004, 0x005, 0x006},
[ai_gain_622x] = {0, 1, 4, 5},
[ai_gain_628x] = {1, 2, 3, 4, 5, 6, 7},
[ai_gain_6143] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
};
static const struct comedi_lrange range_ni_E_ai = { 16, {
- RANGE(-10, 10),
- RANGE(-5, 5),
- RANGE(-2.5, 2.5),
- RANGE(-1, 1),
- RANGE(-0.5, 0.5),
- RANGE(-0.25, 0.25),
- RANGE(-0.1, 0.1),
- RANGE(-0.05, 0.05),
- RANGE(0, 20),
- RANGE(0, 10),
- RANGE(0, 5),
- RANGE(0, 2),
- RANGE(0, 1),
- RANGE(0, 0.5),
- RANGE(0, 0.2),
- RANGE(0, 0.1),
- }
+ RANGE(-10, 10),
+ RANGE(-5, 5),
+ RANGE(-2.5, 2.5),
+ RANGE(-1, 1),
+ RANGE(-0.5, 0.5),
+ RANGE(-0.25, 0.25),
+ RANGE(-0.1, 0.1),
+ RANGE(-0.05, 0.05),
+ RANGE(0, 20),
+ RANGE(0, 10),
+ RANGE(0, 5),
+ RANGE(0, 2),
+ RANGE(0, 1),
+ RANGE(0, 0.5),
+ RANGE(0, 0.2),
+ RANGE(0, 0.1),
+ }
};
+
static const struct comedi_lrange range_ni_E_ai_limited = { 8, {
- RANGE(-10, 10),
- RANGE(-5, 5),
- RANGE(-1, 1),
- RANGE(-0.1, 0.1),
- RANGE(0, 10),
- RANGE(0, 5),
- RANGE(0, 1),
- RANGE(0, 0.1),
- }
+ RANGE(-10, 10),
+ RANGE(-5, 5),
+ RANGE(-1, 1),
+ RANGE(-0.1,
+ 0.1),
+ RANGE(0, 10),
+ RANGE(0, 5),
+ RANGE(0, 1),
+ RANGE(0, 0.1),
+ }
};
+
static const struct comedi_lrange range_ni_E_ai_limited14 = { 14, {
- RANGE(-10, 10),
- RANGE(-5, 5),
- RANGE(-2, 2),
- RANGE(-1, 1),
- RANGE(-0.5, 0.5),
- RANGE(-0.2, 0.2),
- RANGE(-0.1, 0.1),
- RANGE(0, 10),
- RANGE(0, 5),
- RANGE(0, 2),
- RANGE(0, 1),
- RANGE(0, 0.5),
- RANGE(0, 0.2),
- RANGE(0, 0.1),
- }
+ RANGE(-10,
+ 10),
+ RANGE(-5, 5),
+ RANGE(-2, 2),
+ RANGE(-1, 1),
+ RANGE(-0.5,
+ 0.5),
+ RANGE(-0.2,
+ 0.2),
+ RANGE(-0.1,
+ 0.1),
+ RANGE(0, 10),
+ RANGE(0, 5),
+ RANGE(0, 2),
+ RANGE(0, 1),
+ RANGE(0,
+ 0.5),
+ RANGE(0,
+ 0.2),
+ RANGE(0,
+ 0.1),
+ }
};
+
static const struct comedi_lrange range_ni_E_ai_bipolar4 = { 4, {
- RANGE(-10, 10),
- RANGE(-5, 5),
- RANGE(-0.5, 0.5),
- RANGE(-0.05, 0.05),
- }
+ RANGE(-10, 10),
+ RANGE(-5, 5),
+ RANGE(-0.5,
+ 0.5),
+ RANGE(-0.05,
+ 0.05),
+ }
};
+
static const struct comedi_lrange range_ni_E_ai_611x = { 8, {
- RANGE(-50, 50),
- RANGE(-20, 20),
- RANGE(-10, 10),
- RANGE(-5, 5),
- RANGE(-2, 2),
- RANGE(-1, 1),
- RANGE(-0.5, 0.5),
- RANGE(-0.2, 0.2),
- }
+ RANGE(-50, 50),
+ RANGE(-20, 20),
+ RANGE(-10, 10),
+ RANGE(-5, 5),
+ RANGE(-2, 2),
+ RANGE(-1, 1),
+ RANGE(-0.5, 0.5),
+ RANGE(-0.2, 0.2),
+ }
};
+
static const struct comedi_lrange range_ni_M_ai_622x = { 4, {
- RANGE(-10, 10),
- RANGE(-5, 5),
- RANGE(-1, 1),
- RANGE(-0.2, 0.2),
- }
+ RANGE(-10, 10),
+ RANGE(-5, 5),
+ RANGE(-1, 1),
+ RANGE(-0.2, 0.2),
+ }
};
+
static const struct comedi_lrange range_ni_M_ai_628x = { 7, {
- RANGE(-10, 10),
- RANGE(-5, 5),
- RANGE(-2, 2),
- RANGE(-1, 1),
- RANGE(-0.5, 0.5),
- RANGE(-0.2, 0.2),
- RANGE(-0.1, 0.1),
- }
+ RANGE(-10, 10),
+ RANGE(-5, 5),
+ RANGE(-2, 2),
+ RANGE(-1, 1),
+ RANGE(-0.5, 0.5),
+ RANGE(-0.2, 0.2),
+ RANGE(-0.1, 0.1),
+ }
};
+
static const struct comedi_lrange range_ni_S_ai_6143 = { 1, {
- RANGE(-5, +5),
- }
+ RANGE(-5, +5),
+ }
};
+
static const struct comedi_lrange range_ni_E_ao_ext = { 4, {
- RANGE(-10, 10),
- RANGE(0, 10),
- RANGE_ext(-1, 1),
- RANGE_ext(0, 1),
- }
+ RANGE(-10, 10),
+ RANGE(0, 10),
+ RANGE_ext(-1, 1),
+ RANGE_ext(0, 1),
+ }
};
static const struct comedi_lrange *const ni_range_lkup[] = {
@@ -194,46 +213,64 @@ static const struct comedi_lrange *const ni_range_lkup[] = {
[ai_gain_6143] = &range_ni_S_ai_6143
};
-static int ni_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_cdio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_cmd *cmd);
+static int ni_dio_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_dio_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_cdio_cmdtest(struct comedi_device *dev,
+ struct comedi_subdevice *s, struct comedi_cmd *cmd);
static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s);
-static int ni_cdio_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
+static int ni_cdio_cancel(struct comedi_device *dev,
+ struct comedi_subdevice *s);
static void handle_cdio_interrupt(struct comedi_device *dev);
static int ni_cdo_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int trignum);
-
-static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_serial_hw_readwrite8(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned char data_out, unsigned char *data_in);
-static int ni_serial_sw_readwrite8(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned char data_out, unsigned char *data_in);
-
-static int ni_calib_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_calib_insn_write(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-
-static int ni_eeprom_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
+ unsigned int trignum);
+
+static int ni_serial_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_serial_hw_readwrite8(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned char data_out,
+ unsigned char *data_in);
+static int ni_serial_sw_readwrite8(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned char data_out,
+ unsigned char *data_in);
+
+static int ni_calib_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_calib_insn_write(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+
+static int ni_eeprom_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
static int ni_m_series_eeprom_insn_read(struct comedi_device *dev,
- struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
-
-static int ni_pfi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_pfi_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static unsigned ni_old_get_pfi_routing(struct comedi_device *dev, unsigned chan);
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data);
+
+static int ni_pfi_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_pfi_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static unsigned ni_old_get_pfi_routing(struct comedi_device *dev,
+ unsigned chan);
static void ni_rtsi_init(struct comedi_device *dev);
-static int ni_rtsi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_rtsi_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
+static int ni_rtsi_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_rtsi_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
static void caldac_setup(struct comedi_device *dev, struct comedi_subdevice *s);
static int ni_read_eeprom(struct comedi_device *dev, int addr);
@@ -252,53 +289,62 @@ static void ni_mio_print_status_b(int status);
static int ni_ai_reset(struct comedi_device *dev, struct comedi_subdevice *s);
#ifndef PCIDMA
static void ni_handle_fifo_half_full(struct comedi_device *dev);
-static int ni_ao_fifo_half_empty(struct comedi_device *dev, struct comedi_subdevice *s);
+static int ni_ao_fifo_half_empty(struct comedi_device *dev,
+ struct comedi_subdevice *s);
#endif
static void ni_handle_fifo_dregs(struct comedi_device *dev);
static int ni_ai_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int trignum);
-static void ni_load_channelgain_list(struct comedi_device *dev, unsigned int n_chan,
- unsigned int *list);
+ unsigned int trignum);
+static void ni_load_channelgain_list(struct comedi_device *dev,
+ unsigned int n_chan, unsigned int *list);
static void shutdown_ai_command(struct comedi_device *dev);
static int ni_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int trignum);
+ unsigned int trignum);
static int ni_ao_reset(struct comedi_device *dev, struct comedi_subdevice *s);
static int ni_8255_callback(int dir, int port, int data, unsigned long arg);
-static int ni_gpct_insn_write(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_gpct_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_gpct_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
+static int ni_gpct_insn_write(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_gpct_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_gpct_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s);
-static int ni_gpct_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_cmd *cmd);
-static int ni_gpct_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
+static int ni_gpct_cmdtest(struct comedi_device *dev,
+ struct comedi_subdevice *s, struct comedi_cmd *cmd);
+static int ni_gpct_cancel(struct comedi_device *dev,
+ struct comedi_subdevice *s);
static void handle_gpct_interrupt(struct comedi_device *dev,
- unsigned short counter_index);
+ unsigned short counter_index);
static int init_cs5529(struct comedi_device *dev);
-static int cs5529_do_conversion(struct comedi_device *dev, unsigned short *data);
-static int cs5529_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
+static int cs5529_do_conversion(struct comedi_device *dev,
+ unsigned short *data);
+static int cs5529_ai_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
#ifdef NI_CS5529_DEBUG
static unsigned int cs5529_config_read(struct comedi_device *dev,
- unsigned int reg_select_bits);
+ unsigned int reg_select_bits);
#endif
static void cs5529_config_write(struct comedi_device *dev, unsigned int value,
- unsigned int reg_select_bits);
+ unsigned int reg_select_bits);
-static int ni_m_series_pwm_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
-static int ni_6143_pwm_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
+static int ni_m_series_pwm_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
+static int ni_6143_pwm_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data);
static int ni_set_master_clock(struct comedi_device *dev, unsigned source,
- unsigned period_ns);
+ unsigned period_ns);
static void ack_a_interrupt(struct comedi_device *dev, unsigned short a_status);
static void ack_b_interrupt(struct comedi_device *dev, unsigned short b_status);
@@ -355,14 +401,14 @@ enum timebase_nanoseconds {
static const int num_adc_stages_611x = 3;
static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
- unsigned ai_mite_status);
+ unsigned ai_mite_status);
static void handle_b_interrupt(struct comedi_device *dev, unsigned short status,
- unsigned ao_mite_status);
+ unsigned ao_mite_status);
static void get_last_sample_611x(struct comedi_device *dev);
static void get_last_sample_6143(struct comedi_device *dev);
static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
- unsigned bit_mask, unsigned bit_values)
+ unsigned bit_mask, unsigned bit_values)
{
unsigned long flags;
@@ -372,19 +418,19 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
devpriv->int_a_enable_reg &= ~bit_mask;
devpriv->int_a_enable_reg |= bit_values & bit_mask;
devpriv->stc_writew(dev, devpriv->int_a_enable_reg,
- Interrupt_A_Enable_Register);
+ Interrupt_A_Enable_Register);
break;
case Interrupt_B_Enable_Register:
devpriv->int_b_enable_reg &= ~bit_mask;
devpriv->int_b_enable_reg |= bit_values & bit_mask;
devpriv->stc_writew(dev, devpriv->int_b_enable_reg,
- Interrupt_B_Enable_Register);
+ Interrupt_B_Enable_Register);
break;
case IO_Bidirection_Pin_Register:
devpriv->io_bidirection_pin_reg &= ~bit_mask;
devpriv->io_bidirection_pin_reg |= bit_values & bit_mask;
devpriv->stc_writew(dev, devpriv->io_bidirection_pin_reg,
- IO_Bidirection_Pin_Register);
+ IO_Bidirection_Pin_Register);
break;
case AI_AO_Select:
devpriv->ai_ao_select_reg &= ~bit_mask;
@@ -397,8 +443,7 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
ni_writeb(devpriv->g0_g1_select_reg, G0_G1_Select);
break;
default:
- printk("Warning %s() called with invalid register\n",
- __func__);
+ printk("Warning %s() called with invalid register\n", __func__);
printk("reg is %d\n", reg);
break;
}
@@ -418,8 +463,8 @@ static inline void ni_set_ai_dma_channel(struct comedi_device *dev, int channel)
if (channel >= 0) {
bitfield =
- (ni_stc_dma_channel_select_bitfield(channel) <<
- AI_DMA_Select_Shift) & AI_DMA_Select_Mask;
+ (ni_stc_dma_channel_select_bitfield(channel) <<
+ AI_DMA_Select_Shift) & AI_DMA_Select_Mask;
} else {
bitfield = 0;
}
@@ -433,8 +478,8 @@ static inline void ni_set_ao_dma_channel(struct comedi_device *dev, int channel)
if (channel >= 0) {
bitfield =
- (ni_stc_dma_channel_select_bitfield(channel) <<
- AO_DMA_Select_Shift) & AO_DMA_Select_Mask;
+ (ni_stc_dma_channel_select_bitfield(channel) <<
+ AO_DMA_Select_Shift) & AO_DMA_Select_Mask;
} else {
bitfield = 0;
}
@@ -443,7 +488,8 @@ static inline void ni_set_ao_dma_channel(struct comedi_device *dev, int channel)
/* negative mite_channel means no channel */
static inline void ni_set_gpct_dma_channel(struct comedi_device *dev,
- unsigned gpct_index, int mite_channel)
+ unsigned gpct_index,
+ int mite_channel)
{
unsigned bitfield;
@@ -453,11 +499,12 @@ static inline void ni_set_gpct_dma_channel(struct comedi_device *dev,
bitfield = 0;
}
ni_set_bitfield(dev, G0_G1_Select, GPCT_DMA_Select_Mask(gpct_index),
- bitfield);
+ bitfield);
}
/* negative mite_channel means no channel */
-static inline void ni_set_cdo_dma_channel(struct comedi_device *dev, int mite_channel)
+static inline void ni_set_cdo_dma_channel(struct comedi_device *dev,
+ int mite_channel)
{
unsigned long flags;
@@ -468,8 +515,8 @@ static inline void ni_set_cdo_dma_channel(struct comedi_device *dev, int mite_ch
under the assumption the cdio dma selection works just like ai/ao/gpct.
Definitely works for dma channels 0 and 1. */
devpriv->cdio_dma_select_reg |=
- (ni_stc_dma_channel_select_bitfield(mite_channel) <<
- CDO_DMA_Select_Shift) & CDO_DMA_Select_Mask;
+ (ni_stc_dma_channel_select_bitfield(mite_channel) <<
+ CDO_DMA_Select_Shift) & CDO_DMA_Select_Mask;
}
ni_writeb(devpriv->cdio_dma_select_reg, M_Offset_CDIO_DMA_Select);
mmiowb();
@@ -483,12 +530,11 @@ static int ni_request_ai_mite_channel(struct comedi_device *dev)
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->ai_mite_chan);
devpriv->ai_mite_chan =
- mite_request_channel(devpriv->mite, devpriv->ai_mite_ring);
+ mite_request_channel(devpriv->mite, devpriv->ai_mite_ring);
if (devpriv->ai_mite_chan == NULL) {
- spin_unlock_irqrestore(&devpriv->mite_channel_lock,
- flags);
+ spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
comedi_error(dev,
- "failed to reserve mite dma channel for analog input.");
+ "failed to reserve mite dma channel for analog input.");
return -EBUSY;
}
devpriv->ai_mite_chan->dir = COMEDI_INPUT;
@@ -504,12 +550,11 @@ static int ni_request_ao_mite_channel(struct comedi_device *dev)
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->ao_mite_chan);
devpriv->ao_mite_chan =
- mite_request_channel(devpriv->mite, devpriv->ao_mite_ring);
+ mite_request_channel(devpriv->mite, devpriv->ao_mite_ring);
if (devpriv->ao_mite_chan == NULL) {
- spin_unlock_irqrestore(&devpriv->mite_channel_lock,
- flags);
+ spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
comedi_error(dev,
- "failed to reserve mite dma channel for analog outut.");
+ "failed to reserve mite dma channel for analog outut.");
return -EBUSY;
}
devpriv->ao_mite_chan->dir = COMEDI_OUTPUT;
@@ -519,7 +564,8 @@ static int ni_request_ao_mite_channel(struct comedi_device *dev)
}
static int ni_request_gpct_mite_channel(struct comedi_device *dev,
- unsigned gpct_index, enum comedi_io_direction direction)
+ unsigned gpct_index,
+ enum comedi_io_direction direction)
{
unsigned long flags;
struct mite_channel *mite_chan;
@@ -528,18 +574,17 @@ static int ni_request_gpct_mite_channel(struct comedi_device *dev,
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->counter_dev->counters[gpct_index].mite_chan);
mite_chan =
- mite_request_channel(devpriv->mite,
- devpriv->gpct_mite_ring[gpct_index]);
+ mite_request_channel(devpriv->mite,
+ devpriv->gpct_mite_ring[gpct_index]);
if (mite_chan == NULL) {
- spin_unlock_irqrestore(&devpriv->mite_channel_lock,
- flags);
+ spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
comedi_error(dev,
- "failed to reserve mite dma channel for counter.");
+ "failed to reserve mite dma channel for counter.");
return -EBUSY;
}
mite_chan->dir = direction;
ni_tio_set_mite_channel(&devpriv->counter_dev->counters[gpct_index],
- mite_chan);
+ mite_chan);
ni_set_gpct_dma_channel(dev, gpct_index, mite_chan->channel);
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return 0;
@@ -555,12 +600,11 @@ static int ni_request_cdo_mite_channel(struct comedi_device *dev)
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->cdo_mite_chan);
devpriv->cdo_mite_chan =
- mite_request_channel(devpriv->mite, devpriv->cdo_mite_ring);
+ mite_request_channel(devpriv->mite, devpriv->cdo_mite_ring);
if (devpriv->cdo_mite_chan == NULL) {
- spin_unlock_irqrestore(&devpriv->mite_channel_lock,
- flags);
+ spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
comedi_error(dev,
- "failed to reserve mite dma channel for correlated digital outut.");
+ "failed to reserve mite dma channel for correlated digital outut.");
return -EBUSY;
}
devpriv->cdo_mite_chan->dir = COMEDI_OUTPUT;
@@ -600,7 +644,8 @@ static void ni_release_ao_mite_channel(struct comedi_device *dev)
#endif /* PCIDMA */
}
-void ni_release_gpct_mite_channel(struct comedi_device *dev, unsigned gpct_index)
+void ni_release_gpct_mite_channel(struct comedi_device *dev,
+ unsigned gpct_index)
{
#ifdef PCIDMA
unsigned long flags;
@@ -609,11 +654,12 @@ void ni_release_gpct_mite_channel(struct comedi_device *dev, unsigned gpct_index
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->counter_dev->counters[gpct_index].mite_chan) {
struct mite_channel *mite_chan =
- devpriv->counter_dev->counters[gpct_index].mite_chan;
+ devpriv->counter_dev->counters[gpct_index].mite_chan;
ni_set_gpct_dma_channel(dev, gpct_index, -1);
- ni_tio_set_mite_channel(&devpriv->counter_dev->
- counters[gpct_index], NULL);
+ ni_tio_set_mite_channel(&devpriv->
+ counter_dev->counters[gpct_index],
+ NULL);
mite_release_channel(mite_chan);
}
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
@@ -638,7 +684,7 @@ static void ni_release_cdo_mite_channel(struct comedi_device *dev)
/* e-series boards use the second irq signals to generate dma requests for their counters */
#ifdef PCIDMA
static void ni_e_series_enable_second_irq(struct comedi_device *dev,
- unsigned gpct_index, short enable)
+ unsigned gpct_index, short enable)
{
if (boardtype.reg_type & ni_reg_m_series_mask)
return;
@@ -646,19 +692,19 @@ static void ni_e_series_enable_second_irq(struct comedi_device *dev,
case 0:
if (enable) {
devpriv->stc_writew(dev, G0_Gate_Second_Irq_Enable,
- Second_IRQ_A_Enable_Register);
+ Second_IRQ_A_Enable_Register);
} else {
devpriv->stc_writew(dev, 0,
- Second_IRQ_A_Enable_Register);
+ Second_IRQ_A_Enable_Register);
}
break;
case 1:
if (enable) {
devpriv->stc_writew(dev, G1_Gate_Second_Irq_Enable,
- Second_IRQ_B_Enable_Register);
+ Second_IRQ_B_Enable_Register);
} else {
devpriv->stc_writew(dev, 0,
- Second_IRQ_B_Enable_Register);
+ Second_IRQ_B_Enable_Register);
}
break;
default:
@@ -684,11 +730,11 @@ static void ni_clear_ai_fifo(struct comedi_device *dev)
/* the NI example code does 3 convert pulses for 625x boards,
but that appears to be wrong in practice. */
devpriv->stc_writew(dev, AI_CONVERT_Pulse,
- AI_Command_1_Register);
+ AI_Command_1_Register);
devpriv->stc_writew(dev, AI_CONVERT_Pulse,
- AI_Command_1_Register);
+ AI_Command_1_Register);
devpriv->stc_writew(dev, AI_CONVERT_Pulse,
- AI_Command_1_Register);
+ AI_Command_1_Register);
#endif
}
}
@@ -709,7 +755,8 @@ static uint32_t win_in2(struct comedi_device *dev, int reg)
}
#define ao_win_out(data, addr) ni_ao_win_outw(dev, data, addr)
-static inline void ni_ao_win_outw(struct comedi_device *dev, uint16_t data, int addr)
+static inline void ni_ao_win_outw(struct comedi_device *dev, uint16_t data,
+ int addr)
{
unsigned long flags;
@@ -719,7 +766,8 @@ static inline void ni_ao_win_outw(struct comedi_device *dev, uint16_t data, int
spin_unlock_irqrestore(&devpriv->window_lock, flags);
}
-static inline void ni_ao_win_outl(struct comedi_device *dev, uint32_t data, int addr)
+static inline void ni_ao_win_outl(struct comedi_device *dev, uint32_t data,
+ int addr)
{
unsigned long flags;
@@ -751,8 +799,8 @@ static inline unsigned short ni_ao_win_inw(struct comedi_device *dev, int addr)
*
* value should only be 1 or 0.
*/
-static inline void ni_set_bits(struct comedi_device *dev, int reg, unsigned bits,
- unsigned value)
+static inline void ni_set_bits(struct comedi_device *dev, int reg,
+ unsigned bits, unsigned value)
{
unsigned bit_values;
@@ -792,17 +840,17 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
ai_mite_status = mite_get_status(devpriv->ai_mite_chan);
if (ai_mite_status & CHSR_LINKC)
writel(CHOR_CLRLC,
- devpriv->mite->mite_io_addr +
- MITE_CHOR(devpriv->ai_mite_chan->
- channel));
+ devpriv->mite->mite_io_addr +
+ MITE_CHOR(devpriv->
+ ai_mite_chan->channel));
}
if (devpriv->ao_mite_chan) {
ao_mite_status = mite_get_status(devpriv->ao_mite_chan);
if (ao_mite_status & CHSR_LINKC)
writel(CHOR_CLRLC,
- mite->mite_io_addr +
- MITE_CHOR(devpriv->ao_mite_chan->
- channel));
+ mite->mite_io_addr +
+ MITE_CHOR(devpriv->
+ ao_mite_chan->channel));
}
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too);
}
@@ -833,7 +881,8 @@ static void ni_sync_ai_dma(struct comedi_device *dev)
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
}
-static void mite_handle_b_linkc(struct mite_struct *mite, struct comedi_device * dev)
+static void mite_handle_b_linkc(struct mite_struct *mite,
+ struct comedi_device *dev)
{
struct comedi_subdevice *s = dev->subdevices + NI_AO_SUBDEV;
unsigned long flags;
@@ -907,9 +956,9 @@ static void shutdown_ai_command(struct comedi_device *dev)
static void ni_event(struct comedi_device *dev, struct comedi_subdevice *s)
{
- if (s->async->
- events & (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW | COMEDI_CB_EOA))
- {
+ if (s->
+ async->events & (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW |
+ COMEDI_CB_EOA)) {
switch (s - dev->subdevices) {
case NI_AI_SUBDEV:
ni_ai_reset(dev, s);
@@ -932,13 +981,14 @@ static void ni_event(struct comedi_device *dev, struct comedi_subdevice *s)
}
static void handle_gpct_interrupt(struct comedi_device *dev,
- unsigned short counter_index)
+ unsigned short counter_index)
{
#ifdef PCIDMA
- struct comedi_subdevice *s = dev->subdevices + NI_GPCT_SUBDEV(counter_index);
+ struct comedi_subdevice *s =
+ dev->subdevices + NI_GPCT_SUBDEV(counter_index);
ni_tio_handle_interrupt(&devpriv->counter_dev->counters[counter_index],
- s);
+ s);
if (s->async->events)
ni_event(dev, s);
#endif
@@ -966,7 +1016,7 @@ static void ack_a_interrupt(struct comedi_device *dev, unsigned short a_status)
}
static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
- unsigned ai_mite_status)
+ unsigned ai_mite_status)
{
struct comedi_subdevice *s = dev->subdevices + NI_AI_SUBDEV;
@@ -976,8 +1026,8 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
#ifdef DEBUG_INTERRUPT
printk
- ("ni_mio_common: interrupt: a_status=%04x ai_mite_status=%08x\n",
- status, ai_mite_status);
+ ("ni_mio_common: interrupt: a_status=%04x ai_mite_status=%08x\n",
+ status, ai_mite_status);
ni_mio_print_status_a(status);
#endif
#ifdef PCIDMA
@@ -986,11 +1036,11 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
}
if (ai_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY |
- CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR |
- CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) {
+ CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR |
+ CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) {
printk
- ("unknown mite interrupt, ack! (ai_mite_status=%08x)\n",
- ai_mite_status);
+ ("unknown mite interrupt, ack! (ai_mite_status=%08x)\n",
+ ai_mite_status);
/* mite_print_chsr(ai_mite_status); */
s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
/* disable_irq(dev->irq); */
@@ -999,23 +1049,23 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
/* test for all uncommon interrupt events at the same time */
if (status & (AI_Overrun_St | AI_Overflow_St | AI_SC_TC_Error_St |
- AI_SC_TC_St | AI_START1_St)) {
+ AI_SC_TC_St | AI_START1_St)) {
if (status == 0xffff) {
printk
- ("ni_mio_common: a_status=0xffff. Card removed?\n");
+ ("ni_mio_common: a_status=0xffff. Card removed?\n");
/* we probably aren't even running a command now,
* so it's a good idea to be careful. */
if (comedi_get_subdevice_runflags(s) & SRF_RUNNING) {
s->async->events |=
- COMEDI_CB_ERROR | COMEDI_CB_EOA;
+ COMEDI_CB_ERROR | COMEDI_CB_EOA;
ni_event(dev, s);
}
return;
}
if (status & (AI_Overrun_St | AI_Overflow_St |
- AI_SC_TC_Error_St)) {
+ AI_SC_TC_Error_St)) {
printk("ni_mio_common: ai error a_status=%04x\n",
- status);
+ status);
ni_mio_print_status_a(status);
shutdown_ai_command(dev);
@@ -1047,7 +1097,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
ni_handle_fifo_half_full(dev);
if ((devpriv->stc_readw(dev,
AI_Status_1_Register) &
- AI_FIFO_Half_Full_St) == 0)
+ AI_FIFO_Half_Full_St) == 0)
break;
}
}
@@ -1063,8 +1113,8 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
status = devpriv->stc_readw(dev, AI_Status_1_Register);
if (status & Interrupt_A_St) {
printk
- ("handle_a_interrupt: didn't clear interrupt? status=0x%x\n",
- status);
+ ("handle_a_interrupt: didn't clear interrupt? status=0x%x\n",
+ status);
}
#endif
}
@@ -1097,14 +1147,14 @@ static void ack_b_interrupt(struct comedi_device *dev, unsigned short b_status)
devpriv->stc_writew(dev, ack, Interrupt_B_Ack_Register);
}
-static void handle_b_interrupt(struct comedi_device *dev, unsigned short b_status,
- unsigned ao_mite_status)
+static void handle_b_interrupt(struct comedi_device *dev,
+ unsigned short b_status, unsigned ao_mite_status)
{
struct comedi_subdevice *s = dev->subdevices + NI_AO_SUBDEV;
/* unsigned short ack=0; */
#ifdef DEBUG_INTERRUPT
printk("ni_mio_common: interrupt: b_status=%04x m1_status=%08x\n",
- b_status, ao_mite_status);
+ b_status, ao_mite_status);
ni_mio_print_status_b(b_status);
#endif
@@ -1115,11 +1165,11 @@ static void handle_b_interrupt(struct comedi_device *dev, unsigned short b_statu
}
if (ao_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY |
- CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR |
- CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) {
+ CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR |
+ CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) {
printk
- ("unknown mite interrupt, ack! (ao_mite_status=%08x)\n",
- ao_mite_status);
+ ("unknown mite interrupt, ack! (ao_mite_status=%08x)\n",
+ ao_mite_status);
/* mite_print_chsr(ao_mite_status); */
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
}
@@ -1129,14 +1179,15 @@ static void handle_b_interrupt(struct comedi_device *dev, unsigned short b_statu
return;
if (b_status & AO_Overrun_St) {
printk
- ("ni_mio_common: AO FIFO underrun status=0x%04x status2=0x%04x\n",
- b_status, devpriv->stc_readw(dev,
- AO_Status_2_Register));
+ ("ni_mio_common: AO FIFO underrun status=0x%04x status2=0x%04x\n",
+ b_status, devpriv->stc_readw(dev, AO_Status_2_Register));
s->async->events |= COMEDI_CB_OVERFLOW;
}
if (b_status & AO_BC_TC_St) {
- MDPRINTK("ni_mio_common: AO BC_TC status=0x%04x status2=0x%04x\n", b_status, devpriv->stc_readw(dev, AO_Status_2_Register));
+ MDPRINTK
+ ("ni_mio_common: AO BC_TC status=0x%04x status2=0x%04x\n",
+ b_status, devpriv->stc_readw(dev, AO_Status_2_Register));
s->async->events |= COMEDI_CB_EOA;
}
#ifndef PCIDMA
@@ -1147,8 +1198,8 @@ static void handle_b_interrupt(struct comedi_device *dev, unsigned short b_statu
if (!ret) {
printk("ni_mio_common: AO buffer underrun\n");
ni_set_bits(dev, Interrupt_B_Enable_Register,
- AO_FIFO_Interrupt_Enable |
- AO_Error_Interrupt_Enable, 0);
+ AO_FIFO_Interrupt_Enable |
+ AO_Error_Interrupt_Enable, 0);
s->async->events |= COMEDI_CB_OVERFLOW;
}
}
@@ -1203,7 +1254,8 @@ static void ni_mio_print_status_b(int status)
#ifndef PCIDMA
-static void ni_ao_fifo_load(struct comedi_device *dev, struct comedi_subdevice *s, int n)
+static void ni_ao_fifo_load(struct comedi_device *dev,
+ struct comedi_subdevice *s, int n)
{
struct comedi_async *async = s->async;
struct comedi_cmd *cmd = &async->cmd;
@@ -1262,7 +1314,8 @@ static void ni_ao_fifo_load(struct comedi_device *dev, struct comedi_subdevice *
* RT code, as RT code might purposely be running close to the
* metal. Needs to be fixed eventually.
*/
-static int ni_ao_fifo_half_empty(struct comedi_device *dev, struct comedi_subdevice *s)
+static int ni_ao_fifo_half_empty(struct comedi_device *dev,
+ struct comedi_subdevice *s)
{
int n;
@@ -1283,7 +1336,8 @@ static int ni_ao_fifo_half_empty(struct comedi_device *dev, struct comedi_subdev
return 1;
}
-static int ni_ao_prep_fifo(struct comedi_device *dev, struct comedi_subdevice *s)
+static int ni_ao_prep_fifo(struct comedi_device *dev,
+ struct comedi_subdevice *s)
{
int n;
@@ -1306,7 +1360,8 @@ static int ni_ao_prep_fifo(struct comedi_device *dev, struct comedi_subdevice *s
return n;
}
-static void ni_ai_fifo_read(struct comedi_device *dev, struct comedi_subdevice *s, int n)
+static void ni_ai_fifo_read(struct comedi_device *dev,
+ struct comedi_subdevice *s, int n)
{
struct comedi_async *async = s->async;
int i;
@@ -1349,17 +1404,18 @@ static void ni_ai_fifo_read(struct comedi_device *dev, struct comedi_subdevice *
}
} else {
if (n > sizeof(devpriv->ai_fifo_buffer) /
- sizeof(devpriv->ai_fifo_buffer[0])) {
+ sizeof(devpriv->ai_fifo_buffer[0])) {
comedi_error(dev, "bug! ai_fifo_buffer too small");
async->events |= COMEDI_CB_ERROR;
return;
}
for (i = 0; i < n; i++) {
devpriv->ai_fifo_buffer[i] =
- ni_readw(ADC_FIFO_Data_Register);
+ ni_readw(ADC_FIFO_Data_Register);
}
cfc_write_array_to_buffer(s, devpriv->ai_fifo_buffer,
- n * sizeof(devpriv->ai_fifo_buffer[0]));
+ n *
+ sizeof(devpriv->ai_fifo_buffer[0]));
}
}
@@ -1387,19 +1443,18 @@ static int ni_ai_drain_dma(struct comedi_device *dev)
for (i = 0; i < timeout; i++) {
if ((devpriv->stc_readw(dev,
AI_Status_1_Register) &
- AI_FIFO_Empty_St)
- && mite_bytes_in_transit(devpriv->
- ai_mite_chan) == 0)
+ AI_FIFO_Empty_St)
+ && mite_bytes_in_transit(devpriv->ai_mite_chan) ==
+ 0)
break;
udelay(5);
}
if (i == timeout) {
+ printk("ni_mio_common: wait for dma drain timed out\n");
printk
- ("ni_mio_common: wait for dma drain timed out\n");
- printk
- ("mite_bytes_in_transit=%i, AI_Status1_Register=0x%x\n",
- mite_bytes_in_transit(devpriv->ai_mite_chan),
- devpriv->stc_readw(dev, AI_Status_1_Register));
+ ("mite_bytes_in_transit=%i, AI_Status1_Register=0x%x\n",
+ mite_bytes_in_transit(devpriv->ai_mite_chan),
+ devpriv->stc_readw(dev, AI_Status_1_Register));
retval = -1;
}
}
@@ -1423,8 +1478,8 @@ static void ni_handle_fifo_dregs(struct comedi_device *dev)
if (boardtype.reg_type == ni_reg_611x) {
while ((devpriv->stc_readw(dev,
- AI_Status_1_Register) &
- AI_FIFO_Empty_St) == 0) {
+ AI_Status_1_Register) &
+ AI_FIFO_Empty_St) == 0) {
dl = ni_readl(ADC_FIFO_Data_611x);
/* This may get the hi/lo data in the wrong order */
@@ -1453,24 +1508,26 @@ static void ni_handle_fifo_dregs(struct comedi_device *dev)
} else {
fifo_empty =
- devpriv->stc_readw(dev,
- AI_Status_1_Register) & AI_FIFO_Empty_St;
+ devpriv->stc_readw(dev,
+ AI_Status_1_Register) & AI_FIFO_Empty_St;
while (fifo_empty == 0) {
for (i = 0;
- i <
- sizeof(devpriv->ai_fifo_buffer) /
- sizeof(devpriv->ai_fifo_buffer[0]); i++) {
+ i <
+ sizeof(devpriv->ai_fifo_buffer) /
+ sizeof(devpriv->ai_fifo_buffer[0]); i++) {
fifo_empty =
- devpriv->stc_readw(dev,
- AI_Status_1_Register) &
- AI_FIFO_Empty_St;
+ devpriv->stc_readw(dev,
+ AI_Status_1_Register) &
+ AI_FIFO_Empty_St;
if (fifo_empty)
break;
devpriv->ai_fifo_buffer[i] =
- ni_readw(ADC_FIFO_Data_Register);
+ ni_readw(ADC_FIFO_Data_Register);
}
cfc_write_array_to_buffer(s, devpriv->ai_fifo_buffer,
- i * sizeof(devpriv->ai_fifo_buffer[0]));
+ i *
+ sizeof(devpriv->
+ ai_fifo_buffer[0]));
}
}
}
@@ -1513,7 +1570,8 @@ static void get_last_sample_6143(struct comedi_device *dev)
}
static void ni_ai_munge(struct comedi_device *dev, struct comedi_subdevice *s,
- void *data, unsigned int num_bytes, unsigned int chan_index)
+ void *data, unsigned int num_bytes,
+ unsigned int chan_index)
{
struct comedi_async *async = s->async;
unsigned int i;
@@ -1620,13 +1678,13 @@ static int ni_ai_reset(struct comedi_device *dev, struct comedi_subdevice *s)
ni_release_ai_mite_channel(dev);
/* ai configuration */
devpriv->stc_writew(dev, AI_Configuration_Start | AI_Reset,
- Joint_Reset_Register);
+ Joint_Reset_Register);
ni_set_bits(dev, Interrupt_A_Enable_Register,
- AI_SC_TC_Interrupt_Enable | AI_START1_Interrupt_Enable |
- AI_START2_Interrupt_Enable | AI_START_Interrupt_Enable |
- AI_STOP_Interrupt_Enable | AI_Error_Interrupt_Enable |
- AI_FIFO_Interrupt_Enable, 0);
+ AI_SC_TC_Interrupt_Enable | AI_START1_Interrupt_Enable |
+ AI_START2_Interrupt_Enable | AI_START_Interrupt_Enable |
+ AI_STOP_Interrupt_Enable | AI_Error_Interrupt_Enable |
+ AI_FIFO_Interrupt_Enable, 0);
ni_clear_ai_fifo(dev);
@@ -1635,51 +1693,60 @@ static int ni_ai_reset(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->stc_writew(dev, AI_Disarm, AI_Command_1_Register); /* reset pulses */
devpriv->stc_writew(dev,
- AI_Start_Stop | AI_Mode_1_Reserved /*| AI_Trigger_Once */ ,
- AI_Mode_1_Register);
+ AI_Start_Stop | AI_Mode_1_Reserved
+ /*| AI_Trigger_Once */ ,
+ AI_Mode_1_Register);
devpriv->stc_writew(dev, 0x0000, AI_Mode_2_Register);
/* generate FIFO interrupts on non-empty */
devpriv->stc_writew(dev, (0 << 6) | 0x0000, AI_Mode_3_Register);
if (boardtype.reg_type == ni_reg_611x) {
devpriv->stc_writew(dev, AI_SHIFTIN_Pulse_Width |
- AI_SOC_Polarity |
- AI_LOCALMUX_CLK_Pulse_Width, AI_Personal_Register);
- devpriv->stc_writew(dev, AI_SCAN_IN_PROG_Output_Select(3) |
- AI_EXTMUX_CLK_Output_Select(0) |
- AI_LOCALMUX_CLK_Output_Select(2) |
- AI_SC_TC_Output_Select(3) |
- AI_CONVERT_Output_Select(AI_CONVERT_Output_Enable_High),
- AI_Output_Control_Register);
+ AI_SOC_Polarity |
+ AI_LOCALMUX_CLK_Pulse_Width,
+ AI_Personal_Register);
+ devpriv->stc_writew(dev,
+ AI_SCAN_IN_PROG_Output_Select(3) |
+ AI_EXTMUX_CLK_Output_Select(0) |
+ AI_LOCALMUX_CLK_Output_Select(2) |
+ AI_SC_TC_Output_Select(3) |
+ AI_CONVERT_Output_Select
+ (AI_CONVERT_Output_Enable_High),
+ AI_Output_Control_Register);
} else if (boardtype.reg_type == ni_reg_6143) {
devpriv->stc_writew(dev, AI_SHIFTIN_Pulse_Width |
- AI_SOC_Polarity |
- AI_LOCALMUX_CLK_Pulse_Width, AI_Personal_Register);
- devpriv->stc_writew(dev, AI_SCAN_IN_PROG_Output_Select(3) |
- AI_EXTMUX_CLK_Output_Select(0) |
- AI_LOCALMUX_CLK_Output_Select(2) |
- AI_SC_TC_Output_Select(3) |
- AI_CONVERT_Output_Select(AI_CONVERT_Output_Enable_Low),
- AI_Output_Control_Register);
+ AI_SOC_Polarity |
+ AI_LOCALMUX_CLK_Pulse_Width,
+ AI_Personal_Register);
+ devpriv->stc_writew(dev,
+ AI_SCAN_IN_PROG_Output_Select(3) |
+ AI_EXTMUX_CLK_Output_Select(0) |
+ AI_LOCALMUX_CLK_Output_Select(2) |
+ AI_SC_TC_Output_Select(3) |
+ AI_CONVERT_Output_Select
+ (AI_CONVERT_Output_Enable_Low),
+ AI_Output_Control_Register);
} else {
unsigned ai_output_control_bits;
devpriv->stc_writew(dev, AI_SHIFTIN_Pulse_Width |
- AI_SOC_Polarity |
- AI_CONVERT_Pulse_Width |
- AI_LOCALMUX_CLK_Pulse_Width, AI_Personal_Register);
- ai_output_control_bits = AI_SCAN_IN_PROG_Output_Select(3) |
- AI_EXTMUX_CLK_Output_Select(0) |
- AI_LOCALMUX_CLK_Output_Select(2) |
- AI_SC_TC_Output_Select(3);
+ AI_SOC_Polarity |
+ AI_CONVERT_Pulse_Width |
+ AI_LOCALMUX_CLK_Pulse_Width,
+ AI_Personal_Register);
+ ai_output_control_bits =
+ AI_SCAN_IN_PROG_Output_Select(3) |
+ AI_EXTMUX_CLK_Output_Select(0) |
+ AI_LOCALMUX_CLK_Output_Select(2) |
+ AI_SC_TC_Output_Select(3);
if (boardtype.reg_type == ni_reg_622x)
ai_output_control_bits |=
- AI_CONVERT_Output_Select
- (AI_CONVERT_Output_Enable_High);
+ AI_CONVERT_Output_Select
+ (AI_CONVERT_Output_Enable_High);
else
ai_output_control_bits |=
- AI_CONVERT_Output_Select
- (AI_CONVERT_Output_Enable_Low);
+ AI_CONVERT_Output_Select
+ (AI_CONVERT_Output_Enable_Low);
devpriv->stc_writew(dev, ai_output_control_bits,
- AI_Output_Control_Register);
+ AI_Output_Control_Register);
}
/* the following registers should not be changed, because there
* are no backup registers in devpriv. If you want to change
@@ -1716,8 +1783,9 @@ static int ni_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
return count;
}
-static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_ai_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s, struct comedi_insn *insn,
+ unsigned int *data)
{
int i, n;
const unsigned int mask = (1 << boardtype.adbits) - 1;
@@ -1733,31 +1801,31 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s
if (boardtype.reg_type == ni_reg_611x) {
for (n = 0; n < num_adc_stages_611x; n++) {
devpriv->stc_writew(dev, AI_CONVERT_Pulse,
- AI_Command_1_Register);
+ AI_Command_1_Register);
udelay(1);
}
for (n = 0; n < insn->n; n++) {
devpriv->stc_writew(dev, AI_CONVERT_Pulse,
- AI_Command_1_Register);
+ AI_Command_1_Register);
/* The 611x has screwy 32-bit FIFOs. */
d = 0;
for (i = 0; i < NI_TIMEOUT; i++) {
if (ni_readb(XXX_Status) & 0x80) {
d = (ni_readl(ADC_FIFO_Data_611x) >> 16)
- & 0xffff;
+ & 0xffff;
break;
}
if (!(devpriv->stc_readw(dev,
- AI_Status_1_Register) &
- AI_FIFO_Empty_St)) {
+ AI_Status_1_Register) &
+ AI_FIFO_Empty_St)) {
d = ni_readl(ADC_FIFO_Data_611x) &
- 0xffff;
+ 0xffff;
break;
}
}
if (i == NI_TIMEOUT) {
printk
- ("ni_mio_common: timeout in 611x ni_ai_insn_read\n");
+ ("ni_mio_common: timeout in 611x ni_ai_insn_read\n");
return -ETIME;
}
d += signbits;
@@ -1766,7 +1834,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s
} else if (boardtype.reg_type == ni_reg_6143) {
for (n = 0; n < insn->n; n++) {
devpriv->stc_writew(dev, AI_CONVERT_Pulse,
- AI_Command_1_Register);
+ AI_Command_1_Register);
/* The 6143 has 32-bit FIFOs. You need to strobe a bit to move a single 16bit stranded sample into the FIFO */
dl = 0;
@@ -1779,7 +1847,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s
}
if (i == NI_TIMEOUT) {
printk
- ("ni_mio_common: timeout in 6143 ni_ai_insn_read\n");
+ ("ni_mio_common: timeout in 6143 ni_ai_insn_read\n");
return -ETIME;
}
data[n] = (((dl >> 16) & 0xFFFF) + signbits) & 0xFFFF;
@@ -1787,21 +1855,21 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s
} else {
for (n = 0; n < insn->n; n++) {
devpriv->stc_writew(dev, AI_CONVERT_Pulse,
- AI_Command_1_Register);
+ AI_Command_1_Register);
for (i = 0; i < NI_TIMEOUT; i++) {
if (!(devpriv->stc_readw(dev,
- AI_Status_1_Register) &
- AI_FIFO_Empty_St))
+ AI_Status_1_Register) &
+ AI_FIFO_Empty_St))
break;
}
if (i == NI_TIMEOUT) {
printk
- ("ni_mio_common: timeout in ni_ai_insn_read\n");
+ ("ni_mio_common: timeout in ni_ai_insn_read\n");
return -ETIME;
}
if (boardtype.reg_type & ni_reg_m_series_mask) {
data[n] =
- ni_readl(M_Offset_AI_FIFO_Data) & mask;
+ ni_readl(M_Offset_AI_FIFO_Data) & mask;
} else {
d = ni_readw(ADC_FIFO_Data_Register);
d += signbits; /* subtle: needs to be short addition */
@@ -1818,8 +1886,8 @@ void ni_prime_channelgain_list(struct comedi_device *dev)
devpriv->stc_writew(dev, AI_CONVERT_Pulse, AI_Command_1_Register);
for (i = 0; i < NI_TIMEOUT; ++i) {
if (!(devpriv->stc_readw(dev,
- AI_Status_1_Register) &
- AI_FIFO_Empty_St)) {
+ AI_Status_1_Register) &
+ AI_FIFO_Empty_St)) {
devpriv->stc_writew(dev, 1, ADC_FIFO_Clear);
return;
}
@@ -1829,7 +1897,8 @@ void ni_prime_channelgain_list(struct comedi_device *dev)
}
static void ni_m_series_load_channelgain_list(struct comedi_device *dev,
- unsigned int n_chan, unsigned int *list)
+ unsigned int n_chan,
+ unsigned int *list)
{
unsigned int chan, range, aref;
unsigned int i;
@@ -1849,11 +1918,11 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev,
bypass_bits = MSeries_AI_Bypass_Config_FIFO_Bit;
bypass_bits |= chan;
bypass_bits |=
- (devpriv->
- ai_calib_source) & (MSeries_AI_Bypass_Cal_Sel_Pos_Mask |
- MSeries_AI_Bypass_Cal_Sel_Neg_Mask |
- MSeries_AI_Bypass_Mode_Mux_Mask |
- MSeries_AO_Bypass_AO_Cal_Sel_Mask);
+ (devpriv->ai_calib_source) &
+ (MSeries_AI_Bypass_Cal_Sel_Pos_Mask |
+ MSeries_AI_Bypass_Cal_Sel_Neg_Mask |
+ MSeries_AI_Bypass_Mode_Mux_Mask |
+ MSeries_AO_Bypass_AO_Cal_Sel_Mask);
bypass_bits |= MSeries_AI_Bypass_Gain_Bits(range_code);
if (dither)
bypass_bits |= MSeries_AI_Bypass_Dither_Bit;
@@ -1876,22 +1945,22 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev,
switch (aref) {
case AREF_DIFF:
config_bits |=
- MSeries_AI_Config_Channel_Type_Differential_Bits;
+ MSeries_AI_Config_Channel_Type_Differential_Bits;
break;
case AREF_COMMON:
config_bits |=
- MSeries_AI_Config_Channel_Type_Common_Ref_Bits;
+ MSeries_AI_Config_Channel_Type_Common_Ref_Bits;
break;
case AREF_GROUND:
config_bits |=
- MSeries_AI_Config_Channel_Type_Ground_Ref_Bits;
+ MSeries_AI_Config_Channel_Type_Ground_Ref_Bits;
break;
case AREF_OTHER:
break;
}
config_bits |= MSeries_AI_Config_Channel_Bits(chan);
config_bits |=
- MSeries_AI_Config_Bank_Bits(boardtype.reg_type, chan);
+ MSeries_AI_Config_Bank_Bits(boardtype.reg_type, chan);
config_bits |= MSeries_AI_Config_Gain_Bits(range_code);
if (i == n_chan - 1)
config_bits |= MSeries_AI_Config_Last_Channel_Bit;
@@ -1933,8 +2002,8 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev,
* bits 0-2: channel
* valid channels are 0-3
*/
-static void ni_load_channelgain_list(struct comedi_device *dev, unsigned int n_chan,
- unsigned int *list)
+static void ni_load_channelgain_list(struct comedi_device *dev,
+ unsigned int n_chan, unsigned int *list)
{
unsigned int chan, range, aref;
unsigned int i;
@@ -1947,9 +2016,9 @@ static void ni_load_channelgain_list(struct comedi_device *dev, unsigned int n_c
return;
}
if (n_chan == 1 && (boardtype.reg_type != ni_reg_611x)
- && (boardtype.reg_type != ni_reg_6143)) {
+ && (boardtype.reg_type != ni_reg_6143)) {
if (devpriv->changain_state
- && devpriv->changain_spec == list[0]) {
+ && devpriv->changain_spec == list[0]) {
/* ready to go. */
return;
}
@@ -1964,25 +2033,23 @@ static void ni_load_channelgain_list(struct comedi_device *dev, unsigned int n_c
/* Set up Calibration mode if required */
if (boardtype.reg_type == ni_reg_6143) {
if ((list[0] & CR_ALT_SOURCE)
- && !devpriv->ai_calib_source_enabled) {
+ && !devpriv->ai_calib_source_enabled) {
/* Strobe Relay enable bit */
- ni_writew(devpriv->
- ai_calib_source |
- Calibration_Channel_6143_RelayOn,
- Calibration_Channel_6143);
+ ni_writew(devpriv->ai_calib_source |
+ Calibration_Channel_6143_RelayOn,
+ Calibration_Channel_6143);
ni_writew(devpriv->ai_calib_source,
- Calibration_Channel_6143);
+ Calibration_Channel_6143);
devpriv->ai_calib_source_enabled = 1;
msleep_interruptible(100); /* Allow relays to change */
} else if (!(list[0] & CR_ALT_SOURCE)
- && devpriv->ai_calib_source_enabled) {
+ && devpriv->ai_calib_source_enabled) {
/* Strobe Relay disable bit */
- ni_writew(devpriv->
- ai_calib_source |
- Calibration_Channel_6143_RelayOff,
- Calibration_Channel_6143);
+ ni_writew(devpriv->ai_calib_source |
+ Calibration_Channel_6143_RelayOff,
+ Calibration_Channel_6143);
ni_writew(devpriv->ai_calib_source,
- Calibration_Channel_6143);
+ Calibration_Channel_6143);
devpriv->ai_calib_source_enabled = 0;
msleep_interruptible(100); /* Allow relays to change */
}
@@ -1991,7 +2058,7 @@ static void ni_load_channelgain_list(struct comedi_device *dev, unsigned int n_c
offset = 1 << (boardtype.adbits - 1);
for (i = 0; i < n_chan; i++) {
if ((boardtype.reg_type != ni_reg_6143)
- && (list[i] & CR_ALT_SOURCE)) {
+ && (list[i] & CR_ALT_SOURCE)) {
chan = devpriv->ai_calib_source;
} else {
chan = CR_CHAN(list[i]);
@@ -2011,7 +2078,7 @@ static void ni_load_channelgain_list(struct comedi_device *dev, unsigned int n_c
if ((list[i] & CR_ALT_SOURCE)) {
if (boardtype.reg_type == ni_reg_611x)
ni_writew(CR_CHAN(list[i]) & 0x0003,
- Calibration_Channel_Select_611x);
+ Calibration_Channel_Select_611x);
} else {
if (boardtype.reg_type == ni_reg_611x)
aref = AREF_DIFF;
@@ -2048,13 +2115,13 @@ static void ni_load_channelgain_list(struct comedi_device *dev, unsigned int n_c
/* prime the channel/gain list */
if ((boardtype.reg_type != ni_reg_611x)
- && (boardtype.reg_type != ni_reg_6143)) {
+ && (boardtype.reg_type != ni_reg_6143)) {
ni_prime_channelgain_list(dev);
}
}
static int ni_ns_to_timer(const struct comedi_device *dev, unsigned nanosec,
- int round_mode)
+ int round_mode)
{
int divider;
switch (round_mode) {
@@ -2078,7 +2145,7 @@ static unsigned ni_timer_to_ns(const struct comedi_device *dev, int timer)
}
static unsigned ni_min_ai_scan_period_ns(struct comedi_device *dev,
- unsigned num_channels)
+ unsigned num_channels)
{
switch (boardtype.reg_type) {
case ni_reg_611x:
@@ -2094,7 +2161,7 @@ static unsigned ni_min_ai_scan_period_ns(struct comedi_device *dev,
}
static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_cmd *cmd)
+ struct comedi_cmd *cmd)
{
int err = 0;
int tmp;
@@ -2119,7 +2186,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
tmp = cmd->convert_src;
sources = TRIG_TIMER | TRIG_EXT;
if ((boardtype.reg_type == ni_reg_611x)
- || (boardtype.reg_type == ni_reg_6143))
+ || (boardtype.reg_type == ni_reg_6143))
sources |= TRIG_NOW;
cmd->convert_src &= sources;
if (!cmd->convert_src || tmp != cmd->convert_src)
@@ -2142,14 +2209,14 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
/* note that mutual compatiblity is not an issue here */
if (cmd->start_src != TRIG_NOW &&
- cmd->start_src != TRIG_INT && cmd->start_src != TRIG_EXT)
+ cmd->start_src != TRIG_INT && cmd->start_src != TRIG_EXT)
err++;
if (cmd->scan_begin_src != TRIG_TIMER &&
- cmd->scan_begin_src != TRIG_EXT &&
- cmd->scan_begin_src != TRIG_OTHER)
+ cmd->scan_begin_src != TRIG_EXT &&
+ cmd->scan_begin_src != TRIG_OTHER)
err++;
if (cmd->convert_src != TRIG_TIMER &&
- cmd->convert_src != TRIG_EXT && cmd->convert_src != TRIG_NOW)
+ cmd->convert_src != TRIG_EXT && cmd->convert_src != TRIG_NOW)
err++;
if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE)
err++;
@@ -2179,10 +2246,11 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
}
if (cmd->scan_begin_src == TRIG_TIMER) {
if (cmd->scan_begin_arg < ni_min_ai_scan_period_ns(dev,
- cmd->chanlist_len)) {
+ cmd->
+ chanlist_len))
+ {
cmd->scan_begin_arg =
- ni_min_ai_scan_period_ns(dev,
- cmd->chanlist_len);
+ ni_min_ai_scan_period_ns(dev, cmd->chanlist_len);
err++;
}
if (cmd->scan_begin_arg > devpriv->clock_ns * 0xffffff) {
@@ -2208,7 +2276,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
}
if (cmd->convert_src == TRIG_TIMER) {
if ((boardtype.reg_type == ni_reg_611x)
- || (boardtype.reg_type == ni_reg_6143)) {
+ || (boardtype.reg_type == ni_reg_6143)) {
if (cmd->convert_arg != 0) {
cmd->convert_arg = 0;
err++;
@@ -2274,27 +2342,31 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
if (cmd->scan_begin_src == TRIG_TIMER) {
tmp = cmd->scan_begin_arg;
cmd->scan_begin_arg =
- ni_timer_to_ns(dev, ni_ns_to_timer(dev,
- cmd->scan_begin_arg,
- cmd->flags & TRIG_ROUND_MASK));
+ ni_timer_to_ns(dev, ni_ns_to_timer(dev,
+ cmd->scan_begin_arg,
+ cmd->
+ flags &
+ TRIG_ROUND_MASK));
if (tmp != cmd->scan_begin_arg)
err++;
}
if (cmd->convert_src == TRIG_TIMER) {
if ((boardtype.reg_type != ni_reg_611x)
- && (boardtype.reg_type != ni_reg_6143)) {
+ && (boardtype.reg_type != ni_reg_6143)) {
tmp = cmd->convert_arg;
cmd->convert_arg =
- ni_timer_to_ns(dev, ni_ns_to_timer(dev,
- cmd->convert_arg,
- cmd->flags & TRIG_ROUND_MASK));
+ ni_timer_to_ns(dev, ni_ns_to_timer(dev,
+ cmd->convert_arg,
+ cmd->
+ flags &
+ TRIG_ROUND_MASK));
if (tmp != cmd->convert_arg)
err++;
if (cmd->scan_begin_src == TRIG_TIMER &&
- cmd->scan_begin_arg <
- cmd->convert_arg * cmd->scan_end_arg) {
+ cmd->scan_begin_arg <
+ cmd->convert_arg * cmd->scan_end_arg) {
cmd->scan_begin_arg =
- cmd->convert_arg * cmd->scan_end_arg;
+ cmd->convert_arg * cmd->scan_end_arg;
err++;
}
}
@@ -2332,27 +2404,28 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
* interferes with the use of pfi0 */
devpriv->an_trig_etc_reg &= ~Analog_Trigger_Enable;
devpriv->stc_writew(dev, devpriv->an_trig_etc_reg,
- Analog_Trigger_Etc_Register);
+ Analog_Trigger_Etc_Register);
switch (cmd->start_src) {
case TRIG_INT:
case TRIG_NOW:
devpriv->stc_writew(dev, AI_START2_Select(0) |
- AI_START1_Sync | AI_START1_Edge | AI_START1_Select(0),
- AI_Trigger_Select_Register);
+ AI_START1_Sync | AI_START1_Edge |
+ AI_START1_Select(0),
+ AI_Trigger_Select_Register);
break;
case TRIG_EXT:
{
int chan = CR_CHAN(cmd->start_arg);
unsigned int bits = AI_START2_Select(0) |
- AI_START1_Sync | AI_START1_Select(chan + 1);
+ AI_START1_Sync | AI_START1_Select(chan + 1);
if (cmd->start_arg & CR_INVERT)
bits |= AI_START1_Polarity;
if (cmd->start_arg & CR_EDGE)
bits |= AI_START1_Edge;
devpriv->stc_writew(dev, bits,
- AI_Trigger_Select_Register);
+ AI_Trigger_Select_Register);
break;
}
}
@@ -2363,7 +2436,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->stc_writew(dev, mode2, AI_Mode_2_Register);
if (cmd->chanlist_len == 1 || (boardtype.reg_type == ni_reg_611x)
- || (boardtype.reg_type == ni_reg_6143)) {
+ || (boardtype.reg_type == ni_reg_6143)) {
start_stop_select |= AI_STOP_Polarity;
start_stop_select |= AI_STOP_Select(31); /* logic low */
start_stop_select |= AI_STOP_Sync;
@@ -2371,7 +2444,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
start_stop_select |= AI_STOP_Select(19); /* ai configuration memory */
}
devpriv->stc_writew(dev, start_stop_select,
- AI_START_STOP_Select_Register);
+ AI_START_STOP_Select_Register);
devpriv->ai_cmd2 = 0;
switch (cmd->stop_src) {
@@ -2397,7 +2470,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* this is required to get the last sample for chanlist_len > 1, not sure why */
if (cmd->chanlist_len > 1)
start_stop_select |=
- AI_STOP_Polarity | AI_STOP_Edge;
+ AI_STOP_Polarity | AI_STOP_Edge;
}
break;
case TRIG_NONE:
@@ -2433,7 +2506,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
*/
start_stop_select |= AI_START_Edge | AI_START_Sync;
devpriv->stc_writew(dev, start_stop_select,
- AI_START_STOP_Select_Register);
+ AI_START_STOP_Select_Register);
mode2 |= AI_SI_Reload_Mode(0);
/* AI_SI_Initial_Load_Source=A */
@@ -2443,7 +2516,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* load SI */
timer = ni_ns_to_timer(dev, cmd->scan_begin_arg,
- TRIG_ROUND_NEAREST);
+ TRIG_ROUND_NEAREST);
devpriv->stc_writel(dev, timer, AI_SI_Load_A_Registers);
devpriv->stc_writew(dev, AI_SI_Load, AI_Command_1_Register);
break;
@@ -2454,13 +2527,13 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (cmd->scan_begin_arg & CR_INVERT)
start_stop_select |= AI_START_Polarity;
if (cmd->scan_begin_src != cmd->convert_src ||
- (cmd->scan_begin_arg & ~CR_EDGE) !=
- (cmd->convert_arg & ~CR_EDGE))
+ (cmd->scan_begin_arg & ~CR_EDGE) !=
+ (cmd->convert_arg & ~CR_EDGE))
start_stop_select |= AI_START_Sync;
start_stop_select |=
- AI_START_Select(1 + CR_CHAN(cmd->scan_begin_arg));
+ AI_START_Select(1 + CR_CHAN(cmd->scan_begin_arg));
devpriv->stc_writew(dev, start_stop_select,
- AI_START_STOP_Select_Register);
+ AI_START_STOP_Select_Register);
break;
}
@@ -2471,7 +2544,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
timer = 1;
else
timer = ni_ns_to_timer(dev, cmd->convert_arg,
- TRIG_ROUND_NEAREST);
+ TRIG_ROUND_NEAREST);
devpriv->stc_writew(dev, 1, AI_SI2_Load_A_Register); /* 0,0 does not work. */
devpriv->stc_writew(dev, timer, AI_SI2_Load_B_Register);
@@ -2505,14 +2578,14 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* interrupt on FIFO, errors, SC_TC */
interrupt_a_enable |= AI_Error_Interrupt_Enable |
- AI_SC_TC_Interrupt_Enable;
+ AI_SC_TC_Interrupt_Enable;
#ifndef PCIDMA
interrupt_a_enable |= AI_FIFO_Interrupt_Enable;
#endif
if (cmd->flags & TRIG_WAKE_EOS
- || (devpriv->ai_cmd2 & AI_End_On_End_Of_Scan)) {
+ || (devpriv->ai_cmd2 & AI_End_On_End_Of_Scan)) {
/* wake on end-of-scan */
devpriv->aimode = AIMODE_SCAN;
} else {
@@ -2524,24 +2597,24 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/*generate FIFO interrupts and DMA requests on half-full */
#ifdef PCIDMA
devpriv->stc_writew(dev, AI_FIFO_Mode_HF_to_E,
- AI_Mode_3_Register);
+ AI_Mode_3_Register);
#else
devpriv->stc_writew(dev, AI_FIFO_Mode_HF,
- AI_Mode_3_Register);
+ AI_Mode_3_Register);
#endif
break;
case AIMODE_SAMPLE:
/*generate FIFO interrupts on non-empty */
devpriv->stc_writew(dev, AI_FIFO_Mode_NE,
- AI_Mode_3_Register);
+ AI_Mode_3_Register);
break;
case AIMODE_SCAN:
#ifdef PCIDMA
devpriv->stc_writew(dev, AI_FIFO_Mode_NE,
- AI_Mode_3_Register);
+ AI_Mode_3_Register);
#else
devpriv->stc_writew(dev, AI_FIFO_Mode_HF,
- AI_Mode_3_Register);
+ AI_Mode_3_Register);
#endif
interrupt_a_enable |= AI_STOP_Interrupt_Enable;
break;
@@ -2552,10 +2625,10 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->stc_writew(dev, AI_Error_Interrupt_Ack | AI_STOP_Interrupt_Ack | AI_START_Interrupt_Ack | AI_START2_Interrupt_Ack | AI_START1_Interrupt_Ack | AI_SC_TC_Interrupt_Ack | AI_SC_TC_Error_Confirm, Interrupt_A_Ack_Register); /* clear interrupts */
ni_set_bits(dev, Interrupt_A_Enable_Register,
- interrupt_a_enable, 1);
+ interrupt_a_enable, 1);
MDPRINTK("Interrupt_A_Enable_Register = 0x%04x\n",
- devpriv->int_a_enable_reg);
+ devpriv->int_a_enable_reg);
} else {
/* interrupt on nothing */
ni_set_bits(dev, Interrupt_A_Enable_Register, ~0, 0);
@@ -2570,14 +2643,14 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
switch (cmd->scan_begin_src) {
case TRIG_TIMER:
devpriv->stc_writew(dev,
- AI_SI2_Arm | AI_SI_Arm | AI_DIV_Arm | AI_SC_Arm,
- AI_Command_1_Register);
+ AI_SI2_Arm | AI_SI_Arm | AI_DIV_Arm |
+ AI_SC_Arm, AI_Command_1_Register);
break;
case TRIG_EXT:
/* XXX AI_SI_Arm? */
devpriv->stc_writew(dev,
- AI_SI2_Arm | AI_SI_Arm | AI_DIV_Arm | AI_SC_Arm,
- AI_Command_1_Register);
+ AI_SI2_Arm | AI_SI_Arm | AI_DIV_Arm |
+ AI_SC_Arm, AI_Command_1_Register);
break;
}
@@ -2594,7 +2667,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
case TRIG_NOW:
/* AI_START1_Pulse */
devpriv->stc_writew(dev, AI_START1_Pulse | devpriv->ai_cmd2,
- AI_Command_2_Register);
+ AI_Command_2_Register);
s->async->inttrig = NULL;
break;
case TRIG_EXT:
@@ -2611,23 +2684,26 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}
static int ni_ai_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int trignum)
+ unsigned int trignum)
{
if (trignum != 0)
return -EINVAL;
devpriv->stc_writew(dev, AI_START1_Pulse | devpriv->ai_cmd2,
- AI_Command_2_Register);
+ AI_Command_2_Register);
s->async->inttrig = NULL;
return 1;
}
-static int ni_ai_config_analog_trig(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data);
+static int ni_ai_config_analog_trig(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data);
-static int ni_ai_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_ai_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
if (insn->n < 1)
return -EINVAL;
@@ -2666,7 +2742,7 @@ static int ni_ai_insn_config(struct comedi_device *dev, struct comedi_subdevice
devpriv->ai_calib_source = calib_source;
if (boardtype.reg_type == ni_reg_611x) {
ni_writeb(calib_source_adjust,
- Cal_Gain_Select_611x);
+ Cal_Gain_Select_611x);
}
}
return 2;
@@ -2677,8 +2753,10 @@ static int ni_ai_insn_config(struct comedi_device *dev, struct comedi_subdevice
return -EINVAL;
}
-static int ni_ai_config_analog_trig(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_ai_config_analog_trig(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
unsigned int a, b, modebits;
int err = 0;
@@ -2730,8 +2808,7 @@ static int ni_ai_config_analog_trig(struct comedi_device *dev, struct comedi_sub
a = data[4];
b = data[3];
modebits =
- ((data[1] & 0xf) << 4) | ((data[1] & 0xf0) >>
- 4);
+ ((data[1] & 0xf) << 4) | ((data[1] & 0xf0) >> 4);
}
devpriv->atrig_low = a;
devpriv->atrig_high = b;
@@ -2776,7 +2853,8 @@ static int ni_ai_config_analog_trig(struct comedi_device *dev, struct comedi_sub
/* munge data from unsigned to 2's complement for analog output bipolar modes */
static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
- void *data, unsigned int num_bytes, unsigned int chan_index)
+ void *data, unsigned int num_bytes,
+ unsigned int chan_index)
{
struct comedi_async *async = s->async;
unsigned int range;
@@ -2799,8 +2877,9 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
}
static int ni_m_series_ao_config_chanlist(struct comedi_device *dev,
- struct comedi_subdevice *s, unsigned int chanspec[], unsigned int n_chans,
- int timed)
+ struct comedi_subdevice *s,
+ unsigned int chanspec[],
+ unsigned int n_chans, int timed)
{
unsigned int range;
unsigned int chan;
@@ -2811,7 +2890,8 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev,
if (timed) {
for (i = 0; i < boardtype.n_aochan; ++i) {
devpriv->ao_conf[i] &= ~MSeries_AO_Update_Timed_Bit;
- ni_writeb(devpriv->ao_conf[i], M_Offset_AO_Config_Bank(i));
+ ni_writeb(devpriv->ao_conf[i],
+ M_Offset_AO_Config_Bank(i));
ni_writeb(0xf, M_Offset_AO_Waveform_Order(i));
}
}
@@ -2834,16 +2914,16 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev,
case 4000000:
conf |= MSeries_AO_DAC_Reference_10V_Internal_Bits;
ni_writeb(MSeries_Attenuate_x5_Bit,
- M_Offset_AO_Reference_Attenuation(chan));
+ M_Offset_AO_Reference_Attenuation(chan));
break;
case 2000000:
conf |= MSeries_AO_DAC_Reference_5V_Internal_Bits;
ni_writeb(MSeries_Attenuate_x5_Bit,
- M_Offset_AO_Reference_Attenuation(chan));
+ M_Offset_AO_Reference_Attenuation(chan));
break;
default:
printk("%s: bug! unhandled ao reference voltage\n",
- __func__);
+ __func__);
break;
}
switch (krange->max + krange->min) {
@@ -2855,7 +2935,7 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev,
break;
default:
printk("%s: bug! unhandled ao offset voltage\n",
- __func__);
+ __func__);
break;
}
if (timed)
@@ -2867,8 +2947,10 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev,
return invert;
}
-static int ni_old_ao_config_chanlist(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int chanspec[], unsigned int n_chans)
+static int ni_old_ao_config_chanlist(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int chanspec[],
+ unsigned int n_chans)
{
unsigned int range;
unsigned int chan;
@@ -2902,7 +2984,7 @@ static int ni_old_ao_config_chanlist(struct comedi_device *dev, struct comedi_su
/* analog reference */
/* AREF_OTHER connects AO ground to AI ground, i think */
conf |= (CR_AREF(chanspec[i]) ==
- AREF_OTHER) ? AO_Ground_Ref : 0;
+ AREF_OTHER) ? AO_Ground_Ref : 0;
ni_writew(conf, AO_Configuration);
devpriv->ao_conf[chan] = conf;
@@ -2910,25 +2992,30 @@ static int ni_old_ao_config_chanlist(struct comedi_device *dev, struct comedi_su
return invert;
}
-static int ni_ao_config_chanlist(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int chanspec[], unsigned int n_chans, int timed)
+static int ni_ao_config_chanlist(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int chanspec[], unsigned int n_chans,
+ int timed)
{
if (boardtype.reg_type & ni_reg_m_series_mask)
return ni_m_series_ao_config_chanlist(dev, s, chanspec, n_chans,
- timed);
+ timed);
else
return ni_old_ao_config_chanlist(dev, s, chanspec, n_chans);
}
-static int ni_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+
+static int ni_ao_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s, struct comedi_insn *insn,
+ unsigned int *data)
{
data[0] = devpriv->ao[CR_CHAN(insn->chanspec)];
return 1;
}
-static int ni_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_ao_insn_write(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int invert;
@@ -2941,13 +3028,14 @@ static int ni_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *
ni_writew(data[0], M_Offset_DAC_Direct_Data(chan));
} else
ni_writew(data[0] ^ invert,
- (chan) ? DAC1_Direct_Data : DAC0_Direct_Data);
+ (chan) ? DAC1_Direct_Data : DAC0_Direct_Data);
return 1;
}
-static int ni_ao_insn_write_671x(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_ao_insn_write_671x(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int invert;
@@ -2963,16 +3051,17 @@ static int ni_ao_insn_write_671x(struct comedi_device *dev, struct comedi_subdev
return 1;
}
-static int ni_ao_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_ao_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
switch (data[0]) {
case INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE:
- switch (data[1])
- {
+ switch (data[1]) {
case COMEDI_OUTPUT:
data[2] = 1 + boardtype.ao_fifo_depth * sizeof(short);
- if (devpriv->mite) data[2] += devpriv->mite->fifo_size;
+ if (devpriv->mite)
+ data[2] += devpriv->mite->fifo_size;
break;
case COMEDI_INPUT:
data[2] = 0;
@@ -2990,7 +3079,7 @@ static int ni_ao_insn_config(struct comedi_device *dev, struct comedi_subdevice
}
static int ni_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int trignum)
+ unsigned int trignum)
{
int ret;
int interrupt_b_bits;
@@ -3006,7 +3095,7 @@ static int ni_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
s->async->inttrig = NULL;
ni_set_bits(dev, Interrupt_B_Enable_Register,
- AO_FIFO_Interrupt_Enable | AO_Error_Interrupt_Enable, 0);
+ AO_FIFO_Interrupt_Enable | AO_Error_Interrupt_Enable, 0);
interrupt_b_bits = AO_Error_Interrupt_Enable;
#ifdef PCIDMA
devpriv->stc_writew(dev, 1, DAC_FIFO_Clear);
@@ -3027,35 +3116,34 @@ static int ni_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
#endif
devpriv->stc_writew(dev, devpriv->ao_mode3 | AO_Not_An_UPDATE,
- AO_Mode_3_Register);
+ AO_Mode_3_Register);
devpriv->stc_writew(dev, devpriv->ao_mode3, AO_Mode_3_Register);
/* wait for DACs to be loaded */
for (i = 0; i < timeout; i++) {
udelay(1);
if ((devpriv->stc_readw(dev,
Joint_Status_2_Register) &
- AO_TMRDACWRs_In_Progress_St) == 0)
+ AO_TMRDACWRs_In_Progress_St) == 0)
break;
}
if (i == timeout) {
comedi_error(dev,
- "timed out waiting for AO_TMRDACWRs_In_Progress_St to clear");
+ "timed out waiting for AO_TMRDACWRs_In_Progress_St to clear");
return -EIO;
}
/* stc manual says we are need to clear error interrupt after AO_TMRDACWRs_In_Progress_St clears */
devpriv->stc_writew(dev, AO_Error_Interrupt_Ack,
- Interrupt_B_Ack_Register);
+ Interrupt_B_Ack_Register);
ni_set_bits(dev, Interrupt_B_Enable_Register, interrupt_b_bits, 1);
devpriv->stc_writew(dev,
- devpriv->
- ao_cmd1 | AO_UI_Arm | AO_UC_Arm | AO_BC_Arm |
- AO_DAC1_Update_Mode | AO_DAC0_Update_Mode,
- AO_Command_1_Register);
+ devpriv->ao_cmd1 | AO_UI_Arm | AO_UC_Arm | AO_BC_Arm
+ | AO_DAC1_Update_Mode | AO_DAC0_Update_Mode,
+ AO_Command_1_Register);
devpriv->stc_writew(dev, devpriv->ao_cmd2 | AO_START1_Pulse,
- AO_Command_2_Register);
+ AO_Command_2_Register);
return 0;
}
@@ -3104,18 +3192,20 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
case TRIG_INT:
case TRIG_NOW:
devpriv->ao_trigger_select &=
- ~(AO_START1_Polarity | AO_START1_Select(-1));
+ ~(AO_START1_Polarity | AO_START1_Select(-1));
devpriv->ao_trigger_select |= AO_START1_Edge | AO_START1_Sync;
devpriv->stc_writew(dev, devpriv->ao_trigger_select,
- AO_Trigger_Select_Register);
+ AO_Trigger_Select_Register);
break;
case TRIG_EXT:
- devpriv->ao_trigger_select = AO_START1_Select(CR_CHAN(cmd->start_arg)+1);
+ devpriv->ao_trigger_select =
+ AO_START1_Select(CR_CHAN(cmd->start_arg) + 1);
if (cmd->start_arg & CR_INVERT)
- devpriv->ao_trigger_select |= AO_START1_Polarity; /* 0=active high, 1=active low. see daq-stc 3-24 (p186) */
+ devpriv->ao_trigger_select |= AO_START1_Polarity; /* 0=active high, 1=active low. see daq-stc 3-24 (p186) */
if (cmd->start_arg & CR_EDGE)
- devpriv->ao_trigger_select |= AO_START1_Edge; /* 0=edge detection disabled, 1=enabled */
- devpriv->stc_writew(dev, devpriv->ao_trigger_select, AO_Trigger_Select_Register);
+ devpriv->ao_trigger_select |= AO_START1_Edge; /* 0=edge detection disabled, 1=enabled */
+ devpriv->stc_writew(dev, devpriv->ao_trigger_select,
+ AO_Trigger_Select_Register);
break;
default:
BUG();
@@ -3137,17 +3227,19 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->stc_writew(dev, devpriv->ao_mode2, AO_Mode_2_Register);
switch (cmd->stop_src) {
case TRIG_COUNT:
- if (boardtype.reg_type & ni_reg_m_series_mask)
- {
+ if (boardtype.reg_type & ni_reg_m_series_mask) {
/* this is how the NI example code does it for m-series boards, verified correct with 6259 */
- devpriv->stc_writel(dev, cmd->stop_arg - 1, AO_UC_Load_A_Register);
- devpriv->stc_writew(dev, AO_UC_Load, AO_Command_1_Register);
- }else
- {
- devpriv->stc_writel(dev, cmd->stop_arg, AO_UC_Load_A_Register);
- devpriv->stc_writew(dev, AO_UC_Load, AO_Command_1_Register);
devpriv->stc_writel(dev, cmd->stop_arg - 1,
- AO_UC_Load_A_Register);
+ AO_UC_Load_A_Register);
+ devpriv->stc_writew(dev, AO_UC_Load,
+ AO_Command_1_Register);
+ } else {
+ devpriv->stc_writel(dev, cmd->stop_arg,
+ AO_UC_Load_A_Register);
+ devpriv->stc_writew(dev, AO_UC_Load,
+ AO_Command_1_Register);
+ devpriv->stc_writel(dev, cmd->stop_arg - 1,
+ AO_UC_Load_A_Register);
}
break;
case TRIG_NONE:
@@ -3162,21 +3254,21 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}
devpriv->ao_mode1 &=
- ~(AO_UI_Source_Select(0x1f) | AO_UI_Source_Polarity |
- AO_UPDATE_Source_Select(0x1f) | AO_UPDATE_Source_Polarity);
+ ~(AO_UI_Source_Select(0x1f) | AO_UI_Source_Polarity |
+ AO_UPDATE_Source_Select(0x1f) | AO_UPDATE_Source_Polarity);
switch (cmd->scan_begin_src) {
case TRIG_TIMER:
devpriv->ao_cmd2 &= ~AO_BC_Gate_Enable;
trigvar =
- ni_ns_to_timer(dev, cmd->scan_begin_arg,
- TRIG_ROUND_NEAREST);
+ ni_ns_to_timer(dev, cmd->scan_begin_arg,
+ TRIG_ROUND_NEAREST);
devpriv->stc_writel(dev, 1, AO_UI_Load_A_Register);
devpriv->stc_writew(dev, AO_UI_Load, AO_Command_1_Register);
devpriv->stc_writel(dev, trigvar, AO_UI_Load_A_Register);
break;
case TRIG_EXT:
devpriv->ao_mode1 |=
- AO_UPDATE_Source_Select(cmd->scan_begin_arg);
+ AO_UPDATE_Source_Select(cmd->scan_begin_arg);
if (cmd->scan_begin_arg & CR_INVERT)
devpriv->ao_mode1 |= AO_UPDATE_Source_Polarity;
devpriv->ao_cmd2 |= AO_BC_Gate_Enable;
@@ -3188,34 +3280,34 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->stc_writew(dev, devpriv->ao_cmd2, AO_Command_2_Register);
devpriv->stc_writew(dev, devpriv->ao_mode1, AO_Mode_1_Register);
devpriv->ao_mode2 &=
- ~(AO_UI_Reload_Mode(3) | AO_UI_Initial_Load_Source);
+ ~(AO_UI_Reload_Mode(3) | AO_UI_Initial_Load_Source);
devpriv->stc_writew(dev, devpriv->ao_mode2, AO_Mode_2_Register);
if (cmd->scan_end_arg > 1) {
devpriv->ao_mode1 |= AO_Multiple_Channels;
devpriv->stc_writew(dev,
- AO_Number_Of_Channels(cmd->scan_end_arg -
- 1) |
- AO_UPDATE_Output_Select
- (AO_Update_Output_High_Z),
- AO_Output_Control_Register);
+ AO_Number_Of_Channels(cmd->scan_end_arg -
+ 1) |
+ AO_UPDATE_Output_Select
+ (AO_Update_Output_High_Z),
+ AO_Output_Control_Register);
} else {
unsigned bits;
devpriv->ao_mode1 &= ~AO_Multiple_Channels;
bits = AO_UPDATE_Output_Select(AO_Update_Output_High_Z);
- if (boardtype.reg_type & (ni_reg_m_series_mask | ni_reg_6xxx_mask)) {
+ if (boardtype.
+ reg_type & (ni_reg_m_series_mask | ni_reg_6xxx_mask)) {
bits |= AO_Number_Of_Channels(0);
} else {
- bits |= AO_Number_Of_Channels(CR_CHAN(cmd->
- chanlist[0]));
+ bits |=
+ AO_Number_Of_Channels(CR_CHAN(cmd->chanlist[0]));
}
- devpriv->stc_writew(dev, bits,
- AO_Output_Control_Register);
+ devpriv->stc_writew(dev, bits, AO_Output_Control_Register);
}
devpriv->stc_writew(dev, devpriv->ao_mode1, AO_Mode_1_Register);
devpriv->stc_writew(dev, AO_DAC0_Update_Mode | AO_DAC1_Update_Mode,
- AO_Command_1_Register);
+ AO_Command_1_Register);
devpriv->ao_mode3 |= AO_Stop_On_Overrun_Error;
devpriv->stc_writew(dev, devpriv->ao_mode3, AO_Mode_3_Register);
@@ -3230,7 +3322,7 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->stc_writew(dev, devpriv->ao_mode2, AO_Mode_2_Register);
bits = AO_BC_Source_Select | AO_UPDATE_Pulse_Width |
- AO_TMRDACWR_Pulse_Width;
+ AO_TMRDACWR_Pulse_Width;
if (boardtype.ao_fifo_depth)
bits |= AO_FIFO_Enable;
else
@@ -3249,9 +3341,9 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (cmd->stop_src == TRIG_COUNT) {
devpriv->stc_writew(dev, AO_BC_TC_Interrupt_Ack,
- Interrupt_B_Ack_Register);
+ Interrupt_B_Ack_Register);
ni_set_bits(dev, Interrupt_B_Enable_Register,
- AO_BC_TC_Interrupt_Enable, 1);
+ AO_BC_TC_Interrupt_Enable, 1);
}
s->async->inttrig = &ni_ao_inttrig;
@@ -3260,7 +3352,7 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}
static int ni_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_cmd *cmd)
+ struct comedi_cmd *cmd)
{
int err = 0;
int tmp;
@@ -3365,9 +3457,11 @@ static int ni_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
if (cmd->scan_begin_src == TRIG_TIMER) {
tmp = cmd->scan_begin_arg;
cmd->scan_begin_arg =
- ni_timer_to_ns(dev, ni_ns_to_timer(dev,
- cmd->scan_begin_arg,
- cmd->flags & TRIG_ROUND_MASK));
+ ni_timer_to_ns(dev, ni_ns_to_timer(dev,
+ cmd->scan_begin_arg,
+ cmd->
+ flags &
+ TRIG_ROUND_MASK));
if (tmp != cmd->scan_begin_arg)
err++;
}
@@ -3398,7 +3492,7 @@ static int ni_ao_reset(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->stc_writew(dev, AO_BC_Source_Select, AO_Personal_Register);
devpriv->stc_writew(dev, 0x3f98, Interrupt_B_Ack_Register);
devpriv->stc_writew(dev, AO_BC_Source_Select | AO_UPDATE_Pulse_Width |
- AO_TMRDACWR_Pulse_Width, AO_Personal_Register);
+ AO_TMRDACWR_Pulse_Width, AO_Personal_Register);
devpriv->stc_writew(dev, 0, AO_Output_Control_Register);
devpriv->stc_writew(dev, 0, AO_Start_Select_Register);
devpriv->ao_cmd1 = 0;
@@ -3416,12 +3510,11 @@ static int ni_ao_reset(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->stc_writew(dev, devpriv->ao_mode3, AO_Mode_3_Register);
devpriv->ao_trigger_select = 0;
devpriv->stc_writew(dev, devpriv->ao_trigger_select,
- AO_Trigger_Select_Register);
+ AO_Trigger_Select_Register);
if (boardtype.reg_type & ni_reg_6xxx_mask) {
unsigned immediate_bits = 0;
unsigned i;
- for (i = 0; i < s->n_chan; ++i)
- {
+ for (i = 0; i < s->n_chan; ++i) {
immediate_bits |= 1 << i;
}
ao_win_out(immediate_bits, AO_Immediate_671x);
@@ -3434,12 +3527,13 @@ static int ni_ao_reset(struct comedi_device *dev, struct comedi_subdevice *s)
/* digital io */
-static int ni_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_dio_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
#ifdef DEBUG_DIO
printk("ni_dio_insn_config() chan=%d io=%d\n",
- CR_CHAN(insn->chanspec), data[0]);
+ CR_CHAN(insn->chanspec), data[0]);
#endif
switch (data[0]) {
case INSN_CONFIG_DIO_OUTPUT:
@@ -3450,9 +3544,9 @@ static int ni_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice
break;
case INSN_CONFIG_DIO_QUERY:
data[1] =
- (s->io_bits & (1 << CR_CHAN(insn->
- chanspec))) ? COMEDI_OUTPUT :
- COMEDI_INPUT;
+ (s->
+ io_bits & (1 << CR_CHAN(insn->chanspec))) ? COMEDI_OUTPUT :
+ COMEDI_INPUT;
return insn->n;
break;
default:
@@ -3466,8 +3560,9 @@ static int ni_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice
return 1;
}
-static int ni_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_dio_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
#ifdef DEBUG_DIO
printk("ni_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0], data[1]);
@@ -3478,7 +3573,7 @@ static int ni_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *
/* Perform check to make sure we're not using the
serial part of the dio */
if ((data[0] & (DIO_SDIN | DIO_SDOUT))
- && devpriv->serial_interval_ns)
+ && devpriv->serial_interval_ns)
return -EBUSY;
s->state &= ~data[0];
@@ -3486,7 +3581,7 @@ static int ni_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *
devpriv->dio_output &= ~DIO_Parallel_Data_Mask;
devpriv->dio_output |= DIO_Parallel_Data_Out(s->state);
devpriv->stc_writew(dev, devpriv->dio_output,
- DIO_Output_Register);
+ DIO_Output_Register);
}
data[1] = devpriv->stc_readw(dev, DIO_Parallel_Input_Register);
@@ -3494,11 +3589,13 @@ static int ni_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *
}
static int ni_m_series_dio_insn_config(struct comedi_device *dev,
- struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
#ifdef DEBUG_DIO
printk("ni_m_series_dio_insn_config() chan=%d io=%d\n",
- CR_CHAN(insn->chanspec), data[0]);
+ CR_CHAN(insn->chanspec), data[0]);
#endif
switch (data[0]) {
case INSN_CONFIG_DIO_OUTPUT:
@@ -3509,9 +3606,9 @@ static int ni_m_series_dio_insn_config(struct comedi_device *dev,
break;
case INSN_CONFIG_DIO_QUERY:
data[1] =
- (s->io_bits & (1 << CR_CHAN(insn->
- chanspec))) ? COMEDI_OUTPUT :
- COMEDI_INPUT;
+ (s->
+ io_bits & (1 << CR_CHAN(insn->chanspec))) ? COMEDI_OUTPUT :
+ COMEDI_INPUT;
return insn->n;
break;
default:
@@ -3523,12 +3620,14 @@ static int ni_m_series_dio_insn_config(struct comedi_device *dev,
return 1;
}
-static int ni_m_series_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_m_series_dio_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
#ifdef DEBUG_DIO
printk("ni_m_series_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0],
- data[1]);
+ data[1]);
#endif
if (insn->n != 2)
return -EINVAL;
@@ -3542,8 +3641,8 @@ static int ni_m_series_dio_insn_bits(struct comedi_device *dev, struct comedi_su
return 2;
}
-static int ni_cdio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_cmd *cmd)
+static int ni_cdio_cmdtest(struct comedi_device *dev,
+ struct comedi_subdevice *s, struct comedi_cmd *cmd)
{
int err = 0;
int tmp;
@@ -3606,7 +3705,7 @@ static int ni_cdio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s
if (cmd->scan_begin_src == TRIG_EXT) {
tmp = cmd->scan_begin_arg;
tmp &= CR_PACK_FLAGS(CDO_Sample_Source_Select_Mask, 0, 0,
- CR_INVERT);
+ CR_INVERT);
if (tmp != cmd->scan_begin_arg) {
err++;
}
@@ -3661,8 +3760,8 @@ static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
switch (cmd->scan_begin_src) {
case TRIG_EXT:
cdo_mode_bits |=
- CR_CHAN(cmd->
- scan_begin_arg) & CDO_Sample_Source_Select_Mask;
+ CR_CHAN(cmd->scan_begin_arg) &
+ CDO_Sample_Source_Select_Mask;
break;
default:
BUG();
@@ -3677,7 +3776,7 @@ static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
ni_writel(s->io_bits, M_Offset_CDO_Mask_Enable);
} else {
comedi_error(dev,
- "attempted to run digital output command with no lines configured as outputs");
+ "attempted to run digital output command with no lines configured as outputs");
return -EIO;
}
retval = ni_request_cdo_mite_channel(dev);
@@ -3689,7 +3788,7 @@ static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}
static int ni_cdo_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int trignum)
+ unsigned int trignum)
{
#ifdef PCIDMA
unsigned long flags;
@@ -3732,16 +3831,17 @@ static int ni_cdo_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
return -EIO;
}
ni_writel(CDO_Arm_Bit | CDO_Error_Interrupt_Enable_Set_Bit |
- CDO_Empty_FIFO_Interrupt_Enable_Set_Bit, M_Offset_CDIO_Command);
+ CDO_Empty_FIFO_Interrupt_Enable_Set_Bit,
+ M_Offset_CDIO_Command);
return retval;
}
static int ni_cdio_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{
ni_writel(CDO_Disarm_Bit | CDO_Error_Interrupt_Enable_Clear_Bit |
- CDO_Empty_FIFO_Interrupt_Enable_Clear_Bit |
- CDO_FIFO_Request_Interrupt_Enable_Clear_Bit,
- M_Offset_CDIO_Command);
+ CDO_Empty_FIFO_Interrupt_Enable_Clear_Bit |
+ CDO_FIFO_Request_Interrupt_Enable_Clear_Bit,
+ M_Offset_CDIO_Command);
/*
* XXX not sure what interrupt C group does ni_writeb(0,
* M_Offset_Interrupt_C_Enable);
@@ -3766,11 +3866,11 @@ static void handle_cdio_interrupt(struct comedi_device *dev)
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->cdo_mite_chan) {
unsigned cdo_mite_status =
- mite_get_status(devpriv->cdo_mite_chan);
+ mite_get_status(devpriv->cdo_mite_chan);
if (cdo_mite_status & CHSR_LINKC) {
writel(CHOR_CLRLC,
- devpriv->mite->mite_io_addr +
- MITE_CHOR(devpriv->cdo_mite_chan->channel));
+ devpriv->mite->mite_io_addr +
+ MITE_CHOR(devpriv->cdo_mite_chan->channel));
}
mite_sync_output_dma(devpriv->cdo_mite_chan, s->async);
}
@@ -3786,14 +3886,15 @@ static void handle_cdio_interrupt(struct comedi_device *dev)
if (cdio_status & CDO_FIFO_Empty_Bit) {
/* printk("cdio fifo empty\n"); */
ni_writel(CDO_Empty_FIFO_Interrupt_Enable_Clear_Bit,
- M_Offset_CDIO_Command);
+ M_Offset_CDIO_Command);
/* s->async->events |= COMEDI_CB_EOA; */
}
ni_event(dev, s);
}
-static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_serial_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
int err = insn->n;
unsigned char byte_out, byte_in = 0;
@@ -3813,7 +3914,7 @@ static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdev
if (data[1] == SERIAL_DISABLED) {
devpriv->serial_hw_mode = 0;
devpriv->dio_control &= ~(DIO_HW_Serial_Enable |
- DIO_Software_Serial_Control);
+ DIO_Software_Serial_Control);
data[1] = SERIAL_DISABLED;
devpriv->serial_interval_ns = data[1];
} else if (data[1] <= SERIAL_600NS) {
@@ -3827,13 +3928,13 @@ static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdev
} else if (data[1] <= SERIAL_1_2US) {
devpriv->dio_control &= ~DIO_HW_Serial_Timebase;
devpriv->clock_and_fout |= Slow_Internal_Timebase |
- DIO_Serial_Out_Divide_By_2;
+ DIO_Serial_Out_Divide_By_2;
data[1] = SERIAL_1_2US;
devpriv->serial_interval_ns = data[1];
} else if (data[1] <= SERIAL_10US) {
devpriv->dio_control |= DIO_HW_Serial_Timebase;
devpriv->clock_and_fout |= Slow_Internal_Timebase |
- DIO_Serial_Out_Divide_By_2;
+ DIO_Serial_Out_Divide_By_2;
/* Note: DIO_Serial_Out_Divide_By_2 only affects
600ns/1.2us. If you turn divide_by_2 off with the
slow clock, you will still get 10us, except then
@@ -3842,16 +3943,16 @@ static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdev
devpriv->serial_interval_ns = data[1];
} else {
devpriv->dio_control &= ~(DIO_HW_Serial_Enable |
- DIO_Software_Serial_Control);
+ DIO_Software_Serial_Control);
devpriv->serial_hw_mode = 0;
data[1] = (data[1] / 1000) * 1000;
devpriv->serial_interval_ns = data[1];
}
devpriv->stc_writew(dev, devpriv->dio_control,
- DIO_Control_Register);
+ DIO_Control_Register);
devpriv->stc_writew(dev, devpriv->clock_and_fout,
- Clock_and_FOUT_Register);
+ Clock_and_FOUT_Register);
return 1;
break;
@@ -3866,10 +3967,10 @@ static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdev
if (devpriv->serial_hw_mode) {
err = ni_serial_hw_readwrite8(dev, s, byte_out,
- &byte_in);
+ &byte_in);
} else if (devpriv->serial_interval_ns > 0) {
err = ni_serial_sw_readwrite8(dev, s, byte_out,
- &byte_in);
+ &byte_in);
} else {
printk("ni_serial_insn_config: serial disabled!\n");
return -EINVAL;
@@ -3886,8 +3987,10 @@ static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdev
}
-static int ni_serial_hw_readwrite8(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned char data_out, unsigned char *data_in)
+static int ni_serial_hw_readwrite8(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned char data_out,
+ unsigned char *data_in)
{
unsigned int status1;
int err = 0, count = 20;
@@ -3912,14 +4015,14 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, struct comedi_subd
/* Wait until STC says we're done, but don't loop infinitely. */
while ((status1 =
- devpriv->stc_readw(dev,
- Joint_Status_1_Register)) &
- DIO_Serial_IO_In_Progress_St) {
+ devpriv->stc_readw(dev,
+ Joint_Status_1_Register)) &
+ DIO_Serial_IO_In_Progress_St) {
/* Delay one bit per loop */
udelay((devpriv->serial_interval_ns + 999) / 1000);
if (--count < 0) {
printk
- ("ni_serial_hw_readwrite8: SPI serial I/O didn't finish in time!\n");
+ ("ni_serial_hw_readwrite8: SPI serial I/O didn't finish in time!\n");
err = -ETIME;
goto Error;
}
@@ -3936,14 +4039,16 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, struct comedi_subd
#endif
}
- Error:
+Error:
devpriv->stc_writew(dev, devpriv->dio_control, DIO_Control_Register);
return err;
}
-static int ni_serial_sw_readwrite8(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned char data_out, unsigned char *data_in)
+static int ni_serial_sw_readwrite8(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned char data_out,
+ unsigned char *data_in)
{
unsigned char mask, input = 0;
@@ -3963,25 +4068,26 @@ static int ni_serial_sw_readwrite8(struct comedi_device *dev, struct comedi_subd
devpriv->dio_output |= DIO_SDOUT;
}
devpriv->stc_writew(dev, devpriv->dio_output,
- DIO_Output_Register);
+ DIO_Output_Register);
/* Assert SDCLK (active low, inverted), wait for half of
the delay, deassert SDCLK, and wait for the other half. */
devpriv->dio_control |= DIO_Software_Serial_Control;
devpriv->stc_writew(dev, devpriv->dio_control,
- DIO_Control_Register);
+ DIO_Control_Register);
udelay((devpriv->serial_interval_ns + 999) / 2000);
devpriv->dio_control &= ~DIO_Software_Serial_Control;
devpriv->stc_writew(dev, devpriv->dio_control,
- DIO_Control_Register);
+ DIO_Control_Register);
udelay((devpriv->serial_interval_ns + 999) / 2000);
/* Input current bit */
if (devpriv->stc_readw(dev,
- DIO_Parallel_Input_Register) & DIO_SDIN) {
+ DIO_Parallel_Input_Register) & DIO_SDIN)
+ {
/* printk("DIO_P_I_R: 0x%x\n", devpriv->stc_readw(dev, DIO_Parallel_Input_Register)); */
input |= mask;
}
@@ -4010,10 +4116,9 @@ static void init_ao_67xx(struct comedi_device *dev, struct comedi_subdevice *s)
{
int i;
- for (i = 0; i < s->n_chan; i++)
- {
+ for (i = 0; i < s->n_chan; i++) {
ni_ao_win_outw(dev, AO_Channel(i) | 0x0,
- AO_Configuration_2_67xx);
+ AO_Configuration_2_67xx);
}
ao_win_out(0x0, AO_Later_Single_Point_Updates);
}
@@ -4102,7 +4207,7 @@ static unsigned ni_gpct_to_stc_register(enum ni_gpct_register reg)
break;
default:
printk("%s: unhandled register 0x%x in switch.\n",
- __func__, reg);
+ __func__, reg);
BUG();
return 0;
break;
@@ -4111,16 +4216,16 @@ static unsigned ni_gpct_to_stc_register(enum ni_gpct_register reg)
}
static void ni_gpct_write_register(struct ni_gpct *counter, unsigned bits,
- enum ni_gpct_register reg)
+ enum ni_gpct_register reg)
{
struct comedi_device *dev = counter->counter_dev->dev;
unsigned stc_register;
/* bits in the join reset register which are relevant to counters */
static const unsigned gpct_joint_reset_mask = G0_Reset | G1_Reset;
static const unsigned gpct_interrupt_a_enable_mask =
- G0_Gate_Interrupt_Enable | G0_TC_Interrupt_Enable;
+ G0_Gate_Interrupt_Enable | G0_TC_Interrupt_Enable;
static const unsigned gpct_interrupt_b_enable_mask =
- G1_Gate_Interrupt_Enable | G1_TC_Interrupt_Enable;
+ G1_Gate_Interrupt_Enable | G1_TC_Interrupt_Enable;
switch (reg) {
/* m-series-only registers */
@@ -4162,12 +4267,12 @@ static void ni_gpct_write_register(struct ni_gpct *counter, unsigned bits,
case NITIO_G0_Interrupt_Enable_Reg:
BUG_ON(bits & ~gpct_interrupt_a_enable_mask);
ni_set_bitfield(dev, Interrupt_A_Enable_Register,
- gpct_interrupt_a_enable_mask, bits);
+ gpct_interrupt_a_enable_mask, bits);
break;
case NITIO_G1_Interrupt_Enable_Reg:
BUG_ON(bits & ~gpct_interrupt_b_enable_mask);
ni_set_bitfield(dev, Interrupt_B_Enable_Register,
- gpct_interrupt_b_enable_mask, bits);
+ gpct_interrupt_b_enable_mask, bits);
break;
case NITIO_G01_Joint_Reset_Reg:
BUG_ON(bits & ~gpct_joint_reset_mask);
@@ -4179,7 +4284,7 @@ static void ni_gpct_write_register(struct ni_gpct *counter, unsigned bits,
}
static unsigned ni_gpct_read_register(struct ni_gpct *counter,
- enum ni_gpct_register reg)
+ enum ni_gpct_register reg)
{
struct comedi_device *dev = counter->counter_dev->dev;
unsigned stc_register;
@@ -4211,27 +4316,30 @@ static unsigned ni_gpct_read_register(struct ni_gpct *counter,
}
static int ni_freq_out_insn_read(struct comedi_device *dev,
- struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
data[0] = devpriv->clock_and_fout & FOUT_Divider_mask;
return 1;
}
static int ni_freq_out_insn_write(struct comedi_device *dev,
- struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
devpriv->clock_and_fout &= ~FOUT_Enable;
devpriv->stc_writew(dev, devpriv->clock_and_fout,
- Clock_and_FOUT_Register);
+ Clock_and_FOUT_Register);
devpriv->clock_and_fout &= ~FOUT_Divider_mask;
devpriv->clock_and_fout |= FOUT_Divider(data[0]);
devpriv->clock_and_fout |= FOUT_Enable;
devpriv->stc_writew(dev, devpriv->clock_and_fout,
- Clock_and_FOUT_Register);
+ Clock_and_FOUT_Register);
return insn->n;
}
-static int ni_set_freq_out_clock(struct comedi_device *dev, unsigned int clock_source)
+static int ni_set_freq_out_clock(struct comedi_device *dev,
+ unsigned int clock_source)
{
switch (clock_source) {
case NI_FREQ_OUT_TIMEBASE_1_DIV_2_CLOCK_SRC:
@@ -4244,12 +4352,13 @@ static int ni_set_freq_out_clock(struct comedi_device *dev, unsigned int clock_s
return -EINVAL;
}
devpriv->stc_writew(dev, devpriv->clock_and_fout,
- Clock_and_FOUT_Register);
+ Clock_and_FOUT_Register);
return 3;
}
-static void ni_get_freq_out_clock(struct comedi_device *dev, unsigned int *clock_source,
- unsigned int *clock_period_ns)
+static void ni_get_freq_out_clock(struct comedi_device *dev,
+ unsigned int *clock_source,
+ unsigned int *clock_period_ns)
{
if (devpriv->clock_and_fout & FOUT_Timebase_Select) {
*clock_source = NI_FREQ_OUT_TIMEBASE_2_CLOCK_SRC;
@@ -4260,8 +4369,9 @@ static void ni_get_freq_out_clock(struct comedi_device *dev, unsigned int *clock
}
}
-static int ni_freq_out_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_freq_out_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
switch (data[0]) {
case INSN_CONFIG_SET_CLOCK_SRC:
@@ -4312,7 +4422,7 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it)
if (boardtype.n_adchan) {
s->type = COMEDI_SUBD_AI;
s->subdev_flags =
- SDF_READABLE | SDF_DIFF | SDF_DITHER | SDF_CMD_READ;
+ SDF_READABLE | SDF_DIFF | SDF_DITHER | SDF_CMD_READ;
if (boardtype.reg_type != ni_reg_611x)
s->subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER;
if (boardtype.adbits > 16)
@@ -4387,7 +4497,7 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it)
s->n_chan = boardtype.num_p0_dio_channels;
if (boardtype.reg_type & ni_reg_m_series_mask) {
s->subdev_flags |=
- SDF_LSAMPL | SDF_CMD_WRITE /* | SDF_CMD_READ */ ;
+ SDF_LSAMPL | SDF_CMD_WRITE /* | SDF_CMD_READ */ ;
s->insn_bits = &ni_m_series_dio_insn_bits;
s->insn_config = &ni_m_series_dio_insn_config;
s->do_cmd = &ni_cdio_cmd;
@@ -4463,7 +4573,7 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it)
ni_writew(s->state, M_Offset_PFI_DO);
for (i = 0; i < NUM_PFI_OUTPUT_SELECT_REGS; ++i) {
ni_writew(devpriv->pfi_output_select_reg[i],
- M_Offset_PFI_Output_Select(i + 1));
+ M_Offset_PFI_Output_Select(i + 1));
}
} else {
s->n_chan = 10;
@@ -4517,15 +4627,17 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it)
counter_variant = ni_gpct_variant_e_series;
}
devpriv->counter_dev = ni_gpct_device_construct(dev,
- &ni_gpct_write_register, &ni_gpct_read_register,
- counter_variant, NUM_GPCT);
+ &ni_gpct_write_register,
+ &ni_gpct_read_register,
+ counter_variant,
+ NUM_GPCT);
/* General purpose counters */
for (j = 0; j < NUM_GPCT; ++j) {
s = dev->subdevices + NI_GPCT_SUBDEV(j);
s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags =
- SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_CMD_READ
- /* | SDF_CMD_WRITE */ ;
+ SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_CMD_READ
+ /* | SDF_CMD_WRITE */ ;
s->n_chan = 3;
if (boardtype.reg_type & ni_reg_m_series_mask)
s->maxdata = 0xffffffff;
@@ -4561,32 +4673,33 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it)
if ((boardtype.reg_type & ni_reg_6xxx_mask) == 0) {
/* BEAM is this needed for PCI-6143 ?? */
devpriv->clock_and_fout =
- Slow_Internal_Time_Divide_By_2 |
- Slow_Internal_Timebase |
- Clock_To_Board_Divide_By_2 |
- Clock_To_Board |
- AI_Output_Divide_By_2 | AO_Output_Divide_By_2;
+ Slow_Internal_Time_Divide_By_2 |
+ Slow_Internal_Timebase |
+ Clock_To_Board_Divide_By_2 |
+ Clock_To_Board |
+ AI_Output_Divide_By_2 | AO_Output_Divide_By_2;
} else {
devpriv->clock_and_fout =
- Slow_Internal_Time_Divide_By_2 |
- Slow_Internal_Timebase |
- Clock_To_Board_Divide_By_2 | Clock_To_Board;
+ Slow_Internal_Time_Divide_By_2 |
+ Slow_Internal_Timebase |
+ Clock_To_Board_Divide_By_2 | Clock_To_Board;
}
devpriv->stc_writew(dev, devpriv->clock_and_fout,
- Clock_and_FOUT_Register);
+ Clock_and_FOUT_Register);
/* analog output configuration */
ni_ao_reset(dev, dev->subdevices + NI_AO_SUBDEV);
if (dev->irq) {
devpriv->stc_writew(dev,
- (IRQ_POLARITY ? Interrupt_Output_Polarity : 0) |
- (Interrupt_Output_On_3_Pins & 0) | Interrupt_A_Enable |
- Interrupt_B_Enable |
- Interrupt_A_Output_Select(interrupt_pin(dev->
- irq)) |
- Interrupt_B_Output_Select(interrupt_pin(dev->irq)),
- Interrupt_Control_Register);
+ (IRQ_POLARITY ? Interrupt_Output_Polarity :
+ 0) | (Interrupt_Output_On_3_Pins & 0) |
+ Interrupt_A_Enable | Interrupt_B_Enable |
+ Interrupt_A_Output_Select(interrupt_pin
+ (dev->irq)) |
+ Interrupt_B_Output_Select(interrupt_pin
+ (dev->irq)),
+ Interrupt_Control_Register);
}
/* DMA setup */
@@ -4600,7 +4713,7 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it)
for (channel = 0; channel < boardtype.n_aochan; ++channel) {
ni_writeb(0xf, M_Offset_AO_Waveform_Order(channel));
ni_writeb(0x0,
- M_Offset_AO_Reference_Attenuation(channel));
+ M_Offset_AO_Reference_Attenuation(channel));
}
ni_writeb(0x0, M_Offset_AO_Calibration);
}
@@ -4611,7 +4724,7 @@ static int ni_E_init(struct comedi_device *dev, struct comedi_devconfig *it)
static int ni_8255_callback(int dir, int port, int data, unsigned long arg)
{
- struct comedi_device *dev = (struct comedi_device *) arg;
+ struct comedi_device *dev = (struct comedi_device *)arg;
if (dir) {
ni_writeb(data, Port_A + 2 * port);
@@ -4625,8 +4738,9 @@ static int ni_8255_callback(int dir, int port, int data, unsigned long arg)
presents the EEPROM as a subdevice
*/
-static int ni_eeprom_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_eeprom_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
data[0] = ni_read_eeprom(dev, CR_CHAN(insn->chanspec));
@@ -4646,9 +4760,9 @@ static int ni_read_eeprom(struct comedi_device *dev, int addr)
ni_writeb(0x04, Serial_Command);
for (bit = 0x8000; bit; bit >>= 1) {
ni_writeb(0x04 | ((bit & bitstring) ? 0x02 : 0),
- Serial_Command);
+ Serial_Command);
ni_writeb(0x05 | ((bit & bitstring) ? 0x02 : 0),
- Serial_Command);
+ Serial_Command);
}
bitstring = 0;
for (bit = 0x80; bit; bit >>= 1) {
@@ -4662,7 +4776,9 @@ static int ni_read_eeprom(struct comedi_device *dev, int addr)
}
static int ni_m_series_eeprom_insn_read(struct comedi_device *dev,
- struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
data[0] = devpriv->eeprom_buffer[CR_CHAN(insn->chanspec)];
@@ -4676,8 +4792,9 @@ static int ni_get_pwm_config(struct comedi_device *dev, unsigned int *data)
return 3;
}
-static int ni_m_series_pwm_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_m_series_pwm_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
unsigned up_count, down_count;
switch (data[0]) {
@@ -4685,16 +4802,16 @@ static int ni_m_series_pwm_config(struct comedi_device *dev, struct comedi_subde
switch (data[1]) {
case TRIG_ROUND_NEAREST:
up_count =
- (data[2] +
- devpriv->clock_ns / 2) / devpriv->clock_ns;
+ (data[2] +
+ devpriv->clock_ns / 2) / devpriv->clock_ns;
break;
case TRIG_ROUND_DOWN:
up_count = data[2] / devpriv->clock_ns;
break;
case TRIG_ROUND_UP:
up_count =
- (data[2] + devpriv->clock_ns -
- 1) / devpriv->clock_ns;
+ (data[2] + devpriv->clock_ns -
+ 1) / devpriv->clock_ns;
break;
default:
return -EINVAL;
@@ -4703,30 +4820,30 @@ static int ni_m_series_pwm_config(struct comedi_device *dev, struct comedi_subde
switch (data[3]) {
case TRIG_ROUND_NEAREST:
down_count =
- (data[4] +
- devpriv->clock_ns / 2) / devpriv->clock_ns;
+ (data[4] +
+ devpriv->clock_ns / 2) / devpriv->clock_ns;
break;
case TRIG_ROUND_DOWN:
down_count = data[4] / devpriv->clock_ns;
break;
case TRIG_ROUND_UP:
down_count =
- (data[4] + devpriv->clock_ns -
- 1) / devpriv->clock_ns;
+ (data[4] + devpriv->clock_ns -
+ 1) / devpriv->clock_ns;
break;
default:
return -EINVAL;
break;
}
if (up_count * devpriv->clock_ns != data[2] ||
- down_count * devpriv->clock_ns != data[4]) {
+ down_count * devpriv->clock_ns != data[4]) {
data[2] = up_count * devpriv->clock_ns;
data[4] = down_count * devpriv->clock_ns;
return -EAGAIN;
}
ni_writel(MSeries_Cal_PWM_High_Time_Bits(up_count) |
- MSeries_Cal_PWM_Low_Time_Bits(down_count),
- M_Offset_Cal_PWM);
+ MSeries_Cal_PWM_Low_Time_Bits(down_count),
+ M_Offset_Cal_PWM);
devpriv->pwm_up_count = up_count;
devpriv->pwm_down_count = down_count;
return 5;
@@ -4741,8 +4858,9 @@ static int ni_m_series_pwm_config(struct comedi_device *dev, struct comedi_subde
return 0;
}
-static int ni_6143_pwm_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_6143_pwm_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
unsigned up_count, down_count;
switch (data[0]) {
@@ -4750,16 +4868,16 @@ static int ni_6143_pwm_config(struct comedi_device *dev, struct comedi_subdevice
switch (data[1]) {
case TRIG_ROUND_NEAREST:
up_count =
- (data[2] +
- devpriv->clock_ns / 2) / devpriv->clock_ns;
+ (data[2] +
+ devpriv->clock_ns / 2) / devpriv->clock_ns;
break;
case TRIG_ROUND_DOWN:
up_count = data[2] / devpriv->clock_ns;
break;
case TRIG_ROUND_UP:
up_count =
- (data[2] + devpriv->clock_ns -
- 1) / devpriv->clock_ns;
+ (data[2] + devpriv->clock_ns -
+ 1) / devpriv->clock_ns;
break;
default:
return -EINVAL;
@@ -4768,23 +4886,23 @@ static int ni_6143_pwm_config(struct comedi_device *dev, struct comedi_subdevice
switch (data[3]) {
case TRIG_ROUND_NEAREST:
down_count =
- (data[4] +
- devpriv->clock_ns / 2) / devpriv->clock_ns;
+ (data[4] +
+ devpriv->clock_ns / 2) / devpriv->clock_ns;
break;
case TRIG_ROUND_DOWN:
down_count = data[4] / devpriv->clock_ns;
break;
case TRIG_ROUND_UP:
down_count =
- (data[4] + devpriv->clock_ns -
- 1) / devpriv->clock_ns;
+ (data[4] + devpriv->clock_ns -
+ 1) / devpriv->clock_ns;
break;
default:
return -EINVAL;
break;
}
if (up_count * devpriv->clock_ns != data[2] ||
- down_count * devpriv->clock_ns != data[4]) {
+ down_count * devpriv->clock_ns != data[4]) {
data[2] = up_count * devpriv->clock_ns;
data[4] = down_count * devpriv->clock_ns;
return -EAGAIN;
@@ -4808,16 +4926,18 @@ static void ni_write_caldac(struct comedi_device *dev, int addr, int val);
/*
calibration subdevice
*/
-static int ni_calib_insn_write(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_calib_insn_write(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
ni_write_caldac(dev, CR_CHAN(insn->chanspec), data[0]);
return 1;
}
-static int ni_calib_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_calib_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
data[0] = devpriv->caldacs[CR_CHAN(insn->chanspec)];
@@ -4884,7 +5004,7 @@ static void caldac_setup(struct comedi_device *dev, struct comedi_subdevice *s)
type = boardtype.caldac[i];
for (j = 0; j < caldacs[type].n_chans; j++) {
maxdata_list[chan] =
- (1 << caldacs[type].n_bits) - 1;
+ (1 << caldacs[type].n_bits) - 1;
chan++;
}
}
@@ -4948,8 +5068,8 @@ static int pack_mb88341(int addr, int val, int *bitstring)
*/
addr++;
*bitstring = ((addr & 0x1) << 11) |
- ((addr & 0x2) << 9) |
- ((addr & 0x4) << 7) | ((addr & 0x8) << 5) | (val & 0xff);
+ ((addr & 0x2) << 9) |
+ ((addr & 0x4) << 7) | ((addr & 0x8) << 5) | (val & 0xff);
return 12;
}
@@ -4993,11 +5113,11 @@ static int GPCT_G_Watch(struct comedi_device *dev, int chan)
devpriv->gpct_command[chan] &= ~G_Save_Trace;
devpriv->stc_writew(dev, devpriv->gpct_command[chan],
- G_Command_Register(chan));
+ G_Command_Register(chan));
devpriv->gpct_command[chan] |= G_Save_Trace;
devpriv->stc_writew(dev, devpriv->gpct_command[chan],
- G_Command_Register(chan));
+ G_Command_Register(chan));
/* This procedure is used because the two registers cannot
* be read atomically. */
@@ -5021,37 +5141,37 @@ static void GPCT_Reset(struct comedi_device *dev, int chan)
case 0:
devpriv->stc_writew(dev, G0_Reset, Joint_Reset_Register);
ni_set_bits(dev, Interrupt_A_Enable_Register,
- G0_TC_Interrupt_Enable, 0);
+ G0_TC_Interrupt_Enable, 0);
ni_set_bits(dev, Interrupt_A_Enable_Register,
- G0_Gate_Interrupt_Enable, 0);
+ G0_Gate_Interrupt_Enable, 0);
temp_ack_reg |= G0_Gate_Error_Confirm;
temp_ack_reg |= G0_TC_Error_Confirm;
temp_ack_reg |= G0_TC_Interrupt_Ack;
temp_ack_reg |= G0_Gate_Interrupt_Ack;
devpriv->stc_writew(dev, temp_ack_reg,
- Interrupt_A_Ack_Register);
+ Interrupt_A_Ack_Register);
/* problem...this interferes with the other ctr... */
devpriv->an_trig_etc_reg |= GPFO_0_Output_Enable;
devpriv->stc_writew(dev, devpriv->an_trig_etc_reg,
- Analog_Trigger_Etc_Register);
+ Analog_Trigger_Etc_Register);
break;
case 1:
devpriv->stc_writew(dev, G1_Reset, Joint_Reset_Register);
ni_set_bits(dev, Interrupt_B_Enable_Register,
- G1_TC_Interrupt_Enable, 0);
+ G1_TC_Interrupt_Enable, 0);
ni_set_bits(dev, Interrupt_B_Enable_Register,
- G0_Gate_Interrupt_Enable, 0);
+ G0_Gate_Interrupt_Enable, 0);
temp_ack_reg |= G1_Gate_Error_Confirm;
temp_ack_reg |= G1_TC_Error_Confirm;
temp_ack_reg |= G1_TC_Interrupt_Ack;
temp_ack_reg |= G1_Gate_Interrupt_Ack;
devpriv->stc_writew(dev, temp_ack_reg,
- Interrupt_B_Ack_Register);
+ Interrupt_B_Ack_Register);
devpriv->an_trig_etc_reg |= GPFO_1_Output_Enable;
devpriv->stc_writew(dev, devpriv->an_trig_etc_reg,
- Analog_Trigger_Etc_Register);
+ Analog_Trigger_Etc_Register);
break;
};
@@ -5062,9 +5182,9 @@ static void GPCT_Reset(struct comedi_device *dev, int chan)
devpriv->gpct_command[chan] |= G_Synchronized_Gate;
devpriv->stc_writew(dev, devpriv->gpct_mode[chan],
- G_Mode_Register(chan));
+ G_Mode_Register(chan));
devpriv->stc_writew(dev, devpriv->gpct_input_select[chan],
- G_Input_Select_Register(chan));
+ G_Input_Select_Register(chan));
devpriv->stc_writew(dev, 0, G_Autoincrement_Register(chan));
/* printk("exit GPCT_Reset\n"); */
@@ -5072,22 +5192,25 @@ static void GPCT_Reset(struct comedi_device *dev, int chan)
#endif
-static int ni_gpct_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_gpct_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
struct ni_gpct *counter = s->private;
return ni_tio_insn_config(counter, insn, data);
}
-static int ni_gpct_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_gpct_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
struct ni_gpct *counter = s->private;
return ni_tio_rinsn(counter, insn, data);
}
-static int ni_gpct_insn_write(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_gpct_insn_write(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
struct ni_gpct *counter = s->private;
return ni_tio_winsn(counter, insn, data);
@@ -5101,10 +5224,10 @@ static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* const struct comedi_cmd *cmd = &s->async->cmd; */
retval = ni_request_gpct_mite_channel(dev, counter->counter_index,
- COMEDI_INPUT);
+ COMEDI_INPUT);
if (retval) {
comedi_error(dev,
- "no dma channel available for use by counter");
+ "no dma channel available for use by counter");
return retval;
}
ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL, NULL);
@@ -5116,8 +5239,8 @@ static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return retval;
}
-static int ni_gpct_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_cmd *cmd)
+static int ni_gpct_cmdtest(struct comedi_device *dev,
+ struct comedi_subdevice *s, struct comedi_cmd *cmd)
{
#ifdef PCIDMA
struct ni_gpct *counter = s->private;
@@ -5150,7 +5273,7 @@ static int ni_gpct_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
*/
static int ni_m_series_set_pfi_routing(struct comedi_device *dev, unsigned chan,
- unsigned source)
+ unsigned source)
{
unsigned pfi_reg_index;
unsigned array_offset;
@@ -5159,16 +5282,16 @@ static int ni_m_series_set_pfi_routing(struct comedi_device *dev, unsigned chan,
pfi_reg_index = 1 + chan / 3;
array_offset = pfi_reg_index - 1;
devpriv->pfi_output_select_reg[array_offset] &=
- ~MSeries_PFI_Output_Select_Mask(chan);
+ ~MSeries_PFI_Output_Select_Mask(chan);
devpriv->pfi_output_select_reg[array_offset] |=
- MSeries_PFI_Output_Select_Bits(chan, source);
+ MSeries_PFI_Output_Select_Bits(chan, source);
ni_writew(devpriv->pfi_output_select_reg[array_offset],
- M_Offset_PFI_Output_Select(pfi_reg_index));
+ M_Offset_PFI_Output_Select(pfi_reg_index));
return 2;
}
static int ni_old_set_pfi_routing(struct comedi_device *dev, unsigned chan,
- unsigned source)
+ unsigned source)
{
/* pre-m-series boards have fixed signals on pfi pins */
if (source != ni_old_get_pfi_routing(dev, chan))
@@ -5177,7 +5300,7 @@ static int ni_old_set_pfi_routing(struct comedi_device *dev, unsigned chan,
}
static int ni_set_pfi_routing(struct comedi_device *dev, unsigned chan,
- unsigned source)
+ unsigned source)
{
if (boardtype.reg_type & ni_reg_m_series_mask)
return ni_m_series_set_pfi_routing(dev, chan, source);
@@ -5185,11 +5308,14 @@ static int ni_set_pfi_routing(struct comedi_device *dev, unsigned chan,
return ni_old_set_pfi_routing(dev, chan, source);
}
-static unsigned ni_m_series_get_pfi_routing(struct comedi_device *dev, unsigned chan)
+static unsigned ni_m_series_get_pfi_routing(struct comedi_device *dev,
+ unsigned chan)
{
const unsigned array_offset = chan / 3;
return MSeries_PFI_Output_Select_Source(chan,
- devpriv->pfi_output_select_reg[array_offset]);
+ devpriv->
+ pfi_output_select_reg
+ [array_offset]);
}
static unsigned ni_old_get_pfi_routing(struct comedi_device *dev, unsigned chan)
@@ -5242,7 +5368,7 @@ static unsigned ni_get_pfi_routing(struct comedi_device *dev, unsigned chan)
}
static int ni_config_filter(struct comedi_device *dev, unsigned pfi_channel,
- enum ni_pfi_filter_select filter)
+ enum ni_pfi_filter_select filter)
{
unsigned bits;
if ((boardtype.reg_type & ni_reg_m_series_mask) == 0) {
@@ -5255,8 +5381,9 @@ static int ni_config_filter(struct comedi_device *dev, unsigned pfi_channel,
return 0;
}
-static int ni_pfi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_pfi_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
if ((boardtype.reg_type & ni_reg_m_series_mask) == 0) {
return -ENOTSUPP;
@@ -5270,8 +5397,9 @@ static int ni_pfi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *
return 2;
}
-static int ni_pfi_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_pfi_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
unsigned int chan;
@@ -5289,9 +5417,8 @@ static int ni_pfi_insn_config(struct comedi_device *dev, struct comedi_subdevice
break;
case INSN_CONFIG_DIO_QUERY:
data[1] =
- (devpriv->
- io_bidirection_pin_reg & (1 << chan)) ? COMEDI_OUTPUT :
- COMEDI_INPUT;
+ (devpriv->io_bidirection_pin_reg & (1 << chan)) ?
+ COMEDI_OUTPUT : COMEDI_INPUT;
return 0;
break;
case INSN_CONFIG_SET_ROUTING:
@@ -5325,23 +5452,26 @@ static void ni_rtsi_init(struct comedi_device *dev)
}
/* default internal lines routing to RTSI bus lines */
devpriv->rtsi_trig_a_output_reg =
- RTSI_Trig_Output_Bits(0,
- NI_RTSI_OUTPUT_ADR_START1) | RTSI_Trig_Output_Bits(1,
- NI_RTSI_OUTPUT_ADR_START2) | RTSI_Trig_Output_Bits(2,
- NI_RTSI_OUTPUT_SCLKG) | RTSI_Trig_Output_Bits(3,
- NI_RTSI_OUTPUT_DACUPDN);
+ RTSI_Trig_Output_Bits(0,
+ NI_RTSI_OUTPUT_ADR_START1) |
+ RTSI_Trig_Output_Bits(1,
+ NI_RTSI_OUTPUT_ADR_START2) |
+ RTSI_Trig_Output_Bits(2,
+ NI_RTSI_OUTPUT_SCLKG) |
+ RTSI_Trig_Output_Bits(3, NI_RTSI_OUTPUT_DACUPDN);
devpriv->stc_writew(dev, devpriv->rtsi_trig_a_output_reg,
- RTSI_Trig_A_Output_Register);
+ RTSI_Trig_A_Output_Register);
devpriv->rtsi_trig_b_output_reg =
- RTSI_Trig_Output_Bits(4,
- NI_RTSI_OUTPUT_DA_START1) | RTSI_Trig_Output_Bits(5,
- NI_RTSI_OUTPUT_G_SRC0) | RTSI_Trig_Output_Bits(6,
- NI_RTSI_OUTPUT_G_GATE0);
+ RTSI_Trig_Output_Bits(4,
+ NI_RTSI_OUTPUT_DA_START1) |
+ RTSI_Trig_Output_Bits(5,
+ NI_RTSI_OUTPUT_G_SRC0) |
+ RTSI_Trig_Output_Bits(6, NI_RTSI_OUTPUT_G_GATE0);
if (boardtype.reg_type & ni_reg_m_series_mask)
devpriv->rtsi_trig_b_output_reg |=
- RTSI_Trig_Output_Bits(7, NI_RTSI_OUTPUT_RTSI_OSC);
+ RTSI_Trig_Output_Bits(7, NI_RTSI_OUTPUT_RTSI_OSC);
devpriv->stc_writew(dev, devpriv->rtsi_trig_b_output_reg,
- RTSI_Trig_B_Output_Register);
+ RTSI_Trig_B_Output_Register);
/*
* Sets the source and direction of the 4 on board lines
@@ -5349,8 +5479,9 @@ static void ni_rtsi_init(struct comedi_device *dev)
*/
}
-static int ni_rtsi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_rtsi_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
@@ -5363,8 +5494,9 @@ static int ni_rtsi_insn_bits(struct comedi_device *dev, struct comedi_subdevice
/* Find best multiplier/divider to try and get the PLL running at 80 MHz
* given an arbitrary frequency input clock */
static int ni_mseries_get_pll_parameters(unsigned reference_period_ns,
- unsigned *freq_divider, unsigned *freq_multiplier,
- unsigned *actual_period_ns)
+ unsigned *freq_divider,
+ unsigned *freq_multiplier,
+ unsigned *actual_period_ns)
{
unsigned div;
unsigned best_div = 1;
@@ -5383,9 +5515,9 @@ static int ni_mseries_get_pll_parameters(unsigned reference_period_ns,
for (div = 1; div <= max_div; ++div) {
for (mult = 1; mult <= max_mult; ++mult) {
unsigned new_period_ps =
- (reference_picosec * div) / mult;
+ (reference_picosec * div) / mult;
if (abs(new_period_ps - target_picosec) <
- abs(best_period_picosec - target_picosec)) {
+ abs(best_period_picosec - target_picosec)) {
best_period_picosec = new_period_ps;
best_div = div;
best_mult = mult;
@@ -5393,15 +5525,14 @@ static int ni_mseries_get_pll_parameters(unsigned reference_period_ns,
}
}
if (best_period_picosec == 0) {
- printk("%s: bug, failed to find pll parameters\n",
- __func__);
+ printk("%s: bug, failed to find pll parameters\n", __func__);
return -EIO;
}
*freq_divider = best_div;
*freq_multiplier = best_mult;
*actual_period_ns =
- (best_period_picosec * fudge_factor_80_to_20Mhz +
- (pico_per_nano / 2)) / pico_per_nano;
+ (best_period_picosec * fudge_factor_80_to_20Mhz +
+ (pico_per_nano / 2)) / pico_per_nano;
return 0;
}
@@ -5413,8 +5544,8 @@ static inline unsigned num_configurable_rtsi_channels(struct comedi_device *dev)
return 7;
}
-static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, unsigned source,
- unsigned period_ns)
+static int ni_mseries_set_pll_master_clock(struct comedi_device *dev,
+ unsigned source, unsigned period_ns)
{
static const unsigned min_period_ns = 50;
static const unsigned max_period_ns = 1000;
@@ -5429,34 +5560,36 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, unsigned s
/* these limits are somewhat arbitrary, but NI advertises 1 to 20MHz range so we'll use that */
if (period_ns < min_period_ns || period_ns > max_period_ns) {
printk
- ("%s: you must specify an input clock frequency between %i and %i nanosec "
- "for the phased-lock loop.\n", __func__,
- min_period_ns, max_period_ns);
+ ("%s: you must specify an input clock frequency between %i and %i nanosec "
+ "for the phased-lock loop.\n", __func__,
+ min_period_ns, max_period_ns);
return -EINVAL;
}
devpriv->rtsi_trig_direction_reg &= ~Use_RTSI_Clock_Bit;
devpriv->stc_writew(dev, devpriv->rtsi_trig_direction_reg,
- RTSI_Trig_Direction_Register);
+ RTSI_Trig_Direction_Register);
pll_control_bits =
- MSeries_PLL_Enable_Bit | MSeries_PLL_VCO_Mode_75_150MHz_Bits;
+ MSeries_PLL_Enable_Bit | MSeries_PLL_VCO_Mode_75_150MHz_Bits;
devpriv->clock_and_fout2 |=
- MSeries_Timebase1_Select_Bit | MSeries_Timebase3_Select_Bit;
+ MSeries_Timebase1_Select_Bit | MSeries_Timebase3_Select_Bit;
devpriv->clock_and_fout2 &= ~MSeries_PLL_In_Source_Select_Mask;
switch (source) {
case NI_MIO_PLL_PXI_STAR_TRIGGER_CLOCK:
devpriv->clock_and_fout2 |=
- MSeries_PLL_In_Source_Select_Star_Trigger_Bits;
+ MSeries_PLL_In_Source_Select_Star_Trigger_Bits;
retval = ni_mseries_get_pll_parameters(period_ns, &freq_divider,
- &freq_multiplier, &devpriv->clock_ns);
+ &freq_multiplier,
+ &devpriv->clock_ns);
if (retval < 0)
return retval;
break;
case NI_MIO_PLL_PXI10_CLOCK:
/* pxi clock is 10MHz */
devpriv->clock_and_fout2 |=
- MSeries_PLL_In_Source_Select_PXI_Clock10;
+ MSeries_PLL_In_Source_Select_PXI_Clock10;
retval = ni_mseries_get_pll_parameters(period_ns, &freq_divider,
- &freq_multiplier, &devpriv->clock_ns);
+ &freq_multiplier,
+ &devpriv->clock_ns);
if (retval < 0)
return retval;
break;
@@ -5465,20 +5598,22 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, unsigned s
unsigned rtsi_channel;
static const unsigned max_rtsi_channel = 7;
for (rtsi_channel = 0; rtsi_channel <= max_rtsi_channel;
- ++rtsi_channel) {
+ ++rtsi_channel) {
if (source ==
- NI_MIO_PLL_RTSI_CLOCK(rtsi_channel)) {
+ NI_MIO_PLL_RTSI_CLOCK(rtsi_channel)) {
devpriv->clock_and_fout2 |=
- MSeries_PLL_In_Source_Select_RTSI_Bits
- (rtsi_channel);
+ MSeries_PLL_In_Source_Select_RTSI_Bits
+ (rtsi_channel);
break;
}
}
if (rtsi_channel > max_rtsi_channel)
return -EINVAL;
retval = ni_mseries_get_pll_parameters(period_ns,
- &freq_divider, &freq_multiplier,
- &devpriv->clock_ns);
+ &freq_divider,
+ &freq_multiplier,
+ &devpriv->
+ clock_ns);
if (retval < 0)
return retval;
}
@@ -5486,8 +5621,8 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, unsigned s
}
ni_writew(devpriv->clock_and_fout2, M_Offset_Clock_and_Fout2);
pll_control_bits |=
- MSeries_PLL_Divisor_Bits(freq_divider) |
- MSeries_PLL_Multiplier_Bits(freq_multiplier);
+ MSeries_PLL_Divisor_Bits(freq_divider) |
+ MSeries_PLL_Multiplier_Bits(freq_multiplier);
/* printk("using divider=%i, multiplier=%i for PLL. pll_control_bits = 0x%x\n",
* freq_divider, freq_multiplier, pll_control_bits); */
@@ -5503,45 +5638,46 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, unsigned s
}
if (i == timeout) {
printk
- ("%s: timed out waiting for PLL to lock to reference clock source %i with period %i ns.\n",
- __func__, source, period_ns);
+ ("%s: timed out waiting for PLL to lock to reference clock source %i with period %i ns.\n",
+ __func__, source, period_ns);
return -ETIMEDOUT;
}
return 3;
}
static int ni_set_master_clock(struct comedi_device *dev, unsigned source,
- unsigned period_ns)
+ unsigned period_ns)
{
if (source == NI_MIO_INTERNAL_CLOCK) {
devpriv->rtsi_trig_direction_reg &= ~Use_RTSI_Clock_Bit;
devpriv->stc_writew(dev, devpriv->rtsi_trig_direction_reg,
- RTSI_Trig_Direction_Register);
+ RTSI_Trig_Direction_Register);
devpriv->clock_ns = TIMEBASE_1_NS;
if (boardtype.reg_type & ni_reg_m_series_mask) {
devpriv->clock_and_fout2 &=
- ~(MSeries_Timebase1_Select_Bit |
- MSeries_Timebase3_Select_Bit);
+ ~(MSeries_Timebase1_Select_Bit |
+ MSeries_Timebase3_Select_Bit);
ni_writew(devpriv->clock_and_fout2,
- M_Offset_Clock_and_Fout2);
+ M_Offset_Clock_and_Fout2);
ni_writew(0, M_Offset_PLL_Control);
}
devpriv->clock_source = source;
} else {
if (boardtype.reg_type & ni_reg_m_series_mask) {
return ni_mseries_set_pll_master_clock(dev, source,
- period_ns);
+ period_ns);
} else {
if (source == NI_MIO_RTSI_CLOCK) {
devpriv->rtsi_trig_direction_reg |=
- Use_RTSI_Clock_Bit;
+ Use_RTSI_Clock_Bit;
devpriv->stc_writew(dev,
- devpriv->rtsi_trig_direction_reg,
- RTSI_Trig_Direction_Register);
+ devpriv->
+ rtsi_trig_direction_reg,
+ RTSI_Trig_Direction_Register);
if (period_ns == 0) {
printk
- ("%s: we don't handle an unspecified clock period correctly yet, returning error.\n",
- __func__);
+ ("%s: we don't handle an unspecified clock period correctly yet, returning error.\n",
+ __func__);
return -EINVAL;
} else {
devpriv->clock_ns = period_ns;
@@ -5555,7 +5691,7 @@ static int ni_set_master_clock(struct comedi_device *dev, unsigned source,
}
static int ni_valid_rtsi_output_source(struct comedi_device *dev, unsigned chan,
- unsigned source)
+ unsigned source)
{
if (chan >= num_configurable_rtsi_channels(dev)) {
if (chan == old_RTSI_clock_channel) {
@@ -5563,9 +5699,8 @@ static int ni_valid_rtsi_output_source(struct comedi_device *dev, unsigned chan,
return 1;
else {
printk
- ("%s: invalid source for channel=%i, channel %i is always the RTSI clock for pre-m-series boards.\n",
- __func__, chan,
- old_RTSI_clock_channel);
+ ("%s: invalid source for channel=%i, channel %i is always the RTSI clock for pre-m-series boards.\n",
+ __func__, chan, old_RTSI_clock_channel);
return 0;
}
}
@@ -5596,22 +5731,22 @@ static int ni_valid_rtsi_output_source(struct comedi_device *dev, unsigned chan,
}
static int ni_set_rtsi_routing(struct comedi_device *dev, unsigned chan,
- unsigned source)
+ unsigned source)
{
if (ni_valid_rtsi_output_source(dev, chan, source) == 0)
return -EINVAL;
if (chan < 4) {
devpriv->rtsi_trig_a_output_reg &= ~RTSI_Trig_Output_Mask(chan);
devpriv->rtsi_trig_a_output_reg |=
- RTSI_Trig_Output_Bits(chan, source);
+ RTSI_Trig_Output_Bits(chan, source);
devpriv->stc_writew(dev, devpriv->rtsi_trig_a_output_reg,
- RTSI_Trig_A_Output_Register);
+ RTSI_Trig_A_Output_Register);
} else if (chan < 8) {
devpriv->rtsi_trig_b_output_reg &= ~RTSI_Trig_Output_Mask(chan);
devpriv->rtsi_trig_b_output_reg |=
- RTSI_Trig_Output_Bits(chan, source);
+ RTSI_Trig_Output_Bits(chan, source);
devpriv->stc_writew(dev, devpriv->rtsi_trig_b_output_reg,
- RTSI_Trig_B_Output_Register);
+ RTSI_Trig_B_Output_Register);
}
return 2;
}
@@ -5620,10 +5755,10 @@ static unsigned ni_get_rtsi_routing(struct comedi_device *dev, unsigned chan)
{
if (chan < 4) {
return RTSI_Trig_Output_Source(chan,
- devpriv->rtsi_trig_a_output_reg);
+ devpriv->rtsi_trig_a_output_reg);
} else if (chan < num_configurable_rtsi_channels(dev)) {
return RTSI_Trig_Output_Source(chan,
- devpriv->rtsi_trig_b_output_reg);
+ devpriv->rtsi_trig_b_output_reg);
} else {
if (chan == old_RTSI_clock_channel)
return NI_RTSI_OUTPUT_RTSI_OSC;
@@ -5632,53 +5767,54 @@ static unsigned ni_get_rtsi_routing(struct comedi_device *dev, unsigned chan)
}
}
-static int ni_rtsi_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int ni_rtsi_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
unsigned int chan = CR_CHAN(insn->chanspec);
switch (data[0]) {
case INSN_CONFIG_DIO_OUTPUT:
if (chan < num_configurable_rtsi_channels(dev)) {
devpriv->rtsi_trig_direction_reg |=
- RTSI_Output_Bit(chan,
- (boardtype.reg_type & ni_reg_m_series_mask) !=
- 0);
+ RTSI_Output_Bit(chan,
+ (boardtype.
+ reg_type & ni_reg_m_series_mask) !=
+ 0);
} else if (chan == old_RTSI_clock_channel) {
devpriv->rtsi_trig_direction_reg |=
- Drive_RTSI_Clock_Bit;
+ Drive_RTSI_Clock_Bit;
}
devpriv->stc_writew(dev, devpriv->rtsi_trig_direction_reg,
- RTSI_Trig_Direction_Register);
+ RTSI_Trig_Direction_Register);
break;
case INSN_CONFIG_DIO_INPUT:
if (chan < num_configurable_rtsi_channels(dev)) {
devpriv->rtsi_trig_direction_reg &=
- ~RTSI_Output_Bit(chan,
- (boardtype.reg_type & ni_reg_m_series_mask) !=
- 0);
+ ~RTSI_Output_Bit(chan,
+ (boardtype.
+ reg_type & ni_reg_m_series_mask)
+ != 0);
} else if (chan == old_RTSI_clock_channel) {
devpriv->rtsi_trig_direction_reg &=
- ~Drive_RTSI_Clock_Bit;
+ ~Drive_RTSI_Clock_Bit;
}
devpriv->stc_writew(dev, devpriv->rtsi_trig_direction_reg,
- RTSI_Trig_Direction_Register);
+ RTSI_Trig_Direction_Register);
break;
case INSN_CONFIG_DIO_QUERY:
if (chan < num_configurable_rtsi_channels(dev)) {
data[1] =
- (devpriv->
- rtsi_trig_direction_reg & RTSI_Output_Bit(chan,
- (boardtype.
- reg_type & ni_reg_m_series_mask)
- !=
- 0)) ? INSN_CONFIG_DIO_OUTPUT :
- INSN_CONFIG_DIO_INPUT;
+ (devpriv->rtsi_trig_direction_reg &
+ RTSI_Output_Bit(chan,
+ (boardtype.reg_type &
+ ni_reg_m_series_mask)
+ != 0)) ? INSN_CONFIG_DIO_OUTPUT :
+ INSN_CONFIG_DIO_INPUT;
} else if (chan == old_RTSI_clock_channel) {
data[1] =
- (devpriv->
- rtsi_trig_direction_reg & Drive_RTSI_Clock_Bit)
- ? INSN_CONFIG_DIO_OUTPUT :
- INSN_CONFIG_DIO_INPUT;
+ (devpriv->rtsi_trig_direction_reg &
+ Drive_RTSI_Clock_Bit)
+ ? INSN_CONFIG_DIO_OUTPUT : INSN_CONFIG_DIO_INPUT;
}
return 2;
break;
@@ -5751,12 +5887,12 @@ static void cs5529_command(struct comedi_device *dev, unsigned short value)
/* write to cs5529 register */
static void cs5529_config_write(struct comedi_device *dev, unsigned int value,
- unsigned int reg_select_bits)
+ unsigned int reg_select_bits)
{
ni_ao_win_outw(dev, ((value >> 16) & 0xff),
- CAL_ADC_Config_Data_High_Word_67xx);
+ CAL_ADC_Config_Data_High_Word_67xx);
ni_ao_win_outw(dev, (value & 0xffff),
- CAL_ADC_Config_Data_Low_Word_67xx);
+ CAL_ADC_Config_Data_Low_Word_67xx);
reg_select_bits &= CSCMD_REGISTER_SELECT_MASK;
cs5529_command(dev, CSCMD_COMMAND | reg_select_bits);
if (cs5529_wait_for_idle(dev))
@@ -5766,7 +5902,7 @@ static void cs5529_config_write(struct comedi_device *dev, unsigned int value,
#ifdef NI_CS5529_DEBUG
/* read from cs5529 register */
static unsigned int cs5529_config_read(struct comedi_device *dev,
- unsigned int reg_select_bits)
+ unsigned int reg_select_bits)
{
unsigned int value;
@@ -5775,7 +5911,8 @@ static unsigned int cs5529_config_read(struct comedi_device *dev,
if (cs5529_wait_for_idle(dev))
comedi_error(dev, "timeout or signal in cs5529_config_read()");
value = (ni_ao_win_inw(dev,
- CAL_ADC_Config_Data_High_Word_67xx) << 16) & 0xff0000;
+ CAL_ADC_Config_Data_High_Word_67xx) << 16) &
+ 0xff0000;
value |= ni_ao_win_inw(dev, CAL_ADC_Config_Data_Low_Word_67xx) & 0xffff;
return value;
}
@@ -5790,18 +5927,18 @@ static int cs5529_do_conversion(struct comedi_device *dev, unsigned short *data)
retval = cs5529_wait_for_idle(dev);
if (retval) {
comedi_error(dev,
- "timeout or signal in cs5529_do_conversion()");
+ "timeout or signal in cs5529_do_conversion()");
return -ETIME;
}
status = ni_ao_win_inw(dev, CAL_ADC_Status_67xx);
if (status & CSS_OSC_DETECT) {
printk
- ("ni_mio_common: cs5529 conversion error, status CSS_OSC_DETECT\n");
+ ("ni_mio_common: cs5529 conversion error, status CSS_OSC_DETECT\n");
return -EIO;
}
if (status & CSS_OVERRANGE) {
printk
- ("ni_mio_common: cs5529 conversion error, overrange (ignoring)\n");
+ ("ni_mio_common: cs5529 conversion error, overrange (ignoring)\n");
}
if (data) {
*data = ni_ao_win_inw(dev, CAL_ADC_Data_67xx);
@@ -5811,8 +5948,9 @@ static int cs5529_do_conversion(struct comedi_device *dev, unsigned short *data)
return 0;
}
-static int cs5529_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int cs5529_ai_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
int n, retval;
unsigned short sample;
@@ -5840,29 +5978,28 @@ static int cs5529_ai_insn_read(struct comedi_device *dev, struct comedi_subdevic
static int init_cs5529(struct comedi_device *dev)
{
unsigned int config_bits =
- CSCFG_PORT_MODE | CSCFG_WORD_RATE_2180_CYCLES;
+ CSCFG_PORT_MODE | CSCFG_WORD_RATE_2180_CYCLES;
#if 1
/* do self-calibration */
cs5529_config_write(dev, config_bits | CSCFG_SELF_CAL_OFFSET_GAIN,
- CSCMD_CONFIG_REGISTER);
+ CSCMD_CONFIG_REGISTER);
/* need to force a conversion for calibration to run */
cs5529_do_conversion(dev, NULL);
#else
/* force gain calibration to 1 */
cs5529_config_write(dev, 0x400000, CSCMD_GAIN_REGISTER);
cs5529_config_write(dev, config_bits | CSCFG_SELF_CAL_OFFSET,
- CSCMD_CONFIG_REGISTER);
+ CSCMD_CONFIG_REGISTER);
if (cs5529_wait_for_idle(dev))
comedi_error(dev, "timeout or signal in init_cs5529()\n");
#endif
#ifdef NI_CS5529_DEBUG
printk("config: 0x%x\n", cs5529_config_read(dev,
- CSCMD_CONFIG_REGISTER));
- printk("gain: 0x%x\n", cs5529_config_read(dev,
- CSCMD_GAIN_REGISTER));
+ CSCMD_CONFIG_REGISTER));
+ printk("gain: 0x%x\n", cs5529_config_read(dev, CSCMD_GAIN_REGISTER));
printk("offset: 0x%x\n", cs5529_config_read(dev,
- CSCMD_OFFSET_REGISTER));
+ CSCMD_OFFSET_REGISTER));
#endif
return 0;
}