Fix error handling in multiple block read and multiple block write state. When an error occurs, the host still needs to send CMD_STOP_TRANSMISSION resp. the STOP_TRAN token.

git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_0@18527 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2008-09-16 06:48:38 +00:00
parent 177bb338dd
commit 8a21a2f209

View file

@ -665,6 +665,9 @@ int ata_read_sectors(IF_MV2(int drive,)
rc = receive_block(inbuf, card->read_timeout); rc = receive_block(inbuf, card->read_timeout);
if (rc) if (rc)
{ {
/* If an error occurs during multiple block reading, the
* host still needs to send CMD_STOP_TRANSMISSION */
send_cmd(CMD_STOP_TRANSMISSION, 0, &response);
rc = rc * 10 - 4; rc = rc * 10 - 4;
goto error; goto error;
} }
@ -755,15 +758,17 @@ int ata_write_sectors(IF_MV2(int drive,)
if (rc) if (rc)
{ {
rc = rc * 10 - 3; rc = rc * 10 - 3;
goto error; break;
} }
} }
if (rc == 0)
{
rc = send_block_send(start_token, card->write_timeout, false); rc = send_block_send(start_token, card->write_timeout, false);
if (rc) if (rc)
{
rc = rc * 10 - 4; rc = rc * 10 - 4;
goto error;
} }
/* If an error occurs during multiple block writing, the STOP_TRAN token
* still needs to be sent, hence the special error handling above. */
if (write_cmd == CMD_WRITE_MULTIPLE_BLOCK) if (write_cmd == CMD_WRITE_MULTIPLE_BLOCK)
{ {