static void mso_update_trigger_pos(struct dev_context *devc)
{
- int pos = (devc->horiz_triggerpos * MSO_NUM_SAMPLES) + 0.5;
- uint16_t sign_bit = TRIG_POS_IS_POSITIVE;
+ int pos;
+ uint16_t sign_bit;
+
+ pos = (devc->horiz_triggerpos * MSO_NUM_SAMPLES) + 0.5;
+ sign_bit = TRIG_POS_IS_POSITIVE;
if (pos < 0) {
pos = -pos;
sign_bit = TRIG_POS_IS_NEGATIVE;
static void mso_update_offset_value(struct dev_context *devc)
{
- double scaled_value = devc->dso_offset / devc->dso_probe_factor;
- double limited_value = MIN(2.0, MAX(-2.0, scaled_value));
- int value = devc->dac_offset - (limited_value / devc->offset_vbit);
+ double scaled_value, limited_value;
+ int value;
+
+ scaled_value = devc->dso_offset / devc->dso_probe_factor;
+ limited_value = MIN(2.0, MAX(-2.0, scaled_value));
+ value = devc->dac_offset - (limited_value / devc->offset_vbit);
value = MIN(DAC_DSO_VALUE_MASK, MAX(0, value));
devc->dso_offset_value = value;
devc->dso_offset_adjusted = (devc->dac_offset - value) *
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
- GSList *devices = NULL;
- const char *conn = NULL;
- GSList *l;
+ GSList *devices, *l;
+ const char *conn;
struct sr_config *src;
+ devices = NULL;
+ conn = NULL;
+
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
- int ret = SR_ERR;
+ int ret;
+ ret = SR_ERR;
devc = sdi->priv;
if (mso_configure_channels(sdi) != SR_OK) {
SR_PRIV int mso_configure_trigger(const struct sr_dev_inst *sdi)
{
- struct dev_context *devc = sdi->priv;
- uint16_t threshold_value = mso_calc_trigger_threshold(devc);
+ struct dev_context *devc;
+ uint16_t threshold_value;
+
+ devc = sdi->priv;
+ threshold_value = mso_calc_trigger_threshold(devc);
TRIG_UPDATE_THRESH_MSB(devc->ctltrig, threshold_value);
SR_PRIV int mso_configure_rate(const struct sr_dev_inst *sdi, uint32_t rate)
{
- struct dev_context *devc = sdi->priv;
+ struct dev_context *devc;
unsigned int i;
- int ret = SR_ERR;
+ int ret;
+
+ devc = sdi->priv;
+ ret = SR_ERR;
for (i = 0; i < ARRAY_SIZE(rate_map); i++) {
if (rate_map[i].rate == rate) {
}
static int mso_validate_status(uint8_t val) {
- uint8_t action = BITS_STATUS_ACTION(val);
+ uint8_t action;
+
+ action = BITS_STATUS_ACTION(val);
if (action == 0 || action > STATUS_DATA_READY
|| val & 0xC0) {
sr_err("Invalid status byte %.2x", val);
SR_PRIV int mso_read_status(struct sr_serial_dev_inst *serial, uint8_t *status)
{
uint16_t ops[] = { mso_trans(REG_STATUS, 0) };
- uint8_t buf = 0;
+ uint8_t buf;
int ret;
+ buf = 0;
+
sr_dbg("Requesting status.");
ret = mso_send_control_message(serial, ARRAY_AND_SIZE(ops));
if (!status || ret != SR_OK) {