enc28j60: Factor out command list to lists.py.
authorUwe Hermann <uwe@hermann-uwe.de>
Tue, 14 May 2019 22:57:42 +0000 (00:57 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Tue, 14 May 2019 22:58:33 +0000 (00:58 +0200)
decoders/enc28j60/lists.py [new file with mode: 0644]
decoders/enc28j60/pd.py

diff --git a/decoders/enc28j60/lists.py b/decoders/enc28j60/lists.py
new file mode 100644 (file)
index 0000000..59fbc1f
--- /dev/null
@@ -0,0 +1,161 @@
+##
+## This file is part of the libsigrokdecode project.
+##
+## Copyright (C) 2019 Jiahao Li <reg@ljh.me>
+##
+## Permission is hereby granted, free of charge, to any person obtaining a copy
+## of this software and associated documentation files (the "Software"), to deal
+## in the Software without restriction, including without limitation the rights
+## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+## copies of the Software, and to permit persons to whom the Software is
+## furnished to do so, subject to the following conditions:
+##
+## The above copyright notice and this permission notice shall be included in all
+## copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+## SOFTWARE.
+
+REGS = [
+    [
+        'ERDPTL',
+        'ERDPTH',
+        'EWRPTL',
+        'EWRPTH',
+        'ETXSTL',
+        'ETXSTH',
+        'ETXNDL',
+        'ETXNDH',
+        'ERXSTL',
+        'ERXSTH',
+        'ERXNDL',
+        'ERXNDH',
+        'ERXRDPTL',
+        'ERXRDPTH',
+        'ERXWRPTL',
+        'ERXWRPTH',
+        'EDMASTL',
+        'EDMASTH',
+        'EDMANDL',
+        'EDMANDH',
+        'EDMADSTL',
+        'EDMADSTH',
+        'EDMACSL',
+        'EDMACSH',
+        '—',
+        '—',
+        'Reserved',
+        'EIE',
+        'EIR',
+        'ESTAT',
+        'ECON2',
+        'ECON1',
+    ],
+    [
+        'EHT0',
+        'EHT1',
+        'EHT2',
+        'EHT3',
+        'EHT4',
+        'EHT5',
+        'EHT6',
+        'EHT7',
+        'EPMM0',
+        'EPMM1',
+        'EPMM2',
+        'EPMM3',
+        'EPMM4',
+        'EPMM5',
+        'EPMM6',
+        'EPMM7',
+        'EPMCSL',
+        'EPMCSH',
+        '—',
+        '—',
+        'EPMOL',
+        'EPMOH',
+        'Reserved',
+        'Reserved',
+        'ERXFCON',
+        'EPKTCNT',
+        'Reserved',
+        'EIE',
+        'EIR',
+        'ESTAT',
+        'ECON2',
+        'ECON1',
+    ],
+    [
+        'MACON1',
+        'Reserved',
+        'MACON3',
+        'MACON4',
+        'MABBIPG',
+        '—',
+        'MAIPGL',
+        'MAIPGH',
+        'MACLCON1',
+        'MACLCON2',
+        'MAMXFLL',
+        'MAMXFLH',
+        'Reserved',
+        'Reserved',
+        'Reserved',
+        '—',
+        'Reserved',
+        'Reserved',
+        'MICMD',
+        '—',
+        'MIREGADR',
+        'Reserved',
+        'MIWRL',
+        'MIWRH',
+        'MIRDL',
+        'MIRDH',
+        'Reserved',
+        'EIE',
+        'EIR',
+        'ESTAT',
+        'ECON2',
+        'ECON1',
+    ],
+    [
+        'MAADR5',
+        'MAADR6',
+        'MAADR3',
+        'MAADR4',
+        'MAADR1',
+        'MAADR2',
+        'EBSTSD',
+        'EBSTCON',
+        'EBSTCSL',
+        'EBSTCSH',
+        'MISTAT',
+        '—',
+        '—',
+        '—',
+        '—',
+        '—',
+        '—',
+        '—',
+        'EREVID',
+        '—',
+        '—',
+        'ECOCON',
+        'Reserved',
+        'EFLOCON',
+        'EPAUSL',
+        'EPAUSH',
+        'Reserved',
+        'EIE',
+        'EIR',
+        'ESTAT',
+        'ECON2',
+        'ECON1',
+    ],
+]
index f2b8db793ee415db9c8fb681badb5002df0a5827..ba36419c42803fb5b76172282607b3d4ed6c054e 100644 (file)
@@ -22,6 +22,7 @@
 ## SOFTWARE.
 
 import sigrokdecode as srd
+from .lists import *
 
 OPCODE_MASK = 0b11100000
 REG_ADDR_MASK = 0b00011111
@@ -43,145 +44,6 @@ REG_ADDR_ECON1 = 0x1F
 BIT_ECON1_BSEL0 = 0b00000001
 BIT_ECON1_BSEL1 = 0b00000010
 
-REGS = [
-    [
-        'ERDPTL',
-        'ERDPTH',
-        'EWRPTL',
-        'EWRPTH',
-        'ETXSTL',
-        'ETXSTH',
-        'ETXNDL',
-        'ETXNDH',
-        'ERXSTL',
-        'ERXSTH',
-        'ERXNDL',
-        'ERXNDH',
-        'ERXRDPTL',
-        'ERXRDPTH',
-        'ERXWRPTL',
-        'ERXWRPTH',
-        'EDMASTL',
-        'EDMASTH',
-        'EDMANDL',
-        'EDMANDH',
-        'EDMADSTL',
-        'EDMADSTH',
-        'EDMACSL',
-        'EDMACSH',
-        '—',
-        '—',
-        'Reserved',
-        'EIE',
-        'EIR',
-        'ESTAT',
-        'ECON2',
-        'ECON1',
-    ],
-    [
-        'EHT0',
-        'EHT1',
-        'EHT2',
-        'EHT3',
-        'EHT4',
-        'EHT5',
-        'EHT6',
-        'EHT7',
-        'EPMM0',
-        'EPMM1',
-        'EPMM2',
-        'EPMM3',
-        'EPMM4',
-        'EPMM5',
-        'EPMM6',
-        'EPMM7',
-        'EPMCSL',
-        'EPMCSH',
-        '—',
-        '—',
-        'EPMOL',
-        'EPMOH',
-        'Reserved',
-        'Reserved',
-        'ERXFCON',
-        'EPKTCNT',
-        'Reserved',
-        'EIE',
-        'EIR',
-        'ESTAT',
-        'ECON2',
-        'ECON1',
-    ],
-    [
-        'MACON1',
-        'Reserved',
-        'MACON3',
-        'MACON4',
-        'MABBIPG',
-        '—',
-        'MAIPGL',
-        'MAIPGH',
-        'MACLCON1',
-        'MACLCON2',
-        'MAMXFLL',
-        'MAMXFLH',
-        'Reserved',
-        'Reserved',
-        'Reserved',
-        '—',
-        'Reserved',
-        'Reserved',
-        'MICMD',
-        '—',
-        'MIREGADR',
-        'Reserved',
-        'MIWRL',
-        'MIWRH',
-        'MIRDL',
-        'MIRDH',
-        'Reserved',
-        'EIE',
-        'EIR',
-        'ESTAT',
-        'ECON2',
-        'ECON1',
-    ],
-    [
-        'MAADR5',
-        'MAADR6',
-        'MAADR3',
-        'MAADR4',
-        'MAADR1',
-        'MAADR2',
-        'EBSTSD',
-        'EBSTCON',
-        'EBSTCSL',
-        'EBSTCSH',
-        'MISTAT',
-        '—',
-        '—',
-        '—',
-        '—',
-        '—',
-        '—',
-        '—',
-        'EREVID',
-        '—',
-        '—',
-        'ECOCON',
-        'Reserved',
-        'EFLOCON',
-        'EPAUSL',
-        'EPAUSH',
-        'Reserved',
-        'EIE',
-        'EIR',
-        'ESTAT',
-        'ECON2',
-        'ECON1',
-    ],
-]
-
 class Decoder(srd.Decoder):
     api_version = 3
     id = 'enc28j60'