forked from len0rd/rockbox
Fix idle monitoring to not freeze the Ondio, and add it in a more elegant way. Fixed hotswap ifdefing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11465 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
92eff9d293
commit
af2d91f629
1 changed files with 20 additions and 17 deletions
|
|
@ -976,14 +976,39 @@ void ata_spin(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HOTSWAP
|
|
||||||
static void mmc_thread(void)
|
static void mmc_thread(void)
|
||||||
{
|
{
|
||||||
struct event ev;
|
struct event ev;
|
||||||
static long last_seen_mtx_unlock = 0;
|
static long last_seen_mtx_unlock = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
while ( queue_empty( &mmc_queue ) ) {
|
queue_wait_w_tmo(&mmc_queue, &ev, HZ);
|
||||||
|
switch ( ev.id )
|
||||||
|
{
|
||||||
|
case SYS_POWEROFF:
|
||||||
|
call_ata_idle_notifys(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYS_USB_CONNECTED:
|
||||||
|
call_ata_idle_notifys(false);
|
||||||
|
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
||||||
|
/* Wait until the USB cable is extracted again */
|
||||||
|
usb_wait_for_disconnect(&mmc_queue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
|
case SYS_MMC_INSERTED:
|
||||||
|
disk_mount(1); /* mount MMC */
|
||||||
|
queue_broadcast(SYS_FS_CHANGED, NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYS_MMC_EXTRACTED:
|
||||||
|
disk_unmount(1); /* release "by force" */
|
||||||
|
queue_broadcast(SYS_FS_CHANGED, NULL);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
default:
|
||||||
if (!ata_disk_is_active())
|
if (!ata_disk_is_active())
|
||||||
{
|
{
|
||||||
if (!last_seen_mtx_unlock)
|
if (!last_seen_mtx_unlock)
|
||||||
|
|
@ -994,38 +1019,17 @@ static void mmc_thread(void)
|
||||||
last_seen_mtx_unlock = 0;
|
last_seen_mtx_unlock = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
queue_wait(&mmc_queue, &ev);
|
|
||||||
switch ( ev.id )
|
|
||||||
{
|
|
||||||
case SYS_POWEROFF:
|
|
||||||
call_ata_idle_notifys(false);
|
|
||||||
break;
|
|
||||||
case SYS_USB_CONNECTED:
|
|
||||||
call_ata_idle_notifys(false);
|
|
||||||
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
|
||||||
/* Wait until the USB cable is extracted again */
|
|
||||||
usb_wait_for_disconnect(&mmc_queue);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYS_MMC_INSERTED:
|
|
||||||
disk_mount(1); /* mount MMC */
|
|
||||||
queue_broadcast(SYS_FS_CHANGED, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYS_MMC_EXTRACTED:
|
|
||||||
disk_unmount(1); /* release "by force" */
|
|
||||||
queue_broadcast(SYS_FS_CHANGED, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
void mmc_enable_monitoring(bool on)
|
void mmc_enable_monitoring(bool on)
|
||||||
{
|
{
|
||||||
mmc_monitor_enabled = on;
|
mmc_monitor_enabled = on;
|
||||||
}
|
}
|
||||||
#endif /* #ifdef HAVE_HOTSWAP */
|
#endif
|
||||||
|
|
||||||
bool mmc_detect(void)
|
bool mmc_detect(void)
|
||||||
{
|
{
|
||||||
|
|
@ -1168,11 +1172,10 @@ int ata_init(void)
|
||||||
{
|
{
|
||||||
if (!last_mmc_status)
|
if (!last_mmc_status)
|
||||||
mmc_status = MMC_UNTOUCHED;
|
mmc_status = MMC_UNTOUCHED;
|
||||||
#ifdef HAVE_HOTSWAP
|
|
||||||
queue_init(&mmc_queue, true);
|
queue_init(&mmc_queue, true);
|
||||||
create_thread(mmc_thread, mmc_stack,
|
create_thread(mmc_thread, mmc_stack,
|
||||||
sizeof(mmc_stack), mmc_thread_name IF_PRIO(, PRIORITY_SYSTEM));
|
sizeof(mmc_stack), mmc_thread_name IF_PRIO(, PRIORITY_SYSTEM));
|
||||||
#endif
|
|
||||||
tick_add_task(mmc_tick);
|
tick_add_task(mmc_tick);
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue