mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Hotswap: Avoid mount race at startup and after returning from USB mode.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6479 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f414fb1e22
commit
15d7077c3a
4 changed files with 44 additions and 20 deletions
|
@ -233,6 +233,9 @@ void init(void)
|
||||||
usb_screen();
|
usb_screen();
|
||||||
system_reboot();
|
system_reboot();
|
||||||
}
|
}
|
||||||
|
#if defined(HAVE_MMC) && defined(HAVE_HOTSWAP)
|
||||||
|
mmc_enable_monitoring(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
settings_calc_config_sector();
|
settings_calc_config_sector();
|
||||||
settings_load(SETTINGS_ALL);
|
settings_load(SETTINGS_ALL);
|
||||||
|
|
|
@ -94,6 +94,7 @@ static struct mutex mmc_mutex;
|
||||||
static long mmc_stack[(DEFAULT_STACK_SIZE + 0x800)/sizeof(long)];
|
static long mmc_stack[(DEFAULT_STACK_SIZE + 0x800)/sizeof(long)];
|
||||||
static const char mmc_thread_name[] = "mmc";
|
static const char mmc_thread_name[] = "mmc";
|
||||||
static struct event_queue mmc_queue;
|
static struct event_queue mmc_queue;
|
||||||
|
static bool mmc_monitor_enabled = false;
|
||||||
#endif
|
#endif
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
static bool new_mmc_circuit;
|
static bool new_mmc_circuit;
|
||||||
|
@ -1033,6 +1034,11 @@ static void mmc_thread(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mmc_enable_monitoring(bool on)
|
||||||
|
{
|
||||||
|
mmc_monitor_enabled = on;
|
||||||
|
}
|
||||||
#endif /* #ifdef HAVE_HOTSWAP */
|
#endif /* #ifdef HAVE_HOTSWAP */
|
||||||
|
|
||||||
bool mmc_detect(void)
|
bool mmc_detect(void)
|
||||||
|
@ -1050,6 +1056,9 @@ bool mmc_usb_active(int delayticks)
|
||||||
static void mmc_tick(void)
|
static void mmc_tick(void)
|
||||||
{
|
{
|
||||||
bool current_status;
|
bool current_status;
|
||||||
|
#ifndef HAVE_HOTSWAP
|
||||||
|
const bool mmc_monitor_enabled = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (new_mmc_circuit)
|
if (new_mmc_circuit)
|
||||||
/* USB bridge activity is 0 on idle, ~527 on active */
|
/* USB bridge activity is 0 on idle, ~527 on active */
|
||||||
|
@ -1061,6 +1070,8 @@ static void mmc_tick(void)
|
||||||
last_usb_activity = current_tick;
|
last_usb_activity = current_tick;
|
||||||
usb_activity = current_status;
|
usb_activity = current_status;
|
||||||
|
|
||||||
|
if (mmc_monitor_enabled)
|
||||||
|
{
|
||||||
current_status = mmc_detect();
|
current_status = mmc_detect();
|
||||||
/* Only report when the status has changed */
|
/* Only report when the status has changed */
|
||||||
if (current_status != last_mmc_status)
|
if (current_status != last_mmc_status)
|
||||||
|
@ -1087,6 +1098,7 @@ static void mmc_tick(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ata_soft_reset(void)
|
int ata_soft_reset(void)
|
||||||
|
|
|
@ -45,5 +45,8 @@ unsigned long mmc_extract_bits(const unsigned long *p, unsigned int start,
|
||||||
unsigned int size);
|
unsigned int size);
|
||||||
tCardInfo *mmc_card_info(int card_no);
|
tCardInfo *mmc_card_info(int card_no);
|
||||||
bool mmc_usb_active(int delayticks);
|
bool mmc_usb_active(int delayticks);
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
|
void mmc_enable_monitoring(bool on);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -194,7 +194,13 @@ static void usb_slave_mode(bool on)
|
||||||
panicf("ata: %d",rc);
|
panicf("ata: %d",rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_MMC) && defined(HAVE_HOTSWAP)
|
||||||
|
mmc_enable_monitoring(false);
|
||||||
rc = disk_mount_all();
|
rc = disk_mount_all();
|
||||||
|
mmc_enable_monitoring(true);
|
||||||
|
#else
|
||||||
|
rc = disk_mount_all();
|
||||||
|
#endif
|
||||||
if (rc <= 0) /* no partition */
|
if (rc <= 0) /* no partition */
|
||||||
panicf("mount: %d",rc);
|
panicf("mount: %d",rc);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue