diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2009-06-08 23:05:33 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2009-06-08 23:05:33 +0000 |
commit | f5041538574c039b07c4db8d261bd33ec0f3bab0 (patch) | |
tree | d4fc2f48c7209e3303b5c48abc211e3a961a7dac /firmware/target/arm/as3525/ata_sd_as3525.c | |
parent | 20a78a36f36967651032ab10b4ee31412e37b69d (diff) | |
download | rockbox-f5041538574c039b07c4db8d261bd33ec0f3bab0.tar.gz rockbox-f5041538574c039b07c4db8d261bd33ec0f3bab0.zip |
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
Diffstat (limited to 'firmware/target/arm/as3525/ata_sd_as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/ata_sd_as3525.c | 25 |
1 files changed, 10 insertions, 15 deletions
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) | |||
595 | dma_enable_channel(0, card_data, MCI_FIFO(INTERNAL_AS3525), DMA_PERI_SD, | 595 | dma_enable_channel(0, card_data, MCI_FIFO(INTERNAL_AS3525), DMA_PERI_SD, |
596 | DMAC_FLOWCTRL_PERI_MEM_TO_PERI, true, false, 0, DMA_S8, NULL); | 596 | DMAC_FLOWCTRL_PERI_MEM_TO_PERI, true, false, 0, DMA_S8, NULL); |
597 | 597 | ||
598 | MCI_DATA_TIMER(INTERNAL_AS3525) = 0x1000000; /* FIXME: arbitrary */ | 598 | MCI_DATA_TIMER(INTERNAL_AS3525) = 0xffffffff;/* FIXME: arbitrary */ |
599 | MCI_DATA_LENGTH(INTERNAL_AS3525) = 512; | 599 | MCI_DATA_LENGTH(INTERNAL_AS3525) = 512; |
600 | MCI_DATA_CTRL(INTERNAL_AS3525) = (1<<0) /* enable */ | | 600 | MCI_DATA_CTRL(INTERNAL_AS3525) = (1<<0) /* enable */ | |
601 | (0<<1) /* transfer direction */ | | 601 | (0<<1) /* transfer direction */ | |
@@ -618,7 +618,8 @@ static int sd_select_bank(signed char bank) | |||
618 | } | 618 | } |
619 | 619 | ||
620 | #define UNALIGNED_NUM_SECTORS 10 | 620 | #define UNALIGNED_NUM_SECTORS 10 |
621 | static int32_t aligned_buffer[UNALIGNED_NUM_SECTORS* (SECTOR_SIZE / 4)]; | 621 | static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SECTOR_SIZE] __attribute__((aligned(32))); /* align on cache line size */ |
622 | static unsigned char *uncached_buffer = UNCACHED_ADDR(aligned_buffer); | ||
622 | 623 | ||
623 | static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start, | 624 | static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start, |
624 | int count, void* buf, const bool write) | 625 | int count, void* buf, const bool write) |
@@ -627,7 +628,6 @@ static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start, | |||
627 | const int drive = 0; | 628 | const int drive = 0; |
628 | #endif | 629 | #endif |
629 | int ret = 0; | 630 | int ret = 0; |
630 | bool unaligned_transfer = (int)buf & 3; | ||
631 | 631 | ||
632 | /* skip SanDisk OF */ | 632 | /* skip SanDisk OF */ |
633 | if (drive == INTERNAL_AS3525) | 633 | if (drive == INTERNAL_AS3525) |
@@ -693,16 +693,11 @@ static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start, | |||
693 | transfer = BLOCKS_PER_BANK - bank_start; | 693 | transfer = BLOCKS_PER_BANK - bank_start; |
694 | } | 694 | } |
695 | 695 | ||
696 | if(unaligned_transfer) | 696 | dma_buf = aligned_buffer; |
697 | { | 697 | if(transfer > UNALIGNED_NUM_SECTORS) |
698 | dma_buf = aligned_buffer; | 698 | transfer = UNALIGNED_NUM_SECTORS; |
699 | if(transfer > UNALIGNED_NUM_SECTORS) | 699 | if(write) |
700 | transfer = UNALIGNED_NUM_SECTORS; | 700 | memcpy(uncached_buffer, buf, transfer * SECTOR_SIZE); |
701 | if(write) | ||
702 | memcpy(aligned_buffer, buf, transfer * SECTOR_SIZE); | ||
703 | } | ||
704 | else /* Aligned transfers are faster : no memcpy */ | ||
705 | dma_buf = buf; | ||
706 | 701 | ||
707 | /* Set bank_start to the correct unit (blocks or bytes) */ | 702 | /* Set bank_start to the correct unit (blocks or bytes) */ |
708 | if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */ | 703 | 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, | |||
734 | wakeup_wait(&transfer_completion_signal, TIMEOUT_BLOCK); | 729 | wakeup_wait(&transfer_completion_signal, TIMEOUT_BLOCK); |
735 | if(!retry) | 730 | if(!retry) |
736 | { | 731 | { |
737 | if(unaligned_transfer && !write) | 732 | if(!write) |
738 | memcpy(buf, aligned_buffer, transfer * SECTOR_SIZE); | 733 | memcpy(buf, uncached_buffer, transfer * SECTOR_SIZE); |
739 | buf += transfer * SECTOR_SIZE; | 734 | buf += transfer * SECTOR_SIZE; |
740 | start += transfer; | 735 | start += transfer; |
741 | count -= transfer; | 736 | count -= transfer; |