]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/lpc/pd.py
lpc: Use annotation types.
[libsigrokdecode.git] / decoders / lpc / pd.py
index 7664156eefce18668f01620a6056a683e6a19f73..60399a52e0138c120b7d51d972b6c3621111da15 100644 (file)
@@ -108,7 +108,6 @@ class Decoder(srd.Decoder):
     outputs = ['lpc']
     probes = [
         {'id': 'lframe', 'name': 'LFRAME#', 'desc': 'TODO'},
-        {'id': 'lreset', 'name': 'LRESET#', 'desc': 'TODO'},
         {'id': 'lclk',   'name': 'LCLK',    'desc': 'TODO'},
         {'id': 'lad0',   'name': 'LAD[0]',  'desc': 'TODO'},
         {'id': 'lad1',   'name': 'LAD[1]',  'desc': 'TODO'},
@@ -116,6 +115,7 @@ class Decoder(srd.Decoder):
         {'id': 'lad3',   'name': 'LAD[3]',  'desc': 'TODO'},
     ]
     optional_probes = [
+        {'id': 'lreset', 'name': 'LRESET#', 'desc': 'TODO'},
         {'id': 'ldrq',   'name': 'LDRQ#',   'desc': 'TODO'},
         {'id': 'serirq', 'name': 'SERIRQ',  'desc': 'TODO'},
         {'id': 'clkrun', 'name': 'CLKRUN#', 'desc': 'TODO'},
@@ -125,7 +125,14 @@ class Decoder(srd.Decoder):
     ]
     options = {}
     annotations = [
-        ['Text', 'Human-readable text'],
+        ['warnings', 'Warnings'],
+        ['start', 'Start'],
+        ['cycle_type', 'Cycle-type/direction'],
+        ['addr', 'Address'],
+        ['tar1', 'Turn-around cycle 1'],
+        ['sync', 'Sync'],
+        ['data', 'Data'],
+        ['tar2', 'Turn-around cycle 2'],
     ]
 
     def __init__(self, **kwargs):
@@ -160,13 +167,12 @@ class Decoder(srd.Decoder):
         # multiple clocks, and we output all START fields that occur, even
         # though the peripherals are supposed to ignore all but the last one.
         s = fields['START'][lad]
-        self.putb([0, [s]])
+        self.putb([1, [s]])
 
         # Output a warning if LAD[3:0] changes while LFRAME# is low.
         # TODO
         if (self.lad != -1 and self.lad != lad):
-            self.putb([0, ['Warning: LAD[3:0] changed while '
-                           'LFRAME# was asserted']])
+            self.putb([0, ['LAD[3:0] changed while LFRAME# was asserted']])
 
         # LFRAME# is asserted (low). Wait until it gets de-asserted again
         # (the host is allowed to keep it asserted multiple clocks).
@@ -183,10 +189,10 @@ class Decoder(srd.Decoder):
 
         # TODO: Warning/error on invalid cycle types.
         if self.cycle_type == 'Reserved':
-            self.putb([0, ['Warning: Invalid cycle type (%s)' % lad_bits]])
+            self.putb([0, ['Invalid cycle type (%s)' % lad_bits]])
 
         # ...
-        self.putb([0, ['Cycle type: %s' % self.cycle_type]])
+        self.putb([2, ['Cycle type: %s' % self.cycle_type]])
 
         self.state = 'GET ADDR'
         self.addr = 0
@@ -214,7 +220,7 @@ class Decoder(srd.Decoder):
             return
 
         s = 'Address: 0x%%0%dx' % addr_nibbles
-        self.putb([0, [s % self.addr]])
+        self.putb([3, [s % self.addr]])
 
         self.state = 'GET TAR'
         self.tar_count = 0
@@ -222,14 +228,14 @@ class Decoder(srd.Decoder):
     def handle_get_tar(self, lad, lad_bits):
         # LAD[3:0]: First TAR (turn-around) field (2 clock cycles).
 
-        self.putb([0, ['TAR, cycle %d: %s' % (self.tarcount, lad_bits)]])
+        self.putb([4, ['TAR, cycle %d: %s' % (self.tarcount, lad_bits)]])
 
         # On the first TAR clock cycle LAD[3:0] is driven to 1111 by
         # either the host or peripheral. On the second clock cycle,
         # the host or peripheral tri-states LAD[3:0], but its value
         # should still be 1111, due to pull-ups on the LAD lines.
         if lad_bits != '1111':
-            self.putb([0, ['Warning: TAR, cycle %d: %s (expected 1111)' % \
+            self.putb([0, ['TAR, cycle %d: %s (expected 1111)' % \
                            (self.tarcount, lad_bits)]])
 
         if (self.tarcount != 1):
@@ -247,10 +253,10 @@ class Decoder(srd.Decoder):
 
         # TODO: Warnings if reserved value are seen?
         if self.cycle_type == 'Reserved':
-            self.putb([0, ['Warning: SYNC, cycle %d: %s (reserved value)' % \
+            self.putb([0, ['SYNC, cycle %d: %s (reserved value)' % \
                            (self.synccount, self.sync_val)]])
 
-        self.putb([0, ['SYNC, cycle %d: %s' % (self.synccount, self.sync_val)]])
+        self.putb([5, ['SYNC, cycle %d: %s' % (self.synccount, self.sync_val)]])
 
         # TODO
 
@@ -272,7 +278,7 @@ class Decoder(srd.Decoder):
             self.cycle_count += 1
             return
 
-        self.putb([0, ['DATA: 0x%02x' % self.databyte]])
+        self.putb([6, ['DATA: 0x%02x' % self.databyte]])
 
         self.cycle_count = 0
         self.state = 'GET TAR2'
@@ -280,7 +286,7 @@ class Decoder(srd.Decoder):
     def handle_get_tar2(self, lad, lad_bits):
         # LAD[3:0]: Second TAR field (2 clock cycles).
 
-        self.putb([0, ['TAR, cycle %d: %s' % (self.tarcount, lad_bits)]])
+        self.putb([7, ['TAR, cycle %d: %s' % (self.tarcount, lad_bits)]])
 
         # On the first TAR clock cycle LAD[3:0] is driven to 1111 by
         # either the host or peripheral. On the second clock cycle,
@@ -308,8 +314,8 @@ class Decoder(srd.Decoder):
             self.oldpins = pins
 
             # Get individual pin values into local variables.
-            (lframe, lreset, lclk, lad0, lad1, lad2, lad3) = pins[:7]
-            (ldrq, serirq, clkrun, lpme, lpcpd, lsmi) = pins[7:]
+            (lframe, lclk, lad0, lad1, lad2, lad3) = pins[:6]
+            (lreset, ldrq, serirq, clkrun, lpme, lpcpd, lsmi) = pins[6:]
 
             # Only look at the signals upon rising LCLK edges. The LPC clock
             # is the same as the PCI clock (which is sampled at rising edges).