diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-09-19 20:17:17 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-09-19 20:17:17 +0000 |
commit | f748d3b49fc10097ecfb0b0b4a0b6c6d73cf4914 (patch) | |
tree | 34b704c9e6300155687520f1c43c541e3fe6428d /firmware | |
parent | 5b17f37e84cdba2fd9057429dc9f102c4c0cc8f5 (diff) | |
download | rockbox-f748d3b49fc10097ecfb0b0b4a0b6c6d73cf4914.tar.gz rockbox-f748d3b49fc10097ecfb0b0b4a0b6c6d73cf4914.zip |
Some more size optimisations, giving a tiny write speedup as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18552 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata_mmc.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 447bd8bec6..1040ab067f 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c @@ -643,7 +643,7 @@ int ata_read_sectors(IF_MV2(int drive,) rc = -3; goto error; } - while (incount-- > lastblock) + while (--incount >= lastblock) { rc = receive_block(inbuf, card->read_timeout); if (rc) @@ -730,25 +730,17 @@ int ata_write_sectors(IF_MV2(int drive,) rc = -2; goto error; } - - while (--count > 0) + while (--count >= 0) { - rc = send_block_send(start_token, card->write_timeout, true); + rc = send_block_send(start_token, card->write_timeout, count > 0); if (rc) { rc = rc * 10 - 3; break; + /* If an error occurs during multiple block writing, + * the STOP_TRAN token still needs to be sent. */ } } - if (rc == 0) - { - 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) { static const unsigned char stop_tran = DT_STOP_TRAN; |