]> sigrok.org Git - libsigrok.git/commitdiff
sysclk-lwla: Define constants for long registers
authorDaniel Elstner <redacted>
Sat, 31 Oct 2015 00:39:03 +0000 (01:39 +0100)
committerDaniel Elstner <redacted>
Sat, 31 Oct 2015 00:39:03 +0000 (01:39 +0100)
src/hardware/sysclk-lwla/lwla.h
src/hardware/sysclk-lwla/protocol.c

index 9483ae85f20294d322505aa5e61460cde50d5e78..9eb69566c6e89dabfdc1c2c18f787ed9c3f5cc50 100644 (file)
@@ -101,6 +101,23 @@ enum {
        MEM_CTRL_CLR_IDX = 1 << 1, /* "clr_idx" bit */
 };
 
+/* LWLA1034 long register addresses.
+ */
+enum {
+       LREG_CAP_CTRL = 10,  /* capture control bits */
+       LREG_TEST_ID  = 100, /* constant test ID */
+};
+
+/** Flag bits for LREG_CAP_CTRL.
+ */
+enum {
+       CAP_CTRL_TRG_EN       = 1 << 0, /* "trg_en" bit */
+       CAP_CTRL_CLR_TIMEBASE = 1 << 2, /* "do_clr_timebase" bit */
+       CAP_CTRL_FLUSH_FIFO   = 1 << 4, /* "flush_fifo" bit */
+       CAP_CTRL_CLR_FIFOFULL = 1 << 5, /* "clr_fifo32_ful" bit */
+       CAP_CTRL_CLR_COUNTER  = 1 << 6, /* "clr_cntr0" bit */
+};
+
 /** Register/value pair.
  */
 struct regval_pair {
index 5a64840fb4a53878f89b38f6775ea72b7cc165d9..0753f4579714a70b6b528c6f97ad41902f68afbb 100644 (file)
@@ -328,7 +328,7 @@ static void issue_stop_capture(const struct sr_dev_inst *sdi)
        regvals = devc->reg_write_seq;
 
        regvals[0].reg = REG_LONG_ADDR;
-       regvals[0].val = 10;
+       regvals[0].val = LREG_CAP_CTRL;
 
        regvals[1].reg = REG_LONG_LOW;
        regvals[1].val = 0;
@@ -713,12 +713,12 @@ SR_PRIV int lwla_init_device(const struct sr_dev_inst *sdi)
        if (ret != SR_OK)
                return ret;
 
-       ret = lwla_read_long_reg(sdi->conn, 100, &value);
+       ret = lwla_read_long_reg(sdi->conn, LREG_TEST_ID, &value);
        if (ret != SR_OK)
                return ret;
 
        /* Ignore the value returned by the first read */
-       ret = lwla_read_long_reg(sdi->conn, 100, &value);
+       ret = lwla_read_long_reg(sdi->conn, LREG_TEST_ID, &value);
        if (ret != SR_OK)
                return ret;
 
@@ -821,11 +821,11 @@ SR_PRIV int lwla_setup_acquisition(const struct sr_dev_inst *sdi)
        regvals[1].val = MEM_CTRL_WRITE;
 
        regvals[2].reg = REG_LONG_ADDR;
-       regvals[2].val = 10;
+       regvals[2].val = LREG_CAP_CTRL;
 
        regvals[3].reg = REG_LONG_LOW;
-       regvals[3].val = 0x74;
-
+       regvals[3].val = CAP_CTRL_CLR_TIMEBASE | CAP_CTRL_FLUSH_FIFO
+                      | CAP_CTRL_CLR_FIFOFULL | CAP_CTRL_CLR_COUNTER;
        regvals[4].reg = REG_LONG_HIGH;
        regvals[4].val = 0;
 
@@ -875,10 +875,10 @@ SR_PRIV int lwla_start_acquisition(const struct sr_dev_inst *sdi)
        regvals = devc->reg_write_seq;
 
        regvals[0].reg = REG_LONG_ADDR;
-       regvals[0].val = 10;
+       regvals[0].val = LREG_CAP_CTRL;
 
        regvals[1].reg = REG_LONG_LOW;
-       regvals[1].val = 1;
+       regvals[1].val = CAP_CTRL_TRG_EN;
 
        regvals[2].reg = REG_LONG_HIGH;
        regvals[2].val = 0;