hantek-dso: deprecate struct sr_rational

This commit is contained in:
Bert Vermeulen 2013-03-30 15:24:37 +01:00
parent e48a546292
commit 86bb3f4a86
1 changed files with 9 additions and 10 deletions

View File

@ -81,7 +81,7 @@ static const uint64_t buffersizes[] = {
/* TODO: 65535 */ /* TODO: 65535 */
}; };
static const int32_t timebases[][2] = { static const uint64_t timebases[][2] = {
/* microseconds */ /* microseconds */
{ 10, 1000000 }, { 10, 1000000 },
{ 20, 1000000 }, { 20, 1000000 },
@ -101,7 +101,7 @@ static const int32_t timebases[][2] = {
{ 400, 1000 }, { 400, 1000 },
}; };
static const int32_t vdivs[][2] = { static const uint64_t vdivs[][2] = {
/* millivolts */ /* millivolts */
{ 10, 1000 }, { 10, 1000 },
{ 20, 1000 }, { 20, 1000 },
@ -406,8 +406,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
{ {
struct dev_context *devc; struct dev_context *devc;
double tmp_double; double tmp_double;
uint64_t tmp_u64; uint64_t tmp_u64, p, q;
int32_t p, q;
int tmp_int, ret; int tmp_int, ret;
unsigned int i; unsigned int i;
const char *tmp_str; const char *tmp_str;
@ -448,7 +447,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
ret = SR_ERR_ARG; ret = SR_ERR_ARG;
break; break;
case SR_CONF_TIMEBASE: case SR_CONF_TIMEBASE:
g_variant_get(data, "(ii)", &p, &q); g_variant_get(data, "(tt)", &p, &q);
tmp_int = -1; tmp_int = -1;
for (i = 0; i < ARRAY_SIZE(timebases); i++) { for (i = 0; i < ARRAY_SIZE(timebases); i++) {
if (timebases[i][0] == p && timebases[i][1] == q) { if (timebases[i][0] == p && timebases[i][1] == q) {
@ -495,7 +494,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
break; break;
case SR_CONF_VDIV: case SR_CONF_VDIV:
/* TODO: Not supporting vdiv per channel yet. */ /* TODO: Not supporting vdiv per channel yet. */
g_variant_get(data, "(ii)", &p, &q); g_variant_get(data, "(tt)", &p, &q);
tmp_int = -1; tmp_int = -1;
for (i = 0; i < ARRAY_SIZE(vdivs); i++) { for (i = 0; i < ARRAY_SIZE(vdivs); i++) {
if (vdivs[i][0] == p && vdivs[i][1] == q) { if (vdivs[i][0] == p && vdivs[i][1] == q) {
@ -548,16 +547,16 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
*data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling)); *data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
break; break;
case SR_CONF_VDIV: case SR_CONF_VDIV:
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT64,
vdivs, ARRAY_SIZE(vdivs) * 2, sizeof(int32_t)); vdivs, ARRAY_SIZE(vdivs) * 2, sizeof(uint64_t));
break; break;
case SR_CONF_FILTER: case SR_CONF_FILTER:
*data = g_variant_new_strv(filter_targets, *data = g_variant_new_strv(filter_targets,
ARRAY_SIZE(filter_targets)); ARRAY_SIZE(filter_targets));
break; break;
case SR_CONF_TIMEBASE: case SR_CONF_TIMEBASE:
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT64,
timebases, ARRAY_SIZE(timebases) * 2, sizeof(int32_t)); timebases, ARRAY_SIZE(timebases) * 2, sizeof(uint64_t));
break; break;
case SR_CONF_TRIGGER_SOURCE: case SR_CONF_TRIGGER_SOURCE:
*data = g_variant_new_strv(trigger_sources, *data = g_variant_new_strv(trigger_sources,