summaryrefslogtreecommitdiff
path: root/firmware/export/ata_idle_notify.h
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2006-11-08 01:55:26 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2006-11-08 01:55:26 +0000
commitf184152c0501a80e95ad871927d766fdee50281b (patch)
treeecfa4b6cdf24065b32467d6d7274a2659c3ec9b0 /firmware/export/ata_idle_notify.h
parent5dd07759248fec1407f6b3d4d1fb177554e45a13 (diff)
downloadrockbox-f184152c0501a80e95ad871927d766fdee50281b.tar.gz
rockbox-f184152c0501a80e95ad871927d766fdee50281b.zip
* 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
Diffstat (limited to 'firmware/export/ata_idle_notify.h')
-rw-r--r--firmware/export/ata_idle_notify.h24
1 files changed, 19 insertions, 5 deletions
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 @@
20#define __ATACALLBACK_H__ 20#define __ATACALLBACK_H__
21 21
22#include <stdbool.h> 22#include <stdbool.h>
23
24#if 0
25 NOTE: ata_idle_nofity usage notes..
26
27 1) the callbacks are called in the ata thread, not main/your thread.
28 2) Asyncronous callbacks (like the buffer refill) should be avoided.
29 If you must use an async callback, remember to check ata_is_active() before
30 accessing the disk, and nonot call any functions between that check and the
31 disk access which may cause a yield (lcd_update() does this!)
32 3) Do not call cany yielding functions in the callback
33 4) Do not call ata_sleep in the callbacks
34 5) Dont Panic!
35#endif
36
23#define USING_ATA_CALLBACK !defined(SIMULATOR) \ 37#define USING_ATA_CALLBACK !defined(SIMULATOR) \
24 && !defined(HAVE_FLASH_DISK) \ 38 && !defined(HAVE_FLASH_DISK) \
25 && !defined(HAVE_MMC) 39 && !defined(HAVE_MMC)
26 40
27#define MAX_ATA_CALLBACKS 5 41#define MAX_ATA_CALLBACKS 5
28typedef bool (*ata_idle_notify)(void); 42typedef bool (*ata_idle_notify)(void);
29 43
30extern bool register_ata_idle_func(ata_idle_notify function); 44extern bool register_ata_idle_func(ata_idle_notify function);
31#if USING_ATA_CALLBACK 45#if USING_ATA_CALLBACK
32extern void ata_idle_notify_init(void); 46extern void ata_idle_notify_init(void);
33extern void unregister_ata_idle_func(ata_idle_notify function); 47extern void unregister_ata_idle_func(ata_idle_notify function, bool run);
34extern bool call_ata_idle_notifys(void); 48extern bool call_ata_idle_notifys(bool sleep_after);
35#else 49#else
36#define unregister_ata_idle_func(f) 50#define unregister_ata_idle_func(f,r)
37#define call_ata_idle_notifys() 51#define call_ata_idle_notifys()
38#define ata_idle_notify_init() 52#define ata_idle_notify_init(s)
39#endif 53#endif
40 54
41#endif /* __ATACALLBACK_H__ */ 55#endif /* __ATACALLBACK_H__ */