diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-11-08 07:32:53 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-11-08 07:32:53 +0000 |
commit | af2d91f629c66c6ba1c3d89f1e321be184b99312 (patch) | |
tree | 28301da0265592ba7be262c248ecdbc3042ac17b /firmware | |
parent | 92eff9d293dd358195839b9fa67ba6f05579400e (diff) | |
download | rockbox-af2d91f629c66c6ba1c3d89f1e321be184b99312.tar.gz rockbox-af2d91f629c66c6ba1c3d89f1e321be184b99312.zip |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata_mmc.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 3b5510f43d..0920ad730b 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c @@ -976,31 +976,19 @@ void ata_spin(void) { } -#ifdef HAVE_HOTSWAP static void mmc_thread(void) { struct event ev; static long last_seen_mtx_unlock = 0; while (1) { - while ( queue_empty( &mmc_queue ) ) { - if (!ata_disk_is_active()) - { - if (!last_seen_mtx_unlock) - last_seen_mtx_unlock = current_tick; - if (TIME_AFTER(current_tick, last_seen_mtx_unlock+(HZ*10))) - { - call_ata_idle_notifys(false); - last_seen_mtx_unlock = 0; - } - } - } - queue_wait(&mmc_queue, &ev); + 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); @@ -1008,6 +996,7 @@ static void mmc_thread(void) 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); @@ -1017,15 +1006,30 @@ static void mmc_thread(void) disk_unmount(1); /* release "by force" */ queue_broadcast(SYS_FS_CHANGED, NULL); break; +#endif + + default: + if (!ata_disk_is_active()) + { + if (!last_seen_mtx_unlock) + last_seen_mtx_unlock = current_tick; + if (TIME_AFTER(current_tick, last_seen_mtx_unlock+(HZ*10))) + { + call_ata_idle_notifys(false); + last_seen_mtx_unlock = 0; + } + } + break; } } } +#ifdef HAVE_HOTSWAP void mmc_enable_monitoring(bool on) { mmc_monitor_enabled = on; } -#endif /* #ifdef HAVE_HOTSWAP */ +#endif bool mmc_detect(void) { @@ -1168,11 +1172,10 @@ int ata_init(void) { if (!last_mmc_status) mmc_status = MMC_UNTOUCHED; -#ifdef HAVE_HOTSWAP + queue_init(&mmc_queue, true); create_thread(mmc_thread, mmc_stack, sizeof(mmc_stack), mmc_thread_name IF_PRIO(, PRIORITY_SYSTEM)); -#endif tick_add_task(mmc_tick); initialized = true; } |