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/export/ata.h | 2 -- firmware/export/ata_idle_notify.h | 24 +++++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'firmware/export') diff --git a/firmware/export/ata.h b/firmware/export/ata.h index 83124c6bfa..c2ba974544 100644 --- a/firmware/export/ata.h +++ b/firmware/export/ata.h @@ -46,8 +46,6 @@ extern int ata_soft_reset(void); extern int ata_init(void); extern int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); extern int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); -extern void ata_delayed_write(unsigned long sector, const void* buf); -extern void ata_flush(void); extern void ata_spin(void); #if CONFIG_LED == LED_REAL extern void ata_set_led_enabled(bool enabled); diff --git a/firmware/export/ata_idle_notify.h b/firmware/export/ata_idle_notify.h index f5f2a25fd9..491a612bdd 100644 --- a/firmware/export/ata_idle_notify.h +++ b/firmware/export/ata_idle_notify.h @@ -20,22 +20,36 @@ #define __ATACALLBACK_H__ #include + +#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__ */ -- cgit v1.2.3