All SD cards have a block size of 512. The READ_BL_LEN field in the
CSD is usually 512 (well, 9), but for 2GB (and the rogue 4GB SD cards) it is 1024 (or 2048 for 4GB). This value doesn't work for the block read commands (which really want 512). Hardcode 512 for those. This may break really old MMC cards that don't have a 512 block size (I've never seen one: make my day and send me one :-), but since the MMC side of the house is currently broken, it should only have the effect that 2GB (and non-conforming 4GB) SD cards will work. My 'non-conforming' 4GB SD card also works now too. The non-conforming 4GB SD cards were sold for a while before the SD association was worried they would be (a) incompatible (different FAT flavor on them) and (b) confusing for the new SDHC standard and cracked down on suppliers' bogus use of the SD trademark...
This commit is contained in:
parent
5394d87e21
commit
304d0536ab
@ -157,8 +157,9 @@ MCI_GetStatus()
|
||||
static int
|
||||
MCI_ReadBlock(int src, unsigned int *dataBuffer, int sizeToRead)
|
||||
{
|
||||
unsigned log2sl = MCI_Device.READ_BL_LEN;
|
||||
unsigned sectorLength = 1 << log2sl;
|
||||
// unsigned log2sl = MCI_Device.READ_BL_LEN;
|
||||
// unsigned sectorLength = 1 << log2sl;
|
||||
unsigned sectorLength = 512;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
if (MCI_Device.state != AT91C_MCI_IDLE)
|
||||
@ -195,8 +196,9 @@ MCI_ReadBlock(int src, unsigned int *dataBuffer, int sizeToRead)
|
||||
int
|
||||
MCI_read(char* dest, unsigned source, unsigned length)
|
||||
{
|
||||
unsigned log2sl = MCI_Device.READ_BL_LEN;
|
||||
unsigned sectorLength = 1 << log2sl;
|
||||
// unsigned log2sl = MCI_Device.READ_BL_LEN;
|
||||
// unsigned sectorLength = 1 << log2sl;
|
||||
unsigned sectorLength = 512;
|
||||
int sizeToRead;
|
||||
unsigned int *walker;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user