summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2010-04-22 08:31:02 +0000
committerAmaury Pouly <pamaury@rockbox.org>2010-04-22 08:31:02 +0000
commitacd09d33349b9fa6721d9a15dd1e4a4cb6ac9842 (patch)
tree4c699a45445e7fbea329b0ad5ff16e7528bedc65
parent847a0fd56c4e98c58ddabb30b1d36c11c8b0536c (diff)
downloadrockbox-acd09d33349b9fa6721d9a15dd1e4a4cb6ac9842.tar.gz
rockbox-acd09d33349b9fa6721d9a15dd1e4a4cb6ac9842.zip
ata-sd-pp: reduce size of the buffer used to switch bank, no functional change intended.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25696 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/ata-sd-pp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index fafc5f20d9..7929449a23 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -546,11 +546,11 @@ static inline void copy_write_sectors(const unsigned char** buf)
static int sd_select_bank(unsigned char bank)
{
- unsigned char card_data[512];
+ unsigned char card_data[FIFO_LEN*2];// FIFO_LEN words=FIFO_LEN*2 bytes
const unsigned char* write_buf;
int i, ret;
- memset(card_data, 0, 512);
+ memset(card_data, 0, sizeof card_data);
ret = sd_wait_for_state(SD_TRAN, EC_TRAN_SEL_BANK);
if (ret < 0)
@@ -569,13 +569,15 @@ static int sd_select_bank(unsigned char bank)
card_data[0] = bank;
/* Write the card data */
- write_buf = card_data;
for (i = 0; i < SD_BLOCK_SIZE/2; i += FIFO_LEN)
{
+ write_buf = card_data;
/* Wait for the FIFO to empty */
if (sd_poll_status(STAT_XMIT_FIFO_EMPTY, 10000))
{
copy_write_sectors(&write_buf); /* Copy one chunk of 16 words */
+ /* clear buffer: only the first chunk contains interesting data (bank), the remaining is zero filling */
+ memset(card_data, 0, sizeof card_data);
continue;
}