Move sd_get_info() into common sd code

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21610 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2009-07-01 23:39:57 +00:00
parent ccbd8f4f31
commit 293b499093
4 changed files with 23 additions and 53 deletions

View file

@ -21,6 +21,7 @@
#include "config.h" #include "config.h"
#include "hotswap.h" #include "hotswap.h"
#include "storage.h"
static const unsigned char sd_mantissa[] = { /* *10 */ static const unsigned char sd_mantissa[] = { /* *10 */
0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 }; 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 };
@ -75,3 +76,25 @@ void sd_spindown(int seconds)
{ {
(void)seconds; (void)seconds;
} }
#ifdef STORAGE_GET_INFO
void sd_get_info(IF_MV2(int drive,) struct storage_info *info)
{
#ifndef HAVE_MULTIVOLUME
const int drive=0;
#endif
tCardInfo *card = card_get_info_target(drive);
info->sector_size=card->blocksize;
info->num_sectors=card->numblocks;
info->vendor="Rockbox";
#if CONFIG_STORAGE == STORAGE_SD
info->product = (drive==0) ? "Internal Storage" : "SD Card Slot";
#else /* Internal storage is not SD */
info->product = "SD Card Slot";
#endif
info->revision="0.00";
}
#endif

View file

@ -495,20 +495,6 @@ int sd_init(void)
return 0; return 0;
} }
#ifdef STORAGE_GET_INFO
void sd_get_info(IF_MV2(int drive,) struct storage_info *info)
{
#ifndef HAVE_MULTIVOLUME
const int drive=0;
#endif
info->sector_size=card_info[drive].blocksize;
info->num_sectors=card_info[drive].numblocks;
info->vendor="Rockbox";
info->product = (drive == 0) ? "Internal Storage" : "SD Card Slot";
info->revision="0.00";
}
#endif
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
bool sd_removable(IF_MV_NONVOID(int drive)) bool sd_removable(IF_MV_NONVOID(int drive))
{ {

View file

@ -1334,27 +1334,6 @@ long sd_last_disk_activity(void)
return last_disk_activity; return last_disk_activity;
} }
#ifdef STORAGE_GET_INFO
void sd_get_info(IF_MV2(int drive,) struct storage_info *info)
{
#ifndef HAVE_MULTIVOLUME
const int drive=0;
#endif
info->sector_size=card_info[drive].blocksize;
info->num_sectors=card_info[drive].numblocks;
info->vendor="Rockbox";
if(drive==0)
{
info->product="Internal Storage";
}
else
{
info->product="SD Card Slot";
}
info->revision="0.00";
}
#endif
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
bool sd_removable(IF_MV_NONVOID(int drive)) bool sd_removable(IF_MV_NONVOID(int drive))
{ {

View file

@ -1743,21 +1743,3 @@ bool sd_present(IF_MV_NONVOID(int drive))
#endif #endif
return (sdinfo.block_num > 0 && card_detect_target()); return (sdinfo.block_num > 0 && card_detect_target());
} }
#ifdef STORAGE_GET_INFO
void sd_get_info(IF_MV2(int drive,) struct storage_info *info)
{
#ifdef HAVE_MULTIVOLUME
(void)drive;
#endif
/* firmware version */
info->revision="0.00";
info->vendor="Rockbox";
info->product="SD Storage";
/* blocks count */
info->num_sectors = sdinfo.block_num;
info->sector_size = sdinfo.block_len;
}
#endif