aboutsummaryrefslogtreecommitdiff
path: root/hw/sd
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-08-14 11:23:43 +0200
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-08-21 16:35:35 +0200
commite35c343dd9c18d4d3e6424e2fab38f08085875d6 (patch)
tree2cddeafa5853b20e04ed97a266e4f753c2b542a8 /hw/sd
parent8467f62201fd2383d553702f9f9441e2493ece75 (diff)
downloadqemu-e35c343dd9c18d4d3e6424e2fab38f08085875d6.zip
qemu-e35c343dd9c18d4d3e6424e2fab38f08085875d6.tar.gz
qemu-e35c343dd9c18d4d3e6424e2fab38f08085875d6.tar.bz2
hw/sd: Add sdbus_write_data() to write multiples bytes on the data line
Add a sdbus_write_data() method to write multiple bytes on the data line of a SD bus. We might improve the tracing later, for now keep logging each byte individually. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200814092346.21825-5-f4bug@amsat.org>
Diffstat (limited to 'hw/sd')
-rw-r--r--hw/sd/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/sd/core.c b/hw/sd/core.c
index a3b620b..9c2781e 100644
--- a/hw/sd/core.c
+++ b/hw/sd/core.c
@@ -114,6 +114,21 @@ void sdbus_write_byte(SDBus *sdbus, uint8_t value)
}
}
+void sdbus_write_data(SDBus *sdbus, const void *buf, size_t length)
+{
+ SDState *card = get_card(sdbus);
+ const uint8_t *data = buf;
+
+ if (card) {
+ SDCardClass *sc = SD_CARD_GET_CLASS(card);
+
+ for (size_t i = 0; i < length; i++) {
+ trace_sdbus_write(sdbus_name(sdbus), data[i]);
+ sc->write_byte(card, data[i]);
+ }
+ }
+}
+
uint8_t sdbus_read_byte(SDBus *sdbus)
{
SDState *card = get_card(sdbus);