1
0
Fork 0
forked from len0rd/rockbox

Remove unused card_detect(), and make card_detect_target() static inline in each sd driver.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23757 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-11-26 00:51:09 +00:00
parent 82bbd1ed9f
commit ee7cf6c63c
7 changed files with 42 additions and 50 deletions

View file

@ -53,7 +53,6 @@ typedef struct
#if (CONFIG_STORAGE & STORAGE_SD) #if (CONFIG_STORAGE & STORAGE_SD)
#include "sd.h" #include "sd.h"
#define card_detect card_detect_target
#define card_get_info card_get_info_target #define card_get_info card_get_info_target
tCardInfo *card_get_info_target(int card_no); tCardInfo *card_get_info_target(int card_no);
void sd_parse_csd(tCardInfo *card); void sd_parse_csd(tCardInfo *card);
@ -65,7 +64,6 @@ void sd_parse_csd(tCardInfo *card);
#else /* STORAGE_MMC */ #else /* STORAGE_MMC */
#include "ata_mmc.h" #include "ata_mmc.h"
#define card_detect mmc_detect
#define card_get_info mmc_card_info #define card_get_info mmc_card_info
tCardInfo *mmc_card_info(int card_no); tCardInfo *mmc_card_info(int card_no);
#define card_touched mmc_touched #define card_touched mmc_touched

View file

@ -51,8 +51,6 @@ bool sd_present(IF_MV_NONVOID(int drive));
void card_enable_monitoring_target(bool on); void card_enable_monitoring_target(bool on);
#endif #endif
bool card_detect_target(void);
long sd_last_disk_activity(void); long sd_last_disk_activity(void);
#ifdef CONFIG_STORAGE_MULTI #ifdef CONFIG_STORAGE_MULTI

View file

@ -137,6 +137,16 @@ static inline void mci_delay(void)
} while (--i); } while (--i);
} }
static inline bool card_detect_target(void)
{
#if defined(HAVE_MULTIDRIVE)
return !(GPIOA_PIN(2));
#else
return false;
#endif
}
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
static int sd1_oneshot_callback(struct timeout *tmo) static int sd1_oneshot_callback(struct timeout *tmo)
{ {
@ -872,15 +882,6 @@ tCardInfo *card_get_info_target(int card_no)
return &card_info[card_no]; return &card_info[card_no];
} }
bool card_detect_target(void)
{
#if defined(HAVE_MULTIDRIVE)
return !(GPIOA_PIN(2));
#else
return false;
#endif
}
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
void card_enable_monitoring_target(bool on) void card_enable_monitoring_target(bool on)
{ {

View file

@ -340,6 +340,21 @@ static int sd_wait_for_state(unsigned int state, int id)
} }
} }
static inline bool card_detect_target(void)
{
#ifdef HAVE_HOTSWAP
#ifdef SANSA_E200
return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */
#elif defined SANSA_C200
return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */
#endif
#else
return false;
#endif
}
static inline void copy_read_sectors_fast(unsigned char **buf) static inline void copy_read_sectors_fast(unsigned char **buf)
{ {
/* Copy one chunk of 16 words using best method for start alignment */ /* Copy one chunk of 16 words using best method for start alignment */
@ -1278,20 +1293,6 @@ tCardInfo *card_get_info_target(int card_no)
{ {
return &card_info[card_no]; return &card_info[card_no];
} }
bool card_detect_target(void)
{
#ifdef HAVE_HOTSWAP
#ifdef SANSA_E200
return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */
#elif defined SANSA_C200
return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */
#endif
#else
return false;
#endif
}
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
static int sd1_oneshot_callback(struct timeout *tmo) static int sd1_oneshot_callback(struct timeout *tmo)
{ {

View file

@ -494,6 +494,17 @@ static int sd_init_card(const int card_no)
Generic functions Generic functions
*****************************************************************************/ *****************************************************************************/
static inline bool card_detect_target(void)
{
/* TODO - use interrupt on change? */
#ifdef MINI2440
return (GPGDAT & SD_CD) == 0;
#else
#error Unsupported target
#endif
}
/*****************************************************************************/ /*****************************************************************************/
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
@ -512,16 +523,6 @@ static int sd1_oneshot_callback(struct timeout *tmo)
return 0; return 0;
} }
bool card_detect_target(void)
{
/* TODO - use interrupt on change? */
#ifdef MINI2440
return (GPGDAT & SD_CD) == 0;
#else
#error Unsupported target
#endif
}
void card_enable_monitoring_target(bool on) void card_enable_monitoring_target(bool on)
{ {
if (on) if (on)
@ -570,12 +571,6 @@ bool sd_present(IF_MD_NONVOID(int card_no))
/*****************************************************************************/ /*****************************************************************************/
#else #else
bool card_detect_target(void)
{
/* not applicable */
return false;
}
bool sd_removable(IF_MD_NONVOID(int card_no)) bool sd_removable(IF_MD_NONVOID(int card_no))
{ {
#ifndef HAVE_MULTIDRIVE #ifndef HAVE_MULTIDRIVE

View file

@ -205,9 +205,13 @@ static void sd_card_mux(int card_no)
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
bool card_detect_target(void) static inline bool card_detect_target(void)
{ {
#ifdef HAVE_HOTSWAP
return (GPIOB & (1<<26)) == 0; /* low active */ return (GPIOB & (1<<26)) == 0; /* low active */
#else
return false;
#endif
} }
void card_enable_monitoring_target(bool on) void card_enable_monitoring_target(bool on)
@ -261,11 +265,6 @@ bool sd_present(IF_MD_NONVOID(int card_no))
#else #else
bool card_detect_target(void)
{
return false;
}
bool sd_removable(IF_MD_NONVOID(int card_no)) bool sd_removable(IF_MD_NONVOID(int card_no))
{ {
#ifndef HAVE_MULTIDRIVE #ifndef HAVE_MULTIDRIVE

View file

@ -1200,7 +1200,7 @@ int sd_init(void)
return -1; return -1;
} }
bool card_detect_target(void) static inline bool card_detect_target(void)
{ {
return (jz_sd_chkcard() == 1); return (jz_sd_chkcard() == 1);
} }