summaryrefslogtreecommitdiff
path: root/decoders/mx25lxx05d/mx25lxx05d.py
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2012-05-18 15:28:52 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2012-05-18 20:01:52 +0200
commit87e574b787fc96a34fe7ea2fd20a4de06cde8c08 (patch)
tree02f69c00168ecd45ec98bd3e9871ac7e8e34f4d4 /decoders/mx25lxx05d/mx25lxx05d.py
parent5ebb76fecc4ed07dd68a38dc55f3ba4ff34e7d70 (diff)
downloadlibsigrokdecode-87e574b787fc96a34fe7ea2fd20a4de06cde8c08.tar.gz
libsigrokdecode-87e574b787fc96a34fe7ea2fd20a4de06cde8c08.zip
srd: MX25Lxx05D: Fix SE command.
Diffstat (limited to 'decoders/mx25lxx05d/mx25lxx05d.py')
-rw-r--r--decoders/mx25lxx05d/mx25lxx05d.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/decoders/mx25lxx05d/mx25lxx05d.py b/decoders/mx25lxx05d/mx25lxx05d.py
index c6e950d..18c5917 100644
--- a/decoders/mx25lxx05d/mx25lxx05d.py
+++ b/decoders/mx25lxx05d/mx25lxx05d.py
@@ -168,16 +168,13 @@ class Decoder(srd.Decoder):
self.start_sample = self.ss
self.putx([0, ['Command: %s' % cmds[self.cmd]]])
elif self.cmdstate in (2, 3, 4):
- # Bytes 2/3/4: Master sends address of the sector to erase.
- # Note: Assumes SPI data is 8 bits wide (it is for MX25Lxx05D).
- # TODO: LSB-first of MSB-first?
- self.addr <<= 8
- self.addr |= mosi
- self.putx([0, ['Address byte %d: 0x%02x' % (self.cmdstate - 1,
- miso)]]) # TODO: Count from 0 or 1?
+ # Bytes 2/3/4: Master sends sectror address (24bits, MSB-first).
+ self.addr |= (mosi << ((4 - self.cmdstate) * 8))
+ # self.putx([0, ['Sector address, byte %d: 0x%02x' % \
+ # (4 - self.cmdstate, mosi)]])
if self.cmdstate == 4:
- d = 'Erase sector %d' % self.addr
+ d = 'Erase sector %d (0x%06x)' % (self.addr, self.addr)
self.put(self.start_sample, self.es, self.out_ann, [0, [d]])
# TODO: Max. size depends on chip, check that too if possible.
if self.addr % 4096 != 0: