Merge tCardInfo struct (MMC) and tSDCardInfo struct (SD)

Put specific members under #ifdef (CONFIG_STORAGE & STORAGE_xx) (2 members for SD and 1 for MMC)
Fix a typo: tsac doesn't exist and must be read taac
Move card_get_info functions declaration inside hotswap.h to remove mutual inclusion of ata_mmc.h and hotswap.h
Move static const data structures from SD drivers into sd.h (sd_exponent and sd_mantissa)
Fix sd_command prototypes in SD drivers (card registers are unsigned long)
Fix speed calculation in Sansa AMS driver (PP SD driver needs to be checked)
Move ata-sd-target.h to sd-pp-target.h to reflect the PP specifity. Now it only contains declaration of microsd_int()
Remove unused ata-sd-target.h for injenic

TODO:
- check if CSD register bits are extracted correctly in PP driver
- correctly define read_timeout and write_timeout unit for MMC & SD, and use timeouts in Sansa AMS driver

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21586 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2009-07-01 10:07:22 +00:00
parent c929310e55
commit e0e24cbf0a
11 changed files with 112 additions and 122 deletions

View file

@ -1672,10 +1672,6 @@ tCardInfo* card_get_info_target(int card_no)
(void)card_no;
int i, temp;
static tCardInfo card;
static const char mantissa[] = { /* *10 */
0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 };
static const int exponent[] = { /* use varies */
1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000 };
card.initialized = true;
card.ocr = 0;
@ -1684,12 +1680,12 @@ tCardInfo* card_get_info_target(int card_no)
for(i=0; i<4; i++)
card.cid[i] = (*((unsigned long*)&mmcinfo.cid+4*i));
temp = card_extract_bits(card.csd, 29, 3);
card.speed = mantissa[card_extract_bits(card.csd, 25, 4)]
* exponent[temp > 2 ? 7 : temp + 4];
card.speed = sd_mantissa[card_extract_bits(card.csd, 25, 4)]
* sd_exponent[temp > 2 ? 7 : temp + 4];
card.nsac = 100 * card_extract_bits(card.csd, 16, 8);
temp = card_extract_bits(card.csd, 13, 3);
card.tsac = mantissa[card_extract_bits(card.csd, 9, 4)]
* exponent[temp] / 10;
card.taac = sd_mantissa[card_extract_bits(card.csd, 9, 4)]
* sd_exponent[temp] / 10;
card.numblocks = mmcinfo.block_num;
card.blocksize = mmcinfo.block_len;

View file

@ -26,14 +26,6 @@
#include "hotswap.h"
#include "jz4740.h"
tCardInfo *card_get_info_target(int card_no);
bool card_detect_target(void);
#ifdef HAVE_HOTSWAP
void card_enable_monitoring_target(bool on);
void microsd_int(void); /* ??? */
#endif
int _sd_read_sectors(unsigned long start, int count, void* buf);
int _sd_write_sectors(unsigned long start, int count, const void* buf);
int _sd_init(void);