summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2020-08-30 07:20:33 +0200
committerGerhard Sittig <gerhard.sittig@gmx.net>2020-08-30 07:23:58 +0200
commitbcbdb1d9aa98dc9af0249bf4b42a60a7bb1eed01 (patch)
tree8663fad978b6b93e11ca6d84bf78caaeebc4fd86 /decoders
parent6bddf39e7a2758cdd5b0e6e3ef1304346a22c565 (diff)
downloadlibsigrokdecode-bcbdb1d9aa98dc9af0249bf4b42a60a7bb1eed01.tar.gz
libsigrokdecode-bcbdb1d9aa98dc9af0249bf4b42a60a7bb1eed01.zip
sle44xx: support memory read "to end of capacity"
Assume a maximum memory capacity, currently open coded, could become a user servicable option when needed. Automatically flush the accumulated outgoing data when a memory read reaches address 256. Drop the unconditional START condition check now that it became obsolete.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/sle44xx/pd.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/decoders/sle44xx/pd.py b/decoders/sle44xx/pd.py
index 56d2d04..9f33207 100644
--- a/decoders/sle44xx/pd.py
+++ b/decoders/sle44xx/pd.py
@@ -79,6 +79,7 @@ class Decoder(srd.Decoder):
def reset(self):
self.samplerate = None
+ self.max_addr = 256
self.bits = []
self.atr_bytes = []
self.cmd_bytes = []
@@ -252,6 +253,7 @@ class Decoder(srd.Decoder):
'read main memory, addr {addr:02x}',
'RD-M @{addr:02x}',
],
+ 'len': lambda ctrl, addr, data: self.max_addr - addr,
},
0x31: {
'fmt': [
@@ -306,6 +308,8 @@ class Decoder(srd.Decoder):
fmt = [fmt,]
texts = [f.format(ctrl = ctrl, addr = addr, data = data) for f in fmt]
length = code.get('len', None)
+ if callable(length):
+ length = length(ctrl, addr, data)
is_proc = code.get('proc', False)
return texts, length, is_proc
@@ -528,13 +532,6 @@ class Decoder(srd.Decoder):
# The START/STOP conditions are only applicable outside of
# "outgoing data" or "internal processing" periods. This is
# what the data sheet specifies.
- # TODO There is the decoder's inability to reliably detect
- # where memory reads are done because they reached the end
- # of the chip's capacity. Which makes the decoder miss the
- # next START symbol, and lose synchronization to the BIT
- # stream (bit counts are off, which breaks the accumulation
- # of bytes). That's why this decoder unconditionally keeps
- # detecting the START condition although it should not.
if not is_outgoing and not is_processing:
if self.matched[COND_CMD_START]:
self.handle_command(self.samplenum, True)
@@ -542,7 +539,3 @@ class Decoder(srd.Decoder):
if self.matched[COND_CMD_STOP]:
self.handle_command(self.samplenum, False)
continue
- if True: # HACK See the comment above.
- if self.matched[COND_CMD_START]:
- self.handle_command(self.samplenum, True)
- continue