X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fspiflash%2Fpd.py;h=26f3a24c3105f67c67d44ee40d42dbaf926e34b1;hb=07da8a9b7b4c6e433b2246e65c712f4b2dbcc856;hp=aecc2d37db5766ce8e994177f05b3b9396f15df9;hpb=bb2cda30325a7e01a77dd30aeed67b142837d822;p=libsigrokdecode.git diff --git a/decoders/spiflash/pd.py b/decoders/spiflash/pd.py index aecc2d3..26f3a24 100644 --- a/decoders/spiflash/pd.py +++ b/decoders/spiflash/pd.py @@ -1,7 +1,7 @@ ## ## This file is part of the libsigrokdecode project. ## -## Copyright (C) 2011-2016 Uwe Hermann +## Copyright (C) 2011-2020 Uwe Hermann ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -18,16 +18,14 @@ ## import sigrokdecode as srd +import re +from common.srdhelper import SrdIntEnum from .lists import * L = len(cmds) -# Don't forget to keep this in sync with 'cmds' is lists.py. -class Ann: - WRSR, PP, READ, WRDI, RDSR, WREN, FAST_READ, SE, RDSCUR, WRSCUR, \ - RDSR2, CE, ESRY, DSRY, WRITE1, WRITE2, REMS, RDID, RDP_RES, CP, ENSO, DP, \ - READ2X, EXSO, CE2, STATUS, BE, REMS2, \ - BIT, FIELD, WARN = range(L + 3) +a = [re.sub('\/', '_', c[0]).replace('2READ', 'READ2X') for c in cmds.values()] + ['BIT', 'FIELD', 'WARN'] +Ann = SrdIntEnum.from_list('Ann', a) def cmd_annotation_classes(): return tuple([tuple([cmd[0].lower(), cmd[1]]) for cmd in cmds.values()]) @@ -73,12 +71,13 @@ def decode_status_reg(data): class Decoder(srd.Decoder): api_version = 3 id = 'spiflash' - name = 'SPI flash' - longname = 'SPI flash chips' - desc = 'xx25 series SPI (NOR) flash chip protocol.' + name = 'SPI flash/EEPROM' + longname = 'SPI flash/EEPROM chips' + desc = 'xx25 series SPI (NOR) flash/EEPROM chip protocol.' license = 'gplv2+' inputs = ['spi'] - outputs = ['spiflash'] + outputs = [] + tags = ['IC', 'Memory'] annotations = cmd_annotation_classes() + ( ('bit', 'Bit'), ('field', 'Field'), @@ -473,8 +472,8 @@ class Decoder(srd.Decoder): self.putx([Ann.FIELD, ['%s ID: 0x%02x' % (d, miso)]]) if self.cmdstate == 6: - id = self.ids[1] if self.manufacturer_id_first else self.ids[0] - self.device_id = id + id_ = self.ids[1] if self.manufacturer_id_first else self.ids[0] + self.device_id = id_ self.es_cmd = self.es self.putc([Ann.REMS, self.cmd_vendor_dev_list()]) self.state = None