summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2019-08-06 21:42:07 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2019-08-23 12:24:20 +0200
commit5e82e3c666ac2180d6b9a1e67eed25693de0c6ef (patch)
tree69cc2169f327457c3ec0cd1fb0afe68889ef2b19
parent739b654a10c34065c021f0bb1152e3a47c8b3b7d (diff)
downloadlibsigrokdecode-5e82e3c666ac2180d6b9a1e67eed25693de0c6ef.tar.gz
libsigrokdecode-5e82e3c666ac2180d6b9a1e67eed25693de0c6ef.zip
mrf24j40: Add TX retries/fails and CCAFAIL support.
-rw-r--r--decoders/mrf24j40/pd.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/decoders/mrf24j40/pd.py b/decoders/mrf24j40/pd.py
index 58d3dfd..db3ca98 100644
--- a/decoders/mrf24j40/pd.py
+++ b/decoders/mrf24j40/pd.py
@@ -40,6 +40,11 @@ class Decoder(srd.Decoder):
('warning', 'Warnings'),
('tx-frame', 'TX frame'),
('rx-frame', 'RX frame'),
+ ('tx-retry-1', '1x TX retry'),
+ ('tx-retry-2', '2x TX retry'),
+ ('tx-retry-3', '3x TX retry'),
+ ('tx-fail', 'TX fail (too many retries)'),
+ ('ccafail', 'CCAFAIL (channel busy)'),
)
annotation_rows = (
('read', 'Read', (0, 2)),
@@ -47,6 +52,11 @@ class Decoder(srd.Decoder):
('warnings', 'Warnings', (4,)),
('tx-frames', 'TX frames', (5,)),
('rx-frames', 'RX frames', (6,)),
+ ('tx-retries-1', '1x TX retries', (7,)),
+ ('tx-retries-2', '2x TX retries', (8,)),
+ ('tx-retries-3', '3x TX retries', (9,)),
+ ('tx-fails', 'TX fails', (10,)),
+ ('ccafails', 'CCAFAILs', (11,)),
)
def __init__(self):
@@ -93,6 +103,16 @@ class Decoder(srd.Decoder):
self.putx([1, ['%s: %#x' % (reg_desc, self.mosi_bytes[1])]])
else:
self.putx([0, ['%s: %#x' % (reg_desc, self.miso_bytes[1])]])
+ numretries = (self.miso_bytes[1] & 0xc0) >> 6
+ if reg_desc == 'TXSTAT' and numretries > 0:
+ txfail = 1 if ((self.miso_bytes[1] & (1 << 0)) != 0) else 0
+ idx = 6 + numretries + txfail
+ if txfail:
+ self.putx([idx, ['TX fail (>= 4 retries)', 'TX fail']])
+ else:
+ self.putx([idx, ['TX retries: %d' % numretries]])
+ if reg_desc == 'TXSTAT' and (self.miso_bytes[1] & (1 << 5)) != 0:
+ self.putx([11, ['CCAFAIL (channel busy)', 'CCAFAIL']])
def handle_long(self):
dword = self.mosi_bytes[0] << 8 | self.mosi_bytes[1]