X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Farm_tpiu%2Fpd.py;h=f50af65b471b652814aaa45f22185a8afc8ea7e3;hb=6d1ad4ae80788184a59b034b5ee2e19958998034;hp=0e07eb4e47c72615157bc8d60d020647c7db7148;hpb=686f0c3621cd8ef7264f3e45e0218f2ebdfb612a;p=libsigrokdecode.git diff --git a/decoders/arm_tpiu/pd.py b/decoders/arm_tpiu/pd.py index 0e07eb4..f50af65 100644 --- a/decoders/arm_tpiu/pd.py +++ b/decoders/arm_tpiu/pd.py @@ -14,18 +14,17 @@ ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## along with this program; if not, see . ## import sigrokdecode as srd class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'arm_tpiu' name = 'ARM TPIU' longname = 'ARM Trace Port Interface Unit' - desc = 'Filter TPIU formatted trace data into separate data streams.' + desc = 'Filter TPIU formatted trace data into separate streams.' license = 'gplv2+' inputs = ['uart'] outputs = ['uart'] # Emulate uart output so that arm_itm/arm_etm can stack. @@ -42,12 +41,15 @@ class Decoder(srd.Decoder): ('data', 'Stream data', (1,)), ) - def __init__(self, **kwargs): + def __init__(self): + self.reset() + + def reset(self): self.buf = [] self.syncbuf = [] self.prevsample = 0 self.stream = 0 - self.stream_ss = None + self.ss_stream = None self.bytenum = 0 def start(self): @@ -57,14 +59,14 @@ class Decoder(srd.Decoder): def stream_changed(self, ss, stream): if self.stream != stream: if self.stream != 0: - self.put(self.stream_ss, ss, self.out_ann, - [0, ["Stream %d" % self.stream, "S%d" % self.stream]]) + self.put(self.ss_stream, ss, self.out_ann, + [0, ['Stream %d' % self.stream, 'S%d' % self.stream]]) self.stream = stream - self.stream_ss = ss + self.ss_stream = ss def emit_byte(self, ss, es, byte): if self.stream == self.options['stream']: - self.put(ss, es, self.out_ann, [1, ["0x%02x" % byte]]) + self.put(ss, es, self.out_ann, [1, ['0x%02x' % byte]]) self.put(ss, es, self.out_python, ['DATA', 0, (byte, [])]) def process_frame(self, buf):