[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v42 27/98] hw/sd/sdcard: Convert SEND_NUM_WR_BLOCKS to generic_re
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v42 27/98] hw/sd/sdcard: Convert SEND_NUM_WR_BLOCKS to generic_read_byte (ACMD22) |
Date: |
Fri, 28 Jun 2024 09:01:03 +0200 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/sd/sd.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 1c4811f410..8d02cd9a26 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1715,11 +1715,9 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */
switch (sd->state) {
case sd_transfer_state:
- stl_be_p(sd->data, sd->blk_written);
- sd->state = sd_sendingdata_state;
- sd->data_start = 0;
- sd->data_offset = 0;
- return sd_r1;
+ return sd_cmd_to_sendingdata(sd, req, 0,
+ &sd->blk_written,
+ sizeof(sd->blk_written));
default:
break;
@@ -2138,6 +2136,7 @@ uint8_t sd_read_byte(SDState *sd)
case 13: /* ACMD13: SD_STATUS */
case 17: /* CMD17: READ_SINGLE_BLOCK */
case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */
+ case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */
case 30: /* CMD30: SEND_WRITE_PROT */
case 56: /* CMD56: GEN_CMD */
sd_generic_read_byte(sd, &ret);
@@ -2167,13 +2166,6 @@ uint8_t sd_read_byte(SDState *sd)
}
break;
- case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */
- ret = sd->data[sd->data_offset ++];
-
- if (sd->data_offset >= 4)
- sd->state = sd_transfer_state;
- break;
-
case 51: /* ACMD51: SEND_SCR */
ret = sd->scr[sd->data_offset ++];
--
2.41.0
- [PATCH v42 22/98] hw/sd/sdcard: Convert READ_SINGLE_BLOCK to generic_read_byte (CMD17), (continued)
- [PATCH v42 22/98] hw/sd/sdcard: Convert READ_SINGLE_BLOCK to generic_read_byte (CMD17), Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 25/98] hw/sd/sdcard: Convert GEN_CMD to generic_read_byte (CMD56), Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 21/98] hw/sd/sdcard: Duplicate READ_SINGLE_BLOCK / READ_MULTIPLE_BLOCK cases, Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 24/98] hw/sd/sdcard: Convert SEND_WRITE_PROT to generic_read_byte (CMD30), Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 26/98] hw/sd/sdcard: Convert SD_STATUS to generic_read_byte (ACMD13), Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 27/98] hw/sd/sdcard: Convert SEND_NUM_WR_BLOCKS to generic_read_byte (ACMD22),
Philippe Mathieu-Daudé <=
- [PATCH v42 28/98] hw/sd/sdcard: Convert SEND_SCR to generic_read_byte (ACMD51), Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 29/98] hw/sd/sdcard: Introduce sd_cmd_to_receivingdata / sd_generic_write_byte, Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 32/98] hw/sd/sdcard: Convert PROGRAM_CID to generic_write_byte (CMD26), Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 33/98] hw/sd/sdcard: Convert PROGRAM_CSD to generic_write_byte (CMD27), Philippe Mathieu-Daudé, 2024/06/28
- [PATCH v42 30/98] hw/sd/sdcard: Duplicate WRITE_SINGLE_BLOCK / WRITE_MULTIPLE_BLOCK cases, Philippe Mathieu-Daudé, 2024/06/28