/* Current CPU. XXX should this be hard_smp_processor_id()? */
#define THISCPU smp_processor_id()
-/* State flags for atomic bit operations */
-#define AI_CMD_STARTED 0
-#define AO_CMD_STARTED 1
-
/*
* Board descriptions for the two boards supported.
*/
spinlock_t ai_stop_spinlock; /* Spin lock for stopping AI command */
spinlock_t ao_stop_spinlock; /* Spin lock for stopping AO command */
unsigned long daqio; /* PCI230's DAQ I/O space */
- unsigned long state; /* State flags */
unsigned int ai_scan_count; /* Number of AI scans remaining */
unsigned int ai_scan_pos; /* Current position within AI scan */
unsigned int ao_scan_count; /* Number of AO scans remaining. */
bool intr_running:1; /* Flag set in interrupt routine */
bool ai_bipolar:1; /* Flag AI range is bipolar */
bool ao_bipolar:1; /* Flag AO range is bipolar */
+ bool ai_cmd_started:1; /* Flag AI command started */
+ bool ao_cmd_started:1; /* Flag AO command started */
};
/* PCI230 clock source periods in ns */
struct pci230_private *devpriv = dev->private;
unsigned long irqflags;
unsigned char intsrc;
- int started;
+ bool started;
struct comedi_cmd *cmd;
spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags);
- started = test_and_clear_bit(AO_CMD_STARTED, &devpriv->state);
+ started = devpriv->ao_cmd_started;
+ devpriv->ao_cmd_started = false;
spin_unlock_irqrestore(&devpriv->ao_stop_spinlock, irqflags);
if (!started)
return;
return -EINVAL;
spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags);
- if (test_bit(AO_CMD_STARTED, &devpriv->state)) {
+ if (devpriv->ao_cmd_started) {
/* Perform scan. */
if (devpriv->hwver < 2) {
/* Not using DAC FIFO. */
struct comedi_cmd *cmd = &async->cmd;
unsigned long irqflags;
- set_bit(AO_CMD_STARTED, &devpriv->state);
+ devpriv->ao_cmd_started = true;
if (cmd->stop_src == TRIG_COUNT && devpriv->ao_scan_count == 0) {
/* An empty acquisition! */
async->events |= COMEDI_CB_EOA;
return -EINVAL;
spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags);
- if (test_bit(AI_CMD_STARTED, &devpriv->state)) {
+ if (devpriv->ai_cmd_started) {
unsigned int delayus;
/*
return -EINVAL;
spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags);
- if (test_bit(AI_CMD_STARTED, &devpriv->state)) {
+ if (devpriv->ai_cmd_started) {
/* Trigger scan by waggling CT0 gate source. */
zgat = GAT_CONFIG(0, GAT_GND);
outb(zgat, dev->iobase + PCI230_ZGAT_SCE);
struct pci230_private *devpriv = dev->private;
unsigned long irqflags;
struct comedi_cmd *cmd;
- int started;
+ bool started;
spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags);
- started = test_and_clear_bit(AI_CMD_STARTED, &devpriv->state);
+ started = devpriv->ai_cmd_started;
+ devpriv->ai_cmd_started = false;
spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags);
if (!started)
return;
struct comedi_async *async = s->async;
struct comedi_cmd *cmd = &async->cmd;
- set_bit(AI_CMD_STARTED, &devpriv->state);
+ devpriv->ai_cmd_started = true;
if (cmd->stop_src == TRIG_COUNT && devpriv->ai_scan_count == 0) {
/* An empty acquisition! */
async->events |= COMEDI_CB_EOA;