SD requests are 48-bit SD frames, while SD responses can be 48-bit or 136-bit frames. The 48-bit response frames share the same CRC logic than request frames. Unify the 48-bit framing to reuse the same CRC logic between requests and responses.
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- include/hw/sd/sd.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 9bdb3c9285..f0b41232f7 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -76,11 +76,22 @@ typedef enum { sd_adtc, /* addressed with data transfer */ } sd_cmd_type_t; -typedef struct { +/** + * SDFrame48: 48 bits commands or responses + * + * @cmd: request: command + * response: mirrored command + * @arg: request: address information or parameter + * response: status information, OCR register, RCA + * @crc: 7-bit CRC checksum + */ +typedef struct SDFrame48 { uint8_t cmd; uint32_t arg; uint8_t crc; -} SDRequest; +} SDFrame48; + +typedef struct SDFrame48 SDRequest; typedef struct SDState SDState; typedef struct SDBus SDBus; -- 2.17.0