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:
parent
82bbd1ed9f
commit
ee7cf6c63c
7 changed files with 42 additions and 50 deletions
|
@ -53,7 +53,6 @@ typedef struct
|
|||
#if (CONFIG_STORAGE & STORAGE_SD)
|
||||
|
||||
#include "sd.h"
|
||||
#define card_detect card_detect_target
|
||||
#define card_get_info card_get_info_target
|
||||
tCardInfo *card_get_info_target(int card_no);
|
||||
void sd_parse_csd(tCardInfo *card);
|
||||
|
@ -65,7 +64,6 @@ void sd_parse_csd(tCardInfo *card);
|
|||
#else /* STORAGE_MMC */
|
||||
|
||||
#include "ata_mmc.h"
|
||||
#define card_detect mmc_detect
|
||||
#define card_get_info mmc_card_info
|
||||
tCardInfo *mmc_card_info(int card_no);
|
||||
#define card_touched mmc_touched
|
||||
|
|
|
@ -51,8 +51,6 @@ bool sd_present(IF_MV_NONVOID(int drive));
|
|||
void card_enable_monitoring_target(bool on);
|
||||
#endif
|
||||
|
||||
bool card_detect_target(void);
|
||||
|
||||
long sd_last_disk_activity(void);
|
||||
|
||||
#ifdef CONFIG_STORAGE_MULTI
|
||||
|
|
|
@ -137,6 +137,16 @@ static inline void mci_delay(void)
|
|||
} while (--i);
|
||||
}
|
||||
|
||||
|
||||
static inline bool card_detect_target(void)
|
||||
{
|
||||
#if defined(HAVE_MULTIDRIVE)
|
||||
return !(GPIOA_PIN(2));
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_HOTSWAP
|
||||
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];
|
||||
}
|
||||
|
||||
bool card_detect_target(void)
|
||||
{
|
||||
#if defined(HAVE_MULTIDRIVE)
|
||||
return !(GPIOA_PIN(2));
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_HOTSWAP
|
||||
void card_enable_monitoring_target(bool on)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
/* 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];
|
||||
}
|
||||
|
||||
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
|
||||
static int sd1_oneshot_callback(struct timeout *tmo)
|
||||
{
|
||||
|
|
|
@ -494,6 +494,17 @@ static int sd_init_card(const int card_no)
|
|||
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
|
||||
|
||||
|
@ -512,16 +523,6 @@ static int sd1_oneshot_callback(struct timeout *tmo)
|
|||
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)
|
||||
{
|
||||
if (on)
|
||||
|
@ -570,12 +571,6 @@ bool sd_present(IF_MD_NONVOID(int card_no))
|
|||
/*****************************************************************************/
|
||||
#else
|
||||
|
||||
bool card_detect_target(void)
|
||||
{
|
||||
/* not applicable */
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sd_removable(IF_MD_NONVOID(int card_no))
|
||||
{
|
||||
#ifndef HAVE_MULTIDRIVE
|
||||
|
|
|
@ -205,9 +205,13 @@ static void sd_card_mux(int card_no)
|
|||
|
||||
#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 */
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void card_enable_monitoring_target(bool on)
|
||||
|
@ -261,11 +265,6 @@ bool sd_present(IF_MD_NONVOID(int card_no))
|
|||
|
||||
#else
|
||||
|
||||
bool card_detect_target(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sd_removable(IF_MD_NONVOID(int card_no))
|
||||
{
|
||||
#ifndef HAVE_MULTIDRIVE
|
||||
|
|
|
@ -1200,7 +1200,7 @@ int sd_init(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool card_detect_target(void)
|
||||
static inline bool card_detect_target(void)
|
||||
{
|
||||
return (jz_sd_chkcard() == 1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue