diff options
-rw-r--r-- | common/sdcard/__init__.py | 21 | ||||
-rw-r--r-- | common/sdcard/mod.py (renamed from decoders/sdcard_sd/lists.py) | 13 | ||||
-rw-r--r-- | decoders/sdcard_sd/__init__.py | 2 | ||||
-rw-r--r-- | decoders/sdcard_sd/pd.py | 4 | ||||
-rw-r--r-- | decoders/sdcard_spi/pd.py | 59 |
5 files changed, 38 insertions, 61 deletions
diff --git a/common/sdcard/__init__.py b/common/sdcard/__init__.py new file mode 100644 index 0000000..cf09d9d --- /dev/null +++ b/common/sdcard/__init__.py @@ -0,0 +1,21 @@ +## +## This file is part of the libsigrokdecode project. +## +## Copyright (C) 2012-2014 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 +## + +from .mod import * diff --git a/decoders/sdcard_sd/lists.py b/common/sdcard/mod.py index 479c9f3..f553cf1 100644 --- a/decoders/sdcard_sd/lists.py +++ b/common/sdcard/mod.py @@ -1,7 +1,7 @@ ## -## This file is part of the sigrok project. +## This file is part of the libsigrokdecode project. ## -## Copyright (C) 2015 Uwe Hermann <uwe@hermann-uwe.de> +## Copyright (C) 2012-2014 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 @@ -23,7 +23,7 @@ # seem to be mentioned in the spec, but aren't marked as reserved either. cmd_names = { 0: 'GO_IDLE_STATE', - # 1: Reserved + 1: 'SEND_OP_COND', # Reserved in SD mode 2: 'ALL_SEND_CID', 3: 'SEND_RELATIVE_ADDR', 4: 'SET_DSR', @@ -53,8 +53,8 @@ cmd_names = { 29: 'CLR_WRITE_PROT', 30: 'SEND_WRITE_PROT', # 31: Reserved - 32: 'ERASE_WR_BLK_START', - 33: 'ERASE_WR_BLK_END', + 32: 'ERASE_WR_BLK_START', # SPI mode: ERASE_WR_BLK_START_ADDR + 33: 'ERASE_WR_BLK_END', # SPI mode: ERASE_WR_BLK_END_ADDR 34: 'Reserved for CMD6', # New since spec 1.10 35: 'Reserved for CMD6', # New since spec 1.10 36: 'Reserved for CMD6', # New since spec 1.10 @@ -73,7 +73,8 @@ cmd_names = { 55: 'APP_CMD', 56: 'GEN_CMD', 57: 'Reserved for CMD6', # New since spec 1.10 - # 58-59: Reserved + 58: 'READ_OCR', # Reserved in SD mode + 59: 'CRC_ON_OFF', # Reserved in SD mode 60: 'Reserved for manufacturer', 61: 'Reserved for manufacturer', 62: 'Reserved for manufacturer', diff --git a/decoders/sdcard_sd/__init__.py b/decoders/sdcard_sd/__init__.py index a05f21a..c43f623 100644 --- a/decoders/sdcard_sd/__init__.py +++ b/decoders/sdcard_sd/__init__.py @@ -1,5 +1,5 @@ ## -## This file is part of the sigrok project. +## This file is part of the libsigrokdecode project. ## ## Copyright (C) 2015 Uwe Hermann <uwe@hermann-uwe.de> ## diff --git a/decoders/sdcard_sd/pd.py b/decoders/sdcard_sd/pd.py index a1eac2b..8382224 100644 --- a/decoders/sdcard_sd/pd.py +++ b/decoders/sdcard_sd/pd.py @@ -1,5 +1,5 @@ ## -## This file is part of the sigrok project. +## This file is part of the libsigrokdecode project. ## ## Copyright (C) 2015 Uwe Hermann <uwe@hermann-uwe.de> ## @@ -19,7 +19,7 @@ ## import sigrokdecode as srd -from .lists import * +from sdcard import (cmd_names, acmd_names, accepted_voltages, card_status, sd_status) class Decoder(srd.Decoder): api_version = 2 diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py index bc761ee..ad6329b 100644 --- a/decoders/sdcard_spi/pd.py +++ b/decoders/sdcard_spi/pd.py @@ -19,57 +19,7 @@ ## import sigrokdecode as srd - -# Normal commands (CMD) -cmd_names = { - 0: 'GO_IDLE_STATE', - 1: 'SEND_OP_COND', - 6: 'SWITCH_FUNC', - 8: 'SEND_IF_COND', - 9: 'SEND_CSD', - 10: 'SEND_CID', - 12: 'STOP_TRANSMISSION', - 13: 'SEND_STATUS', - 16: 'SET_BLOCKLEN', - 17: 'READ_SINGLE_BLOCK', - 18: 'READ_MULTIPLE_BLOCK', - 24: 'WRITE_BLOCK', - 25: 'WRITE_MULTIPLE_BLOCK', - 27: 'PROGRAM_CSD', - 28: 'SET_WRITE_PROT', - 29: 'CLR_WRITE_PROT', - 30: 'SEND_WRITE_PROT', - 32: 'ERASE_WR_BLK_START_ADDR', - 33: 'ERASE_WR_BLK_END_ADDR', - 38: 'ERASE', - 42: 'LOCK_UNLOCK', - 55: 'APP_CMD', - 56: 'GEN_CMD', - 58: 'READ_OCR', - 59: 'CRC_ON_OFF', - # CMD60-63: Reserved for manufacturer -} - -# Application-specific commands (ACMD) -acmd_names = { - 13: 'SD_STATUS', - 18: 'Reserved for SD security applications', - 22: 'SEND_NUM_WR_BLOCKS', - 23: 'SET_WR_BLK_ERASE_COUNT', - 25: 'Reserved for SD security applications', - 26: 'Reserved for SD security applications', - 38: 'Reserved for SD security applications', - 41: 'SD_SEND_OP_COND', - 42: 'SET_CLR_CARD_DETECT', - 43: 'Reserved for SD security applications', - 44: 'Reserved for SD security applications', - 45: 'Reserved for SD security applications', - 46: 'Reserved for SD security applications', - 47: 'Reserved for SD security applications', - 48: 'Reserved for SD security applications', - 49: 'Reserved for SD security applications', - 51: 'SEND_SCR', -} +from sdcard import (cmd_names, acmd_names) class Decoder(srd.Decoder): api_version = 2 @@ -122,7 +72,12 @@ class Decoder(srd.Decoder): def cmd_name(self, cmd): c = acmd_names if self.is_acmd else cmd_names - return c.get(cmd, 'Unknown') + s = c.get(cmd, 'Unknown') + # SD mode names for CMD32/33: ERASE_WR_BLK_{START,END}. + # SPI mode names for CMD32/33: ERASE_WR_BLK_{START,END}_ADDR. + if cmd in (32, 33): + s += '_ADDR' + return s def handle_command_token(self, mosi, miso): # Command tokens (6 bytes) are sent (MSB-first) by the host. |