X-Git-Url: http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fspiflash%2Fpd.py;fp=decoders%2Fspiflash%2Fpd.py;h=4c5c06b232011d3121668406274b1bc9d91ef10f;hp=3afafba1587584fff17214ea49974e5a353ddb16;hb=6ccb64feb20dcb7833b2452cdfface4d9aa2bd72;hpb=0a89f2ae27d7ba9e6f009df9745f45c4524234fd diff --git a/decoders/spiflash/pd.py b/decoders/spiflash/pd.py index 3afafba..4c5c06b 100644 --- a/decoders/spiflash/pd.py +++ b/decoders/spiflash/pd.py @@ -173,6 +173,22 @@ class Decoder(srd.Decoder): self.cmdstate += 1 + def handle_rdsr2(self, mosi, miso): + # Read status register 2: Master asserts CS#, sends RDSR2 command, + # reads status register 2 byte. If CS# is kept asserted, the status + # register 2 can be read continuously / multiple times in a row. + # When done, the master de-asserts CS# again. + if self.cmdstate == 1: + # Byte 1: Master sends command ID. + self.putx([3, ['Command: %s' % cmds[self.state][1]]]) + elif self.cmdstate >= 2: + # Bytes 2-x: Slave sends status register 2 as long as master clocks. + self.putx([24, ['Status register 2: 0x%02x' % miso]]) + self.putx([25, [decode_status_reg(miso)]]) + # TODO: Handle status register 2 correctly. + + self.cmdstate += 1 + def handle_wrsr(self, mosi, miso): # Write status register: Master asserts CS#, sends WRSR command, # writes 1 or 2 status register byte(s).