From: Uwe Hermann Date: Tue, 4 Feb 2014 23:44:52 +0000 (+0100) Subject: sdcard_spi: Adapt for MSB-first bits from spi PD. X-Git-Tag: libsigrokdecode-0.3.0~92 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c82620fc0b10c9541b8a92bd3ea3dd4bdf982390;p=libsigrokdecode.git sdcard_spi: Adapt for MSB-first bits from spi PD. --- diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py index 8bf5f84..f92be0d 100644 --- a/decoders/sdcard_spi/pd.py +++ b/decoders/sdcard_spi/pd.py @@ -159,7 +159,7 @@ class Decoder(srd.Decoder): s = 'ACMD' if self.is_acmd else 'CMD' def tb(byte, bit): - return self.cmd_token_bits[5 - byte][7 - bit] + return self.cmd_token_bits[5 - byte][bit] # Bits[47:47]: Start bit (always 0) bit, self.bit_ss, self.bit_es = tb(5, 7)[0], tb(5, 7)[1], tb(5, 7)[2] @@ -221,8 +221,8 @@ class Decoder(srd.Decoder): # CMD1: SEND_OP_COND self.putc(1, 'Send HCS info and activate the card init process') hcs = (self.arg & (1 << 30)) >> 30 - self.bit_ss = self.cmd_token_bits[5 - 4][7 - 6][1] - self.bit_es = self.cmd_token_bits[5 - 4][7 - 6][2] + self.bit_ss = self.cmd_token_bits[5 - 4][6][1] + self.bit_es = self.cmd_token_bits[5 - 4][6][2] self.putb([70, ['HCS: %d' % hcs]]) self.state = 'GET RESPONSE R1' @@ -341,11 +341,11 @@ class Decoder(srd.Decoder): # The R1 response token format (1 byte). # Sent by the card after every command except for SEND_STATUS. - self.cmd_ss, self.cmd_es = self.miso_bits[0][1], self.miso_bits[7][2] + self.cmd_ss, self.cmd_es = self.miso_bits[7][1], self.miso_bits[0][2] self.putx([65, ['R1: 0x%02x' % res]]) def putbit(bit, data): - b = self.miso_bits[7 - bit] + b = self.miso_bits[bit] self.bit_ss, self.bit_es = b[1], b[2] self.putb([70, data])