From f184152c0501a80e95ad871927d766fdee50281b Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 8 Nov 2006 01:55:26 +0000 Subject: * changes to ata.c - idle callbacks are called after 2 sec of real idle, and shutdown and usb (it makes sense here). ata_sleep doesnt get broken by callbacks. * allow ata_sleep() at the end of buffering again * config block uses ata_idle instead of delayed sector when saving * remove delayed sector code from ata_mmc.c (idle callbacks are not yet implemented for ata_mmc.c tho) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11461 a1c6a512-1295-4272-9138-f99709370657 --- firmware/ata_idle_notify.c | 16 +++++----- firmware/drivers/ata.c | 65 ++++++++++++--------------------------- firmware/drivers/ata_mmc.c | 31 ------------------- firmware/export/ata.h | 2 -- firmware/export/ata_idle_notify.h | 24 ++++++++++++--- firmware/powermgmt.c | 1 - 6 files changed, 48 insertions(+), 91 deletions(-) (limited to 'firmware') diff --git a/firmware/ata_idle_notify.c b/firmware/ata_idle_notify.c index a0a56e958b..c51c3800ce 100644 --- a/firmware/ata_idle_notify.c +++ b/firmware/ata_idle_notify.c @@ -18,8 +18,10 @@ ****************************************************************************/ #include #include "system.h" +#include "ata.h" #include "ata_idle_notify.h" #include "logf.h" +#include "string.h" #if USING_ATA_CALLBACK static ata_idle_notify ata_idle_notify_funcs[MAX_ATA_CALLBACKS]; @@ -52,7 +54,7 @@ bool register_ata_idle_func(ata_idle_notify function) } #if USING_ATA_CALLBACK -void unregister_ata_idle_func(ata_idle_notify func) +void unregister_ata_idle_func(ata_idle_notify func, bool run) { int i; for (i=0; i + +#if 0 + NOTE: ata_idle_nofity usage notes.. + + 1) the callbacks are called in the ata thread, not main/your thread. + 2) Asyncronous callbacks (like the buffer refill) should be avoided. + If you must use an async callback, remember to check ata_is_active() before + accessing the disk, and nonot call any functions between that check and the + disk access which may cause a yield (lcd_update() does this!) + 3) Do not call cany yielding functions in the callback + 4) Do not call ata_sleep in the callbacks + 5) Dont Panic! +#endif + #define USING_ATA_CALLBACK !defined(SIMULATOR) \ && !defined(HAVE_FLASH_DISK) \ && !defined(HAVE_MMC) - + #define MAX_ATA_CALLBACKS 5 typedef bool (*ata_idle_notify)(void); extern bool register_ata_idle_func(ata_idle_notify function); #if USING_ATA_CALLBACK extern void ata_idle_notify_init(void); -extern void unregister_ata_idle_func(ata_idle_notify function); -extern bool call_ata_idle_notifys(void); +extern void unregister_ata_idle_func(ata_idle_notify function, bool run); +extern bool call_ata_idle_notifys(bool sleep_after); #else -#define unregister_ata_idle_func(f) +#define unregister_ata_idle_func(f,r) #define call_ata_idle_notifys() -#define ata_idle_notify_init() +#define ata_idle_notify_init(s) #endif #endif /* __ATACALLBACK_H__ */ diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index f258502c2c..2ca176d072 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -1098,7 +1098,6 @@ void shutdown_hw(void) #ifdef HAVE_LCD_BITMAP glyph_cache_save(); #endif - ata_flush(); ata_spindown(1); while(ata_disk_is_active()) sleep(HZ/10); -- cgit v1.2.3