From f5041538574c039b07c4db8d261bd33ec0f3bab0 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Mon, 8 Jun 2009 23:05:33 +0000 Subject: FS#10048 : enable MMU and data cache on Sansa AMS to give a major speed up - cache IRAM and DRAM - map IRAM just next to DRAM to remove the need for -mlong-calls and reduce binsize - tweak delays in Fuze button code - tweak delays in Clip button code (down button sometimes doesn't respond anyway : an alternate driver is being worked on) Before reporting any problem, please check your filesystem or format your player from the OF git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21228 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/ata_sd_as3525.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'firmware/target/arm/as3525/ata_sd_as3525.c') diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index b3ab31b293..91d65235ef 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c @@ -595,7 +595,7 @@ static int sd_select_bank(signed char bank) dma_enable_channel(0, card_data, MCI_FIFO(INTERNAL_AS3525), DMA_PERI_SD, DMAC_FLOWCTRL_PERI_MEM_TO_PERI, true, false, 0, DMA_S8, NULL); - MCI_DATA_TIMER(INTERNAL_AS3525) = 0x1000000; /* FIXME: arbitrary */ + MCI_DATA_TIMER(INTERNAL_AS3525) = 0xffffffff;/* FIXME: arbitrary */ MCI_DATA_LENGTH(INTERNAL_AS3525) = 512; MCI_DATA_CTRL(INTERNAL_AS3525) = (1<<0) /* enable */ | (0<<1) /* transfer direction */ | @@ -618,7 +618,8 @@ static int sd_select_bank(signed char bank) } #define UNALIGNED_NUM_SECTORS 10 -static int32_t aligned_buffer[UNALIGNED_NUM_SECTORS* (SECTOR_SIZE / 4)]; +static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SECTOR_SIZE] __attribute__((aligned(32))); /* align on cache line size */ +static unsigned char *uncached_buffer = UNCACHED_ADDR(aligned_buffer); static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf, const bool write) @@ -627,7 +628,6 @@ static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start, const int drive = 0; #endif int ret = 0; - bool unaligned_transfer = (int)buf & 3; /* skip SanDisk OF */ if (drive == INTERNAL_AS3525) @@ -693,16 +693,11 @@ static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start, transfer = BLOCKS_PER_BANK - bank_start; } - if(unaligned_transfer) - { - dma_buf = aligned_buffer; - if(transfer > UNALIGNED_NUM_SECTORS) - transfer = UNALIGNED_NUM_SECTORS; - if(write) - memcpy(aligned_buffer, buf, transfer * SECTOR_SIZE); - } - else /* Aligned transfers are faster : no memcpy */ - dma_buf = buf; + dma_buf = aligned_buffer; + if(transfer > UNALIGNED_NUM_SECTORS) + transfer = UNALIGNED_NUM_SECTORS; + if(write) + memcpy(uncached_buffer, buf, transfer * SECTOR_SIZE); /* Set bank_start to the correct unit (blocks or bytes) */ if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */ @@ -734,8 +729,8 @@ static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start, wakeup_wait(&transfer_completion_signal, TIMEOUT_BLOCK); if(!retry) { - if(unaligned_transfer && !write) - memcpy(buf, aligned_buffer, transfer * SECTOR_SIZE); + if(!write) + memcpy(buf, uncached_buffer, transfer * SECTOR_SIZE); buf += transfer * SECTOR_SIZE; start += transfer; count -= transfer; -- cgit v1.2.3