summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorJack Halpin <jack.halpin@gmail.com>2009-11-25 03:24:28 +0000
committerJack Halpin <jack.halpin@gmail.com>2009-11-25 03:24:28 +0000
commit84f04a57eee2480100ab533b97665fec7f1da83f (patch)
tree76f78ae0cdf898d78fb638d2be296d14cbc6c8d4 /firmware/target
parent384b9436d4e3d3265ddfa4ff4ded353da85143cc (diff)
downloadrockbox-84f04a57eee2480100ab533b97665fec7f1da83f.tar.gz
rockbox-84f04a57eee2480100ab533b97665fec7f1da83f.zip
AMS Sansa: For consistency, replace references to SECTOR_SIZE with SD_BLOCK_SIZE which is defined in sd.h as 512 bytes.
We had 3 different references to the same value. Rockbox always uses a blocksize of 512 bytes for SD and we were using SECTOR_SIZE, SD_BLOCK_SIZE, & card_info[drive].blocksize to use this value. Now the only reference being used is SD_BLOCK_SIZE. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23746 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/as3525/ata_sd_as3525.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c
index e71c886021..fdb39f34c2 100644
--- a/firmware/target/arm/as3525/ata_sd_as3525.c
+++ b/firmware/target/arm/as3525/ata_sd_as3525.c
@@ -98,7 +98,7 @@ static int sd_wait_for_state(const int drive, unsigned int state);
98static int sd_select_bank(signed char bank); 98static int sd_select_bank(signed char bank);
99static int sd_init_card(const int drive); 99static int sd_init_card(const int drive);
100static void init_pl180_controller(const int drive); 100static void init_pl180_controller(const int drive);
101#define SECTOR_SIZE 512 /* XXX: different sector sizes ? */ 101
102#define BLOCKS_PER_BANK 0x7a7800 102#define BLOCKS_PER_BANK 0x7a7800
103 103
104static tCardInfo card_info[NUM_DRIVES]; 104static tCardInfo card_info[NUM_DRIVES];
@@ -126,7 +126,7 @@ static volatile unsigned int transfer_error[NUM_VOLUMES];
126#define PL180_MAX_TRANSFER_ERRORS 10 126#define PL180_MAX_TRANSFER_ERRORS 10
127 127
128#define UNALIGNED_NUM_SECTORS 10 128#define UNALIGNED_NUM_SECTORS 10
129static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SECTOR_SIZE] __attribute__((aligned(32))); /* align on cache line size */ 129static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */
130static unsigned char *uncached_buffer = UNCACHED_ADDR(&aligned_buffer[0]); 130static unsigned char *uncached_buffer = UNCACHED_ADDR(&aligned_buffer[0]);
131 131
132static inline void mci_delay(void) 132static inline void mci_delay(void)
@@ -691,7 +691,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
691 if(transfer > UNALIGNED_NUM_SECTORS) 691 if(transfer > UNALIGNED_NUM_SECTORS)
692 transfer = UNALIGNED_NUM_SECTORS; 692 transfer = UNALIGNED_NUM_SECTORS;
693 if(write) 693 if(write)
694 memcpy(uncached_buffer, buf, transfer * SECTOR_SIZE); 694 memcpy(uncached_buffer, buf, transfer * SD_BLOCK_SIZE);
695 695
696 /* Set bank_start to the correct unit (blocks or bytes) */ 696 /* Set bank_start to the correct unit (blocks or bytes) */
697 if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */ 697 if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */
@@ -724,7 +724,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
724 * Note : the OF doesn't seem to use them anyway */ 724 * Note : the OF doesn't seem to use them anyway */
725 MCI_DATA_TIMER(drive) = write ? 725 MCI_DATA_TIMER(drive) = write ?
726 SD_MAX_WRITE_TIMEOUT : SD_MAX_READ_TIMEOUT; 726 SD_MAX_WRITE_TIMEOUT : SD_MAX_READ_TIMEOUT;
727 MCI_DATA_LENGTH(drive) = transfer * card_info[drive].blocksize; 727 MCI_DATA_LENGTH(drive) = transfer * SD_BLOCK_SIZE;
728 MCI_DATA_CTRL(drive) = (1<<0) /* enable */ | 728 MCI_DATA_CTRL(drive) = (1<<0) /* enable */ |
729 (!write<<1) /* transfer direction */ | 729 (!write<<1) /* transfer direction */ |
730 (1<<3) /* DMA */ | 730 (1<<3) /* DMA */ |
@@ -739,8 +739,8 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
739 if(!transfer_error[drive]) 739 if(!transfer_error[drive])
740 { 740 {
741 if(!write) 741 if(!write)
742 memcpy(buf, uncached_buffer, transfer * SECTOR_SIZE); 742 memcpy(buf, uncached_buffer, transfer * SD_BLOCK_SIZE);
743 buf += transfer * SECTOR_SIZE; 743 buf += transfer * SD_BLOCK_SIZE;
744 start += transfer; 744 start += transfer;
745 count -= transfer; 745 count -= transfer;
746 loops = 0; /* reset errors counter */ 746 loops = 0; /* reset errors counter */