]> Git Repo - qemu.git/commitdiff
sdcard: Correct CRC16 offset in sd_function_switch()
authorPhilippe Mathieu-Daudé <[email protected]>
Tue, 15 May 2018 13:58:44 +0000 (14:58 +0100)
committerPeter Maydell <[email protected]>
Tue, 15 May 2018 13:58:44 +0000 (14:58 +0100)
Per the Physical Layer Simplified Spec. "4.3.10.4 Switch Function Status":

  The block length is predefined to 512 bits

and "4.10.2 SD Status":

  The SD Status contains status bits that are related to the SD Memory Card
  proprietary features and may be used for future application-specific usage.
  The size of the SD Status is one data block of 512 bit. The content of this
  register is transmitted to the Host over the DAT bus along with a 16-bit CRC.

Thus the 16-bit CRC goes at offset 64.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20180509060104[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
hw/sd/sd.c

index 235e0518d61f020ea88a31814b1ce09619b24a4a..7af19fa06ca5a06deeae0bdaf27a7c6295385d63 100644 (file)
@@ -787,7 +787,7 @@ static void sd_function_switch(SDState *sd, uint32_t arg)
         sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4);
     }
     memset(&sd->data[17], 0, 47);
-    stw_be_p(sd->data + 65, sd_crc16(sd->data, 64));
+    stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));
 }
 
 static inline bool sd_wp_addr(SDState *sd, uint64_t addr)
This page took 0.02758 seconds and 4 git commands to generate.