diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-02-21 22:01:37 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-02-21 22:01:37 +0000 |
commit | e9cd0f1c7aaa0443a3a2a33161fadf838862eda2 (patch) | |
tree | 643e92aed31ef17354cb397f6db0fd661aa32c28 | |
parent | f857fe145090711ba4c7a28e82da6bde4f4bba9a (diff) | |
download | rockbox-e9cd0f1c7aaa0443a3a2a33161fadf838862eda2.tar.gz rockbox-e9cd0f1c7aaa0443a3a2a33161fadf838862eda2.zip |
sd-as3525v2: no limits on the amount of sectors to transfer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24832 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525v2.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index 96c615a2be..27c73720b6 100644 --- a/firmware/target/arm/as3525/sd-as3525v2.c +++ b/firmware/target/arm/as3525/sd-as3525v2.c | |||
@@ -651,25 +651,19 @@ static int sd_transfer_sectors(unsigned long start, int count, void* buf, bool w | |||
651 | 651 | ||
652 | dma_retain(); | 652 | dma_retain(); |
653 | 653 | ||
654 | while(count) | 654 | const int cmd = write ? SD_WRITE_MULTIPLE_BLOCK : SD_READ_MULTIPLE_BLOCK; |
655 | { | ||
656 | /* Interrupt handler might set this to true during transfer */ | ||
657 | retry = false; | ||
658 | /* 128 * 512 = 2^16, and doesn't fit in the 16 bits of DATA_LENGTH | ||
659 | * register, so we have to transfer maximum 127 sectors at a time. */ | ||
660 | //unsigned int transfer = (count >= 128) ? 127 : count; /* sectors */ | ||
661 | unsigned int transfer = count; | ||
662 | |||
663 | const int cmd = | ||
664 | write ? SD_WRITE_MULTIPLE_BLOCK : SD_READ_MULTIPLE_BLOCK; | ||
665 | 655 | ||
656 | /* Interrupt handler might set this to true during transfer */ | ||
657 | retry = false; | ||
666 | 658 | ||
659 | do | ||
660 | { | ||
667 | MCI_CTRL |= FIFO_RESET; | 661 | MCI_CTRL |= FIFO_RESET; |
668 | while(MCI_CTRL & FIFO_RESET) | 662 | while(MCI_CTRL & FIFO_RESET) |
669 | ; | 663 | ; |
670 | 664 | ||
671 | //MCI_BLKSIZ = 512; | 665 | //MCI_BLKSIZ = 512; |
672 | MCI_BYTCNT = transfer * 512; | 666 | MCI_BYTCNT = count * 512; |
673 | 667 | ||
674 | MCI_CTRL |= FIFO_RESET; | 668 | MCI_CTRL |= FIFO_RESET; |
675 | while(MCI_CTRL & FIFO_RESET) | 669 | while(MCI_CTRL & FIFO_RESET) |
@@ -708,13 +702,6 @@ static int sd_transfer_sectors(unsigned long start, int count, void* buf, bool w | |||
708 | printf("dma <-"); | 702 | printf("dma <-"); |
709 | int delay = 0x1000000; while(delay--) ; | 703 | int delay = 0x1000000; while(delay--) ; |
710 | 704 | ||
711 | if(!retry) | ||
712 | { | ||
713 | buf += transfer * SECTOR_SIZE; | ||
714 | start += transfer; | ||
715 | count -= transfer; | ||
716 | } | ||
717 | |||
718 | last_disk_activity = current_tick; | 705 | last_disk_activity = current_tick; |
719 | 706 | ||
720 | if(!send_cmd(SD_STOP_TRANSMISSION, 0, MCI_NO_RESP, NULL)) | 707 | if(!send_cmd(SD_STOP_TRANSMISSION, 0, MCI_NO_RESP, NULL)) |
@@ -730,7 +717,7 @@ static int sd_transfer_sectors(unsigned long start, int count, void* buf, bool w | |||
730 | panicf(" wait for state TRAN failed (%d)", ret); | 717 | panicf(" wait for state TRAN failed (%d)", ret); |
731 | goto sd_transfer_error; | 718 | goto sd_transfer_error; |
732 | } | 719 | } |
733 | } | 720 | } while(retry); |
734 | 721 | ||
735 | dma_release(); | 722 | dma_release(); |
736 | 723 | ||