]> sigrok.org Git - libsigrokdecode.git/commitdiff
spiflash: Implement Release Power-down / Device ID (0xAB) command.
authorUwe Hermann <redacted>
Sun, 23 Oct 2016 22:36:45 +0000 (00:36 +0200)
committerUwe Hermann <redacted>
Sun, 6 Nov 2016 14:44:29 +0000 (15:44 +0100)
This fixes bug #845.

decoders/spiflash/pd.py

index 10c39192353e878652e069343def1887fff40d9b..3d40ceb0663d424a3ff65f4cf7b0151e2491c5a8 100644 (file)
@@ -302,7 +302,20 @@ class Decoder(srd.Decoder):
         pass # TODO
 
     def handle_rdp_res(self, mosi, miso):
-        pass # TODO
+        if self.cmdstate == 1:
+            # Byte 1: Master sends command ID.
+            self.ss_block = self.ss
+            self.putx([16, ['Command: %s' % cmds[self.state][1]]])
+        elif self.cmdstate in (2, 3, 4):
+            # Bytes 2/3/4: Master sends three dummy bytes.
+            self.putx([24, ['Dummy byte: %02x' % mosi]])
+        elif self.cmdstate == 5:
+            # Byte 5: Slave sends device ID.
+            self.ids = [miso]
+            self.putx([24, ['Device: Macronix %s' % device_name[self.ids[0]]]])
+            self.state = None
+
+        self.cmdstate += 1
 
     def handle_rems(self, mosi, miso):
         if self.cmdstate == 1: