]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/sdcard_sd/pd.py
sdcard_sd: output CMD8 in cmd8-handler
[libsigrokdecode.git] / decoders / sdcard_sd / pd.py
index 02e78d72191c5a37b4b5b63efdfc603324629a73..2d880968a842badc7838d59b64736dbe12e70095 100644 (file)
@@ -76,9 +76,6 @@ class Decoder(srd.Decoder):
     def putt(self, data):
         self.put(self.token[0][0], self.token[47][1], self.out_ann, data)
 
-    def putt2(self, data):
-        self.put(self.token[47][0], self.token[0][1], self.out_ann, data)
-
     def putf(self, s, e, data):
         self.put(self.token[s][0], self.token[e][1], self.out_ann, data)
 
@@ -93,9 +90,6 @@ class Decoder(srd.Decoder):
     def putr(self, cmd, desc):
         self.putt([cmd, ['Reply: %s' % desc]])
 
-    def putr2(self, cmd, desc):
-        self.putt2([cmd, ['Reply: %s' % desc]])
-
     def reset(self):
         self.cmd, self.arg = None, None
         self.token, self.state = [], 'GET COMMAND TOKEN'
@@ -135,7 +129,8 @@ class Decoder(srd.Decoder):
                                'CMD%d' % self.cmd, 'Cmd', 'C']])
 
         # CMD[39:08]: Argument
-        self.putf(8, 39, [132, ['Argument', 'Arg', 'A']])
+        self.arg = int('0b' + ''.join([str(s[i][2]) for i in range(8, 40)]), 2)
+        self.putf(8, 39, [132, ['Argument: 0x%08x' % self.arg, 'Arg', 'A']])
 
         # CMD[07:01]: CRC7
         self.crc = int('0b' + ''.join([str(s[i][2]) for i in range(40, 47)]), 2)
@@ -164,7 +159,7 @@ class Decoder(srd.Decoder):
         # Handle command.
         s = 'ACMD' if self.is_acmd else 'CMD'
         self.cmd_str = '%s%d (%s)' % (s, self.cmd, self.cmd_name(self.cmd))
-        if self.cmd in (0, 2, 3, 4, 6, 7, 8, 9, 10, 13, 41, 51, 55):
+        if self.cmd in (0, 2, 3, 6, 7, 8, 9, 10, 13, 41, 51, 55):
             self.state = 'HANDLE CMD%d' % self.cmd
         else:
             self.state = 'HANDLE CMD999'
@@ -203,7 +198,7 @@ class Decoder(srd.Decoder):
         self.puta(12, 31, [136, ['Reserved', 'Res', 'R']])
         self.puta(8, 11, [136, ['Supply voltage', 'Voltage', 'VHS', 'V']])
         self.puta(0, 7, [136, ['Check pattern', 'Check pat', 'Check', 'C']])
-        self.putc(0, 'Send interface condition to card')
+        self.putc(8, 'Send interface condition to card')
         self.token, self.state = [], 'GET RESPONSE R7'
         # TODO: Handle case when card doesn't reply with R7 (no reply at all).
 
@@ -230,9 +225,8 @@ class Decoder(srd.Decoder):
 
     def handle_cmd16(self):
         # CMD16 (SET_BLOCKLEN) -> R1
-        self.blocklen = self.arg
         self.puta(0, 31, [136, ['Block length', 'Blocklen', 'BL', 'B']])
-        self.putc(16, 'Set the block length to %d bytes' % self.blocklen)
+        self.putc(16, 'Set the block length to %d bytes' % self.arg)
         self.token, self.state = [], 'GET RESPONSE R1'
 
     def handle_cmd55(self):