diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-19 12:11:57 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-19 12:11:57 +0000 |
commit | b3a8170afef84b545b7df17ff7d87d3f8528bae7 (patch) | |
tree | 0937fb6631accf3575982dc322a0071c574be910 | |
parent | 6f2afd36bc3ad1dfe6a747060e4575caa186c010 (diff) | |
download | rockbox-b3a8170afef84b545b7df17ff7d87d3f8528bae7.tar.gz rockbox-b3a8170afef84b545b7df17ff7d87d3f8528bae7.zip |
sd-as3525: avoid division when calculating current bank, we only deal with 1 or 2 banks
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26161 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c index 2b299f182d..ac359f3f85 100644 --- a/firmware/target/arm/as3525/sd-as3525.c +++ b/firmware/target/arm/as3525/sd-as3525.c | |||
@@ -105,7 +105,7 @@ static int sd_select_bank(signed char bank); | |||
105 | static int sd_init_card(const int drive); | 105 | static int sd_init_card(const int drive); |
106 | static void init_pl180_controller(const int drive); | 106 | static void init_pl180_controller(const int drive); |
107 | 107 | ||
108 | #define BLOCKS_PER_BANK 0x7a7800 | 108 | #define BLOCKS_PER_BANK 0x7a7800u |
109 | 109 | ||
110 | static tCardInfo card_info[NUM_DRIVES]; | 110 | static tCardInfo card_info[NUM_DRIVES]; |
111 | 111 | ||
@@ -712,7 +712,12 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, | |||
712 | /* Only switch banks for internal storage */ | 712 | /* Only switch banks for internal storage */ |
713 | if(drive == INTERNAL_AS3525) | 713 | if(drive == INTERNAL_AS3525) |
714 | { | 714 | { |
715 | unsigned int bank = start / BLOCKS_PER_BANK; /* Current bank */ | 715 | unsigned int bank = 0; |
716 | while(bank_start >= BLOCKS_PER_BANK) | ||
717 | { | ||
718 | bank_start -= BLOCKS_PER_BANK; | ||
719 | bank++; | ||
720 | } | ||
716 | 721 | ||
717 | /* Switch bank if needed */ | 722 | /* Switch bank if needed */ |
718 | if(card_info[INTERNAL_AS3525].current_bank != bank) | 723 | if(card_info[INTERNAL_AS3525].current_bank != bank) |
@@ -725,9 +730,6 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, | |||
725 | } | 730 | } |
726 | } | 731 | } |
727 | 732 | ||
728 | /* Adjust start block in current bank */ | ||
729 | bank_start -= bank * BLOCKS_PER_BANK; | ||
730 | |||
731 | /* Do not cross a bank boundary in a single transfer loop */ | 733 | /* Do not cross a bank boundary in a single transfer loop */ |
732 | if((transfer + bank_start) > BLOCKS_PER_BANK) | 734 | if((transfer + bank_start) > BLOCKS_PER_BANK) |
733 | transfer = BLOCKS_PER_BANK - bank_start; | 735 | transfer = BLOCKS_PER_BANK - bank_start; |