aboutsummaryrefslogtreecommitdiff
path: root/hw/sd/pl181.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-06-29 15:11:20 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-06-29 15:11:20 +0100
commitb3141c0625a18d35c45c175a20826271b3241d92 (patch)
tree6699e0bceca9636f4105786d749e1ee329a385f4 /hw/sd/pl181.c
parent13606b99515e8c5f81eab7fd88a70fb2ad506cd8 (diff)
downloadqemu-b3141c0625a18d35c45c175a20826271b3241d92.zip
qemu-b3141c0625a18d35c45c175a20826271b3241d92.tar.gz
qemu-b3141c0625a18d35c45c175a20826271b3241d92.tar.bz2
sdcard: Use the ldst API
The load/store API will ease further code movement. Per the Physical Layer Simplified Spec. "3.6 Bus Protocol": "In the CMD line the Most Significant Bit (MSB) is transmitted first, the Least Significant Bit (LSB) is the last." Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/sd/pl181.c')
-rw-r--r--hw/sd/pl181.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
index 1cc94db..3ad7e92 100644
--- a/hw/sd/pl181.c
+++ b/hw/sd/pl181.c
@@ -182,23 +182,20 @@ static void pl181_send_command(PL181State *s)
if (rlen < 0)
goto error;
if (s->cmd & PL181_CMD_RESPONSE) {
-#define RWORD(n) (((uint32_t)response[n] << 24) | (response[n + 1] << 16) \
- | (response[n + 2] << 8) | response[n + 3])
if (rlen == 0 || (rlen == 4 && (s->cmd & PL181_CMD_LONGRESP)))
goto error;
if (rlen != 4 && rlen != 16)
goto error;
- s->response[0] = RWORD(0);
+ s->response[0] = ldl_be_p(&response[0]);
if (rlen == 4) {
s->response[1] = s->response[2] = s->response[3] = 0;
} else {
- s->response[1] = RWORD(4);
- s->response[2] = RWORD(8);
- s->response[3] = RWORD(12) & ~1;
+ s->response[1] = ldl_be_p(&response[4]);
+ s->response[2] = ldl_be_p(&response[8]);
+ s->response[3] = ldl_be_p(&response[12]) & ~1;
}
DPRINTF("Response received\n");
s->status |= PL181_STATUS_CMDRESPEND;
-#undef RWORD
} else {
DPRINTF("Command sent\n");
s->status |= PL181_STATUS_CMDSENT;