X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fzeroplus-logic-cube%2Fanalyzer.c;h=0617d227467e840548a93c823678c89c0c199ca1;hb=82ff7044494dab2e1473e45c72ee32b038d3eee0;hp=321b17c0ed54f11a56c2ac09cf6f8d1e0e0240ba;hpb=d9251a2c9f1ca4380c27240ccca90c9f9ed46d3f;p=libsigrok.git diff --git a/src/hardware/zeroplus-logic-cube/analyzer.c b/src/hardware/zeroplus-logic-cube/analyzer.c index 321b17c0..0617d227 100644 --- a/src/hardware/zeroplus-logic-cube/analyzer.c +++ b/src/hardware/zeroplus-logic-cube/analyzer.c @@ -62,7 +62,7 @@ enum { TRIGGER_STATUS5, TRIGGER_STATUS6, TRIGGER_STATUS7, - TRIGGER_STATUS8, + TRIGGER_EDGE, TRIGGER_COUNT0 = 0x50, TRIGGER_COUNT1, @@ -108,7 +108,8 @@ enum { READ_RAM_STATUS = 0xa0, }; -static int g_trigger_status[9] = { 0 }; +static int g_trigger_status[8] = { 0 }; +static int g_trigger_edge = 0; static int g_trigger_count = 1; static int g_filter_status[8] = { 0 }; static int g_filter_enable = 0; @@ -461,8 +462,9 @@ SR_PRIV void analyzer_configure(libusb_device_handle *devh) gl_reg_write(devh, CLOCK_SOURCE, 0x03); /* Set_Trigger_Status */ - for (i = 0; i < 9; i++) + for (i = 0; i < 8; i++) gl_reg_write(devh, TRIGGER_STATUS0 + i, g_trigger_status[i]); + gl_reg_write(devh, TRIGGER_EDGE, g_trigger_edge); __analyzer_set_trigger_count(devh, g_trigger_count); @@ -503,6 +505,9 @@ SR_PRIV int analyzer_add_triggers(const struct sr_dev_inst *sdi) if (!(trigger = sr_session_trigger_get(sdi->session))) return SR_OK; + memset(g_trigger_status, 0, sizeof(g_trigger_status)); + g_trigger_edge = 0; + for (l = trigger->stages; l; l = l->next) { stage = l->data; for (m = stage->matches; m; m = m->next) { @@ -519,6 +524,15 @@ SR_PRIV int analyzer_add_triggers(const struct sr_dev_inst *sdi) case SR_TRIGGER_ONE: g_trigger_status[channel / 4] |= 1 << (channel % 4 * 2); break; + case SR_TRIGGER_RISING: + g_trigger_edge = 0x40 | (channel & 0x1F); + break; + case SR_TRIGGER_FALLING: + g_trigger_edge = 0x80 | (channel & 0x1F); + break; + case SR_TRIGGER_EDGE: + g_trigger_edge = 0xc0 | (channel & 0x1F); + break; default: sr_err("Unsupported match %d", match->match); return SR_ERR;