mirror of https://github.com/xemu-project/xemu.git
hw/sd: Add sd_cmd_SET_BLOCK_COUNT() handler
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
parent
793d04f495
commit
6380cd2052
30
hw/sd/sd.c
30
hw/sd/sd.c
|
@ -1078,6 +1078,21 @@ static sd_rsp_type_t sd_cmd_SEND_TUNING_BLOCK(SDState *sd, SDRequest req)
|
||||||
return sd_r1;
|
return sd_r1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static sd_rsp_type_t sd_cmd_SET_BLOCK_COUNT(SDState *sd, SDRequest req)
|
||||||
|
{
|
||||||
|
if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
|
||||||
|
return sd_cmd_illegal(sd, req);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sd->state != sd_transfer_state) {
|
||||||
|
return sd_invalid_state_for_cmd(sd, req);
|
||||||
|
}
|
||||||
|
|
||||||
|
sd->multi_blk_cnt = req.arg;
|
||||||
|
|
||||||
|
return sd_r1;
|
||||||
|
}
|
||||||
|
|
||||||
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
|
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
|
||||||
{
|
{
|
||||||
uint32_t rca = 0x0000;
|
uint32_t rca = 0x0000;
|
||||||
|
@ -1321,20 +1336,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 23: /* CMD23: SET_BLOCK_COUNT */
|
|
||||||
if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
|
|
||||||
return sd_invalid_state_for_cmd(sd, req);
|
|
||||||
}
|
|
||||||
switch (sd->state) {
|
|
||||||
case sd_transfer_state:
|
|
||||||
sd->multi_blk_cnt = req.arg;
|
|
||||||
return sd_r1;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Block write commands (Class 4) */
|
/* Block write commands (Class 4) */
|
||||||
case 24: /* CMD24: WRITE_SINGLE_BLOCK */
|
case 24: /* CMD24: WRITE_SINGLE_BLOCK */
|
||||||
case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */
|
case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */
|
||||||
|
@ -2158,6 +2159,7 @@ static const SDProto sd_proto_sd = {
|
||||||
[3] = sd_cmd_SEND_RELATIVE_ADDR,
|
[3] = sd_cmd_SEND_RELATIVE_ADDR,
|
||||||
[5] = sd_cmd_illegal,
|
[5] = sd_cmd_illegal,
|
||||||
[19] = sd_cmd_SEND_TUNING_BLOCK,
|
[19] = sd_cmd_SEND_TUNING_BLOCK,
|
||||||
|
[23] = sd_cmd_SET_BLOCK_COUNT,
|
||||||
[52 ... 54] = sd_cmd_illegal,
|
[52 ... 54] = sd_cmd_illegal,
|
||||||
[58] = sd_cmd_illegal,
|
[58] = sd_cmd_illegal,
|
||||||
[59] = sd_cmd_illegal,
|
[59] = sd_cmd_illegal,
|
||||||
|
|
Loading…
Reference in New Issue