From: Paul Kasemir Date: Mon, 12 Dec 2022 18:49:36 +0000 (-0700) Subject: link-mso19: Use upper case CG_IS_DIGITAL/CG_IS_ANALOG macro names X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=77d7efa45bec930b2c76ad7cfb4d8569f9eb3227;p=libsigrok.git link-mso19: Use upper case CG_IS_DIGITAL/CG_IS_ANALOG macro names --- diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index b6217718..04a5b1a9 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -380,12 +380,12 @@ static int config_get(uint32_t key, GVariant **data, *data = g_variant_new_uint64(devc->limit_samples); break; case SR_CONF_COUPLING: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_NA; *data = g_variant_new_string(devc->coupling); break; case SR_CONF_PROBE_FACTOR: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_NA; *data = g_variant_new_uint64(devc->dso_probe_factor); break; @@ -393,20 +393,20 @@ static int config_get(uint32_t key, GVariant **data, *data = g_variant_new_string(trigger_sources[devc->trigger_source]); break; case SR_CONF_TRIGGER_SLOPE: - if (cg_is_analog(cg)) + if (CG_IS_ANALOG(cg)) *data = g_variant_new_string(dso_trigger_slopes[devc->dso_trigger_slope]); - else if (cg_is_digital(cg)) + else if (CG_IS_DIGITAL(cg)) *data = g_variant_new_string(la_trigger_slopes[devc->la_trigger_slope]); else return SR_ERR_NA; break; case SR_CONF_TRIGGER_LEVEL: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_ARG; *data = g_variant_new_double(devc->dso_trigger_level); break; case SR_CONF_OFFSET: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_ARG; *data = g_variant_new_double(devc->dso_offset); break; @@ -414,7 +414,7 @@ static int config_get(uint32_t key, GVariant **data, *data = g_variant_new_double(devc->horiz_triggerpos); break; case SR_CONF_LOGIC_THRESHOLD: - if (!cg_is_digital(cg)) + if (!CG_IS_DIGITAL(cg)) return SR_ERR_ARG; *data = g_variant_new_string(logic_thresholds[devc->logic_threshold]); break; @@ -463,12 +463,12 @@ static int config_set(uint32_t key, GVariant *data, mso_update_trigger_slope(devc); break; case SR_CONF_TRIGGER_SLOPE: - if (cg_is_analog(cg)) { + if (CG_IS_ANALOG(cg)) { idx = std_str_idx(data, ARRAY_AND_SIZE(dso_trigger_slopes)); if (idx < 0) return SR_ERR_ARG; devc->dso_trigger_slope = idx; - } else if (cg_is_digital(cg)) { + } else if (CG_IS_DIGITAL(cg)) { idx = std_str_idx(data, ARRAY_AND_SIZE(la_trigger_slopes)); if (idx < 0) return SR_ERR_ARG; @@ -479,13 +479,13 @@ static int config_set(uint32_t key, GVariant *data, mso_update_trigger_slope(devc); break; case SR_CONF_TRIGGER_LEVEL: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_ARG; devc->dso_trigger_level = g_variant_get_double(data); mso_limit_trigger_level(devc); break; case SR_CONF_OFFSET: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_ARG; devc->dso_offset = g_variant_get_double(data); mso_update_offset_value(devc); @@ -501,7 +501,7 @@ static int config_set(uint32_t key, GVariant *data, mso_update_trigger_pos(devc); break; case SR_CONF_COUPLING: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_ARG; idx = std_str_idx(data, ARRAY_AND_SIZE(coupling)); if (idx < 0) @@ -509,7 +509,7 @@ static int config_set(uint32_t key, GVariant *data, devc->coupling = coupling[idx]; break; case SR_CONF_PROBE_FACTOR: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_ARG; tmp_u64 = g_variant_get_uint64(data); if (!tmp_u64) @@ -518,7 +518,7 @@ static int config_set(uint32_t key, GVariant *data, mso_update_offset_value(devc); break; case SR_CONF_LOGIC_THRESHOLD: - if (!cg_is_digital(cg)) + if (!CG_IS_DIGITAL(cg)) return SR_ERR_ARG; idx = std_str_idx(data, ARRAY_AND_SIZE(logic_thresholds)); if (idx < 0) @@ -541,9 +541,9 @@ static int config_list(uint32_t key, GVariant **data, case SR_CONF_DEVICE_OPTIONS: if (!cg) return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); - else if (cg_is_analog(cg)) + else if (CG_IS_ANALOG(cg)) *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog)); - else if (cg_is_digital(cg)) + else if (CG_IS_DIGITAL(cg)) *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_digital)); else return SR_ERR_NA; @@ -552,7 +552,7 @@ static int config_list(uint32_t key, GVariant **data, *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates)); break; case SR_CONF_COUPLING: - if (!cg_is_analog(cg)) + if (!CG_IS_ANALOG(cg)) return SR_ERR_NA; *data = g_variant_new_strv(ARRAY_AND_SIZE(coupling)); break; @@ -560,9 +560,9 @@ static int config_list(uint32_t key, GVariant **data, *data = g_variant_new_strv(ARRAY_AND_SIZE(trigger_sources)); break; case SR_CONF_TRIGGER_SLOPE: - if (cg_is_analog(cg)) + if (CG_IS_ANALOG(cg)) *data = g_variant_new_strv(ARRAY_AND_SIZE(dso_trigger_slopes)); - else if (cg_is_digital(cg)) + else if (CG_IS_DIGITAL(cg)) *data = g_variant_new_strv(ARRAY_AND_SIZE(la_trigger_slopes)); else return SR_ERR_NA; @@ -571,7 +571,7 @@ static int config_list(uint32_t key, GVariant **data, *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches)); break; case SR_CONF_LOGIC_THRESHOLD: - if (!cg_is_digital(cg)) + if (!CG_IS_DIGITAL(cg)) return SR_ERR_ARG; *data = g_variant_new_strv(ARRAY_AND_SIZE(logic_thresholds)); break; diff --git a/src/hardware/link-mso19/protocol.h b/src/hardware/link-mso19/protocol.h index ac6537a8..56ec45f3 100644 --- a/src/hardware/link-mso19/protocol.h +++ b/src/hardware/link-mso19/protocol.h @@ -38,8 +38,8 @@ #define MSO_NUM_SAMPLES 1024 #define MSO_NUM_LOGIC_CHANNELS 8 -#define cg_is_digital(cg) (cg && cg->name[0] == 'L') -#define cg_is_analog(cg) (cg && cg->name[0] == 'D') +#define CG_IS_DIGITAL(cg) (cg && cg->name[0] == 'L') +#define CG_IS_ANALOG(cg) (cg && cg->name[0] == 'D') /* Structure for the pattern generator state */ struct mso_patgen {