return 1;
}
+static int ni_get_pwm_config(comedi_device *dev, lsampl_t *data)
+{
+ data[1] = devpriv->pwm_up_count * TIMER_BASE;
+ data[2] = devpriv->pwm_down_count * TIMER_BASE;
+ return 3;
+}
+
static int ni_m_series_pwm_config(comedi_device *dev, comedi_subdevice *s,
comedi_insn *insn, lsampl_t *data)
{
return -EAGAIN;
}
ni_writel(MSeries_Cal_PWM_High_Time_Bits(up_count) | 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;
break;
+ case INSN_CONFIG_GET_PWM_OUTPUT:
+ return ni_get_pwm_config(dev, data);
+ break;
default:
return -EINVAL;
break;
return -EAGAIN;
}
ni_writel(up_count, Calibration_HighTime_6143);
+ devpriv->pwm_up_count = up_count;
ni_writel(down_count, Calibration_LowTime_6143);
+ devpriv->pwm_down_count = down_count;
return 5;
break;
+ case INSN_CONFIG_GET_PWM_OUTPUT:
+ return ni_get_pwm_config(dev, data);
default:
return -EINVAL;
break;
unsigned short atrig_mode; \
unsigned short atrig_high; \
unsigned short atrig_low; \
- \
+ \
+ unsigned short pwm_up_count; \
+ unsigned short pwm_down_count; \
+ \
sampl_t ai_fifo_buffer[0x2000]; \
uint8_t eeprom_buffer[M_SERIES_EEPROM_SIZE];
INSN_CONFIG_BIDIRECTIONAL_DATA = 27,
INSN_CONFIG_DIO_QUERY = 28,
INSN_CONFIG_PWM_OUTPUT = 29,
+ INSN_CONFIG_GET_PWM_OUTPUT = 30,
INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR = 1001, // Use CTR as single pulsegenerator
INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR = 1002, // Use CTR as pulsetraingenerator
INSN_CONFIG_GPCT_QUADRATURE_ENCODER = 1003, // Use the counter as encoder