]> sigrok.org Git - libsigrok.git/commitdiff
ipdbg-la: add edge trigger option
authorEva Kissling <redacted>
Mon, 25 Sep 2017 19:32:13 +0000 (21:32 +0200)
committerUwe Hermann <redacted>
Wed, 29 Aug 2018 21:59:27 +0000 (23:59 +0200)
src/hardware/ipdbg-logic-analyser/api.c
src/hardware/ipdbg-logic-analyser/protocol.c
src/hardware/ipdbg-logic-analyser/protocol.h

index 9c6d7f123e38aa8707a8148b58a7767b65f586fe..98512a1495be06574ed1219c8f8bcf4becd583d6 100644 (file)
@@ -40,7 +40,7 @@ static const int32_t ipdbg_org_la_trigger_matches[] = {
     SR_TRIGGER_ONE,
     SR_TRIGGER_RISING,
     SR_TRIGGER_FALLING,
-    //SR_TRIGGER_EDGE,
+    SR_TRIGGER_EDGE,
 };
 
 SR_PRIV struct sr_dev_driver ipdbg_la_driver_info;
index 61a9d0a8787c132008b64b6766cf0c773e7c28a4..e707ebd98288459143d0daf7cf7ed53519b8affc 100644 (file)
@@ -60,6 +60,9 @@
 
 #define Value_last                 0xFF
 
+#define Select_Edge_Mask           0xF5
+#define Set_Edge_Mask              0xF6
+
 #define delay                      0x1F
 #define K_Mauslesen                0xAA
 
@@ -197,6 +200,7 @@ SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
         devc->trigger_value[i] = 0;
         devc->trigger_mask_last[i] = 0;
         devc->trigger_value_last[i] = 0;
+        devc->trigger_edge_mask[i] = 0;
     }
 
     if (!(trigger = sr_session_trigger_get(sdi->session))) //
@@ -225,6 +229,7 @@ SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
                 devc->trigger_value[byteIndex] |= matchPattern;
                 devc->trigger_mask[byteIndex] |= matchPattern;
                 devc->trigger_mask_last[byteIndex] &= ~matchPattern;
+                devc->trigger_edge_mask[byteIndex] &= ~matchPattern;
                 //sr_err("\n========ONE MASK===========");
 
             }
@@ -233,6 +238,7 @@ SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
                 devc->trigger_value[byteIndex] &= ~matchPattern;
                 devc->trigger_mask[byteIndex] |= matchPattern;
                 devc->trigger_mask_last[byteIndex] &= ~matchPattern;
+                devc->trigger_edge_mask[byteIndex] &= ~matchPattern;
                 //sr_err("\n========ZERO MASK===========");
             }
             else if ( match->match == SR_TRIGGER_RISING)
@@ -241,6 +247,7 @@ SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
                 devc->trigger_value_last[byteIndex] &= ~matchPattern;
                 devc->trigger_mask[byteIndex] |= matchPattern;
                 devc->trigger_mask_last[byteIndex] |= matchPattern;
+                devc->trigger_edge_mask[byteIndex] &= ~matchPattern;
                 //sr_err("\n==========RISING===========");
 
             }
@@ -250,8 +257,15 @@ SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
                 devc->trigger_value_last[byteIndex] |= matchPattern;
                 devc->trigger_mask[byteIndex] |= matchPattern;
                 devc->trigger_mask_last[byteIndex] |= matchPattern;
+                devc->trigger_edge_mask[byteIndex] &= ~matchPattern;
                 //sr_err("\n========FALlING===========");
             }
+            else if (match->match == SR_TRIGGER_EDGE)
+            {
+                devc->trigger_mask[byteIndex] &= ~matchPattern;
+                devc->trigger_mask_last[byteIndex] &= ~matchPattern;
+                devc->trigger_edge_mask[byteIndex] |= matchPattern;
+            }
 
         }
 
@@ -450,6 +464,18 @@ SR_PRIV int ipdbg_org_la_sendTrigger(struct ipdbg_org_la_dev_context *devc, stru
     for(size_t k = 0 ; k < devc->DATA_WIDTH_BYTES ; ++k)
         sendEscaping(tcp, devc->trigger_value_last + devc->DATA_WIDTH_BYTES -1-k, 1);
 
+    /////////////////////////////////////////////edge_mask////////////////////////////////////////////////////////////
+    buf[0] = Trigger;
+    ipdbg_org_la_tcp_send(tcp, buf, 1);
+    buf[0] = Select_Edge_Mask;
+    ipdbg_org_la_tcp_send(tcp, buf, 1);
+    buf[0] = Set_Edge_Mask;
+    ipdbg_org_la_tcp_send(tcp, buf, 1);
+
+    for(size_t k = 0 ; k < devc->DATA_WIDTH_BYTES ; ++k)
+        sendEscaping(tcp, devc->trigger_edge_mask + devc->DATA_WIDTH_BYTES -1-k, 1);
+
+
     return SR_OK;
 }
 
@@ -539,7 +565,9 @@ SR_PRIV void ipdbg_org_la_get_addrwidth_and_datawidth(struct ipdbg_org_la_tcp *t
     devc->trigger_value      = g_malloc0(devc->DATA_WIDTH_BYTES);
     devc->trigger_mask_last  = g_malloc0(devc->DATA_WIDTH_BYTES);
     devc->trigger_value_last = g_malloc0(devc->DATA_WIDTH_BYTES);
+    devc->trigger_edge_mask  = g_malloc0(devc->DATA_WIDTH_BYTES);
 
+    // TODO add missing free for trigger_mask, trigger_value, trigger_mask_last, trigger_value_last and trigger_edge_mask
 
 }
 
index 48cfcd1c57475e6a149f5a2b54e01615949c16a7..6d4b6c3dfdf29cdcb60175222f16ab3ab4992723 100644 (file)
@@ -49,6 +49,7 @@ struct ipdbg_org_la_dev_context
     char *trigger_value;
     char *trigger_mask_last;
     char *trigger_value_last;
+    char *trigger_edge_mask;
     unsigned int delay_value;
     int num_stages; //always 0
     unsigned int num_transfers;