/* Generate soft index strobe. */
void (*pulse_index)(struct comedi_device *dev,
const struct s626_enc_info *k);
- /* Program clock enable. */
- void (*set_enable)(struct comedi_device *dev,
- const struct s626_enc_info *k, uint16_t enab);
/* Program interrupt source. */
void (*set_int_src)(struct comedi_device *dev,
const struct s626_enc_info *k, uint16_t int_source);
/*
* Return/set a counter's enable. enab: 0=always enabled, 1=enabled by index.
*/
-static void s626_set_enable_a(struct comedi_device *dev,
- const struct s626_enc_info *k, uint16_t enab)
+static void s626_set_enable(struct comedi_device *dev,
+ const struct s626_enc_info *k, uint16_t enab)
{
- s626_debi_replace(dev, S626_LP_CRB(k->chan),
- ~(S626_CRBMSK_INTCTRL | S626_CRBMSK_CLKENAB_A),
- S626_SET_CRB_CLKENAB_A(enab));
-}
+ unsigned int mask = S626_CRBMSK_INTCTRL;
+ unsigned int set;
-static void s626_set_enable_b(struct comedi_device *dev,
- const struct s626_enc_info *k, uint16_t enab)
-{
- s626_debi_replace(dev, S626_LP_CRB(k->chan),
- ~(S626_CRBMSK_INTCTRL | S626_CRBMSK_CLKENAB_B),
- S626_SET_CRB_CLKENAB_B(enab));
+ if (k->chan < 3) {
+ mask |= S626_CRBMSK_CLKENAB_A;
+ set = S626_SET_CRB_CLKENAB_A(enab);
+ } else {
+ mask |= S626_CRBMSK_CLKENAB_B;
+ set = S626_SET_CRB_CLKENAB_B(enab);
+ }
+ s626_debi_replace(dev, S626_LP_CRB(k->chan), ~mask, set);
}
static uint16_t s626_get_enable_a(struct comedi_device *dev,
.get_load_trig = s626_get_load_trig_a,
.get_mode = s626_get_mode_a,
.pulse_index = s626_pulse_index_a,
- .set_enable = s626_set_enable_a,
.set_int_src = s626_set_int_src_a,
.set_load_trig = s626_set_load_trig_a,
.set_mode = s626_set_mode_a,
.get_load_trig = s626_get_load_trig_a,
.get_mode = s626_get_mode_a,
.pulse_index = s626_pulse_index_a,
- .set_enable = s626_set_enable_a,
.set_int_src = s626_set_int_src_a,
.set_load_trig = s626_set_load_trig_a,
.set_mode = s626_set_mode_a,
.get_load_trig = s626_get_load_trig_a,
.get_mode = s626_get_mode_a,
.pulse_index = s626_pulse_index_a,
- .set_enable = s626_set_enable_a,
.set_int_src = s626_set_int_src_a,
.set_load_trig = s626_set_load_trig_a,
.set_mode = s626_set_mode_a,
.get_load_trig = s626_get_load_trig_b,
.get_mode = s626_get_mode_b,
.pulse_index = s626_pulse_index_b,
- .set_enable = s626_set_enable_b,
.set_int_src = s626_set_int_src_b,
.set_load_trig = s626_set_load_trig_b,
.set_mode = s626_set_mode_b,
.get_load_trig = s626_get_load_trig_b,
.get_mode = s626_get_mode_b,
.pulse_index = s626_pulse_index_b,
- .set_enable = s626_set_enable_b,
.set_int_src = s626_set_int_src_b,
.set_load_trig = s626_set_load_trig_b,
.set_mode = s626_set_mode_b,
.get_load_trig = s626_get_load_trig_b,
.get_mode = s626_get_mode_b,
.pulse_index = s626_pulse_index_b,
- .set_enable = s626_set_enable_b,
.set_int_src = s626_set_int_src_b,
.set_load_trig = s626_set_load_trig_b,
.set_mode = s626_set_mode_b,
&s626_enc_chan_info[5];
devpriv->ai_convert_count = cmd->chanlist_len;
- k->set_enable(dev, k, S626_CLKENAB_ALWAYS);
+ s626_set_enable(dev, k, S626_CLKENAB_ALWAYS);
}
}
if ((irqbit >> (cmd->convert_arg - (16 * group))) == 1 &&
if (devpriv->ai_convert_count > 0) {
devpriv->ai_convert_count--;
if (devpriv->ai_convert_count == 0)
- k->set_enable(dev, k, S626_CLKENAB_INDEX);
+ s626_set_enable(dev, k, S626_CLKENAB_INDEX);
if (cmd->convert_src == TRIG_TIMER) {
/* Trigger ADC scan loop start */
if (cmd->convert_src == TRIG_TIMER) {
k = &s626_enc_chan_info[4];
devpriv->ai_convert_count = cmd->chanlist_len;
- k->set_enable(dev, k, S626_CLKENAB_ALWAYS);
+ s626_set_enable(dev, k, S626_CLKENAB_ALWAYS);
}
}
}
k->set_int_src(dev, k, S626_INTSRC_OVER);
s626_set_latch_source(dev, k, value_latchsrc);
- /* k->set_enable(dev, k, (uint16_t)(enab != 0)); */
+ /* s626_set_enable(dev, k, (uint16_t)(enab != 0)); */
}
/* TO COMPLETE */
/* load timer value and enable interrupt */
s626_timer_load(dev, k, tick);
- k->set_enable(dev, k, S626_CLKENAB_ALWAYS);
+ s626_set_enable(dev, k, S626_CLKENAB_ALWAYS);
break;
case TRIG_EXT:
/* set the digital line and interrupt for scan trigger */
/* load timer value and enable interrupt */
s626_timer_load(dev, k, tick);
- k->set_enable(dev, k, S626_CLKENAB_INDEX);
+ s626_set_enable(dev, k, S626_CLKENAB_INDEX);
break;
case TRIG_EXT:
/* set the digital line and interrupt for convert trigger */
s626_preload(dev, k, data[0]);
k->pulse_index(dev, k);
s626_set_latch_source(dev, k, value_latchsrc);
- k->set_enable(dev, k, (enab != 0));
+ s626_set_enable(dev, k, (enab != 0));
return insn->n;
}
k->set_mode(dev, k, setup, true);
k->set_int_src(dev, k, 0);
k->reset_cap_flags(dev, k);
- k->set_enable(dev, k, S626_CLKENAB_ALWAYS);
+ s626_set_enable(dev, k, S626_CLKENAB_ALWAYS);
}
}