diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2008-09-15 21:10:08 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2008-09-15 21:10:08 +0000 |
| commit | e42a7373f604fdfe46a3dddc51507fb80a550ec2 (patch) | |
| tree | 99961b5b3b8079b5fb06bc40fd702683208a82f2 | |
| parent | 1a904eb1ebec1b92d9bba7b1f471f51832ea073d (diff) | |
| download | rockbox-e42a7373f604fdfe46a3dddc51507fb80a550ec2.zip rockbox-e42a7373f604fdfe46a3dddc51507fb80a550ec2.tar.gz rockbox-e42a7373f604fdfe46a3dddc51507fb80a550ec2.tar.bz2 rockbox-e42a7373f604fdfe46a3dddc51507fb80a550ec2.tar.xz | |
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/trunk@18524 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/drivers/ata_mmc.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 6c3f1f6..d7b7346 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c @@ -575,7 +575,7 @@ static void send_block_prepare(void) /* Send one block with DMA from the current write buffer, possibly preparing * the next block within the next write buffer in the background. */ -static int send_block_send(unsigned char start_token, long timeout, +static int send_block_send(unsigned char start_token, long timeout, bool prepare_next) { int rc = 0; @@ -665,6 +665,9 @@ int ata_read_sectors(IF_MV2(int drive,) rc = receive_block(inbuf, card->read_timeout); 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; goto error; } @@ -755,15 +758,17 @@ int ata_write_sectors(IF_MV2(int drive,) if (rc) { rc = rc * 10 - 3; - goto error; + break; } } - rc = send_block_send(start_token, card->write_timeout, false); - if (rc) + if (rc == 0) { - rc = rc * 10 - 4; - goto error; - } + rc = send_block_send(start_token, card->write_timeout, false); + if (rc) + rc = rc * 10 - 4; + } + /* 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) { @@ -802,7 +807,7 @@ static void mmc_thread(void) { struct queue_event ev; bool idle_notified = false; - + while (1) { queue_wait_w_tmo(&mmc_queue, &ev, HZ); switch ( ev.id ) |