]> sigrok.org Git - libsigrokdecode.git/commitdiff
srd: avr_isp: Factor out part numbers/names to part.py.
authorUwe Hermann <redacted>
Sat, 28 Jul 2012 08:51:32 +0000 (10:51 +0200)
committerUwe Hermann <redacted>
Sat, 28 Jul 2012 21:39:47 +0000 (23:39 +0200)
decoders/avr_isp/Makefile.am
decoders/avr_isp/parts.py [new file with mode: 0644]
decoders/avr_isp/pd.py

index 7960b11b8c5bde261cacef28586597b69ca3b7d2..6dfa63598d7c66d27b11401dea94ceaf897b25e7 100644 (file)
@@ -20,7 +20,7 @@
 
 pkgdatadir = $(DECODERS_DIR)/avr_isp
 
-dist_pkgdata_DATA = __init__.py pd.py
+dist_pkgdata_DATA = __init__.py pd.py parts.py
 
 CLEANFILES = *.pyc
 
diff --git a/decoders/avr_isp/parts.py b/decoders/avr_isp/parts.py
new file mode 100644 (file)
index 0000000..fbc0b92
--- /dev/null
@@ -0,0 +1,43 @@
+##
+## This file is part of the sigrok project.
+##
+## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## 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
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## 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
+##
+
+# Device code addresses:
+# 0x00: vendor code, 0x01: part family + flash size, 0x02: part number
+
+# Vendor code
+vendor_code = {
+    0x1e: 'Atmel',
+    0x00: 'Device locked',
+}
+
+# (Part family + flash size, part number)
+part = {
+    (0x90, 0x01): 'AT90S1200',
+    (0x91, 0x01): 'AT90S2313',
+    (0x92, 0x01): 'AT90S4414',
+    (0x92, 0x05): 'ATmega48', # 4kB flash
+    (0x93, 0x01): 'AT90S8515',
+    (0x93, 0x0a): 'ATmega88', # 8kB flash
+    (0x94, 0x06): 'ATmega168', # 16kB flash
+    (0xff, 0xff): 'Device code erased, or target missing',
+    (0x01, 0x02): 'Device locked',
+    # TODO: Lots more entries.
+}
+
index be6c1903db3ce196d9b520fb4338ee4c00f28bf0..4b496e0249fc64e061944992e61cbe2df84c101a 100644 (file)
 # AVR ISP protocol decoder
 
 import sigrokdecode as srd
-
-# Device code addresses:
-# 0x00: vendor code, 0x01: part family + flash size, 0x02: part number
-
-# Vendor code
-vendor_code = {
-    0x1e: 'Atmel',
-    0x00: 'Device locked',
-}
-
-# (Part family + flash size, part number)
-part = {
-    (0x90, 0x01): 'AT90S1200',
-    (0x91, 0x01): 'AT90S2313',
-    (0x92, 0x01): 'AT90S4414',
-    (0x92, 0x05): 'ATmega48', # 4kB flash
-    (0x93, 0x01): 'AT90S8515',
-    (0x93, 0x0a): 'ATmega88', # 8kB flash
-    (0x94, 0x06): 'ATmega168', # 16kB flash
-    (0xff, 0xff): 'Device code erased, or target missing',
-    (0x01, 0x02): 'Device locked',
-    # TODO: Lots more entries.
-}
+from .parts import *
 
 VENDOR_CODE_ATMEL = 0x1e